fab.build_config module#
Contains the BuildConfig
and helper classes.
- class fab.build_config.BuildConfig(project_label, tool_box, mpi=False, openmp=False, multiprocessing=True, n_procs=None, reuse_artefacts=False, fab_workspace=None, two_stage=False, verbose=False)#
Bases:
object
Contains and runs a list of build steps.
The user is not expected to instantiate this class directly, but rather through the build_config() context manager.
- Parameters:
project_label (
str
) – Name of the build project. The project workspace folder is created from this name, with spaces replaced by underscores.tool_box (
ToolBox
) – The ToolBox with all tools to use in the build.mpi (
bool
) – whether the project uses MPI or not. This is used to pick a default compiler (if none is explicitly set in the ToolBox), and controls PSyclone parameters. (default:False
)openmp (
bool
) – as with mpi, this controls whether the project is using OpenMP or not. This is used to pick a default compiler (if none is explicitly set in the ToolBox). The compiler-specific flag to enable OpenMP will automatically be added when compiling and linking. (default:False
)multiprocessing (
bool
) – An option to disable multiprocessing to aid debugging. (default:True
)n_procs (
Optional
[int
]) – The number of cores to use for multiprocessing operations. Defaults to the number of available cores. (default:None
)reuse_artefacts (
bool
) – A flag to avoid reprocessing certain files on subsequent runs. WARNING: Currently unsophisticated, this flag should only be used by Fab developers. The logic behind flag will soon be improved, in a work package called “incremental build”. (default:False
)fab_workspace (
Optional
[Path
]) – Overrides the FAB_WORKSPACE environment variable. If not set, and FAB_WORKSPACE is not set, the fab workspace defaults to ~/fab-workspace. (default:None
)two_stage (
bool
) – Compile .mod files first in a separate pass. Theoretically faster in some projects. (default:False
)verbose (
bool
) – DEBUG level logging. (default:False
)
- property artefact_store: ArtefactStore#
- Returns:
the Artefact instance for this configuration.
- add_current_prebuilds(artefacts)#
Mark the given file paths as being current prebuilds, not to be cleaned during housekeeping.
- class fab.build_config.AddFlags(match, flags)#
Bases:
object
Add command-line flags when our path filter matches. Generally used inside a
FlagsConfig
.- Parameters:
Both the match and flags arguments can make use of templating:
$source for <project workspace>/source
$output for <project workspace>/build_output
$relative for <the source file’s folder>
For example:
# For source in the um folder, add an absolute include path AddFlags(match="$source/um/*", flags=['-I$source/include']), # For source in the um folder, add an include path relative to # each source file. AddFlags(match="$source/um/*", flags=['-I$relative/include']),
- run(fpath, input_flags, config)#
Check if our filter matches a given file. If it does, add our flags.