Host Fixes and CMakeLists.txt update #229
114
CMakeLists.txt
114
CMakeLists.txt
@ -10,23 +10,23 @@
|
||||
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")
|
||||
|
||||
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)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
# Perform steps like loading toolchain files where applicable.
|
||||
include(PreProjectConfig)
|
||||
pre_project_config()
|
||||
|
||||
set(OBSW_ADD_STAR_TRACKER 0)
|
||||
set(OBSW_DEBUG_STARTRACKER 0)
|
||||
# Project Name
|
||||
project(eive-obsw)
|
||||
|
||||
set(OBSW_VERSION_MAJOR_IF_GIT_FAILS 0)
|
||||
set(OBSW_VERSION_MINOR_IF_GIT_FAILS 0)
|
||||
set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0)
|
||||
|
||||
if(NOT FSFW_OSAL)
|
||||
set(FSFW_OSAL linux CACHE STRING "OS for the FSFW.")
|
||||
@ -44,10 +44,21 @@ else()
|
||||
option(EIVE_CREATE_UNIQUE_OBSW_BIN "Append username to generated binary name" OFF)
|
||||
endif()
|
||||
|
||||
# Perform steps like loading toolchain files where applicable.
|
||||
include(PreProjectConfig)
|
||||
include(EiveHelpers)
|
||||
pre_project_config()
|
||||
|
||||
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
|
||||
################################################################################
|
||||
|
||||
# Specify the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# Version handling
|
||||
set(GIT_VER_HANDLING_OK FALSE)
|
||||
@ -80,20 +91,27 @@ 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)
|
||||
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)
|
||||
|
||||
# Project Name
|
||||
project(eive-obsw)
|
||||
FetchContent_Declare(
|
||||
Catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||
GIT_TAG ${FSFW_CATCH2_LIB_VERSION}
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Pre-Sources preparation
|
||||
################################################################################
|
||||
|
||||
# Specify the C++ standard
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
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()
|
||||
|
||||
# Set names and variables
|
||||
set(OBSW_NAME ${CMAKE_PROJECT_NAME})
|
||||
@ -253,30 +271,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,21 +297,16 @@ target_include_directories(${WATCHDOG_NAME} PUBLIC
|
||||
${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
#unittests
|
||||
# unittests
|
||||
add_executable(${UNITTEST_NAME} EXCLUDE_FROM_ALL)
|
||||
|
||||
|
||||
|
||||
if(EIVE_ADD_ETL_LIB)
|
||||
# add_subdirectory(${LIB_ETL_PATH})
|
||||
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})
|
||||
@ -325,26 +316,29 @@ 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)
|
||||
|
||||
################################################################################
|
||||
# Post-Sources preparation
|
||||
################################################################################
|
||||
|
||||
|
||||
|
||||
# Add libraries
|
||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||
${LIB_FSFW_NAME}
|
||||
@ -383,7 +377,7 @@ endif()
|
||||
|
||||
if(EIVE_ADD_ETL_LIB)
|
||||
target_link_libraries(${LIB_EIVE_MISSION} PUBLIC
|
||||
${LIB_ETL_NAME}
|
||||
etl
|
||||
)
|
||||
endif()
|
||||
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 3d047f9629c3a6fe25514f92dd008bd34d0784dd
|
||||
Subproject commit c1be1fe2320eed167e808eecf3e582c87b688cde
|
Loading…
Reference in New Issue
Block a user