Skip to content
Snippets Groups Projects
Commit cb7e814f authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

Doc: add build related docs.

parent 4f9f05f4
No related branches found
No related tags found
No related merge requests found
# CMake: building software
There is a script `build.sh` to build the CEPCSW. Inside this script, it consists of three major steps:
* configure: in this step, a *build directory* is created and the cmake reads `CMakeLists.txt` in *source code directory* and generates config files which will be used to build the project.
* build: in this step, the project is built according to the config files under *build directory*.
* install: in this step, the libraries, header files and python scripts are installed into *install directory*, which is `InstallArea`.
The `cmake` command reads the `CMakeLists.txt` files recursively to produce the config files. As there are some common patterns to build the packages in the project, we use some macros from Gaudi framework.
* `gaudi_add_library`: produce a shared library, which will be linked by other libraries.
* The source code files need to be added after `SOURCES` option.
* The link libraries need to be added after `LINK` option.
* `gaudi_add_module`: produce a module library, which will be imported by Gaudi. Note, this library should not be linked by other libraries.
* Options `SOURCES` and `LINK` are same as `gaudi_add_library`.
We also use some macros from CMake.
* `target_include_directories`: specify the include directories when build a target.
* `install`: install the targets.
Examples could be found in CEPCSW.
For example, the `RecPFACyber` package uses all the macros:
```cmake
gaudi_add_library(CrystalCaloRecLib
SOURCES src/Objects/CaloUnit.cc
src/Objects/CaloHit.cc
...
LINK k4FWCore::k4FWCore
GearSvc
CrystalEcalSvcLib
...
)
gaudi_add_module(CrystalCaloRec
SOURCES src/CyberPFAlg.cpp
src/CyberDataCol.cpp
...
LINK CrystalCaloRecLib
)
target_include_directories(CrystalCaloRec PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
install(TARGETS CrystalCaloRecLib CrystalCaloRec
EXPORT CEPCSWTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
COMPONENT dev)
```
......@@ -23,6 +23,7 @@ Contents
:caption: Development Process
development/overview.md
development/build.md
development/doc.md
.. toctree::
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment