Streamlining the handling of locations and include roots in F Prime CMake#5286
Streamlining the handling of locations and include roots in F Prime CMake#5286LeStarch wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors how F Prime’s CMake build system tracks “locations/build roots” and global include roots by introducing a single global INTERFACE target that owns these properties, while maintaining backward compatibility with historical location variables.
Changes:
- Introduces a new global interface target (
FPRIME_GLOBAL_INTERFACE_TARGET) to carry locations, include roots, and chosen implementations as target properties. - Updates module naming/build-root discovery and FPP autocoder path handling to consume
FPRIME_LOCATIONSfrom the global interface target. - Removes the legacy
__fprime_configtarget concept and links BASE_CONFIG configuration modules into the global interface target instead.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
Fw/Types/CMakeLists.txt |
Switches core Fw_Types dependency from the legacy config target to the global interface target. |
cmake/utilities.cmake |
Updates build-root detection to use FPRIME_LOCATIONS from the global interface target. |
cmake/test/data/cmake/target/test_recursion.cmake |
Updates expected dependency set to include the new global interface target. |
cmake/target/sub-build/module_info.cmake |
Writes global-interface-derived properties back to the outer build via generated CMake. |
cmake/sub-build/sub-build-config.cmake |
Removes the deprecated FPRIME_BUILD_LOCATIONS cache variable from sub-build filtering. |
cmake/global_interface.cmake |
Adds the new global interface target and helper functions to register location pairs. |
cmake/FPrime.cmake |
Hooks historical locations into the global interface target and logs locations from sub-build output. |
cmake/config_assembler.cmake |
Removes creation of the legacy internal config interface target. |
cmake/autocoder/fpp.cmake |
Derives FPP -p locations from the global interface target and centralizes related variable setup. |
cmake/autocoder/fpp_ut.cmake |
Aligns unit-test FPP autocoder invocation with the new shared variable setup. |
cmake/API.cmake |
Routes project registration and BASE_CONFIG propagation through the global interface target. |
| function(get_nearest_build_root DIRECTORY_PATH) | ||
| get_filename_component(DIRECTORY_PATH "${DIRECTORY_PATH}" ABSOLUTE) | ||
| resolve_path_variables(DIRECTORY_PATH) | ||
| set(FOUND_BUILD_ROOT "${DIRECTORY_PATH}") | ||
| set(LAST_REL "${DIRECTORY_PATH}") | ||
| foreach(FPRIME_BUILD_LOC ${FPRIME_BUILD_LOCATIONS} ${CMAKE_BINARY_DIR}/F-Prime ${CMAKE_BINARY_DIR}) | ||
|
|
||
| # Read the know locations (up to this point) and look for the closest one. | ||
| get_property(FPRIME_ALL_LOCATIONS TARGET "${FPRIME_GLOBAL_INTERFACE_TARGET}" PROPERTY FPRIME_LOCATIONS) | ||
| foreach(FPRIME_BUILD_LOC IN LISTS FPRIME_ALL_LOCATIONS) |
| include_guard() | ||
| # Create a target for use as the global interface for cross-build properties. Then create a variable to store the name. | ||
| set(FPRIME_GLOBAL_INTERFACE_TARGET "__fprime_global_interface" CACHE INTERNAL "Target name of global interface" FORCE) | ||
| add_library(${FPRIME_GLOBAL_INTERFACE_TARGET} INTERFACE) | ||
|
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Coverage report — base
|
| Module | Line | Δ | Function | Δ | Branch | Δ |
|---|---|---|---|---|---|---|
Os/Posix |
62.00 | -0.40 | 84.21 | +0.00 | 44.10 | +0.00 |
Fw/DataStructures |
98.30 | -0.18 | 97.14 | +0.38 | 83.03 | -0.18 |
Modules without UTs
CFDP/Checksum/GTest, Drv/ByteStreamDriverModel, Drv/Interfaces, Drv/LinuxGpioDriver, Drv/LinuxI2cDriver, Drv/LinuxSpiDriver, Drv/LinuxUartDriver, Drv/Ports, Drv/Ports/DataTypes, FppTestProject/FppTest/interfaces, FppTestProject/FppTest/topology/async, FppTestProject/FppTest/topology/components/Comp, FppTestProject/FppTest/topology/components/Framework, FppTestProject/FppTest/topology/components/Receiver, FppTestProject/FppTest/topology/components/Sender, FppTestProject/FppTest/topology/guarded, FppTestProject/FppTest/topology/ports, FppTestProject/FppTest/topology/sync, FppTestProject/FppTest/topology/top_ports, FppTestProject/FppTest/topology/types, Fw/Cmd, Fw/Com, Fw/Comp, Fw/FilePacket/GTest, Fw/Fpy, Fw/Interfaces, Fw/Obj, Fw/Port, Fw/Ports/CompletionStatus, Fw/Ports/Ready, Fw/Ports/Signal, Fw/Ports/SuccessCondition, Fw/Prm, Fw/SerializableFile/test/TestSerializable, Fw/Sm, Fw/Test, Fw/Types/GTest, Os/Models, Svc/Cycle, Svc/DpPorts, Svc/Fatal, Svc/FatalHandler, Svc/FileDownlinkPorts, Svc/FprimeProtocol, Svc/Interfaces, Svc/PassiveConsoleTextLogger, Svc/Ping, Svc/PolyIf, Svc/Ports/CommsPorts, Svc/Ports/FilePorts, Svc/Ports/OsTimeEpoch, Svc/Ports/TlmPacketizerPorts, Svc/Ports/VersionPorts, Svc/Sched, Svc/Seq, Svc/Subtopologies/CdhCore, Svc/Subtopologies/ComCcsds, Svc/Subtopologies/ComFprime, Svc/Subtopologies/ComLoggerTee, Svc/Subtopologies/DataProducts, Svc/Subtopologies/FileHandling, Svc/Types/TlmPacketizerTypes, Svc/WatchDog, TestDeploymentsProject/Ref/PingReceiver, TestDeploymentsProject/Ref/RecvBuffApp, TestDeploymentsProject/Ref/SendBuffApp, TestDeploymentsProject/Ref/Top, TestDeploymentsProject/Ref/TypeDemo, cmake/test/data/TestDeployment/TestBuildAutocoder, cmake/test/data/TestDeployment/TestChainedAutocoder, cmake/test/data/TestDeployment/TestHeaderAutocoder, cmake/test/data/TestDeployment/TestTargetAutocoder, cmake/test/data/test-fprime-library/TestLibrary/TestComponent, cmake/test/data/test-fprime-library2/TestLibrary2/TestComponent
Change Description
Streamline the handling of F Prime locations. This provides backwards compatibility for the old variables.
Rationale
Needed to remove dependence on old static CMake structures
Testing/Review Recommendations
CI
Future Work
Unknown.
AI Usage (see policy)
Human write code. Ugh. 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥