From 34bd1819737591492ff0397a32b038779a014f22 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 26 Mar 2020 16:47:16 -0400 Subject: [PATCH] Fix #135, Add separate CMakeLists.txt for each implementation Do not use aux_source_directory to assemble a list of source files. Instead, put a proper CMakeLists.txt file in each implementation and build the implementation separately from the shared/common parts. In addition to avoiding the aux_source_directory this allows PSP-specific compile definitions to be set on a per-implementation basis because it is defined separately. --- CMakeLists.txt | 27 +++++++++++++++------------ fsw/mcp750-vxworks/CMakeLists.txt | 13 +++++++++++++ fsw/pc-linux/CMakeLists.txt | 13 +++++++++++++ fsw/pc-rtems/CMakeLists.txt | 13 +++++++++++++ 4 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 fsw/mcp750-vxworks/CMakeLists.txt create mode 100644 fsw/pc-linux/CMakeLists.txt create mode 100644 fsw/pc-rtems/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 176a3ef2..838ec376 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,21 +4,24 @@ if (NOT CFE_SYSTEM_PSPNAME) message(FATAL_ERROR "CFE_SYSTEM_PSPNAME is not defined - do not know which to build") endif() -if (NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/fsw/${CFE_SYSTEM_PSPNAME}) - message(FATAL_ERROR "PSP ${CFE_SYSTEM_PSPNAME} is not implemented") -endif() - add_definitions(-D_CFE_PSP_) -include_directories(fsw/${CFE_SYSTEM_PSPNAME}/inc) + include_directories(fsw/shared) - -# Use all source files under the shared code directory (always) -# as well as all the files for the selected PSP -set(PSPFILES) -aux_source_directory(fsw/shared PSPFILES) -aux_source_directory(fsw/${CFE_SYSTEM_PSPNAME}/src PSPFILES) -add_library(psp-${CFE_SYSTEM_PSPNAME} STATIC ${PSPFILES}) +# Build the PSP implementation which lies in a system-specific subdirectory +include_directories(fsw/${CFE_SYSTEM_PSPNAME}/inc) +add_subdirectory(fsw/${CFE_SYSTEM_PSPNAME} ${CFE_SYSTEM_PSPNAME}) + +# Build the "common" parts as a library +add_library(psp-${CFE_SYSTEM_PSPNAME} STATIC + fsw/shared/cfe_psp_configdata.c + fsw/shared/cfe_psp_eeprom.c + fsw/shared/cfe_psp_memrange.c + fsw/shared/cfe_psp_memutils.c + fsw/shared/cfe_psp_module.c + fsw/shared/cfe_psp_port.c + fsw/shared/cfe_psp_ram.c + $) if (ENABLE_UNIT_TESTS) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/fsw/ut-stubs) diff --git a/fsw/mcp750-vxworks/CMakeLists.txt b/fsw/mcp750-vxworks/CMakeLists.txt new file mode 100644 index 00000000..b3c54e7e --- /dev/null +++ b/fsw/mcp750-vxworks/CMakeLists.txt @@ -0,0 +1,13 @@ + +# Build the mcp750-vxworks implementation as a library +add_library(psp-${CFE_SYSTEM_PSPNAME}-impl OBJECT + src/cfe_psp_exception.c + src/cfe_psp_memory.c + src/cfe_psp_memtab.c + src/cfe_psp_ssr.c + src/cfe_psp_start.c + src/cfe_psp_support.c + src/cfe_psp_timer.c + src/cfe_psp_voltab.c + src/cfe_psp_watchdog.c) + diff --git a/fsw/pc-linux/CMakeLists.txt b/fsw/pc-linux/CMakeLists.txt new file mode 100644 index 00000000..fb5a5d5a --- /dev/null +++ b/fsw/pc-linux/CMakeLists.txt @@ -0,0 +1,13 @@ + +# Build the pc-linux implementation as a library +add_library(psp-${CFE_SYSTEM_PSPNAME}-impl OBJECT + src/cfe_psp_exception.c + src/cfe_psp_memory.c + src/cfe_psp_memtab.c + src/cfe_psp_ssr.c + src/cfe_psp_start.c + src/cfe_psp_support.c + src/cfe_psp_timer.c + src/cfe_psp_voltab.c + src/cfe_psp_watchdog.c) + diff --git a/fsw/pc-rtems/CMakeLists.txt b/fsw/pc-rtems/CMakeLists.txt new file mode 100644 index 00000000..c4a21a13 --- /dev/null +++ b/fsw/pc-rtems/CMakeLists.txt @@ -0,0 +1,13 @@ + +# Build the pc-rtems implementation as a library +add_library(psp-${CFE_SYSTEM_PSPNAME}-impl OBJECT + src/cfe_psp_exception.c + src/cfe_psp_memory.c + src/cfe_psp_memtab.c + src/cfe_psp_ssr.c + src/cfe_psp_start.c + src/cfe_psp_support.c + src/cfe_psp_timer.c + src/cfe_psp_voltab.c + src/cfe_psp_watchdog.c) +