Enable cross compilation to aarch64

Change-Id: Iafc8ac60926f5286990ce63a4ff4f8b6a7c46bef
This commit is contained in:
George Wort
2021-05-17 15:17:38 +01:00
committed by Konstantinos Margaritis
parent 1e7765c485
commit 503483a8ee
7 changed files with 86 additions and 15 deletions

View File

@@ -209,7 +209,7 @@ else()
message(SEND_ERROR "Something went wrong determining gcc tune: -mtune=${GNUCC_ARCH} not valid")
endif()
set(TUNE_FLAG ${GNUCC_ARCH})
else ()
elseif (NOT TUNE_FLAG)
set(TUNE_FLAG native)
endif()
@@ -252,11 +252,11 @@ else()
endif()
if (NOT CMAKE_C_FLAGS MATCHES .*march.* AND NOT CMAKE_C_FLAGS MATCHES .*mtune.*)
set(ARCH_C_FLAGS "-march=native -mtune=${TUNE_FLAG}")
set(ARCH_C_FLAGS "-march=${GNUCC_ARCH} -mtune=${TUNE_FLAG}")
endif()
if (NOT CMAKE_CXX_FLAGS MATCHES .*march.* AND NOT CMAKE_CXX_FLAGS MATCHES .*mtune.*)
set(ARCH_CXX_FLAGS "-march=native -mtune=${TUNE_FLAG}")
set(ARCH_CXX_FLAGS "-march=${GNUCC_ARCH} -mtune=${TUNE_FLAG}")
endif()
if(CMAKE_COMPILER_IS_GNUCC)
@@ -460,7 +460,11 @@ endif()
endif()
if (NOT FAT_RUNTIME)
message(STATUS "Building for current host CPU: ${ARCH_C_FLAGS}")
if (CROSS_COMPILE_AARCH64)
message(STATUS "Building for target CPU: ${ARCH_C_FLAGS}")
else()
message(STATUS "Building for current host CPU: ${ARCH_C_FLAGS}")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_CXX_FLAGS}")
else()