eive-obsw/CMakeLists.txt

582 lines
17 KiB
CMake
Raw Normal View History

2022-05-17 13:40:19 +02:00
# ##############################################################################
2020-12-29 01:09:59 +01:00
# CMake support for the EIVE OBSW
2022-05-17 13:40:19 +02:00
#
2020-12-29 01:09:59 +01:00
# Author: R. Mueller
2022-05-17 13:40:19 +02:00
# ##############################################################################
2020-12-29 01:09:59 +01:00
2022-05-17 13:40:19 +02:00
# ##############################################################################
2020-12-29 01:09:59 +01:00
# Pre-Project preparation
2022-05-17 13:40:19 +02:00
# ##############################################################################
2020-12-29 01:09:59 +01:00
cmake_minimum_required(VERSION 3.13)
2023-10-11 18:16:36 +02:00
set(OBSW_VERSION_MAJOR 7)
2024-02-29 13:10:06 +01:00
set(OBSW_VERSION_MINOR 7)
2024-03-21 10:16:47 +01:00
set(OBSW_VERSION_REVISION 4)
2022-04-26 20:20:56 +02:00
2020-12-29 01:09:59 +01:00
# set(CMAKE_VERBOSE TRUE)
2022-02-10 18:15:33 +01:00
2022-05-17 13:40:19 +02:00
option(
EIVE_HARDCODED_TOOLCHAIN_FILE
"\
2022-04-20 00:57:37 +02:00
For Linux Board Target BSPs, a default toolchain file will be set. Should be set to OFF \
2022-05-17 13:40:19 +02:00
if a different toolchain file is set externally"
ON)
2022-04-26 10:37:25 +02:00
2021-07-15 01:25:32 +02:00
if(NOT FSFW_OSAL)
2022-05-17 13:40:19 +02:00
set(FSFW_OSAL
linux
CACHE STRING "OS for the FSFW.")
2020-12-29 01:09:59 +01:00
endif()
2022-02-20 10:34:41 +01:00
if(TGT_BSP)
2022-05-17 13:40:19 +02:00
if(TGT_BSP MATCHES "arm/q7s"
OR TGT_BSP MATCHES "arm/raspberrypi"
OR TGT_BSP MATCHES "arm/beagleboneblack")
option(LINUX_CROSS_COMPILE ON)
endif()
if(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/beagleboneblack")
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" OFF)
elseif(TGT_BSP MATCHES "arm/q7s")
option(EIVE_Q7S_EM "Build configuration for the EM" OFF)
option(EIVE_BUILD_GPSD_GPS_HANDLER "Build GPSD dependent GPS Handler" ON)
endif()
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name"
ON)
2022-04-26 10:37:25 +02:00
else()
2022-05-17 13:40:19 +02:00
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name"
OFF)
2021-05-05 20:25:52 +02:00
endif()
2022-04-26 20:20:56 +02:00
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Perform steps like loading toolchain files where applicable.
include(PreProjectConfig)
pre_project_config()
# Project Name
project(eive-obsw)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
2022-04-22 15:42:13 +02:00
include(EiveHelpers)
2022-04-26 20:10:09 +02:00
option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
2023-12-12 11:16:13 +01:00
set(OBSW_MAX_SCHEDULED_TCS 4000)
2022-05-24 15:21:37 +02:00
2022-04-29 15:47:54 +02:00
if(EIVE_Q7S_EM)
2022-05-17 13:40:19 +02:00
set(OBSW_Q7S_EM
1
CACHE STRING "Q7S EM configuration")
set(INIT_VAL 0)
2023-03-06 16:52:58 +01:00
set(OBSW_STAR_TRACKER_GROUND_CONFIG 1)
2022-04-29 15:47:54 +02:00
else()
2022-05-17 13:40:19 +02:00
set(OBSW_Q7S_EM
0
CACHE STRING "Q7S EM configuration")
set(INIT_VAL 1)
2023-03-06 16:52:58 +01:00
set(OBSW_STAR_TRACKER_GROUND_CONFIG 0)
2022-04-29 15:47:54 +02:00
endif()
2023-06-09 13:51:10 +02:00
set(OBSW_ADD_TMTC_TCP_SERVER
${OBSW_Q7S_EM}
CACHE STRING "Add TCP TMTC Server")
set(OBSW_ADD_TMTC_UDP_SERVER
0
CACHE STRING "Add UDP TMTC Server")
2022-05-17 13:40:19 +02:00
set(OBSW_ADD_MGT
${INIT_VAL}
CACHE STRING "Add MGT module")
set(OBSW_ADD_BPX_BATTERY_HANDLER
2023-05-22 11:40:33 +02:00
1
CACHE STRING "Add BPX battery module")
2022-05-17 13:40:19 +02:00
set(OBSW_ADD_STAR_TRACKER
2023-07-13 10:16:52 +02:00
1
2022-05-17 13:40:19 +02:00
CACHE STRING "Add Startracker module")
set(OBSW_ADD_SUN_SENSORS
${INIT_VAL}
CACHE STRING "Add sun sensor module")
set(OBSW_ADD_SUS_BOARD_ASS
${INIT_VAL}
CACHE STRING "Add sun sensor board assembly")
2023-04-06 12:13:24 +02:00
set(OBSW_ADD_THERMAL_TEMP_INSERTER
2023-04-06 13:16:50 +02:00
${OBSW_Q7S_EM}
2023-04-06 12:13:24 +02:00
CACHE STRING "Add thermal sensor temperature inserter")
2022-05-17 13:40:19 +02:00
set(OBSW_ADD_ACS_BOARD
2023-07-02 14:02:37 +02:00
1
2022-05-17 13:40:19 +02:00
CACHE STRING "Add ACS board module")
2022-09-15 13:03:22 +02:00
set(OBSW_ADD_GPS_CTRL
2022-05-17 13:40:19 +02:00
${INIT_VAL}
2022-09-15 13:03:22 +02:00
CACHE STRING "Add GPS controllers")
set(OBSW_ADD_CCSDS_IP_CORES
1
CACHE STRING "Add CCSDS IP cores")
set(OBSW_TM_TO_PTME
1
CACHE STRING "Send telemetry to PTME IP core")
set(OBSW_TC_FROM_PDEC
1
CACHE STRING "Poll telecommand from PDEC IP core")
2022-09-16 14:01:54 +02:00
set(OBSW_ADD_TCS_CTRL
2023-03-13 18:37:07 +01:00
1
2022-09-16 14:01:54 +02:00
CACHE STRING "Add TCS controllers")
2022-10-26 15:47:23 +02:00
set(OBSW_ADD_HEATERS
2023-04-03 14:22:58 +02:00
1
2022-10-26 15:47:23 +02:00
CACHE STRING "Add TCS heaters")
set(OBSW_ADD_PLOC_SUPERVISOR
2023-11-06 14:37:13 +01:00
1
2022-10-26 15:47:23 +02:00
CACHE STRING "Add PLOC supervisor handler")
set(OBSW_ADD_SA_DEPL
${INIT_VAL}
CACHE STRING "Add SA deployment handler")
set(OBSW_ADD_PLOC_MPSOC
2023-11-06 14:37:13 +01:00
1
2022-10-26 15:47:23 +02:00
CACHE STRING "Add MPSoC handler")
2022-09-15 13:03:22 +02:00
set(OBSW_ADD_ACS_CTRL
2022-05-17 13:40:19 +02:00
${INIT_VAL}
2022-09-15 13:03:22 +02:00
CACHE STRING "Add ACS controller")
set(OBSW_ADD_RTD_DEVICES
2022-10-20 18:03:37 +02:00
${INIT_VAL}
2022-05-17 13:40:19 +02:00
CACHE STRING "Add RTD devices")
set(OBSW_ADD_RAD_SENSORS
${INIT_VAL}
CACHE STRING "Add Rad Sensor module")
set(OBSW_ADD_PL_PCDU
2023-08-02 13:40:37 +02:00
1
2022-05-17 13:40:19 +02:00
CACHE STRING "Add Payload PCDU modukle")
set(OBSW_ADD_SYRLINKS
2023-01-18 12:58:45 +01:00
1
2022-05-17 13:40:19 +02:00
CACHE STRING "Add Syrlinks module")
set(OBSW_ADD_TMP_DEVICES
2023-06-18 14:19:19 +02:00
1
2022-05-17 13:40:19 +02:00
CACHE STRING "Add TMP devices")
set(OBSW_ADD_GOMSPACE_PCDU
1
2022-05-17 13:40:19 +02:00
CACHE STRING "Add GomSpace PCDU modules")
set(OBSW_ADD_GOMSPACE_ACU
${INIT_VAL}
CACHE STRING "Add GomSpace ACU submodule")
2022-05-17 13:40:19 +02:00
set(OBSW_ADD_RW
${INIT_VAL}
CACHE STRING "Add RW modules")
set(OBSW_ADD_SCEX_DEVICE
2023-07-14 14:04:23 +02:00
1
CACHE STRING "Add Solar Cell Experiment module")
2022-10-27 14:04:55 +02:00
set(OBSW_SYRLINKS_SIMULATED
2023-01-24 19:07:37 +01:00
0
2022-10-27 14:04:55 +02:00
CACHE STRING "Syrlinks is simulated")
2022-05-17 13:40:19 +02:00
# ##############################################################################
2022-04-26 20:10:09 +02:00
# Pre-Sources preparation
2022-05-17 13:40:19 +02:00
# ##############################################################################
2022-04-26 20:10:09 +02:00
2022-04-22 14:09:08 +02:00
# Version handling
2022-04-22 15:47:47 +02:00
set(GIT_VER_HANDLING_OK FALSE)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
2022-05-17 13:40:19 +02:00
determine_version_with_git("--exclude" "docker_*")
set(GIT_INFO
${GIT_INFO}
CACHE STRING "Version information retrieved with git describe")
if(GIT_INFO)
set(GIT_INFO
${GIT_INFO}
CACHE STRING "Version information retrieved with git describe")
2023-02-08 11:08:38 +01:00
# CMakeLists.txt is now single source of information. list(GET GIT_INFO 1
# OBSW_VERSION_MAJOR) list(GET GIT_INFO 2 OBSW_VERSION_MINOR) list(GET
# GIT_INFO 3 OBSW_VERSION_REVISION)
2023-02-07 19:37:23 +01:00
list(LENGTH GIT_INFO LIST_LEN)
if(LIST_LEN GREATER 4)
2023-02-08 11:08:38 +01:00
list(GET GIT_INFO 4 OBSW_VERSION_CST_GIT_SHA1)
2023-02-07 19:37:23 +01:00
endif()
2022-05-17 13:40:19 +02:00
set(GIT_VER_HANDLING_OK TRUE)
else()
set(GIT_VER_HANDLING_OK FALSE)
endif()
2022-04-22 14:09:08 +02:00
endif()
2020-12-29 01:09:59 +01:00
# Set names and variables
set(OBSW_NAME ${CMAKE_PROJECT_NAME})
set(WATCHDOG_NAME eive-watchdog)
set(SIMPLE_OBSW_NAME eive-simple)
2022-02-10 18:15:33 +01:00
set(UNITTEST_NAME eive-unittest)
2020-12-29 01:09:59 +01:00
set(LIB_FSFW_NAME fsfw)
set(LIB_EIVE_MISSION eive-mission)
set(LIB_ETL_TARGET etl::etl)
2020-12-29 14:14:11 +01:00
set(LIB_CSP_NAME libcsp)
set(LIB_LWGPS_NAME lwgps)
set(LIB_ARCSEC wire)
2022-08-26 00:39:06 +02:00
set(LIB_GOMSPACE_CLIENTS gs_clients)
set(LIB_GOMSPACE_CSP gs_csp)
set(THIRD_PARTY_FOLDER thirdparty)
2021-07-08 12:13:38 +02:00
set(LIB_CXX_FS -lstdc++fs)
2021-09-29 09:30:58 +02:00
set(LIB_CATCH2 Catch2)
2022-01-15 13:05:11 +01:00
set(LIB_GPS gps)
set(LIB_JSON_NAME nlohmann_json::nlohmann_json)
set(LIB_DUMMIES dummies)
2020-12-29 01:09:59 +01:00
# Set path names
set(FSFW_PATH fsfw)
2022-03-28 09:08:11 +02:00
set(TEST_PATH test)
2021-09-29 09:30:58 +02:00
set(UNITTEST_PATH unittest)
2021-02-14 12:35:08 +01:00
set(LINUX_PATH linux)
2022-08-25 20:55:56 +02:00
set(LIB_GOMSPACE_PATH ${THIRD_PARTY_FOLDER}/gomspace-sw)
set(COMMON_PATH common)
set(DUMMY_PATH dummies)
2021-07-29 11:35:20 +02:00
set(WATCHDOG_PATH watchdog)
2021-06-08 17:04:28 +02:00
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
2021-09-29 10:52:36 +02:00
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
set(LIB_EIVE_MISSION_PATH mission)
2021-09-29 09:30:58 +02:00
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
set(LIB_CATCH2_PATH ${THIRD_PARTY_FOLDER}/Catch2)
set(LIB_LWGPS_PATH ${THIRD_PARTY_FOLDER}/lwgps)
2023-04-13 17:55:56 +02:00
set(LIB_ARCSEC_PATH ${THIRD_PARTY_FOLDER}/sagittactl)
set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
2020-12-29 01:09:59 +01:00
2021-01-19 16:35:44 +01:00
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
set(EIVE_ADD_LINUX_FILES OFF)
2022-10-24 10:57:30 +02:00
set(FSFW_ADD_TMSTORAGE ON)
2021-09-29 09:30:58 +02:00
set(FSFW_ADD_COORDINATES ON)
set(FSFW_ADD_SGP4_PROPAGATOR ON)
2020-12-29 01:09:59 +01:00
# Analyse different OS and architecture/target options, determine BSP_PATH,
# display information about compiler etc.
pre_source_hw_os_config()
2020-12-29 13:59:31 +01:00
if(TGT_BSP)
2022-05-17 13:40:19 +02:00
set(LIBGPS_VERSION_MAJOR 3)
# I assume a newer version than 3.17 will be installed on other Linux board
# than the Q7S
set(LIBGPS_VERSION_MINOR 20)
if(TGT_BSP MATCHES "arm/q7s"
OR TGT_BSP MATCHES "arm/raspberrypi"
OR TGT_BSP MATCHES "arm/beagleboneblack"
OR TGT_BSP MATCHES "arm/egse"
OR TGT_BSP MATCHES "arm/te0720-1cfa")
find_library(${LIB_GPS} gps)
set(FSFW_CONFIG_PATH "linux/fsfwconfig")
if(NOT BUILD_Q7S_SIMPLE_MODE)
set(EIVE_ADD_LINUX_FILES TRUE)
2022-11-10 17:42:19 +01:00
set(EIVE_ADD_LINUX_FSFWCONFIG TRUE)
2022-08-26 00:39:06 +02:00
set(ADD_GOMSPACE_CSP TRUE)
set(ADD_GOMSPACE_CLIENTS TRUE)
2022-05-17 13:40:19 +02:00
set(FSFW_HAL_ADD_LINUX ON)
2022-08-12 12:55:43 +02:00
set(FSFW_HAL_LINUX_ADD_LIBGPIOD ON)
set(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS ON)
endif()
2022-11-10 17:42:19 +01:00
elseif(UNIX)
set(EIVE_ADD_LINUX_FILES ON)
2022-05-17 13:40:19 +02:00
endif()
if(TGT_BSP MATCHES "arm/raspberrypi")
# Used by configure file
set(RASPBERRY_PI ON)
set(FSFW_HAL_ADD_RASPBERRY_PI ON)
endif()
if(TGT_BSP MATCHES "arm/egse")
# Used by configure file
set(EGSE ON)
set(FSFW_HAL_LINUX_ADD_LIBGPIOD OFF)
set(OBSW_ADD_STAR_TRACKER 1)
set(OBSW_DEBUG_STARTRACKER 1)
endif()
if(TGT_BSP MATCHES "arm/beagleboneblack")
# Used by configure file
set(BEAGLEBONEBLACK ON)
endif()
if(TGT_BSP MATCHES "arm/q7s")
# Used by configure file
set(XIPHOS_Q7S ON)
set(LIBGPS_VERSION_MAJOR 3)
set(LIBGPS_VERSION_MINOR 17)
endif()
2022-02-05 13:19:20 +01:00
2022-05-17 13:40:19 +02:00
if(TGT_BSP MATCHES "arm/te0720-1cfa")
set(TE0720_1CFA ON)
endif()
2020-12-29 01:26:22 +01:00
else()
2022-05-17 13:40:19 +02:00
# Required by FSFW library
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
2022-11-15 17:21:12 +01:00
if(UNIX)
set(EIVE_ADD_LINUX_FILES ON)
endif()
2020-12-29 01:26:22 +01:00
endif()
2021-05-17 16:22:51 +02:00
2023-02-07 17:50:44 +01:00
include(BuildType)
set_build_type()
2023-02-13 01:26:30 +01:00
set(FSFW_DEBUG_INFO 0)
2023-03-26 15:28:00 +02:00
set(OBSW_ENABLE_PERIODIC_HK 1)
2023-03-06 00:55:12 +01:00
set(Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 0)
2023-02-13 01:26:30 +01:00
if(RELEASE_BUILD MATCHES 0)
set(FSFW_DEBUG_INFO 1)
2023-03-26 15:28:00 +02:00
set(OBSW_ENABLE_PERIODIC_HK 0)
2023-03-06 00:55:12 +01:00
set(Q7S_CHECK_FOR_ALREADY_RUNNING_IMG 1)
2023-02-13 01:26:30 +01:00
endif()
2021-06-08 17:04:28 +02:00
# Configuration files
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h)
2022-04-29 15:47:54 +02:00
configure_file(${BSP_PATH}/OBSWConfig.h.in OBSWConfig.h)
if(TGT_BSP MATCHES "arm/q7s")
2022-05-17 13:40:19 +02:00
configure_file(${BSP_PATH}/boardconfig/q7sConfig.h.in q7sConfig.h)
elseif(TGT_BSP MATCHES "arm/raspberrypi" OR TGT_BSP MATCHES "arm/egse")
2022-05-17 13:40:19 +02:00
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
2021-06-08 17:04:28 +02:00
endif()
2021-09-29 10:52:36 +02:00
2021-07-29 13:07:07 +02:00
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
2021-06-08 17:04:28 +02:00
2021-05-17 16:53:06 +02:00
# Set common config path for FSFW
2022-05-17 13:40:19 +02:00
set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_PATH}/config"
${CMAKE_CURRENT_BINARY_DIR})
2020-12-29 01:09:59 +01:00
2022-05-17 13:40:19 +02:00
# ##############################################################################
2020-12-29 01:09:59 +01:00
# Executable and Sources
2022-05-17 13:40:19 +02:00
# ##############################################################################
2020-12-29 01:09:59 +01:00
2022-05-17 13:40:19 +02:00
# global compiler options need to be set before adding executables
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2022-05-17 13:40:19 +02:00
# Remove unused sections.
add_compile_options("-ffunction-sections" "-fdata-sections")
# Removed unused sections.
add_link_options("-Wl,--gc-sections")
2022-03-08 09:37:23 +01:00
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
2022-05-17 13:40:19 +02:00
set(COMPILER_FLAGS "/permissive-")
endif()
add_library(${LIB_EIVE_MISSION})
add_library(${LIB_DUMMIES})
2022-02-10 18:15:33 +01:00
# Add main executable
add_executable(${OBSW_NAME})
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
2022-08-25 20:55:56 +02:00
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS
2022-08-26 00:39:06 +02:00
"-Wall"
"-Wextra"
"-Wimplicit-fallthrough=1"
"-Wno-unused-parameter"
"-Wno-psabi"
2023-02-17 12:19:53 +01:00
"-Wshadow=local"
2022-08-26 00:39:06 +02:00
"-Wduplicated-cond" # check for duplicate conditions
"-Wduplicated-branches" # check for duplicate branches
"-Wlogical-op" # Search for bitwise operations instead of logical
"-Wnull-dereference" # Search for NULL dereference
"-Wundef" # Warn if undefind marcos are used
"-Wformat=2" # Format string problem detection
"-Wformat-overflow=2" # Formatting issues in printf
"-Wformat-truncation=2" # Formatting issues in printf
"-Wformat-security" # Search for dangerous printf operations
"-Wstrict-overflow=3" # Warn if integer overflows might happen
"-Warray-bounds=2" # Some array bounds violations will be found
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
"-Wcast-qual" # Warn if the constness is cast away
"-Wstringop-overflow=4"
# -Wstack-protector # Emits a few false positives for low level access
# -Wconversion # Creates many false positives -Warith-conversion # Use
# with Wconversion to find more implicit conversions -fanalyzer # Should
# be used to look through problems
)
2022-08-25 20:55:56 +02:00
target_compile_options(${OBSW_NAME} PRIVATE ${WARNING_FLAGS})
target_compile_options(${LIB_EIVE_MISSION} PRIVATE ${WARNING_FLAGS})
2022-08-25 20:59:35 +02:00
target_compile_options(${LIB_DUMMIES} PRIVATE ${WARNING_FLAGS})
endif()
2022-02-20 10:34:41 +01:00
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
2022-04-20 01:25:56 +02:00
# Watchdog
if(TGT_BSP MATCHES "arm/q7s")
2022-05-17 13:40:19 +02:00
add_executable(${WATCHDOG_NAME})
2022-04-20 01:25:56 +02:00
else()
2022-05-17 13:40:19 +02:00
add_executable(${WATCHDOG_NAME} EXCLUDE_FROM_ALL)
2022-04-20 01:25:56 +02:00
endif()
2022-05-17 13:40:19 +02:00
add_subdirectory(${WATCHDOG_PATH})
target_link_libraries(${WATCHDOG_NAME} PUBLIC ${LIB_CXX_FS})
target_include_directories(${WATCHDOG_NAME} PUBLIC ${CMAKE_BINARY_DIR})
2020-12-29 01:09:59 +01:00
2022-04-26 20:10:09 +02:00
# unittests
if(NOT TGT_BSP)
2022-05-17 13:40:19 +02:00
add_executable(${UNITTEST_NAME})
else()
2022-05-17 13:40:19 +02:00
add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL)
endif()
2022-02-10 18:15:33 +01:00
2021-09-29 09:12:57 +02:00
if(EIVE_ADD_ETL_LIB)
2022-05-17 13:40:19 +02:00
2020-12-29 01:28:21 +01:00
endif()
2021-09-29 09:14:17 +02:00
if(EIVE_ADD_JSON_LIB)
2022-05-17 13:40:19 +02:00
add_subdirectory(${LIB_JSON_PATH})
endif()
2022-05-17 13:40:19 +02:00
2022-11-04 09:35:17 +01:00
add_subdirectory(thirdparty)
2022-05-10 17:49:10 +02:00
2022-02-10 18:15:33 +01:00
if(EIVE_ADD_LINUX_FILES)
2023-01-09 15:55:01 +01:00
if(TGT_BSP MATCHES "arm/q7s")
add_subdirectory(${LIB_GOMSPACE_PATH})
endif()
2022-05-17 13:40:19 +02:00
add_subdirectory(${LINUX_PATH})
2021-07-29 11:35:20 +02:00
endif()
2022-02-10 18:15:33 +01:00
add_subdirectory(${BSP_PATH})
2022-09-27 21:45:22 +02:00
add_subdirectory(${COMMON_PATH})
add_subdirectory(${DUMMY_PATH})
add_subdirectory(${FSFW_PATH})
add_subdirectory(${LIB_EIVE_MISSION_PATH})
add_subdirectory(${TEST_PATH})
2022-02-10 18:15:33 +01:00
add_subdirectory(${UNITTEST_PATH})
2022-05-17 13:40:19 +02:00
# This should have already been downloaded by the FSFW Still include it to be
2022-08-30 16:51:30 +02:00
# safe find_package(etl ${FSFW_ETL_LIB_MAJOR_VERSION} CONFIG QUIET) Not
# installed, so use FetchContent to download and provide etl if(NOT etl_FOUND)
2022-07-08 16:39:07 +02:00
message(
STATUS
"No ETL installation was found with find_package. Installing and providing "
"etl with FindPackage")
include(FetchContent)
FetchContent_Declare(
etl
GIT_REPOSITORY https://github.com/ETLCPP/etl
GIT_TAG ${FSFW_ETL_LIB_VERSION})
list(APPEND FSFW_FETCH_CONTENT_TARGETS etl)
# endif()
2022-05-17 13:40:19 +02:00
# Use same Catch2 version as framework
if(NOT (TGT_BSP MATCHES "arm/te0720-1cfa")
AND NOT (TGT_BSP MATCHES "arm/q7s")
AND NOT (TGT_BSP MATCHES "arm/raspberrypi"))
# Check whether the user has already installed Catch2 first
find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION} CONFIG QUIET)
# Not installed, so use FetchContent to download and provide Catch2
if(NOT Catch2_FOUND)
message(
STATUS
"${MSG_PREFIX} Catch2 installation not found. Downloading Catch2 library with FetchContent"
)
include(FetchContent)
2022-05-17 13:40:19 +02:00
FetchContent_Declare(
2022-05-17 13:40:19 +02:00
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG ${FSFW_CATCH2_LIB_VERSION})
2021-06-30 15:32:15 +02:00
2022-05-17 13:40:19 +02:00
list(APPEND FSFW_FETCH_CONTENT_TARGETS Catch2)
endif()
endif()
# The documentation for FetchContent recommends declaring all the dependencies
# before making them available. We make all declared dependency available here
# after their declaration
if(FSFW_FETCH_CONTENT_TARGETS)
2022-05-17 13:40:19 +02:00
FetchContent_MakeAvailable(${FSFW_FETCH_CONTENT_TARGETS})
if(TARGET etl)
add_library(${LIB_ETL_TARGET} ALIAS etl)
endif()
if(TARGET Catch2)
# Fixes regression -preview4, to be confirmed in later releases Related
# GitHub issue: https://github.com/catchorg/Catch2/issues/2417
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
set_target_properties(Catch2 PROPERTIES EXCLUDE_FROM_ALL "true")
set_target_properties(Catch2WithMain PROPERTIES EXCLUDE_FROM_ALL "true")
endif()
2022-04-27 09:02:12 +02:00
endif()
2022-05-17 13:40:19 +02:00
# ##############################################################################
2020-12-29 01:09:59 +01:00
# Post-Sources preparation
2022-05-17 13:40:19 +02:00
# ##############################################################################
2020-12-29 01:09:59 +01:00
# Add libraries
2023-02-14 14:29:47 +01:00
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_FSFW_NAME}
${LIB_OS_NAME})
2023-03-31 12:11:31 +02:00
target_link_libraries(${LIB_DUMMIES} PUBLIC ${LIB_EIVE_MISSION}
${LIB_FSFW_NAME} ${LIB_JSON_NAME})
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_EIVE_MISSION} ${LIB_DUMMIES})
if(TGT_BSP MATCHES "arm/q7s")
2023-01-09 15:19:15 +01:00
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_GPS} ${LIB_ARCSEC}
${LIB_GOMSPACE_CLIENTS})
2021-06-30 15:32:15 +02:00
endif()
2020-12-29 01:09:59 +01:00
2022-09-29 13:53:42 +02:00
target_link_libraries(${UNITTEST_NAME} PRIVATE Catch2 ${LIB_EIVE_MISSION}
rapidcsv ${LIB_DUMMIES})
2021-09-29 09:30:58 +02:00
if(TGT_BSP MATCHES "arm/egse")
2022-05-17 13:40:19 +02:00
target_link_libraries(${OBSW_NAME} PRIVATE ${LIB_ARCSEC})
endif()
2021-09-29 09:12:57 +02:00
if(EIVE_ADD_ETL_LIB)
2022-05-17 13:40:19 +02:00
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_ETL_TARGET})
endif()
2021-09-29 09:14:17 +02:00
if(EIVE_ADD_JSON_LIB)
2022-05-17 13:40:19 +02:00
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_JSON_NAME})
endif()
2022-05-17 13:40:19 +02:00
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC ${LIB_CXX_FS})
2021-07-29 11:35:20 +02:00
2020-12-29 01:09:59 +01:00
# Add include paths for all sources.
2022-05-17 13:40:19 +02:00
target_include_directories(
${LIB_EIVE_MISSION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH}
${CMAKE_CURRENT_BINARY_DIR} ${LIB_ARCSEC_PATH})
2020-12-29 01:09:59 +01:00
target_include_directories(
${LIB_DUMMIES} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH}
2022-06-17 08:31:36 +02:00
${CMAKE_CURRENT_BINARY_DIR})
2020-12-29 01:09:59 +01:00
2022-02-05 13:19:20 +01:00
if(TGT_BSP MATCHES "arm/q7s" OR TGT_BSP MATCHES "arm/egse")
2022-05-17 13:40:19 +02:00
target_include_directories(${LIB_EIVE_MISSION} PUBLIC ${ARCSEC_LIB_PATH})
2021-08-11 18:13:43 +02:00
endif()
2020-12-29 01:09:59 +01:00
if(CMAKE_VERBOSE)
2022-05-17 13:40:19 +02:00
message(STATUS "Warning flags: ${WARNING_FLAGS}")
2020-12-29 01:09:59 +01:00
endif()
2022-04-20 01:25:56 +02:00
if(CMAKE_CROSSCOMPILING)
2022-05-17 13:40:19 +02:00
include(HardwareOsPostConfig)
post_source_hw_os_config()
2020-12-29 01:09:59 +01:00
endif()
if(NOT CMAKE_SIZE)
2022-05-17 13:40:19 +02:00
set(CMAKE_SIZE size)
if(WIN32)
set(FILE_SUFFIX ".exe")
endif()
2020-12-29 01:09:59 +01:00
endif()
if(EIVE_BUILD_WATCHDOG)
2022-05-17 13:40:19 +02:00
set(TARGET_STRING "OBSW Watchdog")
2020-12-29 01:09:59 +01:00
else()
2022-05-17 13:40:19 +02:00
if(TGT_BSP)
set(TARGET_STRING "Target BSP: ${TGT_BSP}")
else()
set(TARGET_STRING "Target BSP: Hosted")
endif()
2020-12-29 01:09:59 +01:00
endif()
2022-04-16 01:40:03 +02:00
install(TARGETS ${OBSW_NAME} RUNTIME DESTINATION bin)
2022-05-17 13:40:19 +02:00
string(CONCAT POST_BUILD_COMMENT "Build directory: ${CMAKE_BINARY_DIR}\n"
"Target OSAL: ${FSFW_OSAL}\n"
"Target Build Type: ${CMAKE_BUILD_TYPE}\n" "${TARGET_STRING}")
2021-02-03 13:38:04 +01:00
2020-12-29 01:09:59 +01:00
add_custom_command(
2022-05-17 13:40:19 +02:00
TARGET ${OBSW_NAME}
POST_BUILD
COMMAND ${CMAKE_SIZE} ${OBSW_BIN_NAME}${FILE_SUFFIX}
COMMENT ${POST_BUILD_COMMENT})