Update DetectArchitecture
Some checks failed
eden-license / license-header (pull_request) Failing after 23s

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2025-10-08 13:11:30 -04:00
parent c5aa0f9fdb
commit 257a01774f
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6

View file

@ -10,10 +10,13 @@ adds compile definitions thereof. Namely:
- x86_64 - x86_64
- x86 - x86
- ia64 - ia64
- mips64
- mips - mips
- ppc64 - ppc64
- ppc - ppc
- riscv - riscv
- riscv64
- loongarch64
- wasm - wasm
Unsupported architectures: Unsupported architectures:
@ -76,7 +79,6 @@ function(detect_architecture_symbols)
"${ARGN}") "${ARGN}")
set(arch "${ARGS_ARCH}") set(arch "${ARGS_ARCH}")
foreach(symbol ${ARGS_SYMBOLS}) foreach(symbol ${ARGS_SYMBOLS})
detect_architecture("${symbol}" "${arch}") detect_architecture("${symbol}" "${arch}")
@ -116,8 +118,16 @@ function(DetectArchitecture)
"_M_X64" "_M_X64"
"_M_AMD64") "_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( detect_architecture_symbols(
ARCH riscv ARCH riscv
SYMBOLS
"__riscv_zcf")
# if zcf doesn't exist we can safely assume it's riscv64
detect_architecture_symbols(
ARCH riscv64
SYMBOLS SYMBOLS
"__riscv") "__riscv")
@ -143,9 +153,12 @@ function(DetectArchitecture)
"_M_IA64") "_M_IA64")
# mips is probably the least fun to detect due to microMIPS # mips is probably the least fun to detect due to microMIPS
# there's also unfortunately no way to reliably detect bit-width # Because microMIPS is such cancer I'm considering it out of scope for now
# mips64 itself CAN be detected, but currently I do not have a MIPS environment to test detect_architecture_symbols(
# TODO: crossdev :) ARCH mips64
SYMBOLS
"__mips64")
detect_architecture_symbols( detect_architecture_symbols(
ARCH mips ARCH mips
SYMBOLS SYMBOLS
@ -173,21 +186,29 @@ function(DetectArchitecture)
"_M_MPPC" "_M_MPPC"
"_M_PPC") "_M_PPC")
# TODO: sparc64 detect_architecture_symbols(
ARCH sparc64
SYMBOLS
"__sparc_v9__")
detect_architecture_symbols( detect_architecture_symbols(
ARCH sparc ARCH sparc
SYMBOLS SYMBOLS
"__sparc__" "__sparc__"
"__sparc") "__sparc")
# TODO: riscv32 # I don't actually know about loongarch32 since crossdev does not support it, only 64
# TODO: loongarch64 detect_architecture_symbols(
ARCH loongarch64
SYMBOLS
"__loongarch__"
"__loongarch64")
detect_architecture_symbols( detect_architecture_symbols(
ARCH wasm ARCH wasm
SYMBOLS SYMBOLS
"__EMSCRIPTEN__") "__EMSCRIPTEN__")
# "generic" target # "generic" target
# If you have reached this point, you're on some as-of-yet unsupported architecture. # If you have reached this point, you're on some as-of-yet unsupported architecture.
# See the docs up above for known unsupported architectures # See the docs up above for known unsupported architectures