Skip to content

CMake options

Bert Vandenbroucke edited this page Dec 16, 2015 · 1 revision

CMake options

The most basic cmake command is

cmake -DCMAKE_BUILD_TYPE=Release SHADOWFAX_PATH

to be executed from the folder where you want to build the Shadowfax program. SHADOWFAX_PATH corresponds to the full path (absolute or relative) to the Shadowfax folder that you get when you clone the repository. This folder contains the subfolders src, inc and rundir, and the CMakeLists.txt configuration file used by cmake.

The CMAKE_BUILD_TYPE argument specifies which compiler settings will be used in the generated build files. Build type Release uses optimization flags that generate faster code. Alternatively, you can use build type Debug to enable debug flags and switch off optimization. For compilers that support it, this also enables fast run time memory checks (the ASAN address sanitizer). This mode is useful for code development.

There is a number of optional extra arguments, that control which parts of the code to compile. By default, the main simulation program and both auxiliary programs (icmaker and vtkmaker) are compiled, both in 2D and 3D. You can choose not to compile the two auxiliary programs by specifying the -DONLY_SIMULATION_PROGRAM=True option. Similarly, you can compile only the 2D or 3D programs by specifying -DONLY_2D=True or -DONLY_3D=True. To get a minimal working 3D simulation program for example, you run

cmake -DCMAKE_BUILD_TYPE=Release -DONLY_SIMULATION_PROGRAM=True -DONLY_3D=True

cmake itself has a number of useful command line arguments that control the compilation process. These are documented in the CMake documentation.

Clone this wiki locally