Skip to content

CMake build system

Ivan Novikov requested to merge cmake into master

Changed build system from autotools to cmake.
The cmake scripts are written for cmake 2.8.12, which is the version available on naf-atlas by default.

There is a wrapper script for cmake. You can use it like:

./make.sh install

To configure, compile, and install. By default, the script builds xfitter in the ./build directory, and installs it in-source.

Alternatively, you can invoke cmake without the wrapper script, for the same results, like this:

mkdir build
INSTALL_PREFIX=$(pwd)
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
make -j$(nproc) install

Unlike the previous automake version, xfitter can be install with any install prefix.

There were some changes to where files are installed:

  • xfitter executable goes to $INSTALL_PREFIX/bin
  • xfitter.so goes to $INSTALL_PREFIX/lib
  • All the dynamically loaded modules go to $INSTALL_PREFIX/lib/xfitter
  • Include-able YAML giles go to $INSTALL_PREFIX/share/xfitter

One must make sure that the LD_LIBRARY_PATH environment variable includes both $INSTALL_PREFIX/lib and $INSTALL_PREFIX/lib/xfitter, otherwise there will be a linker error when trying to run xfitter.

The Reactions.txt file is gone now. Instead, names of loaded libraries are derived from names of requested modules. See comments in xfitter_steer.cc for details.

It is no longer necessary to give any --enable-XXXXX flags at configure stage. Instead, cmake always tries to find as many optional libraries as possible, and disables some of xfitter modules based on which optional libraries are available. At configuration, cmake should echo which libraries were and which were not found, and which optional modules will be skipped.

I tested that cmake can compile all parts of xfitter (except fastNLO, whose MR is still open) on my setup. Please tell me if for you cmake fails to find some installed libraries.

I can also compile xfitter with CERES now, while doing so with autotools used to require some hacking.

There were some changes to names of included YAML files. Also, I removed some broken old steering options. For these reasons, the parameters.yaml and steering.txt from master are not compatible with this version. Here are the sed commands which one can run to migrate parameters.yaml and steering.txt from master:

sed -i "s/\(\? \!include .*\)\/parameters.yaml/\1.yaml/;s/UvDvubardbars/UvDvUbarDbarS/" parameters.yaml
sed -i "/\(TheoryType\|RunningMode\|HF_SCHEME\|LUseAPPLgridCKM\) = /d" steering.txt

I ran these commands on all examples, so the tests can be ran normally:

./tools/tests.sh

One can also run xfitter with default inputs using the wrapper script

./make.sh run

~~I ran the unit tests, and I am getting some small differences in CorrelatedChi2 and in LogPenalty of the order ~10^-5. No idea what is causing it.~~
Turns out xfitter produces slightly different results in Debug and Release configurations. When using Release, this branch passes all unit tests, except ALLDATA (because no fastNLO) and profileLHAPDF (due to a known bug with Profiler and NNPDF). Currently, master does not pass these two tests either.

Edited by Ivan Novikov

Merge request reports