1.将arm系统做到SD卡上
2.在arm系统上安装编译好需要的库文件
3.使用arm上系统自带的编译器
4.主要还是cmakelist需要写好
参考如下CMakeLists.txt
/home/wey为本机电脑目录
/media/wey为本机SD卡的目录
# this is required
SET(CMAKE_SYSTEM_NAME Linux)
SET(SYS_APTH /media/wey/46a7e02a-7e0d-4312-b587-8a01b57f9c35 )
# specify the cross compiler
SET(CMAKE_CXX_COMPILER /home/wey/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++)
#SET(CMAKE_C_COMPILER /home/zhk/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc-6.2.1)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /home/wey/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu/
/media/wey/46a7e02a-7e0d-4312-b587-8a01b57f9c35)
# search for programs in the build host directories (not necessary)
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)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
# configure Boost and Qt
#SET(QT_QMAKE_EXECUTABLE /opt/qt-embedded/qmake)
SET(BOOST_ROOT /media/wey/46a7e02a-7e0d-4312-b587-8a01b57f9c35/boost_1_58_0)
cmake_minimum_required(VERSION 3.1)
project(zte_test)
find_package(Boost REQUIRED COMPONENTS system thread timer chrono date_time program_options serialization graph regex filesystem)
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
message(${Boost_INCLUDE_DIRS})
message(${Boost_LIBRARY_DIRS})
message(${Boost_LIBRARIES})
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
include_directories(
${SYS_APTH}/usr/local/include
${Boost_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/tracking
${SYS_APTH}/opt/qt5.4.1arm64/include
)
link_directories(
${SYS_APTH}/lib/aarch64-linux-gnu
${SYS_APTH}/usr/local/lib/
${Boost_LIBRARY_DIRS}
${SYS_APTH}/opt/qt5.4.1arm64/lib
)
file(GLOB project_HEADERS *.h ./lcmtypes/*.h ./mybasic/*.h ./include/scanio/*.h ./include/slam6d/*.h ./SensorProcessing/*.h ./GLPainting/*.h ./lcmtypes/camera/*.hpp ./lcmtypes/LIDAR_OBJECY_SIDE/*.hpp ./lcmtypes/ESR_REAR_DATA/*.hpp ./lcmtypes/*.hpp)
file(GLOB project_SOURCES *.h *.cpp *.hpp *.cc ./lcmtypes/*.c ./lcmtypes/*.hpp ./mybasic/*.cpp ./mybasic/*.h ./slam6d/*.cc ./SensorProcessing/*.cpp ./GLPainting/*.cpp)
add_executable(${PROJECT_NAME} ${project_SOURCES} ${project_HEADERS} ${project_FORMS_HEADERS} ${project_HEADERS_MOC})
TARGET_LINK_LIBRARIES (${PROJECT_NAME} -llcm ${Boost_LIBRARIES} -ldl -lpthread )# $ {VTK_LIBRARIES} ${PCL_LIBRARIES} ann newmat cxsparse