In this section, some specific aspects of the build system are described.
The code_saturne build system is based mostly on the GNU Autotools, and provides a traditional configure
, make
, make install
sequence).
Those tools have their sets of advantages and disadvantages, but are very well documented. An very practical feature, not available in such a natural form in some other build frameworks, is the possibility to provide a quick and complete list of available options using configure --help
.
./sbin/bootstap
from the top source directory. Some scripts may also be rebuilt automatically when the Autotools maintainer mode is enabled (which is the default when sources are pulled from Git), but to ensure a complete update, the above command is recommended.config/cs_auto_flags.sh
script is run by configure
. Modifying this file does not require running ./sbin/bootstap
, so it is possible to adapt it easily when porting to a new machine or set of compilers, even on cluster environments where the Autotools might not be available.src/Makefile.am
Automake template (whereas most files to be compiled are listed in sub-directories). As Fortran is progressively being replaced by C in code_saturne, new modules are rarely added, limiting the inconvenience.configure
(bin/cs_config.py
and the intermediate config/code_saturne_build.cfg.in
file) and make install
(bin/cs_package.py
and the final config/code_saturne_build.cfg
file). Currently, most settings are used directly from the installed cs_config.py
and cs_package.py
, but migrating to import of settings from config/code_saturne_build.cfg
is recommended.libtool
does not handle some compiler options, such as the CUDA compiler. To allow building CUDA code with dynamic libraries,m4
, and prefixed by cs_
(so may be listed as m4/cs_*.m4
). Other m4 files in the same directory are generated or copied by automake
.The main solver executable is usually cs_solver
, but variants such as nc_solver
, or other executables for unit testing are handled in a similar manner.
The main executable is compiled using the Python scripts. When installed or installing, the appropriate code is found in cs_compile.py
(under bin
in the code sources, and Python package install path in installed code). When building, since the available path structure is different, some methods are overloaded, using code from build-aux/cs_compile_build.py
.
To avoid requiring extra steps when releasing a version, which have proved to be error-prone in the past, the code version handling is semi-automatic.
Since it is good practice to provide some form of release notes, and such notes require human intervention, the version number is based on entries available in the NEWS.md
file in the top source directory. This is completed by info available from Git, if available. Based on this information, a build_aux/cs_version.py
script determines the major, minor, and release numbers,n possibly with an additional Git hash, and a flag indicating whether the version based on Git is further modified (i.e. if there are uncommitted changes).
So when editing the NEWS.md
, care must be taken to follow the existing format and naming conventions.
The following logic is also applied in the build_aux/cs_version.py
script:
NEWS.md
(rather than providing a release date), the version will appear as x.y.(z-1)-patch.The GNU Autotools provide some nice features, and the code_saturne build system represents a large amount of work over multiple years, but this system is showing its age, and perhaps not evolving well enough to suit current needs.
Worse, these tools have lacked consistent integration from the start. For example, Autoconf allows generating multiple config.h
files (such as cs_config.h
and cs_config_priv.h
), but Automake can only handle one. This has required writing work-arounds. Libtool possibly causes more issues than it solves. And finally, its cross-platform aspects are very limited. So Windows ports are basically limited to the Windows Subsystem for Linux.
Alternatives also have their advantages and disadvantages:
configure --help
. Though cmake -LAH
is similar, it immediately caches some results, and should thus be run in a specific directory, making it a bit more tricky to use.config/code_saturne_build.cfg
) yet.config.log
or config.status
, adapt it if necessary, empty the build directory, and generate a new configuration. Doing the equivalent with CMake does not seem so straightforward.configure
and Makefile.in
files (using sbin/bootstrap
in code_saturne) when CMake files are modified.For now, a safe solution seems to be to rewrite some parts of the build system in Python, as is already done in quite a few areas (see files in build-aux
), and progressively reduce the reliance on the Autotools.