diff options
author | MerryMage <[email protected]> | 2020-06-11 13:15:13 +0100 |
---|---|---|
committer | MerryMage <[email protected]> | 2021-03-02 20:41:38 +0000 |
commit | 52a9af3dca0c1e7b5e3007967e2ee0042a704f8b (patch) | |
tree | be3e7d37e15d4efde514d80473d9770835031d4f /CMakeModules | |
parent | 3d418e9a4f1fa56dcc11f60c5966134d9a6dedc1 (diff) | |
download | dynarmic-52a9af3dca0c1e7b5e3007967e2ee0042a704f8b.tar.gz dynarmic-52a9af3dca0c1e7b5e3007967e2ee0042a704f8b.zip |
CMakeLists: Rework architecture detection
* Also only enable xybak/vixl on appropriate architectures
Diffstat (limited to 'CMakeModules')
-rw-r--r-- | CMakeModules/DetectArchitecture.cmake | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/CMakeModules/DetectArchitecture.cmake b/CMakeModules/DetectArchitecture.cmake index e984c6b8..ba6679cd 100644 --- a/CMakeModules/DetectArchitecture.cmake +++ b/CMakeModules/DetectArchitecture.cmake @@ -1,16 +1,56 @@ include(CheckSymbolExists) + function(detect_architecture symbol arch) if (NOT DEFINED ARCHITECTURE) - set(CMAKE_REQUIRED_QUIET 1) - check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch}) + set(CMAKE_REQUIRED_QUIET YES) + check_symbol_exists("${symbol}" "" DETECT_ARCHITECTURE_${arch}) unset(CMAKE_REQUIRED_QUIET) - # The output variable needs to be unique across invocations otherwise - # CMake's crazy scope rules will keep it defined - if (ARCHITECTURE_${arch}) + if (DETECT_ARCHITECTURE_${arch}) set(ARCHITECTURE "${arch}" PARENT_SCOPE) - set(ARCHITECTURE_${arch} 1 PARENT_SCOPE) - add_definitions(-DARCHITECTURE_${arch}=1) endif() + + unset(DETECT_ARCHITECTURE_${arch} CACHE) endif() 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) |