Configuring Spheral

After running tpl-manager you will see a file in your Spheral root directory following the format <sys_type>-<spec>.cmake.

For example if you run tpl-manager with only a single --spec e.g. gcc~mpi, you will only see:

<sys_type>-gcc~mpi.cmake

host-config-build.py

The host-config-build tool is located at scripts/devtools/host-config-build.py. host-config-build takes a host-config file and sets up Spheral’s CMake with the appropriate TPLs. host-config-build by default also sets up a basic build/install directory structure.

python3 scripts/devtools/host-config-build.py --host-config <sys_type>-gcc.cmake"

--host-config is a required argument of the tool, by default this will create two directories in the format of:

build_<host-config>/build
build_<host-config>/install

Note

host-config-build.py is simply a wrapper around CMake. It is possible to directly run CMake rather than host-config-build.py; host-config-build.py reports the CMake line it is using, so this can be a good starting point if you need to run CMake manually yourself. See Manually Configure CMake for more details.

Help

host-config-build supports -h or --help if you need to reference the available options.

Custom Build Directory

If you wish your build directory to live somewhere else, run host-config-build from that directory and use --source-dir to point at the root Spheral dir.

Custom Install Directory

You can setup a custom install location by using --install-dir.

Option --build

The --build option will configure CMake as usual and then execute a build and install in parallel.

Note

When building on non LC systems and using --build you can ignore any warning pertaining to lc-modules not set.

Additional CMake Options

With host-config-build we are still able to pass and override CMake arguments (See: Spheral / CMake Configurations). To do this add your CMake -D<XXXXX> options to your host-config-build command. This is particularly useful if you want to change the CMAKE_BUILD_TYPE or use a TPL that was not installed by tpl-manager.

The example below shows how you can take the gcc host-config from above, and configure with Release and a custom PYB11Generator install.

python3 scripts/devtools/host-config-build.py --host-config <sys_type>-gcc.cmake" -DCMAKE_BUILD_TYPE=Release -Dpyb11generator_DIR=<PYB11generator_install_prefix>/lib/python3.9/site-packages/

Manually Configure CMake

host-config-build.py is a tool for convenience, if you prefer to use CMake manually and set up your own build/install directory structure that is still very easy to do.

mkdir -p Spheral_release/BUILD && cd Spheral_release/BUILD
cmake -C ../../Spheral/<sys_type>-gcc.cmake \
      -DCMAKE_INSTALL_PREFIX=`cd ..; pwd` ../../Spheral

In this example we create our build directory Spheral_release/BUILD, and will install Spheral in Spheral_release.

The CMake option -C ../../Spheral/<sys_type>-gcc.cmake is how we tell the CMake system to use the TPLs we installed with tpl-manager.py for gcc.

The somewhat obscure command -DCMAKE_INSTALL_PREFIX=`cd ..; pwd` specifies the install directory as the full path to Spheral_release. Alternatively you can specify this path explicitly, such as -DCMAKE_INSTALL_PREFIX=/usr/local/Spheral_release.