mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 04:23:35 +08:00
ARM Toolchain: search compiler in PATH
Add CMake target for strip since these changes break adb_upload_to_bebop. GCC users should add the cross compiler bin path to PATH (location of arm-linux-gnueabihf-g++). Clang user should do the following: * set CMAKE_CXX_COMPILER to clang++ by providing -DCMAKE_CXX_COMPILER=clang++ to cmake * get GCC cross compiler - needed because Clang does not ship a CRT * create a symlink for clang and clang++ in GCC cross compiler bin dir. * add GCC bin dir to PATH Signed-off-by: Nicolae Rosia <nicolae.rosia@gmail.com>
This commit is contained in:
committed by
Lorenz Meier
parent
8f9ca9b45e
commit
a6acb2e68e
@@ -267,22 +267,36 @@ elseif ("${BOARD}" STREQUAL "excelsior")
|
||||
--sysroot=${HEXAGON_ARM_SYSROOT}/lib32-apq8096 -mfloat-abi=softfp -mfpu=neon -mthumb-interwork
|
||||
|
||||
)
|
||||
elseif ("${BOARD}" STREQUAL "rpi" AND "$ENV{RPI_USE_CLANG}" STREQUAL "1")
|
||||
elseif ("${BOARD}" STREQUAL "rpi")
|
||||
SET(RPI_COMPILE_FLAGS
|
||||
-mcpu=cortex-a53
|
||||
-mfpu=neon
|
||||
-mfloat-abi=hard
|
||||
)
|
||||
LIST(APPEND added_c_flags ${RPI_COMPILE_FLAGS})
|
||||
LIST(APPEND added_cxx_flags ${RPI_COMPILE_FLAGS})
|
||||
|
||||
# Add the toolchain specific flags
|
||||
set(clang_added_flags
|
||||
-m32
|
||||
--target=arm-linux-gnueabihf
|
||||
-ccc-gcc-name arm-linux-gnueabihf
|
||||
--sysroot=${PX4_TOOLCHAIN_DIR}/gcc-linaro-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/)
|
||||
FIND_PROGRAM(CXX_COMPILER_PATH ${CMAKE_CXX_COMPILER})
|
||||
|
||||
set(added_c_flags ${POSIX_CMAKE_C_FLAGS} ${clang_added_flags})
|
||||
list(APPEND added_cxx_flags ${POSIX_CMAKE_CXX_FLAGS} ${clang_added_flags})
|
||||
list(APPEND added_exe_linker_flags ${POSIX_CMAKE_EXE_LINKER_FLAGS} ${clang_added_flags})
|
||||
GET_FILENAME_COMPONENT(CXX_COMPILER_PATH ${CXX_COMPILER_PATH} DIRECTORY)
|
||||
GET_FILENAME_COMPONENT(CXX_COMPILER_PATH "${CXX_COMPILER_PATH}/../" ABSOLUTE)
|
||||
|
||||
IF ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CLANG_COMPILE_FLAGS
|
||||
--target=arm-pc-linux-gnueabihf
|
||||
-ccc-gcc-name arm-linux-gnueabihf-gcc
|
||||
--sysroot=${CXX_COMPILER_PATH}/arm-linux-gnueabihf/libc
|
||||
-I${CXX_COMPILER_PATH}/arm-linux-gnueabihf/libc/usr/include/
|
||||
)
|
||||
|
||||
set(added_c_flags ${POSIX_CMAKE_C_FLAGS} ${CLANG_COMPILE_FLAGS})
|
||||
list(APPEND added_cxx_flags ${POSIX_CMAKE_CXX_FLAGS} ${CLANG_COMPILE_FLAGS})
|
||||
list(APPEND added_exe_linker_flags ${POSIX_CMAKE_EXE_LINKER_FLAGS} ${CLANG_COMPILE_FLAGS}
|
||||
-B${CXX_COMPILER_PATH}/arm-linux-gnueabihf/libc/usr/lib
|
||||
-L${CXX_COMPILER_PATH}/arm-linux-gnueabihf/libc/usr/lib
|
||||
)
|
||||
ENDIF()
|
||||
else()
|
||||
# Add the toolchain specific flags
|
||||
set(added_cflags ${POSIX_CMAKE_C_FLAGS})
|
||||
list(APPEND added_cxx_flags ${POSIX_CMAKE_CXX_FLAGS})
|
||||
endif()
|
||||
|
||||
# output
|
||||
|
||||
Reference in New Issue
Block a user