From f152ff83df8d94045ac28878de9bb67cdabceb94 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 10 Jan 2024 14:47:31 -0500 Subject: [PATCH] Fix #426, conditional module inclusion Add a cmake file that extends the PSP_TARGET_MODULE_LIST conditionally. Initially, this can check for a minimum target system version and only include modules that are known to work on that version. This can be used to make the RTEMS 4.11 build work again. --- CMakeLists.txt | 2 +- fsw/pc-rtems/psp_conditional_modules.cmake | 8 ++++++++ fsw/pc-rtems/psp_module_list.cmake | 7 +++++-- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 fsw/pc-rtems/psp_conditional_modules.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d601212..a6d904c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ target_include_directories(psp_module_api INTERFACE # Translate the CFE_PSP_TARGETNAME to a set of additional modules to build file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/fsw/${CFE_PSP_TARGETNAME}/psp_module_list.cmake" PSP_TARGET_MODULE_LIST REGEX "^[a-zA-Z]") +include("${CMAKE_CURRENT_LIST_DIR}/fsw/${CFE_PSP_TARGETNAME}/psp_conditional_modules.cmake" OPTIONAL) # The PSP is currently built in modular parts, consisting of a platform-specific # module(s) combined with a shared component which is built for multiple targets. @@ -72,4 +73,3 @@ if (ENABLE_UNIT_TESTS) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ut-stubs) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit-test-coverage) endif () - diff --git a/fsw/pc-rtems/psp_conditional_modules.cmake b/fsw/pc-rtems/psp_conditional_modules.cmake new file mode 100644 index 00000000..b559d224 --- /dev/null +++ b/fsw/pc-rtems/psp_conditional_modules.cmake @@ -0,0 +1,8 @@ +# The sysmon module only works in RTEMS >= 5. +# Ideally this check should be VERSION_GREATER_EQUAL 5, but that conditional does +# not exist in all versions of cmake. +if(CMAKE_SYSTEM_VERSION VERSION_GREATER 4.99) + + list(APPEND PSP_TARGET_MODULE_LIST rtems_sysmon) + +endif() \ No newline at end of file diff --git a/fsw/pc-rtems/psp_module_list.cmake b/fsw/pc-rtems/psp_module_list.cmake index ec59c6a7..f93fe1e6 100644 --- a/fsw/pc-rtems/psp_module_list.cmake +++ b/fsw/pc-rtems/psp_module_list.cmake @@ -1,5 +1,9 @@ # This is a list of modules that is included as a fixed/base set -# when this PSP is selected. They must exist under fsw/modules +# when this PSP is selected. They must exist under fsw/modules. + +# NOTE: This set is REQUIRED for all versions of the platform. +# If a module only works on some versions of the platform, add +# if to psp_conditional_modules.cmake instead soft_timebase timebase_posix_clock @@ -7,4 +11,3 @@ eeprom_notimpl ram_direct port_notimpl iodriver -rtems_sysmon \ No newline at end of file