The build can be (re)configured by passing one or more options to the CMake command with prefix -D. A typical command line looks like
cmake .. -D<option>=<value>where <value> is a string or a boolean, depending on the specified option. The table below provides an overview of the non-required options that can be used.
option | description | default value |
CMAKE_INSTALL_PREFIX | user-defined installation path | /usr/local/swan |
CMAKE_PREFIX_PATH | semicolon-separated list of library paths | empty |
CMAKE_Fortran_COMPILER | full path to the Fortran compiler | determined by CMake |
MPI | enable build with MPI | OFF |
OPENMP | enable build with OpenMP | OFF |
METIS | enable build with Metis | OFF |
NETCDF | enable build with netCDF | OFF |
CMAKE_VERBOSE_MAKEFILE | provide verbose output of the build | OFF |
cmake .. -GNinja -DNETCDF=ON -DMPI=ON cmake --build .will configure SWAN to be built created by Ninja that supports netCDF output and parallel computing using the MPI paradigm. Note that CMake will check the availability of MPI and netCDF libraries within your environment. Also note that netCDF libraries might be installed in a custom directory (e.g., /home/your/name/netcdf), which must then be a priori specified on the command line as follows:
export NetCDF_ROOT=/path/to/netcdf/root/directoryor
cmake .. -DCMAKE_PREFIX_PATH=/path/to/netcdf/directoryso that CMake can find the libraries. The same holds for Metis libraries, as follows:
export Metis_ROOT=/path/to/metis/root/directoryor
cmake .. -DCMAKE_PREFIX_PATH=/path/to/metis/directoryNote: to define a path list with more than one prefixes use a semicolon as a separator.
cmake .. -DCMAKE_Fortran_COMPILER=/path/to/desired/compilerFinally, if CMake fails to configure your project, then execute
cmake .. -DCMAKE_VERBOSE_MAKEFILE=ONwhich will generate detailed information that may provide some indications to debug the build process.
The SWAN team 2024-09-09