DevelopKit

Building LHCb software

Overview

Teaching: 10 min
Exercises: 10 min
Questions
  • How are LHCb builds structured?

Objectives
  • Learn the basics of building software in LHCb.

Building in CMake

Modern LHCb software builds is stored in git and built with CMake. The procedure to build is given in the example below:

Customizing the build

The build mechanism requires two files in the main directory:

In your CMakeLists.txt, instead of manually configuring CMake, you generally have the following lines:

cmake_minimum_required(VERSION 2.8.5)

This tells CMake to set policies to the version listed; even if you are in a newer CMake, you will be fully backwards compatible (and will not receive many of the improvements of using a newer CMake, either).

find_package(GaudiProject)

This is a custom package that contains the very powerful gaudi_project command used below. This is CMake’s “import” statement. Other common packages are ROOT and Boost. You can add components, using the COMPONENTS keyword. (ROOT’s components are not very well defined, but this is useful for BOOST).

gaudi_project(MyProject v12r3
              USE BaseProject v45r6
                  AnotherProject v7r8
              DATA Some/DataPackage
                   ExternalData VERSION v2r*
                )

Notice the structure of this command. First we have the current project name, and it’s version. Then we use the keyword “USE” defined by the function to start listing projects to use. Here we have to specify a specific version. Finally, the keyword “DATA” starts a listing of data packages, which can take wild cards in the version strings.

Internally, this tells CMake to find and load other projects in a specific directory structure.

Gaudi supplies a few other commands, as well.

Later, explain:

Further reading

Key Points