Installing TRIP software with SConstruct
TRIP software consists of packages, organized into projects. Individual packages and entire projects install in the the same way.
Preliminaries:The TRIP installation procedure uses SConstruct, a python application. If SConstruct is not available on your system, install it first - see instructions below.
To build a package or project with default options, cd to its root directory and enter
Explanation: Issuing this command in a package or project directory causes the package or project to be built, with default options passed to the compiler and linker. Current default build options are
- Compilers: gcc, g++.
- Default flags for gcc: -g -std=C99 -pedantic -Wunused -Wimplicit -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
- Default flags for g++: -g -pedantic -Wunused -Wimplicit -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
Step 1, with more control:
Set compiler options for the build from a config file, then (re)build:
$ scons --ccopts=[valid full or relative pathname to config file] $ scons
Explanation:: TRIP's extension of SConstruct controls compiler options via a config file containing Python string definitions for these options. The file consists of lines like:
CC = [name of C compiler]
CFLAGS = [flags to be passed to C compiler ONLY]
CXX = [name of C++ compiler]
CXXFLAGS = [flags to be passed to C++ compiler ONLY]
CCFLAGS = [flags to be passed to BOTH C and C++ compilers]
LINKFLAGS = [flags to be passed to the linker]
If you don't need a definition, you can leave it out - for example, for a pure C project compiled with MPI and using C99 features, large file i/o, IWAVE's directive to turn on MPI-enabled code segments, and no special directives to the linker, only CC and CFLAGS are needed:
CC = 'mpicc'
CFLAGS = '-O3 -std=c99 -ffast-math -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DIWAVE_USE_MPI'
Note that the right-hand side of the assignment statement is a quoted string - this file must consist of legal python assignments.
Also compilers are specified by command name, and these must be present in the user's path.
You can create the config file under any file name you like, anywhere you like. The command "scons --ccopts=[valid path to your file]" executed in a project or package directory, installs the your config file in all appropriate places, including package subdirectories if any.
The TRIP admin directory includes a number of preconstructed config files. For example, to use the a "vanilla" set of options appropriate for compiling IWAVE with mpi under Linux using the Intel compiler suite, assuming that you have downloaded an unpacked the TRIP admin directory at a path specified by the environment variable TRIPADMIN,
$ scons --ccopts=$TRIPADMIN/scons/linux.mpi.py
(note that environment variables included in such pathnames are automatically expanded)
Step 2: Cleaning up
To remove all build products,
$ scons -c
in project or package root.
SConstruct depends on python, and the install script checks that python is available.
To use the install script, first download the TRIP admin directory tree. Then
- cd to the root directory of this tree, and enter
- append [path to TRIP admin directory]/scons/bin to your PATH environment variable.
Under the hood
The SConstruct scripts that make this all work are part of the TRIP Build System, an extension of SConstruct that manages common build tasks, such as finding headers, libraries, and other external dependencies, in a consistent way.
Maintained by William W. Symessymes@caam.rice.edu Last modified: Wed Jan 18 17:53:54 CDT 2012