Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
parent
6f88c3a363
commit
8d80349968
2 changed files with 58 additions and 50 deletions
|
@ -65,13 +65,11 @@ endif()
|
||||||
|
|
||||||
include(DetectArchitecture)
|
include(DetectArchitecture)
|
||||||
|
|
||||||
if (NOT DEFINED ARCHITECTURE)
|
DetectArchitecture()
|
||||||
set(ARCHITECTURE "GENERIC")
|
|
||||||
set(ARCHITECTURE_GENERIC 1)
|
|
||||||
add_definitions(-DARCHITECTURE_GENERIC=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "Target architecture(s): ${ARCHITECTURE}")
|
if (NOT DEFINED ARCHITECTURE)
|
||||||
|
message(FATAL_ERROR "Architecture didn't make it out of scope, did you delete DetectArchitecture.cmake?")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (MSVC AND ARCHITECTURE_x86)
|
if (MSVC AND ARCHITECTURE_x86)
|
||||||
message(FATAL_ERROR "Attempting to build with the x86 environment is not supported. \
|
message(FATAL_ERROR "Attempting to build with the x86 environment is not supported. \
|
||||||
|
|
|
@ -40,20 +40,21 @@ if (CMAKE_OSX_ARCHITECTURES)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
macro(detect_architecture symbol arch)
|
function(detect_architecture symbol arch)
|
||||||
if (NOT DEFINED ARCHITECTURE)
|
if (NOT DEFINED ARCHITECTURE)
|
||||||
set(CMAKE_REQUIRED_QUIET 1)
|
set(CMAKE_REQUIRED_QUIET 1)
|
||||||
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
|
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
|
||||||
unset(CMAKE_REQUIRED_QUIET)
|
unset(CMAKE_REQUIRED_QUIET)
|
||||||
|
|
||||||
if (ARCHITECTURE_${arch})
|
if (ARCHITECTURE_${arch})
|
||||||
set(ARCHITECTURE "${arch}")
|
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
||||||
set(ARCHITECTURE_${arch} 1)
|
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
|
||||||
add_definitions(-DARCHITECTURE_${arch}=1)
|
add_definitions(-DARCHITECTURE_${arch}=1)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endfunction()
|
||||||
|
|
||||||
|
macro(DetectArchitecture)
|
||||||
detect_architecture("__ARM64__" arm64)
|
detect_architecture("__ARM64__" arm64)
|
||||||
detect_architecture("__aarch64__" arm64)
|
detect_architecture("__aarch64__" arm64)
|
||||||
detect_architecture("_M_ARM64" arm64)
|
detect_architecture("_M_ARM64" arm64)
|
||||||
|
@ -94,3 +95,12 @@ detect_architecture("_M_PPC" ppc)
|
||||||
detect_architecture("__riscv" riscv)
|
detect_architecture("__riscv" riscv)
|
||||||
|
|
||||||
detect_architecture("__EMSCRIPTEN__" wasm)
|
detect_architecture("__EMSCRIPTEN__" wasm)
|
||||||
|
|
||||||
|
if (NOT DEFINED ARCHITECTURE)
|
||||||
|
set(ARCHITECTURE "GENERIC")
|
||||||
|
set(ARCHITECTURE_GENERIC 1)
|
||||||
|
add_definitions(-DARCHITECTURE_GENERIC=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Target architecture(s): ${ARCHITECTURE}")
|
||||||
|
endmacro()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue