From 1cbd606db2f09c8e461e7ba08f014e433028cf4b Mon Sep 17 00:00:00 2001 From: Dylan Conway Date: Wed, 4 Feb 2026 20:39:57 -0800 Subject: [PATCH] fix: restore PROCESSOR_ARCHITECTURE after VS dev shell on ARM64 VS dev shell with -HostArch amd64 sets PROCESSOR_ARCHITECTURE=AMD64, causing CMake to misdetect the system as x64 and use -march=haswell on ARM64. Restore PROCESSOR_ARCHITECTURE=ARM64 after VS dev shell. --- scripts/vs-shell.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/vs-shell.ps1 b/scripts/vs-shell.ps1 index 3537fcc5ca..ffbf5eecaa 100755 --- a/scripts/vs-shell.ps1 +++ b/scripts/vs-shell.ps1 @@ -39,6 +39,12 @@ if($env:VSINSTALLDIR -eq $null) { # -HostArch only accepts "x86" or "amd64" — even on native ARM64, use "amd64" $hostArch = if ($script:VsArch -eq "arm64") { "amd64" } else { $script:VsArch } . $vsShell -Arch $script:VsArch -HostArch $hostArch + + # VS dev shell with -HostArch amd64 sets PROCESSOR_ARCHITECTURE=AMD64, + # which causes CMake to misdetect the system as x64. Restore it on ARM64. + if ($script:IsARM64) { + $env:PROCESSOR_ARCHITECTURE = "ARM64" + } } finally { Pop-Location }