-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Streamlining the handling of locations and include roots in F Prime CMake #5286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LeStarch
wants to merge
7
commits into
devel
Choose a base branch
from
fix/streamlining-locations
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2b31952
Streamlining the handling of locations and include roots in F Prime C…
LeStarch e187e33
sp
LeStarch f463926
Potential fix for pull request finding
LeStarch 0d7e2c9
Potential fix for pull request finding
LeStarch 92b1566
Potential fix for pull request finding
LeStarch 13b810f
Potential fix for pull request finding
LeStarch 467db96
Fix copilot recommendations
LeStarch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| #### | ||
| # global_interface.cmake: | ||
| # | ||
| # This file provides an internal global interface target for use in the F Prime build system. Its job is to act as a | ||
| # singular target that has all the global properties that the build system requires. These include: | ||
| # | ||
| # 0. FPRIME_LOCATIONS: list of all "root" locations (source, binary) | ||
| # 1. FPRIME_SOURCE_LOCATIONS: list of all "root" locations of the project used for infering target names. | ||
|
Check failure on line 8 in cmake/global_interface.cmake
|
||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| # 2. FPRIME_BINARY_LOCATIONS: list of all binary equivalents of FPRIME_SOURCE_LOCATIONS in the build cache. | ||
| # 3. INTERFACE_INCLUDE_DIRECTORIES: list of all include directories that apply to all targets in the build system. | ||
| # a. These include all FPRIME_SOURCE_LOCATIONS, FPRIME_BINARY_LOCATIONS, and configuration directories | ||
| # 4. FPRIME_CHOSEN_IMPLEMENTATIONS: list of all chosen implementations for selectable build modules. | ||
| # | ||
| # The global interface target also links to all BASE_CONFIG configuration modules. This allows modules to depend on, | ||
| # and receive include directories for all base configurations. | ||
| # | ||
| # The target's name is stored in the FPRIME_GLOBAL_INTERFACE_TARGET cache variable and is available to all projects. | ||
| # Users must include this file to ensure that, should they be the first to need this target, it will be created. | ||
| # | ||
| # A global target is preferable to global properties as it has several advantages. First, it allows for transitive | ||
| # properties for things like include paths. Second, its F Prime properties can be used in generator expressions. | ||
| # | ||
| # CACHE VARIABLES: | ||
| # - FPRIME_GLOBAL_INTERFACE_TARGET: the name of the global interface target. Used when interfacing with the target | ||
| # | ||
| #### | ||
| 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) | ||
|
|
||
|
Comment on lines
+27
to
+32
|
||
| #### | ||
| # Function `fprime_add_location_pair`: | ||
| # | ||
| # This function adds a source location and its corresponding binary location to the global interface target. This | ||
| # includes adding the SOURCE to FPRIME_SOURCE_LOCATIONS, the BINARY to FPRIME_BINARY_LOCATIONS and updating the | ||
| # INTERFACE_INCLUDE_DIRECTORIES and FPRIME_LOCATIONS property with both locations. | ||
| # | ||
| # Arguments: | ||
| # - `SOURCE`: the source location to add | ||
| # - `BINARY`: the binary location to add | ||
| # Returns: None | ||
| #### | ||
| function(fprime_add_location_pair SOURCE BINARY) | ||
| resolve_path_variables(SOURCE BINARY) | ||
| # First update the target properties with the appropriate locations. | ||
| append_list_property("${SOURCE}" TARGET "${FPRIME_GLOBAL_INTERFACE_TARGET}" PROPERTY FPRIME_SOURCE_LOCATIONS) | ||
| append_list_property("${BINARY}" TARGET "${FPRIME_GLOBAL_INTERFACE_TARGET}" PROPERTY FPRIME_BINARY_LOCATIONS) | ||
| append_list_property("${SOURCE}" TARGET "${FPRIME_GLOBAL_INTERFACE_TARGET}" PROPERTY FPRIME_LOCATIONS) | ||
| append_list_property("${BINARY}" TARGET "${FPRIME_GLOBAL_INTERFACE_TARGET}" PROPERTY FPRIME_LOCATIONS) | ||
| # Add source and binaries to the interface includes of our singular global interface target | ||
| target_include_directories("${FPRIME_GLOBAL_INTERFACE_TARGET}" INTERFACE "${SOURCE}") | ||
| target_include_directories("${FPRIME_GLOBAL_INTERFACE_TARGET}" INTERFACE "${BINARY}") | ||
| endfunction(fprime_add_location_pair) | ||
|
|
||
| #### | ||
| # Function `fprime_add_historical_locations`: | ||
| # | ||
| # This function adds the list of historical locations to the global interface target. This is done for backwards | ||
| # compatibility with older versions of F Prime. This includes the following historical locations: | ||
| # - FPRIME_PROJECT_ROOT: the root source directory of the project, from settings.ini | ||
| # - FPRIME_FRAMEWORK_PATH: the source directory of the F Prime framework, from settings.ini | ||
| # - FPRIME_LIBRARY_LOCATIONS: the list of the library locations of the project, from settings.ini | ||
| # | ||
| # > [!WARNING] | ||
| # > This functions and associated variables are deprecated. New projects and code should not use these variables. | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| # | ||
| # Arguments: None | ||
| # Returns: None | ||
| #### | ||
| function(fprime_add_historical_locations) | ||
| if (DEFINED FPRIME_PROJECT_ROOT) | ||
| fprime_add_location_pair("${FPRIME_PROJECT_ROOT}" "${CMAKE_BINARY_DIR}") | ||
| endif() | ||
| if (DEFINED FPRIME_FRAMEWORK_PATH) | ||
| fprime_add_location_pair("${FPRIME_FRAMEWORK_PATH}" "${CMAKE_BINARY_DIR}/F-Prime") | ||
| endif() | ||
| foreach(LIBRARY_LOCATION IN LISTS FPRIME_LIBRARY_LOCATIONS) | ||
| fprime_add_location_pair("${LIBRARY_LOCATION}" "${CMAKE_BINARY_DIR}") | ||
| endforeach() | ||
| endfunction(fprime_add_historical_locations) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.