eive-obsw/cmake/PreProjectConfig.cmake
Ulrich Mohr 4d154b7cee
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
reworked cmake, unfortunately a big one due to interdependence
- /mission is a library now, in preparation of unittests (which bring their own main)
- eive-simple is now only available in bsp=arm/q7s (but is still not compiling)
- watchdog and simple are their own executables, not configurations any more
- moved some q7s specific code into /bsp-q7s to flatten if-hierarchy in main CMakeLists.txt
- compiler and linker options are not globally applied to all targets
- linux is the default fsfw osal now, as current code does not compile on hosted
2022-02-09 21:38:56 +01:00

67 lines
2.0 KiB
CMake

function(pre_project_config)
# Basic input sanitization
if(DEFINED TGT_BSP)
if(${TGT_BSP} MATCHES "arm/raspberrypi" AND NOT FSFW_OSAL MATCHES linux)
message(STATUS "FSFW OSAL invalid for specified target BSP ${TGT_BSP}!")
message(STATUS "Setting valid FSFW_OSAL: linux")
set(FSFW_OSAL "linux")
endif()
endif()
# Disable compiler checks for cross-compiling.
if(FSFW_OSAL MATCHES linux AND TGT_BSP)
if(TGT_BSP MATCHES "arm/q7s")
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SCRIPT_PATH}/Q7SCrossCompileConfig.cmake"
PARENT_SCOPE
)
elseif(TGT_BSP MATCHES "arm/raspberrypi")
if(NOT DEFINED ENV{LINUX_ROOTFS})
if(NOT DEFINED LINUX_ROOTFS)
message(WARNING "No LINUX_ROOTFS environmental or CMake variable set!")
set(ENV{LINUX_ROOTFS} "$ENV{HOME}/raspberrypi/rootfs")
else()
set(ENV{LINUX_ROOTFS} "${LINUX_ROOTFS}")
endif()
else()
message(STATUS
"LINUX_ROOTFS from environmental variables used: $ENV{LINUX_ROOTFS}"
)
endif()
if(NOT DEFINED ENV{RASPBERRY_VERSION})
if(NOT RASPBERRY_VERSION)
message(STATUS "No RASPBERRY_VERSION specified, setting to 4")
set(RASPBERRY_VERSION "4" CACHE STRING "Raspberry Pi version")
else()
message(STATUS "Setting RASPBERRY_VERSION to ${RASPBERRY_VERSION}")
set(RASPBERRY_VERSION ${RASPBERRY_VERSION} CACHE STRING "Raspberry Pi version")
set(ENV{RASPBERRY_VERSION} ${RASPBERRY_VERSION})
endif()
else()
message(STATUS
"RASPBERRY_VERSION from environmental variables used: "
"$ENV{RASPBERRY_VERSION}"
)
endif()
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SCRIPT_PATH}/RPiCrossCompileConfig.cmake"
PARENT_SCOPE
)
elseif(${TGT_BSP} MATCHES "arm/beagleboneblack")
if(LINUX_CROSS_COMPILE)
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SCRIPT_PATH}/BBBCrossCompileConfig.cmake"
PARENT_SCOPE
)
endif()
else()
message(WARNING "Target BSP (TGT_BSP) ${TGT_BSP} unknown!")
endif()
endif()
endfunction()