Fix CMake

This commit is contained in:
TheBrokenRail 2021-10-28 22:57:47 -04:00
parent 9ad6cc3906
commit 05587efc04
4 changed files with 11 additions and 7 deletions

View File

@ -1,10 +1,10 @@
# Compile For ARM
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64_be" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv8b" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv8l")
include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake")
if(HOST_ARCHITECTURE STREQUAL "aarch64_be" OR HOST_ARCHITECTURE STREQUAL "aarch64" OR HOST_ARCHITECTURE STREQUAL "armv8b" OR HOST_ARCHITECTURE STREQUAL "armv8l")
# Force 32-Bit Compile
add_compile_options("-m32")
elseif((NOT CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm") AND (NOT CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv7l"))
elseif((NOT HOST_ARCHITECTURE STREQUAL "arm") AND (NOT HOST_ARCHITECTURE STREQUAL "armv7l"))
# Use ARM Cross-Compiler
include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake")
setup_toolchain("arm-linux-gnueabihf")
endif()
set(CMAKE_SYSTEM_NAME "Linux")

View File

@ -1,7 +1,7 @@
# Compile For ARM64
if(NOT (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64_be" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv8b" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "armv8l"))
# Use ARM64 Cross-Compiler
include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake")
if(NOT (HOST_ARCHITECTURE STREQUAL "aarch64_be" OR HOST_ARCHITECTURE STREQUAL "aarch64" OR HOST_ARCHITECTURE STREQUAL "armv8b" OR HOST_ARCHITECTURE STREQUAL "armv8l"))
# Use ARM64 Cross-Compiler
setup_toolchain("aarch64-linux-gnu")
endif()
set(CMAKE_SYSTEM_NAME "Linux")

View File

@ -1,3 +1,7 @@
# Get Host Architecture
find_program(UNAME uname /bin /usr/bin /usr/local/bin REQUIRED)
execute_process(COMMAND "${UNAME}" "-m" OUTPUT_VARIABLE HOST_ARCHITECTURE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
# Pick GCC Version
macro(pick_gcc_version gcc_root gcc_version)
file(GLOB children RELATIVE "${gcc_root}" "${gcc_root}/*")

View File

@ -1,7 +1,7 @@
# Compile For x86_64
if(NOT CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
# Use x86_64 Cross-Compiler
include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake")
if(NOT HOST_ARCHITECTURE STREQUAL "x86_64")
# Use x86_64 Cross-Compiler
setup_toolchain("x86_64-linux-gnu")
endif()
set(CMAKE_SYSTEM_NAME "Linux")