reverting changes to CMakeList.txt to move back topwards upstream

This commit is contained in:
Ulrich Mohr 2022-09-07 11:09:17 +02:00
parent c14b131e6f
commit 7754d65753

View File

@ -28,33 +28,30 @@ if a different toolchain file is set externally"
if(NOT FSFW_OSAL) if(NOT FSFW_OSAL)
set(FSFW_OSAL set(FSFW_OSAL
linux linux
CACHE STRING "OS for the FSFW.") CACHE STRING "OS for the FSFW.")
endif() endif()
if(TGT_BSP) if(TGT_BSP)
if(TGT_BSP MATCHES "arm/q7s" if(TGT_BSP MATCHES "arm/q7s"
OR TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/raspberrypi"
OR TGT_BSP MATCHES "arm/beagleboneblack") OR TGT_BSP MATCHES "arm/beagleboneblack")
option(LINUX_CROSS_COMPILE ON) option(LINUX_CROSS_COMPILE ON)
endif() endif()
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack") if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" OFF) option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" OFF)
elseif(TGT_BSP MATCHES "arm/q7s") elseif(TGT_BSP MATCHES "arm/q7s")
option(EIVE_Q7S_EM "Build configuration for the EM" OFF) option(EIVE_Q7S_EM "Build configuration for the EM" OFF)
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" ON) option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" ON)
endif() endif()
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name"
ON) ON)
else() else()
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name"
OFF) OFF)
endif() endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Perform steps like loading toolchain files where applicable. # Perform steps like loading toolchain files where applicable.
include(PreProjectConfig) include(PreProjectConfig)
pre_project_config() pre_project_config()
@ -75,58 +72,57 @@ set(OBSW_MAX_SCHEDULED_TCS 500)
if(EIVE_Q7S_EM) if(EIVE_Q7S_EM)
set(OBSW_Q7S_EM set(OBSW_Q7S_EM
1 1
CACHE STRING "Q7S EM configuration") CACHE STRING "Q7S EM configuration")
set(INIT_VAL 0) set(INIT_VAL 0)
else() else()
set(OBSW_Q7S_EM set(OBSW_Q7S_EM
0 0
CACHE STRING "Q7S FM configuration") CACHE STRING "Q7S EM configuration")
set(INIT_VAL 1) set(INIT_VAL 1)
endif() endif()
set(OBSW_ADD_MGT set(OBSW_ADD_MGT
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add MGT module") CACHE STRING "Add MGT module")
set(OBSW_ADD_BPX_BATTERY_HANDLER set(OBSW_ADD_BPX_BATTERY_HANDLER
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add MGT module") CACHE STRING "Add MGT module")
set(OBSW_ADD_STAR_TRACKER set(OBSW_ADD_STAR_TRACKER
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add Startracker module") CACHE STRING "Add Startracker module")
set(OBSW_ADD_SUN_SENSORS set(OBSW_ADD_SUN_SENSORS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add sun sensor module") CACHE STRING "Add sun sensor module")
set(OBSW_ADD_SUS_BOARD_ASS set(OBSW_ADD_SUS_BOARD_ASS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add sun sensor board assembly") CACHE STRING "Add sun sensor board assembly")
set(OBSW_ADD_ACS_BOARD set(OBSW_ADD_ACS_BOARD
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add ACS board module") CACHE STRING "Add ACS board module")
set(OBSW_ADD_ACS_HANDLERS set(OBSW_ADD_ACS_HANDLERS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add ACS handlers") CACHE STRING "Add ACS handlers")
set(OBSW_ADD_RTD_DEVICES set(OBSW_ADD_RTD_DEVICES
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add RTD devices") CACHE STRING "Add RTD devices")
set(OBSW_ADD_RAD_SENSORS set(OBSW_ADD_RAD_SENSORS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add Rad Sensor module") CACHE STRING "Add Rad Sensor module")
set(OBSW_ADD_PL_PCDU set(OBSW_ADD_PL_PCDU
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add Payload PCDU modukle") CACHE STRING "Add Payload PCDU modukle")
set(OBSW_ADD_SYRLINKS set(OBSW_ADD_SYRLINKS
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add Syrlinks module") CACHE STRING "Add Syrlinks module")
set(OBSW_ADD_TMP_DEVICES set(OBSW_ADD_TMP_DEVICES
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add TMP devices") CACHE STRING "Add TMP devices")
set(OBSW_ADD_GOMSPACE_PCDU set(OBSW_ADD_GOMSPACE_PCDU
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add GomSpace PCDU modules") CACHE STRING "Add GomSpace PCDU modules")
set(OBSW_ADD_RW set(OBSW_ADD_RW
${INIT_VAL} ${INIT_VAL}
CACHE STRING "Add RW modules") CACHE STRING "Add RW modules")
# ############################################################################## # ##############################################################################
# Pre-Sources preparation # Pre-Sources preparation
@ -134,40 +130,33 @@ set(OBSW_ADD_RW
# Version handling # Version handling
set(GIT_VER_HANDLING_OK FALSE) set(GIT_VER_HANDLING_OK FALSE)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
determine_version_with_git("--exclude" "docker_*") determine_version_with_git("--exclude" "docker_*")
set(GIT_INFO set(GIT_INFO
${GIT_INFO}
CACHE STRING "Version information retrieved with git describe")
if(GIT_INFO)
set(GIT_INFO
${GIT_INFO} ${GIT_INFO}
CACHE STRING "Version information retrieved with git describe") CACHE STRING "Version information retrieved with git describe")
if(GIT_INFO)
set(GIT_INFO
${GIT_INFO}
CACHE STRING "Version information retrieved with git describe")
list(GET GIT_INFO 1 OBSW_VERSION_MAJOR) list(GET GIT_INFO 1 OBSW_VERSION_MAJOR)
list(GET GIT_INFO 2 OBSW_VERSION_MINOR) list(GET GIT_INFO 2 OBSW_VERSION_MINOR)
list(GET GIT_INFO 3 OBSW_VERSION_REVISION) list(GET GIT_INFO 3 OBSW_VERSION_REVISION)
list(GET GIT_INFO 4 OBSW_VERSION_CST_GIT_SHA1) list(GET GIT_INFO 4 OBSW_VERSION_CST_GIT_SHA1)
if(NOT OBSW_VERSION_MAJOR) if(NOT OBSW_VERSION_MAJOR)
set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS}) set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS})
endif() endif()
if(NOT OBSW_VERSION_MINOR) if(NOT OBSW_VERSION_MINOR)
set(FSFW_SUBVERSION ${OBSW_VERSION_MINOR_IF_GIT_FAILS}) set(FSFW_SUBVERSION ${OBSW_VERSION_MINOR_IF_GIT_FAILS})
endif() endif()
if(NOT OBSW_VERSION_REVISION) if(NOT OBSW_VERSION_REVISION)
set(FSFW_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS}) set(FSFW_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS})
endif() endif()
set(GIT_VER_HANDLING_OK TRUE) set(GIT_VER_HANDLING_OK TRUE)
else() else()
set(GIT_VER_HANDLING_OK FALSE) set(GIT_VER_HANDLING_OK FALSE)
endif() endif()
endif() endif()
if(NOT GIT_VER_HANDLING_OK) if(NOT GIT_VER_HANDLING_OK)
set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS}) set(OBSW_VERSION_MAJOR ${OBSW_VERSION_MAJOR_IF_GIT_FAILS})
set(OBSW_VERSION_MINOR ${OBSW_VERSION_MINOR_IF_GIT_FAILS}) set(OBSW_VERSION_MINOR ${OBSW_VERSION_MINOR_IF_GIT_FAILS})
@ -224,12 +213,11 @@ if(TGT_BSP)
# I assume a newer version than 3.17 will be installed on other Linux board # I assume a newer version than 3.17 will be installed on other Linux board
# than the Q7S # than the Q7S
set(LIBGPS_VERSION_MINOR 20) set(LIBGPS_VERSION_MINOR 20)
if(TGT_BSP MATCHES "arm/q7s" if(TGT_BSP MATCHES "arm/q7s"
OR TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/raspberrypi"
OR TGT_BSP MATCHES "arm/beagleboneblack" OR TGT_BSP MATCHES "arm/beagleboneblack"
OR TGT_BSP MATCHES "arm/egse" OR TGT_BSP MATCHES "arm/egse"
OR TGT_BSP MATCHES "arm/te0720-1cfa") OR TGT_BSP MATCHES "arm/te0720-1cfa")
find_library(${LIB_GPS} gps) find_library(${LIB_GPS} gps)
set(FSFW_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/linux/fsfwconfig) set(FSFW_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/linux/fsfwconfig)
@ -237,8 +225,6 @@ if(TGT_BSP)
set(EIVE_ADD_LINUX_FILES TRUE) set(EIVE_ADD_LINUX_FILES TRUE)
set(ADD_CSP_LIB TRUE) set(ADD_CSP_LIB TRUE)
set(FSFW_HAL_ADD_LINUX ON) set(FSFW_HAL_ADD_LINUX ON)
set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON)
set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON)
endif() endif()
endif() endif()
@ -280,7 +266,6 @@ endif()
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h) configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
configure_file(${BSP_PATH}/OBSWConfig.h.in OBSWConfig.h) configure_file(${BSP_PATH}/OBSWConfig.h.in OBSWConfig.h)
if(TGT_BSP MATCHES "arm/q7s") if(TGT_BSP MATCHES "arm/q7s")
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h) configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse") elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
@ -320,13 +305,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14) "-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
"-Wcast-qual" # Warn if the constness is cast away "-Wcast-qual" # Warn if the constness is cast away
"-Wstringop-overflow=4" "-Wstringop-overflow=4"
# -Wstack-protector # Emits a few false positives for low level access # -Wstack-protector # Emits a few false positives for low level access
# -Wconversion # Creates many false positives -Warith-conversion # Use with # -Wconversion # Creates many false positives -Warith-conversion # Use with
# Wconversion to find more implicit conversions -fanalyzer # Should be used # Wconversion to find more implicit conversions -fanalyzer # Should be used
# to look through problems # to look through problems
) )
# Remove unused sections. # Remove unused sections.
add_compile_options("-ffunction-sections" "-fdata-sections") add_compile_options("-ffunction-sections" "-fdata-sections")
@ -365,6 +348,7 @@ else()
endif() endif()
if(EIVE_ADD_ETL_LIB) if(EIVE_ADD_ETL_LIB)
endif() endif()
if(EIVE_ADD_JSON_LIB) if(EIVE_ADD_JSON_LIB)
@ -400,13 +384,12 @@ add_subdirectory(${UNITTEST_PATH})
# This should have already been downloaded by the FSFW Still include it to be # This should have already been downloaded by the FSFW Still include it to be
# safe # safe
find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET) find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET)
# Not installed, so use FetchContent to download and provide etl # Not installed, so use FetchContent to download and provide etl
if(NOT etl_FOUND) if(NOT etl_FOUND)
message( message(
STATUS STATUS
"No ETL installation was found with find_package. Installing and providing " "No ETL installation was found with find_package. Installing and providing "
"etl with FindPackage") "etl with FindPackage")
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
etl etl
@ -416,17 +399,16 @@ if(NOT etl_FOUND)
endif() endif()
# Use same Catch2 version as framework # Use same Catch2 version as framework
if(NOT(TGT_BSP MATCHES "arm/te0720-1cfa") if(NOT (TGT_BSP MATCHES "arm/te0720-1cfa")
AND NOT(TGT_BSP MATCHES "arm/q7s") AND NOT (TGT_BSP MATCHES "arm/q7s")
AND NOT(TGT_BSP MATCHES "arm/raspberrypi")) AND NOT (TGT_BSP MATCHES "arm/raspberrypi"))
# Check whether the user has already installed Catch2 first # Check whether the user has already installed Catch2 first
find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION} CONFIG QUIET) find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION} CONFIG QUIET)
# Not installed, so use FetchContent to download and provide Catch2 # Not installed, so use FetchContent to download and provide Catch2
if(NOT Catch2_FOUND) if(NOT Catch2_FOUND)
message( message(
STATUS STATUS
"${MSG_PREFIX} Catch2 installation not found. Downloading Catch2 library with FetchContent" "${MSG_PREFIX} Catch2 installation not found. Downloading Catch2 library with FetchContent"
) )
include(FetchContent) include(FetchContent)
@ -444,11 +426,9 @@ endif()
# after their declaration # after their declaration
if(FSFW_FETCH_CONTENT_TARGETS) if(FSFW_FETCH_CONTENT_TARGETS)
FetchContent_MakeAvailable(${FSFW_FETCH_CONTENT_TARGETS}) FetchContent_MakeAvailable(${FSFW_FETCH_CONTENT_TARGETS})
if(TARGET etl) if(TARGET etl)
add_library(${LIB_ETL_TARGET} ALIAS etl) add_library(${LIB_ETL_TARGET} ALIAS etl)
endif() endif()
if(TARGET Catch2) if(TARGET Catch2)
# Fixes regression -preview4, to be confirmed in later releases Related # Fixes regression -preview4, to be confirmed in later releases Related
# GitHub issue: https://github.com/catchorg/Catch2/issues/2417 # GitHub issue: https://github.com/catchorg/Catch2/issues/2417
@ -464,7 +444,7 @@ endif()
# Add libraries # Add libraries
target_link_libraries(${LIB_EIVE_MISSION} target_link_libraries(${LIB_EIVE_MISSION}
PUBLIC ${LIB_FSFW_NAME} ${LIB_LWGPS_NAME} ${LIB_OS_NAME}) PUBLIC ${LIB_FSFW_NAME} ${LIB_LWGPS_NAME} ${LIB_OS_NAME})
target_link_libraries(${LIB_DUMMIES} PUBLIC ${LIB_FSFW_NAME} ${LIB_JSON_NAME}) target_link_libraries(${LIB_DUMMIES} PUBLIC ${LIB_FSFW_NAME} ${LIB_JSON_NAME})
@ -475,7 +455,7 @@ if(TGT_BSP MATCHES "arm/q7s")
endif() endif()
target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION} target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION}
rapidcsv ${LIB_DUMMIES}) rapidcsv ${LIB_DUMMIES})
if(TGT_BSP MATCHES "arm/egse") if(TGT_BSP MATCHES "arm/egse")
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC}) target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})
@ -496,15 +476,13 @@ endif()
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_CXX_FS}) target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_CXX_FS})
# Add include paths for all sources. # Add include paths for all sources.
message(${FSFW_CONFIG_PATH})
target_include_directories( target_include_directories(
${LIB_EIVE_MISSION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH} ${LIB_EIVE_MISSION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH}
${CMAKE_CURRENT_BINARY_DIR} ${LIB_ARCSEC_PATH}) ${CMAKE_CURRENT_BINARY_DIR} ${LIB_ARCSEC_PATH})
target_include_directories( target_include_directories(
${LIB_DUMMIES} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH} ${LIB_DUMMIES} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH}
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse") if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse")
target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${ARCSEC_LIB_PATH}) target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${ARCSEC_LIB_PATH})
@ -521,7 +499,6 @@ endif()
if(NOT CMAKE_SIZE) if(NOT CMAKE_SIZE)
set(CMAKE_SIZE size) set(CMAKE_SIZE size)
if(WIN32) if(WIN32)
set(FILE_SUFFIX ".exe") set(FILE_SUFFIX ".exe")
endif() endif()
@ -540,8 +517,8 @@ endif()
install(TARGETS ${OBSW_NAME} RUNTIME DESTINATION bin) install(TARGETS ${OBSW_NAME} RUNTIME DESTINATION bin)
string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n" string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n"
"Target OSAL: ${FSFW_OSAL}\n" "Target OSAL: ${FSFW_OSAL}\n"
"Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}") "Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}")
add_custom_command( add_custom_command(
TARGET ${OBSW_NAME} TARGET ${OBSW_NAME}