fix(release): configure MSVC for Windows ARM64 (#13055)

This commit is contained in:
Zoltan Kochan
2026-07-16 00:07:41 +02:00
committed by GitHub
parent aa0940d9c7
commit ec976bebdf

View File

@@ -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