Brise

cmake x86->arm cross compile script 본문

Linux

cmake x86->arm cross compile script

naudhizb 2023. 1. 19. 22:47
반응형
# this one is important
set(CMAKE_SYSTEM_NAME Linux)
# specify the cross compiler
set(CMAKE_C_COMPILER  /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++)
# Name of archiving tool for static libraries
set(CMAKE_AR "/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-ar" CACHE PATH "ARM Linux ar Program")
# where is the target environment (compiler and third-party)
set(CMAKE_FIND_ROOT_PATH <third-party library install path> /usr/local/angstrom/arm /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi)
# 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)


# Instruction
# ccmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-linux-arm.cmake ../src
# make
# make install

# build example
# mkdir bldexamples
# cd bldexamples
# ccmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-linux-arm.cmake ../examples
# make
# make install
반응형
Comments