Overview
Teaching: 10 min Exercises: 10 minQuestions
How are LHCb builds structured?
Objectives
Learn the basics of building software in LHCb.
Modern LHCb software builds is stored in git and built with CMake. The procedure to build is given in the example below:
The build mechanism requires two files in the main directory:
toolchain.cmake
: A standard file generated by the steps above (lb-project-init
)CMakeLists.txt
: The cmake build instructions.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:
gaudi_add_library
gaudi_depends_on_subdirs
gaudi_add_module
gaudi_install_headers
god_build_dictionaries
god_build_headers
gaudi_install_python_modules
gaudi_install_scripts
gaudi_install_tests
gaudi_add_dictionary
gaudi_add_executable
gaudi_env
Further reading
Key Points
Understand how to modify builds.