Skip to content

Config assembler

Note: auto-generated from comments in: ./config_assembler.cmake

config_assembler.cmake:

CMake configuration handling function.

Function fprime__internal_process_configuration_sources:

This function will process the configuration sources from various calls to set up configuration modules. It will ensure that SOURCES/HEADERS are unique across module and will ensure CONFIGURATION_OVERRIDES override existing source and header files.

Arguments: - MODULE_NAME: the name of the module being processed - SOURCES: list of sources to process - AUTOCODER_INPUTS: list of autocoder inputs to process - HEADERS: list of headers to process - OVERRIDES: list of configuration overrides to process - DEPENDS: list of dependencies to append to

Returns: - INTERNAL_SOURCES: list of sources in their final configuration location (set in caller) - INTERNAL_AUTOCODER_INPUTS: list of autocoder inputs in their final configuration location (set in caller) - INTERNAL_HEADERS: list of headers in their final configuration location (set in caller) - INTERNAL_DEPENDS: list of dependencies, new and old

Function fprime__internal_process_configuration_source_set:

Processes a single set of configuration files checking to see if files collide and if they must collide.

Arguments: - MODULE_NAME: the name of the module being processed - SOURCE_SET: list of sources to process - EXPECT_OVERRIDE: if true, the source must exist and will be overridden, false if it must not exist - CHECK_INCLUDE_CONFLICTS: if true, check new sources for include path conflicts with the build cache

Returns: - PROCESSED_SOURCES: list (set in caller) - NEW_DEPENDS: list of new dependencies (set in caller)

Function fprime__internal_check_configuration_include_path:

Configuration files are copied into the build cache and are included via the configuration include root: the parent of the module's directory in the build cache. This function ensures that the original source file cannot be found at that same include path via any source include root (project root, framework path, and library locations). If it can, the source tree file and the build cache copy conflict over the include path and a FATAL_ERROR is raised. Configuration files living directly at a source include root conflict in the same way and are also fatal.

For example, a config module registered at ROOT/config with a file ROOT/config/my.h would be copied to /config/my.h and included as "config/my.h" via the configuration include root. Since ROOT is also an include root, "config/my.h" would resolve to both files.

Arguments: - MODULE_NAME: the name of the module being processed - SOURCE: absolute path to the configuration source file being processed

Function fprime__internal_record_configuration_write:

Records the source that should end up at a configuration destination. The last source recorded for a destination wins, which is the overriding one: a module supplying a CONFIGURATION_OVERRIDE is always processed after the module supplying the file it overrides, since the override is rejected outright when that file has not been registered yet.

Copying here rather than at the flush would write an overridden destination twice per CMake run, once with the original and once with the override. Neither write can be skipped by ONLY_IF_DIFFERENT because the file holds the other one's content, so the destination's timestamp moves on every configure and everything including it is rebuilt.

The destination is still created when it does not exist, because it is handed to CMake as a build input before the deferred flush runs.

Arguments: - SOURCE: file that should be copied - DESTINATION: location it belongs at

Function fprime__internal_flush_configuration:

Writes every recorded configuration destination exactly once, from the source that won it. A destination that already holds the winning content is left alone by ONLY_IF_DIFFERENT, which is what keeps its timestamp, and everything including it, stable across configures.

Function fprime_internal_get_configuration_destination:

This function will determine the destination of a configuration file by checking to see if the file is in use by any other configuration modules. If it is, it will return the destination of the read from that module's original source via the DESTINATION variable. If it is not, it will unset the DESTINATION variable in PARENT_SCOPE.

Arguments: - CONFIG_NAME: the relative path to the configuration file

Returns: - DESTINATION: the destination of the configuration file or unset (in caller)