diff --git a/app/scripts/dir_build b/app/scripts/dir_build index 4a815f2ed1..c15b026531 100755 --- a/app/scripts/dir_build +++ b/app/scripts/dir_build @@ -76,10 +76,16 @@ if [[ $platform = "m" ]]; then else # Windows / Linux: derive arch if not supplied if [[ -z $arch ]]; then - case "$(uname -m)" in - arm64|aarch64) arch="arm64" ;; - x86_64) arch="x64" ;; - esac + # On Windows on ARM, an emulated x64 shell reports x86_64 from uname, so check + # the native architecture in the registry + if [[ $platform = "w" ]] && reg.exe query 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -v PROCESSOR_ARCHITECTURE 2> /dev/null | grep -q ARM64; then + arch="arm64" + else + case "$(uname -m)" in + arm64|aarch64) arch="arm64" ;; + x86_64) arch="x64" ;; + esac + fi fi fi