Skip to content

Module

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

Module.cmake:

This cmake file contains the functions needed to compile a module for F prime. This includes code for generating Enums, Serializables, Ports, Components, and Topologies.

These are used as the building blocks of F prime items. This includes deployments, tools, and individual components.

Function fprime__internal_add_build_target:

Processes the module arguments and set variables, then adds a build target with target properties set.

Target properties set: - SOURCES: source files (C++ build) - LINK_LIBRARIES: link dependencies (C++ build) - SUPPLIED_HEADERS: headers (for code counting) - SUPPLIED_SOURCES: original SOURCES before autocoding attached - SUPPLIED_DEPENDENCIES: original link dependencies before autocoding attached - AUTOCODER_INPUTS: input source file list for autocoding - FPRIME_TYPE: set to ${BUILD_TARGET_TYPE_STRING}

This function sets "INTERNAL_MODULE_NAME" in PARENT_SCOPE to pass-back module name for target registration.

  • BUILD_TARGET_TYPE_STRING: "Library", "Executable", "Deployment", and "Unit Test".
  • EXTRA_CONTROL_DIRECTIVES: extra CMake add_* arguments (e.g. INTERFACE for interface libraries)

Function fprime__process_module_setup:

This function is used to process the module setup. It takes a list of arguments and sorts them into SOURCES, HEADERS, and DEPENDS. It also sets the module name based on the first argument or the FPRIME_CURRENT_MODULE variable. If neither is provided, it will throw an error.

It handles the backwards compatibility with the old structure where users set SOURCE_FILES, MOD_DEPS, etc. variables.

  • FPRIME_MODULE_TYPE: fprime type of module
  • ADDITIONAL_CONTROL_SETS: additional control directives to support (e.g. INTERFACE for libraries)
  • ARGN: list of arguments to process.

Function fprime__internal_add_build_target_helper:

Helper to add the target and set target properties.

Target properties set: - SOURCES: source files (C++ build) - LINK_LIBRARIES: link dependencies (C++ build) - SUPPLIED_HEADERS: headers (for code counting) - SUPPLIED_SOURCES: original SOURCES before autocoding attached - SUPPLIED_DEPENDENCIES: original link dependencies before autocoding attached - AUTOCODER_INPUTS: input source file list for autocoding - FPRIME_TYPE: set to ${BUILD_TARGET_TYPE_STRING}

  • BUILD_TARGET_TYPE_STRING: "Library", "Executable", "Deployment", and "Unit Test".
  • EXTRA_CONTROL_DIRECTIVES: extra CMake add_* arguments (e.g. INTERFACE for interface libraries)