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.build_config import BuildConfig
 2from fab.steps.analyse import analyse
 3from fab.steps.compile_fortran import compile_fortran
 4from fab.steps.find_source_files import find_source_files
 5from fab.steps.grab.folder import grab_folder
 6from fab.steps.link import link_exe
 7from fab.steps.preprocess import preprocess_fortran
 8
 9with BuildConfig(project_label='<project label>') as state:
10    grab_folder(state, src='<path to source folder>')
11    find_source_files(state)
12    preprocess_fortran(state)
13    analyse(state, find_programs=True)
14    compile_fortran(state)
15    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.