CMakeLists: Rework architecture detection
* Also only enable xybak/vixl on appropriate architectures
This commit is contained in:
parent
3d418e9a4f
commit
52a9af3dca
4 changed files with 52 additions and 17 deletions
|
@ -107,13 +107,6 @@ endif()
|
||||||
|
|
||||||
# Arch detection
|
# Arch detection
|
||||||
include(DetectArchitecture)
|
include(DetectArchitecture)
|
||||||
if (MSVC)
|
|
||||||
detect_architecture("_M_AMD64" x86_64)
|
|
||||||
detect_architecture("_M_ARM64" Aarch64)
|
|
||||||
else()
|
|
||||||
detect_architecture("__x86_64__" x86_64)
|
|
||||||
detect_architecture("__aarch64__" Aarch64)
|
|
||||||
endif()
|
|
||||||
if (NOT DEFINED ARCHITECTURE)
|
if (NOT DEFINED ARCHITECTURE)
|
||||||
message(FATAL_ERROR "Unsupported architecture encountered. Ending CMake generation.")
|
message(FATAL_ERROR "Unsupported architecture encountered. Ending CMake generation.")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,16 +1,56 @@
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
|
|
||||||
function(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 YES)
|
||||||
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
|
check_symbol_exists("${symbol}" "" DETECT_ARCHITECTURE_${arch})
|
||||||
unset(CMAKE_REQUIRED_QUIET)
|
unset(CMAKE_REQUIRED_QUIET)
|
||||||
|
|
||||||
# The output variable needs to be unique across invocations otherwise
|
if (DETECT_ARCHITECTURE_${arch})
|
||||||
# CMake's crazy scope rules will keep it defined
|
|
||||||
if (ARCHITECTURE_${arch})
|
|
||||||
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
||||||
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
|
|
||||||
add_definitions(-DARCHITECTURE_${arch}=1)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
unset(DETECT_ARCHITECTURE_${arch} CACHE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
detect_architecture("__ARM64__" arm64)
|
||||||
|
detect_architecture("__aarch64__" arm64)
|
||||||
|
detect_architecture("_M_ARM64" arm64)
|
||||||
|
|
||||||
|
detect_architecture("__arm__" arm)
|
||||||
|
detect_architecture("__TARGET_ARCH_ARM" arm)
|
||||||
|
detect_architecture("_M_ARM" arm)
|
||||||
|
|
||||||
|
detect_architecture("__x86_64" x86_64)
|
||||||
|
detect_architecture("__x86_64__" x86_64)
|
||||||
|
detect_architecture("__amd64" x86_64)
|
||||||
|
detect_architecture("_M_X64" x86_64)
|
||||||
|
|
||||||
|
detect_architecture("__i386" x86)
|
||||||
|
detect_architecture("__i386__" x86)
|
||||||
|
detect_architecture("_M_IX86" x86)
|
||||||
|
|
||||||
|
detect_architecture("__ia64" ia64)
|
||||||
|
detect_architecture("__ia64__" ia64)
|
||||||
|
detect_architecture("_M_IA64" ia64)
|
||||||
|
|
||||||
|
detect_architecture("__mips" mips)
|
||||||
|
detect_architecture("__mips__" mips)
|
||||||
|
detect_architecture("_M_MRX000" mips)
|
||||||
|
|
||||||
|
detect_architecture("__ppc64__" ppc64)
|
||||||
|
detect_architecture("__powerpc64__" ppc64)
|
||||||
|
|
||||||
|
detect_architecture("__ppc__" ppc)
|
||||||
|
detect_architecture("__ppc" ppc)
|
||||||
|
detect_architecture("__powerpc__" ppc)
|
||||||
|
detect_architecture("_ARCH_COM" ppc)
|
||||||
|
detect_architecture("_ARCH_PWR" ppc)
|
||||||
|
detect_architecture("_ARCH_PPC" ppc)
|
||||||
|
detect_architecture("_M_MPPC" ppc)
|
||||||
|
detect_architecture("_M_PPC" ppc)
|
||||||
|
|
||||||
|
detect_architecture("__riscv" riscv)
|
||||||
|
|
||||||
|
detect_architecture("__EMSCRIPTEN__" wasm)
|
||||||
|
|
6
externals/CMakeLists.txt
vendored
6
externals/CMakeLists.txt
vendored
|
@ -27,12 +27,14 @@ target_include_directories(robin_map SYSTEM INTERFACE "$<BUILD_INTERFACE:${CMAKE
|
||||||
|
|
||||||
# vixl
|
# vixl
|
||||||
|
|
||||||
add_subdirectory(vixl)
|
if (ARCHITECTURE STREQUAL "arm64")
|
||||||
|
add_subdirectory(vixl)
|
||||||
|
endif()
|
||||||
|
|
||||||
# xbyak
|
# xbyak
|
||||||
|
|
||||||
if (NOT TARGET xbyak)
|
if (NOT TARGET xbyak)
|
||||||
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
|
if (ARCHITECTURE STREQUAL "x86" OR ARCHITECTURE STREQUAL "x86_64")
|
||||||
add_library(xbyak INTERFACE)
|
add_library(xbyak INTERFACE)
|
||||||
target_include_directories(xbyak SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/xbyak/xbyak)
|
target_include_directories(xbyak SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/xbyak/xbyak)
|
||||||
target_compile_definitions(xbyak INTERFACE XBYAK_NO_OP_NAMES)
|
target_compile_definitions(xbyak INTERFACE XBYAK_NO_OP_NAMES)
|
||||||
|
|
|
@ -250,7 +250,7 @@ if ("A64" IN_LIST DYNARMIC_FRONTENDS)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if (ARCHITECTURE STREQUAL "x86_64")
|
||||||
target_sources(dynarmic PRIVATE
|
target_sources(dynarmic PRIVATE
|
||||||
backend/x64/abi.cpp
|
backend/x64/abi.cpp
|
||||||
backend/x64/abi.h
|
backend/x64/abi.h
|
||||||
|
|
Loading…
Reference in a new issue