mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
beaglebone blue: build librobotcontrol with cmake
This commit is contained in:
@@ -108,7 +108,10 @@ endif()
|
||||
|
||||
|
||||
if ("${PX4_BOARD}" MATCHES "beaglebone_blue")
|
||||
target_link_libraries(px4 PRIVATE robotcontrol)
|
||||
target_link_libraries(px4 PRIVATE robotics_cape)
|
||||
add_dependencies(df_driver_framework librobotcontrol)
|
||||
add_dependencies(df_bmp280 librobotcontrol)
|
||||
add_dependencies(df_mpu9250 librobotcontrol)
|
||||
|
||||
elseif ("${PX4_BOARD}" MATCHES "sitl")
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# arm-linux-gnueabihf-gcc toolchain
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
set(triple arm-linux-gnueabihf)
|
||||
@@ -13,16 +14,18 @@ set(CMAKE_C_COMPILER_TARGET ${triple})
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_CXX_COMPILER_TARGET ${triple})
|
||||
|
||||
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
|
||||
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
|
||||
# compiler tools
|
||||
foreach(tool nm ld objcopy ranlib strip)
|
||||
string(TOUPPER ${tool} TOOL)
|
||||
find_program(CMAKE_${TOOL} ${TOOLCHAIN_PREFIX}-${tool})
|
||||
if(CMAKE-${TOOL} MATCHES "NOTFOUND")
|
||||
message(FATAL_ERROR "could not find ${TOOLCHAIN_PREFIX}-${tool}")
|
||||
endif()
|
||||
endforeach()
|
||||
find_program(CMAKE_AR ${TOOLCHAIN_PREFIX}-gcc-ar)
|
||||
find_program(CMAKE_GDB ${TOOLCHAIN_PREFIX}-gdb)
|
||||
find_program(CMAKE_LD ${TOOLCHAIN_PREFIX}-ld)
|
||||
find_program(CMAKE_LINKER ${TOOLCHAIN_PREFIX}-ld)
|
||||
find_program(CMAKE_NM ${TOOLCHAIN_PREFIX}-gcc-nm)
|
||||
find_program(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}-objcopy)
|
||||
find_program(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}-objdump)
|
||||
find_program(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}-gcc-ranlib)
|
||||
find_program(CMAKE_STRIP ${TOOLCHAIN_PREFIX}-strip)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH get_file_component(${CMAKE_C_COMPILER} PATH))
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
@@ -37,9 +40,3 @@ foreach(tool grep make)
|
||||
message(FATAL_ERROR "could not find ${tool}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# optional compiler tools
|
||||
foreach(tool gdb gdbtui)
|
||||
string(TOUPPER ${tool} TOOL)
|
||||
find_program(${TOOL} ${TOOLCHAIN_PREFIX}-${tool})
|
||||
endforeach()
|
||||
|
||||
@@ -309,17 +309,6 @@ function(px4_os_add_flags)
|
||||
-DRC_AUTOPILOT_EXT # Enable extensions in Robotics Cape Library, TODO: remove
|
||||
)
|
||||
|
||||
set(LIBROBOTCONTROL_INSTALL_DIR $ENV{LIBROBOTCONTROL_INSTALL_DIR})
|
||||
|
||||
# On cross compile host system and native build system:
|
||||
# a) select and define LIBROBOTCONTROL_INSTALL_DIR environment variable so that
|
||||
# other unwanted headers will not be included
|
||||
# b) install robotcontrol.h and rc/* into $LIBROBOTCONTROL_INSTALL_DIR/include
|
||||
# c) install pre-built native (ARM) version of librobotcontrol.* into $LIBROBOTCONTROL_INSTALL_DIR/lib
|
||||
add_compile_options(-I${LIBROBOTCONTROL_INSTALL_DIR}/include)
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${LIBROBOTCONTROL_INSTALL_DIR}/lib")
|
||||
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user