User build guide
We use SCons to control the build process. The source:trunk/SConstruct file configures what needs to be built, and is worth a look if this document leaves unanswered questions. The file source:trunk/python/SConsTools.py also contains much of the build logic.
scons can be used to run a single test, or multiple tests, in debug or optimised mode, and with number of other options. This page lists the scons commands that users should be aware of. In order to run scons, open a terminal, cd into the main chaste directory, and run one of the following commands. Or better, create a 'Make target' in eclipse using that given command.
This runs all the tests
scons
To run a single test, say heart/test/bidomain/TestBidomainProblem.hpp, do
scons test_suite=heart/test/bidomain/TestBidomainProblem.hpp
The path is relative to the main chaste directory.
To run all the tests in, say, the heart folder, do
scons heart
The above all compile with debug flags. To compile optimised code you must have to provide a build option, for example
scons build=GccOpt test_suite=heart/test/bidomain/TestBidomainProblem.hpp # optimised build scons build=GccOpt_ndebug test_suite=heart/test/bidomain/TestBidomainProblem.hpp # highly optimised with NDEBUG set to true, recommended for longer-running simulations scons build=IntelProduction test_suite=heart/test/bidomain/TestBidomainProblem.hpp # (see below)
Building with IntelProduction requires an Intel compiler and extra libraries (see the install guide). This provides the fastest code but the compilation time can be very long.
Other options that are worth knowing
- compile_only=1 - just compile test executables without running them. This is useful for fixing build failures.
- chaste_libs=1 - compile Chaste as libraries, rather than using fine-grained dependencies for linking.
- warn - stop compiler warnings being treated as errors.
- build=Parallel - compile and run with two processors
- build=Parallel_4 - compile and run with four processors, etc
- scons -c . - do a clean build (note the '.' - this is necessary to do a full clean).
Abbreviations can be used:
- b= instead of build=
- ts= instead of test_suite=`
- co=1 instead of compile_only=1
- cl=1 instead of chaste_libs=1
For example
scons co=1 b=GccOpt_ndebug ts=heart/test/bidomain/TestBidomainProblem.hpp
See ChasteGuides/DeveloperBuildGuide for a complete list of options.