toolchain file improvements

This commit is contained in:
Robin Müller 2021-07-14 18:19:24 +02:00
parent 30755e25ab
commit 8ff9c1c0d7
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 18 additions and 31 deletions

View File

@ -169,9 +169,6 @@ string(CONCAT POST_BUILD_COMMENT
"${TARGET_STRING}"
)
message(STATUS ${CMAKE_SIZE})
message(STATUS ${CMAKE_OBJCOPY})
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD

View File

@ -7,14 +7,16 @@
# application CMakeLists.txt before loading the toolchain file.
# CROSS_COMPILE also needs to be set accordingly or passed to the CMake command
if(NOT DEFINED ENV{LINUX_ROOTFS})
message(FATAL_ERROR
"Define the LINUX_ROOTFS variable to point to the Beagle Bone Black rootfs."
)
# Sysroot has not been cached yet and was not set in environment either
if(NOT SYSROOT_PATH)
message(FATAL_ERROR
"Define the LINUX_ROOTFS variable to point to the Raspberry Pi rootfs."
)
endif()
else()
set(SYSROOT_PATH "$ENV{LINUX_ROOTFS}" CACHE PATH "Local Linux root filesystem path")
message(STATUS "Beagle Bone Black sysroot: ${SYSROOT_PATH}")
set(SYSROOT_PATH "$ENV{LINUX_ROOTFS}" CACHE PATH "Local linux root filesystem path")
message(STATUS "Raspberry Pi sysroot: ${SYSROOT_PATH}")
endif()
if(NOT DEFINED ENV{CROSS_COMPILE})
@ -44,11 +46,11 @@ set(CROSS_COMPILE_OBJCOPY "${CROSS_COMPILE}-objcopy")
set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}-size")
# At the very least, cross compile gcc and g++ have to be set!
find_program (CROSS_COMPILE_CC_FOUND ${CROSS_COMPILE_CC} REQUIRED)
find_program (CROSS_COMPILE_CXX_FOUND ${CROSS_COMPILE_CXX} REQUIRED)
find_program(CROSS_COMPILE_SIZE ${CROSS_COMPILE_SIZE})
find_program(CROSS_COMPILE_OBJCOY ${CROSS_COMPILE_OBJCOPY})
find_program (CMAKE_C_COMPILER ${CROSS_COMPILE_CC} REQUIRED)
find_program (CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX} REQUIRED)
# Useful utilities, not strictly necessary
find_program(CMAKE_SIZE ${CROSS_COMPILE_SIZE})
find_program(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY})
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSROOT "${SYSROOT_PATH}")
@ -57,12 +59,6 @@ set(CMAKE_SYSROOT "${SYSROOT_PATH}")
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "arm")
# Define the compiler
set(CMAKE_C_COMPILER ${CROSS_COMPILE_CC})
set(CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX})
set(CMAKE_SIZE ${CROSS_COMPILE_SIZE})
set(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY})
# List of library dirs where LD has to look. Pass them directly through gcc.
# LD_LIBRARY_PATH is not evaluated by arm-*-ld
set(LIB_DIRS

View File

@ -57,11 +57,11 @@ set(CROSS_COMPILE_OBJCOPY "${CROSS_COMPILE}-objcopy")
set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}-size")
# At the very least, cross compile gcc and g++ have to be set!
find_program(CROSS_COMPILE_CC_FOUND ${CROSS_COMPILE_CC} REQUIRED)
find_program(CROSS_COMPILE_CXX_FOUND ${CROSS_COMPILE_CXX} REQUIRED)
find_program(CROSS_COMPILE_SIZE ${CROSS_COMPILE_SIZE})
find_program(CROSS_COMPILE_OBJCOY ${CROSS_COMPILE_OBJCOPY})
find_program (CMAKE_C_COMPILER ${CROSS_COMPILE_CC} REQUIRED)
find_program (CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX} REQUIRED)
# Useful utilities, not strictly necessary
find_program(CMAKE_SIZE ${CROSS_COMPILE_SIZE})
find_program(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY})
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSROOT "${SYSROOT_PATH}")
@ -74,12 +74,6 @@ else()
set(CMAKE_SYSTEM_PROCESSOR "arm")
endif()
# Define the compiler
set(CMAKE_C_COMPILER ${CROSS_COMPILE_CC})
set(CMAKE_CXX_COMPILER ${CROSS_COMPILE_CXX})
set(CMAKE_SIZE ${CROSS_COMPILE_SIZE})
set(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY})
# List of library dirs where LD has to look. Pass them directly through gcc.
# LD_LIBRARY_PATH is not evaluated by arm-*-ld
set(LIB_DIRS