Building the Laura++ library, documentation and examples
Prerequisites
Compilation of Laura++ on a UNIX operating system requires:
- the CMake build tool
- a C++17 compatible compiler (GCC 13 or better, Clang 16 or better are recommended)
- GNU Make or Ninja (not currently tested)
The package depends only on ROOT. Before building the code, it is necessary that the ROOT package be findable by CMake, which can be achieved by doing one of the following:
- the installation prefix of the ROOT package is in the CMAKE_PREFIX_PATH environment variable
- the ROOT_DIR environment variable is set to the installation prefix of the ROOT package
- the ROOTSYS environment variable is set to the installation prefix of the ROOT package
- the directory containing the root-config program is in the PATH environment variable
Since ROOT depends on the nlohmann_json package, this must be similarly locatable by CMake.
In order to setup an environment that satifies all of the above requirements we highly recommend use of the LCG views.
For example, on a machine with the CVMFS client installed, one can do:
source /cvmfs/sft.cern.ch/lcg/views/setupViews.(c)sh <LCG release> <arch-os-compiler>
for example:
source /cvmfs/sft.cern.ch/lcg/views/setupViews.sh LCG_104 x86_64-el9-clang16-opt
Building the Laura++ library
To build from a clone of the repository, open a terminal and change directory into the root directory of the repository, i.e. that containing the README file.
Create a build directory in which to run cmake and the build tool, e.g. make, and change into it, e.g. by doing
$ mkdir ../laura.build
$ cd ../laura.build
It is best to install the package after building. You can either install into an existing location or you can create an install directory specifically for Laura++, e.g. by doing
$ mkdir ../laura.install
In the rest of the instructions we use this specific install directory but you can substitute your own in the appropriate places.
Run cmake in the build directory, pointing it to the root directory of the respository (referred to as <source dir> in the following), which holds the top level CMake script for the project:
$ cmake ../<source dir> -DCMAKE_INSTALL_PREFIX=../laura.install
The exact output from this command will depend on your system, compiler and build directory location, but you should not see any errors.
CMake will generate Makefiles by default on UNIX platforms, so to build, simply run make in the build directory:
$ make
$ make install
Again, the exact output will be system specific, but you should see the Laura++ target build without error, followed by a successful installation.
Examples and documentation
Example code is included in the examples directory.
To enable the building and installation of the example executables you need to supply the following option when running cmake:
-DLAURA_BUILD_EXAMPLES=ON
After building and installing, the example executables will be in the bin directory in the install location.
To build a local copy of the Doxygen documentation you need to supply the following option when running cmake:
-DLAURA_BUILD_DOCS=ON
After building and installing, you can load the share/doc/Laura++/html/index.html files (found in the install location) into your web browser.
Building your own code
If you wish to build your own code that uses the Laura++ library you should add the Laura++ installation to the CMAKE_PREFIX_PATH environment variable.
You can then add lines like the following to your own project's CMakeLists.txt file:
# Find Laura++ - all dependencies will automatically be searched for as well
find_package(Laura REQUIRED)
# Now build the executable
add_executable(MyExe MyExe.cc)
target_link_libraries(MyExe PRIVATE Laura::Laura++)
|