Merge branch 'mueller/host-fixes-fsfw-update' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into mueller/host-fixes-fsfw-update
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-04-28 11:32:15 +02:00
commit 9bb6c41134
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -9,27 +9,19 @@
################################################################################
cmake_minimum_required(VERSION 3.13)
# set(CMAKE_VERBOSE TRUE)
set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 0)
set(OBSW_VERSION_MINOR_IF_GIT_FAILS 0)
set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# set(CMAKE_VERBOSE TRUE)
option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
option(EIVE_HARDCODED_TOOLCHAIN_FILE "\
For Linux Board Target BSPs, a default toolchain file will be set. Should be set to OFF \
if a different toolchain file is set externally" ON
)
option(EIVE_SYSROOT_MAGIC "Perform sysroot magic which might not be necessary" OFF)
set(OBSW_ADD_STAR_TRACKER 0)
set(OBSW_DEBUG_STARTRACKER 0)
if(NOT FSFW_OSAL)
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
endif()
if(TGT_BSP)
@ -44,11 +36,30 @@ else()
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" OFF)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Perform steps like loading toolchain files where applicable.
include(PreProjectConfig)
include(EiveHelpers)
pre_project_config()
# Project Name
project(eive-obsw)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include(EiveHelpers)
option(EIVE_ADD_ETL_LIB "Add ETL library" ON)
option(EIVE_ADD_JSON_LIB "Add JSON library" ON)
set(OBSW_ADD_STAR_TRACKER 0)
set(OBSW_DEBUG_STARTRACKER 0)
################################################################################
# Pre-Sources preparation
################################################################################
# Version handling
set(GIT_VER_HANDLING_OK FALSE)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
@ -80,21 +91,6 @@ if(NOT GIT_VER_HANDLING_OK)
set(OBSW_VERSION_REVISION ${OBSW_VERSION_REVISION_IF_GIT_FAILS})
endif()
# Check whether the user has already installed Catch2 first. This has to come before
# the project call. We could also exclude doing this when the Q7S primary OBSW is built..
find_package(Catch2 3 CONFIG QUIET)
# Project Name
project(eive-obsw)
################################################################################
# Pre-Sources preparation
################################################################################
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set names and variables
set(OBSW_NAME ${CMAKE_PROJECT_NAME})
set(WATCHDOG_NAME eive-watchdog)
@ -253,30 +249,8 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(COMPILER_FLAGS "/permissive-")
endif()
if (NOT(TGT_BSP MATCHES "arm/te0720-1cfa") AND NOT(TGT_BSP MATCHES "arm/q7s"))
# Not installed, so use FetchContent to download and provide Catch2
if(NOT Catch2_FOUND)
message(STATUS "Did not find a valid Catch2 installation. Using FetchContent to install it")
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.0-preview4
)
FetchContent_MakeAvailable(Catch2)
#fixes regression -preview4, to be confirmed in later releases
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()
endif()
add_library(${LIB_EIVE_MISSION})
# Add main executable
add_executable(${OBSW_NAME})
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
@ -301,14 +275,16 @@ target_include_directories(${WATCHDOG_NAME} PUBLIC
${CMAKE_BINARY_DIR}
)
#unittests
# unittests
add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL)
if(EIVE_ADD_ETL_LIB)
endif()
if(EIVE_ADD_JSON_LIB)
add_subdirectory(${LIB_JSON_PATH})
endif()
if(EIVE_ADD_LINUX_FILES)
add_subdirectory(${LIB_ARCSEC_PATH})
add_subdirectory(${LINUX_PATH})
@ -318,26 +294,52 @@ if(ADD_CSP_LIB)
add_subdirectory(${LIB_CSP_PATH})
endif()
add_subdirectory(${COMMON_PATH})
add_subdirectory(${LIB_LWGPS_PATH})
add_subdirectory(${FSFW_PATH})
add_subdirectory(${LIB_EIVE_MISSION_PATH})
add_subdirectory(${TEST_PATH})
add_subdirectory(${UNITTEST_PATH})
# This should have already been downloaded by the FSFW
# Still include it to be safe
include(FetchContent)
FetchContent_Declare(
etl
GIT_REPOSITORY https://github.com/ETLCPP/etl
GIT_TAG ${FSFW_ETL_LIB_VERSION}
)
FetchContent_MakeAvailable(etl)
# Use same Catch2 version as framework
if (NOT(TGT_BSP MATCHES "arm/te0720-1cfa") AND NOT(TGT_BSP MATCHES "arm/q7s"))
# 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)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG ${FSFW_CATCH2_LIB_VERSION}
)
FetchContent_MakeAvailable(Catch2)
#fixes regression -preview4, to be confirmed in later releases
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()
endif()
################################################################################
# Post-Sources preparation
################################################################################
# Add libraries
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
${LIB_FSFW_NAME}
@ -376,7 +378,7 @@ endif()
if(EIVE_ADD_ETL_LIB)
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
${LIB_ETL_NAME}
etl
)
endif()