Browse Source

Fix CMake

pull/36/head
TheBrokenRail 8 months ago
parent
commit
05587efc04
  1. 6
      cmake/arm-toolchain.cmake
  2. 4
      cmake/arm64-toolchain.cmake
  3. 4
      cmake/base-toolchain.cmake
  4. 4
      cmake/x86_64-toolchain.cmake

6
cmake/arm-toolchain.cmake

@ -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")

4
cmake/arm64-toolchain.cmake

@ -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"))
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
include("${CMAKE_CURRENT_LIST_DIR}/base-toolchain.cmake")
setup_toolchain("aarch64-linux-gnu")
endif()
set(CMAKE_SYSTEM_NAME "Linux")

4
cmake/base-toolchain.cmake

@ -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}/*")

4
cmake/x86_64-toolchain.cmake

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

Loading…
Cancel
Save