Browse Source
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>sbg
7 changed files with 50 additions and 167 deletions
@ -1,13 +1,3 @@
@@ -1,13 +1,3 @@
|
||||
include(configs/posix_rpi_common) |
||||
|
||||
if("$ENV{RPI_USE_CLANG}" STREQUAL "1") |
||||
set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf-clang.cmake) |
||||
else() |
||||
set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) |
||||
endif() |
||||
|
||||
|
||||
set(CMAKE_PROGRAM_PATH |
||||
"${PX4_TOOLCHAIN_DIR}/gcc-linaro-arm-linux-gnueabihf/bin" |
||||
${CMAKE_PROGRAM_PATH} |
||||
) |
||||
SET(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake) |
||||
|
@ -1,65 +0,0 @@
@@ -1,65 +0,0 @@
|
||||
include(CMakeForceCompiler) |
||||
|
||||
if ($ENV{PX4_TOOLCHAIN_DIR} STREQUAL "") |
||||
message(FATAL_ERROR "PX4_TOOLCHAIN_DIR not set") |
||||
else() |
||||
set(PX4_TOOLCHAIN_DIR $ENV{PX4_TOOLCHAIN_DIR}) |
||||
endif() |
||||
|
||||
# this one is important |
||||
set(CMAKE_SYSTEM_NAME Generic) |
||||
|
||||
#this one not so much |
||||
set(CMAKE_SYSTEM_VERSION 1) |
||||
|
||||
# specify the cross compiler |
||||
# requires a symbolic link typically from /usr/bin/clang |
||||
find_program(C_COMPILER clang |
||||
PATHS ${PX4_TOOLCHAIN_DIR}/gcc-linaro-arm-linux-gnueabihf/bin |
||||
NO_DEFAULT_PATH |
||||
) |
||||
|
||||
if(NOT C_COMPILER) |
||||
message(FATAL_ERROR "could not find C compiler") |
||||
endif() |
||||
cmake_force_c_compiler(${C_COMPILER} Clang) |
||||
|
||||
find_program(CXX_COMPILER clang++ |
||||
PATHS ${PX4_TOOLCHAIN_DIR}/gcc-linaro-arm-linux-gnueabihf/bin |
||||
NO_DEFAULT_PATH |
||||
) |
||||
|
||||
if(NOT CXX_COMPILER) |
||||
message(FATAL_ERROR "could not find C++ compiler") |
||||
endif() |
||||
cmake_force_cxx_compiler(${CXX_COMPILER} Clang) |
||||
|
||||
# compiler tools |
||||
foreach(tool objcopy nm ld) |
||||
string(TOUPPER ${tool} TOOL) |
||||
find_program(${TOOL} arm-linux-gnueabihf-${tool} |
||||
PATHS ${PX4_TOOLCHAIN_DIR}/gcc-linaro-arm-linux-gnueabihf/bin |
||||
NO_DEFAULT_PATH |
||||
) |
||||
if(NOT ${TOOL}) |
||||
message(FATAL_ERROR "could not find arm-linux-gnueabihf-${tool}") |
||||
endif() |
||||
endforeach() |
||||
|
||||
# os tools |
||||
foreach(tool echo grep rm mkdir nm cp touch make unzip) |
||||
string(TOUPPER ${tool} TOOL) |
||||
find_program(${TOOL} ${tool}) |
||||
if(NOT ${TOOL}) |
||||
message(FATAL_ERROR "could not find ${TOOL}") |
||||
endif() |
||||
endforeach() |
||||
|
||||
# where is the target environment |
||||
set(CMAKE_FIND_ROOT_PATH get_file_component(${C_COMPILER} PATH)) |
||||
|
||||
# search for programs in the build host directories |
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
||||
# for libraries and headers in the target directories |
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
Loading…
Reference in new issue