-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cmake toolchain arm support. (#350)
This PR only adds cmake toolchain files for ARM. NAME/COMMAND stuff is so CMAKE_CROSSCOMPILING_EMULATOR is used. The message() is to prevent a warning about unused variable when specifying CMAKE_TOOLCHAIN_FILE.
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR aarch64) | ||
set(CMAKE_SYSTEM_VERSION 1) | ||
|
||
message(STATUS "Using cross-compile toolchain: ${CROSS_COMPILE_TOOLCHAIN}") | ||
|
||
set(CMAKE_C_COMPILER_TARGET "aarch64-linux-gnu") | ||
set(CMAKE_CXX_COMPILER_TARGET "aarch64-linux-gnu") | ||
|
||
set(CMAKE_CROSSCOMPILING TRUE) | ||
set(CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64 -L /usr/${CMAKE_C_COMPILER_TARGET}/) | ||
|
||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
|
||
find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) | ||
if(NOT C_COMPILER_FULL_PATH) | ||
message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") | ||
endif() | ||
set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) | ||
|
||
find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) | ||
if(CXX_COMPILER_FULL_PATH) | ||
set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
set(CMAKE_SYSTEM_NAME Linux) | ||
set(CMAKE_SYSTEM_PROCESSOR arm) | ||
set(CMAKE_SYSTEM_VERSION 1) | ||
|
||
message(STATUS "Using cross-compile toolchain: ${CMAKE_C_COMPILER_TARGET}") | ||
|
||
set(CMAKE_CROSSCOMPILING TRUE) | ||
set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm -L /usr/${CMAKE_C_COMPILER_TARGET}/) | ||
|
||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) | ||
|
||
find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc) | ||
if(NOT C_COMPILER_FULL_PATH) | ||
message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found") | ||
endif() | ||
set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH}) | ||
|
||
find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++) | ||
if(CXX_COMPILER_FULL_PATH) | ||
set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH}) | ||
endif() |