eive-obsw/buildsystem/cmake/HardwareOsPreConfig.cmake

70 lines
1.8 KiB
CMake
Raw Normal View History

2020-12-29 01:09:59 +01:00
function(pre_source_hw_os_config)
# FreeRTOS
if(${OS_FSFW} MATCHES freertos)
message(FATAL_ERROR "No FreeRTOS support implemented yet.")
# RTEMS
elseif(${OS_FSFW} STREQUAL rtems)
add_definitions(-DRTEMS)
message(FATAL_ERROR "No RTEMS support implemented yet.")
elseif(${OS_FSFW} STREQUAL linux)
add_definitions(-DUNIX -DLINUX)
find_package(Threads REQUIRED)
set(BSP_PATH "bsp_linux")
# Hosted
else()
set(BSP_PATH "bsp_hosted")
if(WIN32)
add_definitions(-DWIN32)
elseif(UNIX)
find_package(Threads REQUIRED)
add_definitions(-DUNIX -DLINUX)
endif()
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/raspberrypi"
)
endif()
if(${TGT_BSP} MATCHES "arm/raspberrypi")
2020-12-29 01:26:22 +01:00
set(BSP_PATH "bsp_linux")
2020-12-29 01:09:59 +01:00
else()
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()