From d93a8692e08abbe7926955ffdaa95ad569c372f9 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 7 Dec 2020 12:59:09 +0100 Subject: [PATCH] cmakelists update --- CMakeLists.txt | 26 ++++++++++++++++++++++++++ osal/host/CMakeLists.txt | 2 +- osal/linux/CMakeLists.txt | 25 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 osal/linux/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 9973c0ec..669283c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,32 @@ 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") +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) option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) diff --git a/osal/host/CMakeLists.txt b/osal/host/CMakeLists.txt index d54cfac8..d73e6f27 100644 --- a/osal/host/CMakeLists.txt +++ b/osal/host/CMakeLists.txt @@ -13,9 +13,9 @@ target_sources(${LIB_FSFW_NAME} ) if(UNIX) + add_definitions(-pthread) target_link_libraries(${LIB_FSFW_NAME} PRIVATE - pthread rt ) endif() \ No newline at end of file diff --git a/osal/linux/CMakeLists.txt b/osal/linux/CMakeLists.txt new file mode 100644 index 00000000..c0096e42 --- /dev/null +++ b/osal/linux/CMakeLists.txt @@ -0,0 +1,25 @@ +target_sources(${LIB_FSFW_NAME} + PRIVATE + Clock.cpp + BinarySemaphore.cpp + CountingSemaphore.cpp + FixedTimeslotTask.cpp + InternalErrorCodes.cpp + MessageQueue.cpp + Mutex.cpp + MutexFactory.cpp + PeriodicPosixTask.cpp + PosixThread.cpp + QueueFactory.cpp + SemaphoreFactory.cpp + TaskFactory.cpp + TcUnixUdpPollingTask.cpp + TmTcUnixUdpBridge.cpp + Timer.cpp +) + +target_link_libraries(${LIB_FSFW_NAME} + PRIVATE + rt + pthread +)