Determine configuration options¶
scons helpto see a list all configuration options for Cantera, or see Configuration Options.
Configuration options are specified as additional arguments to the
scons command option=value
sconsis the program that manages the build steps, and
commandis most commonly one of
Other commands are possible, and are explained in Build Commands.
SCons saves configuration options specified on the command line in the file
cantera.confin the root directory of the source tree, so generally it is not necessary to respecify configuration options when rebuilding Cantera. To unset a previously set configuration option, either remove the corresponding line from
cantera.confor use the syntax:
scons command option_name=
Sometimes, changes in your environment can cause SCons’s configuration tests (e.g., checking for libraries or compiler capabilities) to unexpectedly fail. To force SCons to re-run these tests rather than trusting the cached results, run scons with the option
The following lists of options are not complete, they show only some commonly used options. The entire list of options can be found in Configuration Options.
Python 2 Module Options¶
By default, SCons will attempt to build the Cython-based Python module for Python 2, if both Numpy and Cython are installed. The following options control how the Python 2 module is built:
Python 3 Module Options¶
If SCons detects a Python 3 interpreter installed in a default location
python3 is on the
PATH environment variable) or
y, SCons will try to build the Python module
for Python 3. The following SCons options control how the Python 3 module is
Note that even when building the Python 3 Cantera module, you should still use Python 2 with SCons, as SCons does not currently support Python 3.
Windows Only Options¶
cantera.conf file uses the backslash character
\ as an escape
character. When modifying this file, backslashes in paths need to be escaped
boost_inc_dir = 'C:\\Program Files (x86)\\boost\\include'
This does not apply to paths specified on the command line. Alternatively,
you can use forward slashes (
/) in paths.
In Windows there aren’t any proper default locations for many of the packages that Cantera depends on, so you will need to specify these paths explicitly.
Remember to put double quotes around any paths with spaces in them, e.g.
By default, SCons attempts to use the same architecture as the copy of Python that is running SCons, and the most recent installed version of the Visual Studio compiler. If you aren’t building the Python module, you can override this with the configuration options
To compile with MinGW, specify the toolchain option:
MATLAB Toolbox Options¶
Building the MATLAB toolbox requires an installed copy of MATLAB, and the path to the directory where MATLAB is installed must be specified using the following option:
Fortran Module Options¶
Building the Fortran module requires a compatible Fortran comiler. SCons will
attempt to find a compatible compiler by default in the
variable. The following options control how the Fortran module is built:
The following options control if the documentation is built:
The following options are possible as commands to SCons, i.e., the first
Print a description of user-specifiable options.
Compile Cantera and the language interfaces using default options.
Delete files created while building Cantera.
[sudo] scons install
[sudo] scons uninstall
Run all tests which did not previously pass or for which the results may have changed.
Reset the passing status of all tests.
Delete files created while running the tests.
List available tests.
Run the test named “NAME”.
scons <command> dump
Dump the state of the SCons environment to the screen instead of doing
scons build dump. For debugging purposes.
Compile the C++ and Fortran samples.
Build a Windows installer (.msi) for Cantera.
Build the Sphinx documentation
Build the Doxygen documentation
Compile Cantera & Test¶
Run SCons with the list of desired configuration options:
scons build ...
If Cantera compiles successfully, you should see a message that looks like:
******************************************************* Compilation completed successfully. - To run the test suite, type 'scons test'. - To install, type '[sudo] scons install'. *******************************************************
If you do not see this message, check the output for errors to see what went wrong.
Cantera has a series of tests that can be run with the command:
When the tests finish, you should see a summary indicating the number of tests that passed and failed.
If you have tests that fail, try looking at the following to determine the source of the error:
- Messages printed to the console while running
- Output files generated by the tests
- Messages printed to the console while running
To build the Cantera HTML documentation, run the commands:
scons doxygen scons sphinx
or append the options
doxygen_docs=yto the build command, e.g.:
scons build doxygen_docs=y sphinx_docs=y