From e052a9694ffa14cda100ce39a3c106b23dbc79f3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Dec 2020 16:10:13 +0100 Subject: [PATCH] upstream stuff --- CMakeLists.txt | 114 ++++++++++++++++++------ events/CMakeLists.txt | 1 - fdir/CMakeLists.txt | 6 ++ health/CMakeLists.txt | 6 ++ housekeeping/CMakeLists.txt | 5 ++ internalError/CMakeLists.txt | 4 + internalError/InternalErrorReporter.cpp | 3 +- memory/CMakeLists.txt | 5 ++ modes/CMakeLists.txt | 5 ++ monitoring/CMakeLists.txt | 5 ++ objectmanager/CMakeLists.txt | 5 ++ 11 files changed, 128 insertions(+), 31 deletions(-) create mode 100644 fdir/CMakeLists.txt create mode 100644 health/CMakeLists.txt create mode 100644 housekeeping/CMakeLists.txt create mode 100644 internalError/CMakeLists.txt create mode 100644 memory/CMakeLists.txt create mode 100644 modes/CMakeLists.txt create mode 100644 monitoring/CMakeLists.txt create mode 100644 objectmanager/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 669283c74..02849ca44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,30 +3,42 @@ cmake_minimum_required(VERSION 3.13) set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) -# Set options for FSFW OSAL selection. -if(UNIX) -set(OS_FSFW "linux" CACHE STRING "OS abstraction layer used in the FSFW") -elseif(WIN32) -set(OS_FSFW "host" CACHE STRING "OS abstraction layer used in the FSFW") -endif() - set_property(CACHE OS_FSFW PROPERTY STRINGS host linux rtems freertos) -if(${OS_FSFW} STREQUAL host) -set(OS_FSFW_NAME "Host") -elseif(${OS_FSFW} STREQUAL linux) -set(OS_FSFW_NAME "Linux") -elseif(${OS_FSFW} STREQUAL freertos) -set(OS_FSFW_NAME "FreeRTOS") -elseif(${OS_FSFW} STREQUAL rtems) -set(OS_FSFW_NAME "RTEMS") -else() -message(WARNING "Invalid operating system for FSFW specified! Setting to host..") -set(OS_FSFW_NAME "Host") -set(OS_FSFW "host") +if(NOT OS_FSFW) + message(STATUS "No OS for FSFW via OS_FSFW set. Assuming host OS") + # Assume host OS and autodetermine from OS_FSFW + if(UNIX) + set(OS_FSFW "linux" + CACHE STRING + "OS abstraction layer used in the FSFW" + ) + elseif(WIN32) + set(OS_FSFW "host" + CACHE STRING "OS abstraction layer used in the FSFW" + ) + endif() + endif() -message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system") +if(${OS_FSFW} STREQUAL host) + set(OS_FSFW_NAME "Host") +elseif(${OS_FSFW} STREQUAL linux) + set(OS_FSFW_NAME "Linux") +elseif(${OS_FSFW} STREQUAL freertos) + set(OS_FSFW_NAME "FreeRTOS") + target_link_libraries(${LIB_FSFW_NAME} ${LIB_OS_NAME}) +elseif(${OS_FSFW} STREQUAL rtems) + set(OS_FSFW_NAME "RTEMS") +else() + message(WARNING + "Invalid operating system for FSFW specified! Setting to host.." + ) + set(OS_FSFW_NAME "Host") + set(OS_FSFW "host") +endif() + +message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") # Options to exclude parts of the FSFW from compilation. option(FSFW_USE_RMAP "Compile with RMAP" ON) @@ -36,8 +48,14 @@ add_subdirectory(action) add_subdirectory(container) add_subdirectory(controller) add_subdirectory(coordinates) -add_subdirectory(datalinklayer) + +if(FSFW_USE_DATALINKLAYER) + add_subdirectory(datalinklayer) +endif() + add_subdirectory(datapool) +add_subdirectory(datapoollocal) +add_subdirectory(housekeeping) add_subdirectory(devicehandlers) add_subdirectory(events) add_subdirectory(fdir) @@ -55,7 +73,7 @@ add_subdirectory(power) add_subdirectory(pus) if(FSFW_USE_RMAP) -add_subdirectory(rmap) + add_subdirectory(rmap) endif() add_subdirectory(serialize) @@ -73,13 +91,53 @@ add_subdirectory(tmtcservices) # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. if(NOT FSFW_CONFIG_PATH) -message(WARNING "Flight Software Framework configuration path not set!") -message(WARNING "Setting default configuration!") -add_subdirectory(defaultcfg/fsfwconfig) + message(WARNING "Flight Software Framework configuration path not set!") + message(WARNING "Setting default configuration!") + add_subdirectory(defaultcfg/fsfwconfig) +endif() + +# FSFW might be part of a possibly complicated folder structure, so we +# extract the absolute path of the fsfwconfig folder. +if(IS_ABSOLUTE ${FSFW_CONFIG_PATH}) + set(FSFW_CONFIG_PATH_ABSOLUTE ${FSFW_CONFIG_PATH}) +else() + get_filename_component(FSFW_CONFIG_PATH_ABSOLUTE + ${FSFW_CONFIG_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR} + ) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX) + set(WARNING_FLAGS + -Wall + -Wextra + -Wshadow=local + -Wimplicit-fallthrough=1 + -Wno-unused-parameter + -Wno-psabi + ) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(COMPILER_FLAGS "/permissive-") endif() # Required include paths to compile the FSFW -target_include_directories(${LIB_FSFW_NAME} - INTERFACE - ${FSFW_CONFIG_PATH} +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_SOURCE_DIR} + ${FSFW_CONFIG_PATH_ABSOLUTE} +) + +# Includes path required to compile FSFW itself as well +# We assume that the fsfwconfig folder uses include relative to the project +# root here! +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_SOURCE_DIR} + ${FSFW_CONFIG_PATH_ABSOLUTE} +) + +# Machine specific options can be set with the ABI_FLAGS variable. +target_compile_options(${LIB_FSFW_NAME} PRIVATE + ${WARNING_FLAGS} + ${COMPILER_FLAGS} + ${ABI_FLAGS} ) diff --git a/events/CMakeLists.txt b/events/CMakeLists.txt index 9e63deb89..4e935167a 100644 --- a/events/CMakeLists.txt +++ b/events/CMakeLists.txt @@ -1,6 +1,5 @@ target_sources(${LIB_FSFW_NAME} PRIVATE - Event.cpp EventManager.cpp EventMessage.cpp ) diff --git a/fdir/CMakeLists.txt b/fdir/CMakeLists.txt new file mode 100644 index 000000000..f5ffbba8d --- /dev/null +++ b/fdir/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + EventCorrelation.cpp + FailureIsolationBase.cpp + FaultCounter.cpp +) \ No newline at end of file diff --git a/health/CMakeLists.txt b/health/CMakeLists.txt new file mode 100644 index 000000000..d5f3ccd30 --- /dev/null +++ b/health/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + HealthHelper.cpp + HealthMessage.cpp + HealthTable.cpp +) \ No newline at end of file diff --git a/housekeeping/CMakeLists.txt b/housekeeping/CMakeLists.txt new file mode 100644 index 000000000..fecad2e3d --- /dev/null +++ b/housekeeping/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + HousekeepingMessage.cpp + PeriodicHousekeepingHelper.cpp +) \ No newline at end of file diff --git a/internalError/CMakeLists.txt b/internalError/CMakeLists.txt new file mode 100644 index 000000000..2b383914c --- /dev/null +++ b/internalError/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + InternalErrorReporter.cpp +) \ No newline at end of file diff --git a/internalError/InternalErrorReporter.cpp b/internalError/InternalErrorReporter.cpp index 8d5c792b8..bfb672891 100644 --- a/internalError/InternalErrorReporter.cpp +++ b/internalError/InternalErrorReporter.cpp @@ -5,8 +5,7 @@ #include "../serviceinterface/ServiceInterfaceStream.h" InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId, - uint32_t messageQueueDepth) : - SystemObject(setObjectId), + uint32_t messageQueueDepth): SystemObject(setObjectId), commandQueue(QueueFactory::instance()-> createMessageQueue(messageQueueDepth)), poolManager(this, commandQueue), diff --git a/memory/CMakeLists.txt b/memory/CMakeLists.txt new file mode 100644 index 000000000..9edb9031f --- /dev/null +++ b/memory/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + MemoryHelper.cpp + MemoryMessage.cpp +) \ No newline at end of file diff --git a/modes/CMakeLists.txt b/modes/CMakeLists.txt new file mode 100644 index 000000000..8e5c719bc --- /dev/null +++ b/modes/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + ModeHelper.cpp + ModeMessage.cpp +) \ No newline at end of file diff --git a/monitoring/CMakeLists.txt b/monitoring/CMakeLists.txt new file mode 100644 index 000000000..d26e807c3 --- /dev/null +++ b/monitoring/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + LimitViolationReporter.cpp + MonitoringMessage.cpp +) \ No newline at end of file diff --git a/objectmanager/CMakeLists.txt b/objectmanager/CMakeLists.txt new file mode 100644 index 000000000..72aaec896 --- /dev/null +++ b/objectmanager/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + ObjectManager.cpp + SystemObject.cpp +) \ No newline at end of file