aboutsummaryrefslogtreecommitdiff
path: root/externals/cmake-modules/DetectArchitecture.cmake
diff options
context:
space:
mode:
authorcrueter <crueter@eden-emu.dev>2026-01-14 19:29:13 +0100
committercrueter <crueter@eden-emu.dev>2026-01-14 19:29:13 +0100
commit89f72d286a85504ccf997bb8124e32d1f76d6c81 (patch)
treee71d20665bb7dd75c855d5caa2ee304d970f3215 /externals/cmake-modules/DetectArchitecture.cmake
parentecd01e13fd13b39bff0f2c7c7bc2387c3a2157f4 (diff)
[cmake, tools] update CPMUtil and add support for CPMUtil bundled Qt, module updates, cleanups (#3289)
Support for bundled Qt, not through aqtinstall but rather my CI. Multimedia is implemented too, works on both Windows and Linux, though we don't actually use it so it doesn't really matter. Contains Declarative and all that so the Quick frontend will work once it becomes a thing. Some options have changed, notably w.r.t LTO and faster linker, which are now handled directly in the modules. CPMUtil also has support for custom dirs (`PackageName_CUSTOM_DIR`) now. Probably most useful for adding external fragment shaders and whatnot. Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3289
Diffstat (limited to 'externals/cmake-modules/DetectArchitecture.cmake')
-rw-r--r--externals/cmake-modules/DetectArchitecture.cmake256
1 files changed, 126 insertions, 130 deletions
diff --git a/externals/cmake-modules/DetectArchitecture.cmake b/externals/cmake-modules/DetectArchitecture.cmake
index 82dce31878..105963c8c2 100644
--- a/externals/cmake-modules/DetectArchitecture.cmake
+++ b/externals/cmake-modules/DetectArchitecture.cmake
@@ -1,5 +1,5 @@
# SPDX-FileCopyrightText: Copyright 2025 crueter
-# SPDX-License-Identifier: GPL-3.0-or-later
+# SPDX-License-Identifier: LGPL-3.0-or-later
## DetectArchitecture ##
#[[
@@ -93,133 +93,129 @@ function(detect_architecture_symbols)
endforeach()
endfunction()
-function(DetectArchitecture)
- # arches here are put in a sane default order of importance
- # notably, amd64, arm64, and riscv (in order) are BY FAR the most common
- # mips is pretty popular in embedded
- # ppc64 is pretty popular in supercomputing
- # sparc is uh
- # ia64 exists
- # the rest exist, but are probably less popular than ia64
-
- detect_architecture_symbols(
- ARCH arm64
- SYMBOLS
- "__ARM64__"
- "__aarch64__"
- "_M_ARM64")
-
- detect_architecture_symbols(
- ARCH x86_64
- SYMBOLS
- "__x86_64"
- "__x86_64__"
- "__amd64"
- "_M_X64"
- "_M_AMD64")
-
- # riscv is interesting since it generally does not define a riscv64-specific symbol
- # We can, however, check for the rv32 zcf extension which is good enough of a heuristic on GCC
- detect_architecture_symbols(
- ARCH riscv
- SYMBOLS
- "__riscv_zcf")
-
- # if zcf doesn't exist we can safely assume it's riscv64
- detect_architecture_symbols(
- ARCH riscv64
- SYMBOLS
- "__riscv")
-
- detect_architecture_symbols(
- ARCH x86
- SYMBOLS
- "__i386"
- "__i386__"
- "_M_IX86")
-
- detect_architecture_symbols(
- ARCH arm
- SYMBOLS
- "__arm__"
- "__TARGET_ARCH_ARM"
- "_M_ARM")
-
- detect_architecture_symbols(
- ARCH ia64
- SYMBOLS
- "__ia64"
- "__ia64__"
- "_M_IA64")
-
- # mips is probably the least fun to detect due to microMIPS
- # Because microMIPS is such cancer I'm considering it out of scope for now
- detect_architecture_symbols(
- ARCH mips64
- SYMBOLS
- "__mips64")
-
- detect_architecture_symbols(
- ARCH mips
- SYMBOLS
- "__mips"
- "__mips__"
- "_M_MRX000")
-
- detect_architecture_symbols(
- ARCH ppc64
- SYMBOLS
- "__ppc64__"
- "__powerpc64__"
- "_ARCH_PPC64"
- "_M_PPC64")
-
- detect_architecture_symbols(
- ARCH ppc
- SYMBOLS
- "__ppc__"
- "__ppc"
- "__powerpc__"
- "_ARCH_COM"
- "_ARCH_PWR"
- "_ARCH_PPC"
- "_M_MPPC"
- "_M_PPC")
-
- detect_architecture_symbols(
- ARCH sparc64
- SYMBOLS
- "__sparc_v9__")
-
- detect_architecture_symbols(
- ARCH sparc
- SYMBOLS
- "__sparc__"
- "__sparc")
-
- # I don't actually know about loongarch32 since crossdev does not support it, only 64
- detect_architecture_symbols(
- ARCH loongarch64
- SYMBOLS
- "__loongarch__"
- "__loongarch64")
-
- detect_architecture_symbols(
- ARCH wasm
- SYMBOLS
- "__EMSCRIPTEN__")
-
- # "generic" target
- # If you have reached this point, you're on some as-of-yet unsupported architecture.
- # See the docs up above for known unsupported architectures
- # If you're not in the list... I think you know what you're doing.
- if (NOT DEFINED ARCHITECTURE)
- set(ARCHITECTURE "GENERIC")
- set(ARCHITECTURE_GENERIC 1)
- add_definitions(-DARCHITECTURE_GENERIC=1)
- endif()
+# arches here are put in a sane default order of importance
+# notably, amd64, arm64, and riscv (in order) are BY FAR the most common
+# mips is pretty popular in embedded
+# ppc64 is pretty popular in supercomputing
+# sparc is uh
+# ia64 exists
+# the rest exist, but are probably less popular than ia64
+
+detect_architecture_symbols(
+ ARCH arm64
+ SYMBOLS
+ "__ARM64__"
+ "__aarch64__"
+ "_M_ARM64")
+
+detect_architecture_symbols(
+ ARCH x86_64
+ SYMBOLS
+ "__x86_64"
+ "__x86_64__"
+ "__amd64"
+ "_M_X64"
+ "_M_AMD64")
+
+# riscv is interesting since it generally does not define a riscv64-specific symbol
+# We can, however, check for the rv32 zcf extension which is good enough of a heuristic on GCC
+detect_architecture_symbols(
+ ARCH riscv
+ SYMBOLS
+ "__riscv_zcf")
+
+# if zcf doesn't exist we can safely assume it's riscv64
+detect_architecture_symbols(
+ ARCH riscv64
+ SYMBOLS
+ "__riscv")
+
+detect_architecture_symbols(
+ ARCH x86
+ SYMBOLS
+ "__i386"
+ "__i386__"
+ "_M_IX86")
+
+detect_architecture_symbols(
+ ARCH arm
+ SYMBOLS
+ "__arm__"
+ "__TARGET_ARCH_ARM"
+ "_M_ARM")
+
+detect_architecture_symbols(
+ ARCH ia64
+ SYMBOLS
+ "__ia64"
+ "__ia64__"
+ "_M_IA64")
+
+# mips is probably the least fun to detect due to microMIPS
+# Because microMIPS is such cancer I'm considering it out of scope for now
+detect_architecture_symbols(
+ ARCH mips64
+ SYMBOLS
+ "__mips64")
+
+detect_architecture_symbols(
+ ARCH mips
+ SYMBOLS
+ "__mips"
+ "__mips__"
+ "_M_MRX000")
+
+detect_architecture_symbols(
+ ARCH ppc64
+ SYMBOLS
+ "__ppc64__"
+ "__powerpc64__"
+ "_ARCH_PPC64"
+ "_M_PPC64")
+
+detect_architecture_symbols(
+ ARCH ppc
+ SYMBOLS
+ "__ppc__"
+ "__ppc"
+ "__powerpc__"
+ "_ARCH_COM"
+ "_ARCH_PWR"
+ "_ARCH_PPC"
+ "_M_MPPC"
+ "_M_PPC")
+
+detect_architecture_symbols(
+ ARCH sparc64
+ SYMBOLS
+ "__sparc_v9__")
+
+detect_architecture_symbols(
+ ARCH sparc
+ SYMBOLS
+ "__sparc__"
+ "__sparc")
+
+# I don't actually know about loongarch32 since crossdev does not support it, only 64
+detect_architecture_symbols(
+ ARCH loongarch64
+ SYMBOLS
+ "__loongarch__"
+ "__loongarch64")
+
+detect_architecture_symbols(
+ ARCH wasm
+ SYMBOLS
+ "__EMSCRIPTEN__")
+
+# "generic" target
+# If you have reached this point, you're on some as-of-yet unsupported architecture.
+# See the docs up above for known unsupported architectures
+# If you're not in the list... I think you know what you're doing.
+if (NOT DEFINED ARCHITECTURE)
+ set(ARCHITECTURE "GENERIC")
+ set(ARCHITECTURE_GENERIC 1)
+ add_definitions(-DARCHITECTURE_GENERIC=1)
+endif()
- message(STATUS "[DetectArchitecture] Target architecture: ${ARCHITECTURE}")
- set(ARCHITECTURE "${ARCHITECTURE}" PARENT_SCOPE)
- set(ARCHITECTURE_${ARCHITECTURE} 1 PARENT_SCOPE)
-endfunction()
+message(STATUS "[DetectArchitecture] Target architecture: ${ARCHITECTURE}") \ No newline at end of file