How to build and use the Gaudi with CMake {#quick-guide-cmake}
=========================================
Requirements
------------
The CMake configuration of Gaudi is based on the version 2.8.5 or later of
CMake. On lxplus (SLC6 and CentOS7) you need to call something like:
$ export PATH=/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.7.0/Linux-x86_64/bin:$PATH
You also need to ensure that the compiler you want to use is configured and
available on the PATH, for example with something like:
$ . /cvmfs/sft.cern.ch/lcg/contrib/gcc/7.1.0/x86_64-centos7/setup.sh
In addition you will need at least python 2.7.
**NOTE**: If you use the LHCb environment (as of LbScripts v7r7), you do not
need to prepare the environment for the compiler.
Quick Start
-----------
To quickly get started, you can use the `Makefile`, which
will take care of the main details (except the value of `BINARY_TAG`, or
`CMTCONFIG` for backward compatibility):
$ make -j 8
$ make test
The main targets are:
* `configure`
just run CMake to generate the build directory (or reconfigure)
* `all` (default)
build everything (implies `configure`)
* `test`
run the tests (and generate HTML reports), note that it does not
imply the build and does not require installation
* `install`
populate the `InstallArea` directory, *required for runtime/deployment*
Some extra targets are provided for special cases:
* `unsafe-install`
allow partial installation after a failed build (for builds in a
continuous integration system)
* `post-install`
optional operations on the content of `InstallArea` (like compressing
the `python` directory)
* `apply-formatting`
apply automatic code formatting to C++ and python sources (using `clang-format` and
`autopep8` if available)
Build
-----
I suggest to use the off-source build, which means that the files required by
the build and the build products are created in a different directory than the
source one.
In this example I'll use `Gaudi-build`, created at the same level as the
directory containing the sources (`Gaudi`).
To prepare the build directory, you have to:
$ src=$PWD/Gaudi
$ mkdir Gaudi-build
$ cd Gaudi-build
$ export BINARY_TAG=$LCGPLAT
$ export CMAKE_PREFIX_PATH=/cvmfs/sft.cern.ch/lcg/releases
$ cmake -DCMAKE_TOOLCHAIN_FILE=$src/toolchain.cmake \
-G "Eclipse CDT4 - Unix Makefiles" $src
`$LCGPLAT` is set if you used the LCG gcc setup script above, otherwise set it manually.
This will create the required Unix makefiles and the Eclipse project
configuration to build Gaudi.
Other options are available on the command line when you prepare the build
directory the first time or afterwards via the CMake configuration tool
`ccmake`, for example `CMAKE_USE_DISTCC` or `CMAKE_USE_CCACHE`.
Now you can build the project with a simple (from `Gaudi-build`)::
$ make
or from Eclipse after you imported the project.
The tests can be run via the command `ctest` or with `make test`.
Note that the build via `Makefile` uses the build directory
`build.${BINARY_TAG}` under the source directory.
Install
-------
The build of the project obtained with CMake cannot be used directly by other
projects: it needs to be installed in the source directory (for backward
compatibility with CMT) with the command:
$ make install
It must be noted that the special file ``python.zip`` is not automatically
generated, so, if you want it, you have to call, after the installation:
$ make post-install
Run
---
The runtime environment for the installed binaries is described by the XML file
`Gaudi.xenv` located in the directory `InstallArea/$BINARY_TAG`, in
the format understood by the Python script `xenv` available in the `cmake`
directory in the source tree (it is also installed).
The behavior of `xenv` is quite similar to that of the standard Unix
command `env` (see `man env`), with the addition of few functionalities
(append, prepend, XML).
For example, you can call `gaudirun.py` like this (with the variable `src`
defined above):
$ $src/cmake/xenv --xml $src/InstallArea/$BINARY_TAG/Gaudi.xenv \
gaudirun.py --help
or, to have a sub-shell with the right environment:
$ $src/cmake/xenv --xml $src/InstallArea/$BINARY_TAG/Gaudi.xenv bash
(note that you may need to add the `--norc` option to `bash`).
Run from the build directory
----------------------------
For testing and debugging (as already mentioned) there is no need to install.
To run an application using the build directory, you can use the script
`xenv` with the XML file `Gaudi-build.xenv` located in the `conf` subdirectory
of the build directory, or the convenience script `run` (in the build directory),
for example like this:
$ cd Gaudi-build
$ ./run gaudirun.py --help
$ ./run bash
When using `Makefile` the above lines should be changed in
$ build.$BINARY_TAG/run gaudirun.py --help
$ build.$BINARY_TAG/run bash
Resources
-------------
* [CMake documentation](http://www.cmake.org/cmake/help/documentation.html)
* `FindTBB.cmake` was taken from <https://bitbucket.org/sergiu/tbb-cmake>
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
PyPI 官网下载 | LbDevTools-0.4.3.tar.gz (202个子文件)
_git-lb-checkout 2KB
_git-lb-push 2KB
_git-lb-use 3KB
a_script 22B
setup.cfg 151B
default.clang-format 3KB
GaudiProjectConfig.cmake 144KB
GaudiBuildFlags.cmake 17KB
EnableROOT6.cmake 13KB
HEPToolsMacros.cmake 11KB
FindTBB.cmake 10KB
EnableROOT5.cmake 10KB
GaudiToolchainMacros.cmake 9KB
BinaryTagUtils.cmake 8KB
test_binary_tag_utils.cmake 7KB
GangaTools.cmake 4KB
Findpygraphics.cmake 4KB
Findgperftools.cmake 3KB
FindROOT.cmake 3KB
FindEigen.cmake 3KB
Instrument.cmake 3KB
UseHEPTools.cmake 3KB
externals.cmake 3KB
FindIntelAmplifier.cmake 2KB
GaudiDefaultToolchain.cmake 2KB
FindCLHEP.cmake 2KB
toolchain.cmake 2KB
CMakeFunctionalUtils.cmake 2KB
FindQMTest.cmake 2KB
FindCORAL.cmake 2KB
FindCOOL.cmake 2KB
FindCASTOR.cmake 2KB
toolchain.cmake 2KB
FindXrootd.cmake 1KB
FindRELAX.cmake 1KB
InheritHEPTools.cmake 1KB
Findtcmalloc.cmake 1KB
test_functional_utils.cmake 1KB
FindOracle.cmake 1KB
FindXercesC.cmake 1KB
FindHepMC.cmake 1KB
FindHepPDT.cmake 1015B
FindFrontier_Client.cmake 965B
test_special_conventions.cmake 937B
GaudiCPackSettings.cmake 922B
FindFastJet.cmake 918B
FindSQLite.cmake 907B
test_with_tools.cmake 897B
FindNeuroBayesExpert.cmake 890B
FindGSL.cmake 887B
FindMySQL.cmake 784B
test_atlas_convention.cmake 781B
test_simple_use.cmake 696B
FindCppUnit.cmake 682B
FindUUID.cmake 677B
Findunwind.cmake 676B
test_with_chained_tools.cmake 669B
FindVDT.cmake 663B
test_toolchain_extensions_multi.cmake 643B
FindLFC.cmake 641B
FindRangev3.cmake 609B
Findcppgsl.cmake 595B
test_no_use.cmake 573B
test_version_selection.cmake 565B
test_heptools_parsing.cmake 562B
test_diamond.cmake 542B
test_toolchain_extensions_min.cmake 541B
FindFFTW.cmake 537B
Findpyanalysis.cmake 535B
cpack_install.cmake 507B
Findpytools.cmake 493B
test_toolchain_extensions.cmake 488B
FindAIDA.cmake 466B
test_chain.cmake 461B
BaseConfig.cmake 361B
TestMacros.cmake 288B
test_missing_base.cmake 222B
extra-toolchain.cmake 198B
test_guess_toolchain.cmake 196B
extra-toolchain.cmake 194B
extra-toolchain.cmake 192B
test_loops.cmake 141B
project.cmt 190B
build.conf 170B
COPYING 31KB
code.cpp 0B
code.cpp 0B
code.cpp 0B
code.cpp 0B
source.cpp 0B
.emptydir 0B
.emptydir 0B
.emptydir 0B
.emptydir 0B
.emptydir 0B
.emptydir 0B
.emptydir 0B
.emptydir 0B
.gaudi_project_ignore 45B
.gitignore 162B
共 202 条
- 1
- 2
- 3
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功