fix: pass CMAKE_SYSTEM_PROCESSOR=ARM64 on Windows ARM64

cmake.exe is an x64 binary, so the OS sets PROCESSOR_ARCHITECTURE=AMD64
when it runs on ARM64 Windows. This causes cmake to misdetect as x64
and use -march=haswell. Explicitly set CMAKE_SYSTEM_PROCESSOR=ARM64.
This commit is contained in:
Dylan Conway
2026-02-04 20:44:28 -08:00
parent 1cbd606db2
commit 435f5842ce

View File

@@ -85,9 +85,13 @@ async function build(args) {
generateOptions["--toolchain"] = toolchainPath;
}
// Windows ARM64: log detection (compiler is selected by CMake/toolchain)
// Windows ARM64: cmake.exe is x64 so the OS reports PROCESSOR_ARCHITECTURE=AMD64.
// Override CMAKE_SYSTEM_PROCESSOR so cmake detects ARM64 correctly.
if (isWindowsARM64) {
console.log("Windows ARM64 detected");
if (!generateOptions["-DCMAKE_SYSTEM_PROCESSOR"]) {
generateOptions["-DCMAKE_SYSTEM_PROCESSOR"] = "ARM64";
}
}
const generateArgs = Object.entries(generateOptions).flatMap(([flag, value]) =>