Introduction to Configuration#
Use Fab to build your Fortran and C project using a series of build steps written in Python.
Here is an example of a build configuration. It uses some ready made configurable steps provided by Fab, and it’s easy to create your own custom steps.
1from fab.api import (BuildConfig, analyse, compile_fortran,
2 find_source_files, grab_folder, link_exe,
3 preprocess_fortran)
4
5with BuildConfig(project_label='<project label>') as state:
6 grab_folder(state, src='<path to source folder>')
7 find_source_files(state)
8 preprocess_fortran(state)
9 analyse(state, find_programs=True)
10 compile_fortran(state)
11 link_exe(state)
Note
The find_programs tells the analysis
step to discover all Fortran “program” program units and C “main” functions.
If you prefer to specify which programs are to be built you may specify
them using the root_symbol argument instead. It takes a list of program
names.
Fab is designed to minimise user input by providing sensible defaults. Thus it knows to use the build tree created by the preceding step as input for the subsequent step.
Build steps can read and create named collections in the Artefact Store. For example, in the snippet above we don’t tell the compiler which files to compile, that is generated by previous steps.
More details about steps can be found in the guide to writing configuration.