Files
James Dansereau aa5a1b81fe v0.5.0: settings UI, control styles, save import, documentation
PD-style F10 menu with six groups, checkbox/slider/dropdown controls (D504),
wording pass and real-unit sliders (D505-D509), overlay/FPS-counter window
scaling (D510, D512), small settings (D511), control scheme Ext/Original
(D513) with the game's own N64 styles (D516-D518), emulator-format save
import on first launch (D514), build arch tag (D515), converter argv quoting
and sidecar size check, one PC options UI (D519) with by-eye follow-ups,
antialiased overlay sliders (D520), README settings paths, ROADMAP trim,
D441 tier-1 all-level sweep (21/21 pass).

Refs: D503-D520 D349 D441
2026-10-06 18:35:43 -04:00

41 lines
1.7 KiB
CMake

# Determine the target architecture and set TARGET_ARCH / TARGET_IS_64BIT.
# Modelled on the Perfect Dark PC port's cmake/TargetArch.cmake.
function(target_architecture OUT_VAR)
if(CMAKE_CROSSCOMPILING)
# Derive from the cross-compiler target, e.g. x86_64-w64-mingw32-gcc
string(REGEX MATCH "^(i[3-6]86|x86_64|aarch64|arm|powerpc|wasm32)" _arch
"${CMAKE_C_COMPILER_TARGET}")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "")
# D515: a stripped native env (e.g. the build-pc.sh PowerShell re-exec
# before it restored PROCESSOR_ARCHITECTURE) leaves
# CMAKE_HOST_SYSTEM_PROCESSOR / CMAKE_SYSTEM_PROCESSOR empty. Ask the
# compiler instead of silently producing an untagged binary ("ge007..").
execute_process(COMMAND "${CMAKE_C_COMPILER}" -dumpmachine
OUTPUT_VARIABLE _dm OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX MATCH "^(i[3-6]86|x86_64|aarch64|arm|powerpc|wasm32)" _arch "${_dm}")
else()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$")
set(_arch "x86_64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3-6]86|x86)$")
set(_arch "i686")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)$")
set(_arch "aarch64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm)$")
set(_arch "arm")
else()
set(_arch "${CMAKE_SYSTEM_PROCESSOR}")
endif()
endif()
if(_arch STREQUAL "i386")
set(_arch "i686")
endif()
if(_arch STREQUAL "")
message(FATAL_ERROR "TargetArch: could not determine the target architecture (CMAKE_SYSTEM_PROCESSOR empty and compiler -dumpmachine did not match); refusing to build an untagged binary -- the 'ge007..' bug, see D515.")
endif()
set(${OUT_VAR} "${_arch}" PARENT_SCOPE)
endfunction()