fsfw-example-linux-mcu/cmake/HardwareOsPreConfig.cmake

59 lines
1.7 KiB
CMake

function(pre_source_hw_os_config)
if(${OS_FSFW} STREQUAL linux)
find_package(Threads REQUIRED)
set(BSP_PATH "bsp_linux")
# Hosted
else()
message(FATAL_ERROR "OS_FSFW not valid, only Linux is allowed!")
endif()
# Cross-compile information
if(CMAKE_CROSSCOMPILING)
# set(CMAKE_VERBOSE TRUE)
message(STATUS "Cross-compiling for ${TGT_BSP} target")
message(STATUS "Cross-compile gcc: ${CMAKE_C_COMPILER}")
message(STATUS "Cross-compile g++: ${CMAKE_CXX_COMPILER}")
if(CMAKE_VERBOSE)
message(STATUS "Cross-compile linker: ${CMAKE_LINKER}")
message(STATUS "Cross-compile size utility: ${CMAKE_SIZE}")
message(STATUS "Cross-compile objcopy utility: ${CMAKE_OBJCOPY}")
message(STATUS "Cross-compile ranlib utility: ${CMAKE_RANLIB}")
message(STATUS "Cross-compile ar utility: ${CMAKE_AR}")
message(STATUS "Cross-compile nm utility: ${CMAKE_NM}")
message(STATUS "Cross-compile strip utility: ${CMAKE_STRIP}")
message(STATUS
"Cross-compile assembler: ${CMAKE_ASM_COMPILER} "
"-x assembler-with-cpp"
)
message(STATUS "ABI flags: ${ABI_FLAGS}")
message(STATUS "Custom linker script: ${LINKER_SCRIPT}")
endif()
set_property(CACHE TGT_BSP
PROPERTY STRINGS
"arm/stm32h743zi-nucleo" "arm/raspberrypi"
)
endif()
if(${TGT_BSP} MATCHES "arm/raspberrypi")
add_definitions(-DRASPBERRY_PI)
elseif(${TGT_BSP} MATCHES "arm/beagleboneblack")
add_definitions(-DBEAGLE_BONE_BLACK)
elseif(${TGT_BSP} MATCHES "host/none")
else()
option(ADD_LWIP_STACK "Add LwIP stack for application" OFF)
if(TGT_BSP)
message(WARNING "CMake not configured for this target!")
message(FATAL_ERROR "Target: ${TGT_BSP}!")
endif()
endif()
set(BSP_PATH ${BSP_PATH} PARENT_SCOPE)
endfunction()