From ec976bebdf4037af63562e5fbcfd7cdf019c8068 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Thu, 16 Jul 2026 00:07:41 +0200 Subject: [PATCH] fix(release): configure MSVC for Windows ARM64 (#13055) --- .github/workflows/release.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23a44165f7..d5f3395646 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -373,7 +373,7 @@ jobs: run: | $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" $installPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath - & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe" modify --installPath "$installPath" --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --quiet --norestart + & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe" modify --installPath "$installPath" --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --quiet --norestart if ($LASTEXITCODE -ne 0) { throw "Visual Studio installer exited with $LASTEXITCODE" } $llvmDir = Join-Path $installPath 'VC\Tools\Llvm' $deadline = (Get-Date).AddMinutes(5) @@ -395,6 +395,15 @@ jobs: "CC_aarch64_pc_windows_msvc=$clangCl" >> $env:GITHUB_ENV "CXX_aarch64_pc_windows_msvc=$clangCl" >> $env:GITHUB_ENV $clangDir >> $env:GITHUB_PATH + $vcvarsall = Join-Path $installPath 'VC\Auxiliary\Build\vcvarsall.bat' + $targetEnvironment = cmd.exe /c "`"$vcvarsall`" amd64_arm64 > nul && set" + if ($LASTEXITCODE -ne 0) { throw "vcvarsall exited with $LASTEXITCODE" } + if (-not ($targetEnvironment -match '(?i)^LIB=.*\\arm64')) { throw 'vcvarsall did not configure ARM64 libraries' } + foreach ($line in $targetEnvironment) { + if ($line -match '^(INCLUDE|LIB|LIBPATH|PATH)=(.*)$') { + "$($matches[1])=$($matches[2])" >> $env:GITHUB_ENV + } + } # No build cache: GitHub Actions caches are writable by any workflow on # the default branch, so restoring one here would let a poisoned cache @@ -767,7 +776,7 @@ jobs: run: | $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" $installPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath - & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe" modify --installPath "$installPath" --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --quiet --norestart + & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe" modify --installPath "$installPath" --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --quiet --norestart if ($LASTEXITCODE -ne 0) { throw "Visual Studio installer exited with $LASTEXITCODE" } $llvmDir = Join-Path $installPath 'VC\Tools\Llvm' $deadline = (Get-Date).AddMinutes(5) @@ -789,6 +798,15 @@ jobs: "CC_aarch64_pc_windows_msvc=$clangCl" >> $env:GITHUB_ENV "CXX_aarch64_pc_windows_msvc=$clangCl" >> $env:GITHUB_ENV $clangDir >> $env:GITHUB_PATH + $vcvarsall = Join-Path $installPath 'VC\Auxiliary\Build\vcvarsall.bat' + $targetEnvironment = cmd.exe /c "`"$vcvarsall`" amd64_arm64 > nul && set" + if ($LASTEXITCODE -ne 0) { throw "vcvarsall exited with $LASTEXITCODE" } + if (-not ($targetEnvironment -match '(?i)^LIB=.*\\arm64')) { throw 'vcvarsall did not configure ARM64 libraries' } + foreach ($line in $targetEnvironment) { + if ($line -match '^(INCLUDE|LIB|LIBPATH|PATH)=(.*)$') { + "$($matches[1])=$($matches[2])" >> $env:GITHUB_ENV + } + } # No build cache: GitHub Actions caches are writable by any workflow on # the default branch, so restoring one here would let a poisoned cache