build: use clang-cl for Windows CI builds (faster slicing and faster builds) (#15428)

* ci: build the Windows x64 dependencies and slicer with clang-cl

Passes -l -x from the Windows jobs, using the clang-cl and Ninja options
added in #15373. Ninja runs each dependency's build step as a plain command,
so the jobs set up a VC environment for OpenSSL's nmake. arm64 stays on MSVC
for now.

The deps cache key gains the compiler, so windows-x64 becomes
windows-x64-clang and windows-arm64 becomes windows-arm64-msvc.

* deps: select OpenSSL's ARM64 target from DEPS_ARCH

CMAKE_GENERATOR_PLATFORM is only set by -A, which Ninja never receives, so
the Ninja build selected the x64 target on ARM64. DEPS_ARCH is derived from
CMAKE_SYSTEM_PROCESSOR and is already independent of the generator.

* ci: build the Windows ARM64 dependencies and slicer with clang-cl

Three dependencies need handling first. libpng and OpenCV each build an ARM
SIMD path that does not compile with clang-cl, so those paths are off; PNG
already had the same opt-out for Apple ARM. OCCT is built with cl, since
clang-cl cannot emit one of its large generated files and there is no option
to turn that off. All three are gated to Windows ARM64 with clang.
This commit is contained in:
Kris Austin
2026-09-01 08:30:45 -05:00
committed by GitHub
parent 9933cab59f
commit 7eaff76cec
8 changed files with 67 additions and 10 deletions

View File

@@ -13,6 +13,10 @@ on:
arch:
required: false
type: string
compiler:
required: false
type: string
default: msvc
macos-combine-only:
required: false
type: boolean
@@ -395,7 +399,18 @@ jobs:
# "tests" builds the unit tests too; the unit_tests_windows_* jobs run them.
run: |
$arch = "${{ inputs.arch }}"
if ($arch -eq "arm64") { .\build_release_vs.bat slicer arm64 tests } else { .\build_release_vs.bat slicer tests }
# -l selects clang-cl and -x Ninja; together they build the slicer with clang.
$clang = "${{ inputs.compiler }}" -eq "clang"
$flags = if ($clang) { "-l", "-x" } else { @() }
if ($clang) {
# Build against the same VC toolchain and SDK as the dependencies.
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vs = & $vswhere -latest -property installationPath
$devArch = if ($arch -eq "arm64") { "arm64" } else { "amd64" }
Import-Module "$vs\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $vs -SkipAutomaticLocation -DevCmdArguments "-arch=$devArch"
}
if ($arch -eq "arm64") { .\build_release_vs.bat slicer arm64 @flags tests } else { .\build_release_vs.bat slicer @flags tests }
shell: pwsh
- name: Build system preset cache (Windows)