HPCW 3.0
|
To add a new project or run HPCW on a new system you may also want to create a specific toolchain environment, if necessary. This script may contain specific environment variables to export and modules to load and you will need to source it before the compilation:
To configure CMake's behavior, set compilers to use or additional compilation flags for the toolchain, create the following CMake file:
When compiling, you can use this toolchain file with the following cmake option:
Some toolchains (especially experimental or exotic toolchains) require specific build flags. It is possible to pass down build flags on a per-project basic to each of the CMake projects managed by HPCW.
HPCW will look for variables for each project, following these naming schemes:
<project_name>_cmake_args
<project_name>_configure_args
<project_name>_build_args
Please note that some projects use non standard configure and/or build commands. For instance, NEMO uses a custom makenemo
command with arguments that are not compatible with GNU Make. All the variables are listed in the beginning of every project definition (.cmake file). For example, below is the variable declaration for NEMO:
In the toolchain, one can then add custom flags with the following syntax:
:warning: Due to the structure of the CMake files and the version requirement (3.19), the variables in the toolchain file need to be set as cache variables. This CMake policy update, introduced in 3.21, would allow the usage of normal variables in this scenario instead, but presently, we are using the OLD
behaviour of this policy throughout the project.
Alternatively, one can pass down custom flags via the .env.sh
toolchain file.
This syntax is similar to the one used by the build wrapper (see How-Tos section).
To enable a verbose build for the ectrans project, one would add the following in the toolchain .cmake
file:
Note that this can also be achieved by setting the CMake option HPCW_VERBOSE
.
Another example, to go for -O3
and target native would look like this:
:warning: Please note the last CMake flag: This tells CMake to not use any build configuration. Without this, CMake will generate the default build configuration flags after the user flags. In some situation, this can lead to unexpected behavior, compiler flag conflicts, override, etc. In our example above, this would lead to a binary produced with the following flags:
Enabling FMA and disabling documentation :