From 8bf7b73141b3c35800b71409e39717c1171283d2 Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Fri, 2 Oct 2026 06:24:39 -0500 Subject: [PATCH] ci: build Windows ARM64 with CMake 4.3 like the other platforms (#16052) The ARM64 jobs pinned CMake 3.31 because CMake 4 dropped pre-3.5 policy compatibility and its ARMASM support broke Boost.Context. Both are handled now. deps/CMakeLists.txt sets CMAKE_POLICY_VERSION_MINIMUM on CMake 4, and Boost.Context uses the winfib implementation on ARM64, so nothing assembles with armasm. CMake 3.31 also predates VS 2026. Its InstallRequiredSystemLibraries treats the v145 toolset as v143, searches only the VS 2017-2022 install directories and finds no runtime, so the ARM64 installer ships without msvcp140.dll and vcruntime140.dll. CMake 4.2 and newer find the VC145 redistributable. get-cmake also installs Ninja, so the ARM64 jobs now use its latest release instead of the one already on the runner, as x64 does. The install now fails when InstallRequiredSystemLibraries returns no msvcp140.dll or vcruntime140.dll, after a configure warning naming the CMake and MSVC versions. A CMake that predates the Visual Studio in use, on a developer machine or after the next runner image update, then stops the installer build instead of shipping one that cannot start. The build_win.bat prerequisite installer drops its matching 3.31.8 pin. --- .github/workflows/build_deps.yml | 17 ----------------- .github/workflows/build_orca.yml | 17 ----------------- CMakeLists.txt | 8 ++++++++ build_win.bat | 6 +----- scripts/test_build_win.ps1 | 7 ------- 5 files changed, 9 insertions(+), 46 deletions(-) diff --git a/.github/workflows/build_deps.yml b/.github/workflows/build_deps.yml index a6d7a17dff..f1cc9a9723 100644 --- a/.github/workflows/build_deps.yml +++ b/.github/workflows/build_deps.yml @@ -49,28 +49,11 @@ jobs: key: ${{ inputs.cache-key }} - uses: lukka/get-cmake@latest - # The windows-11-arm runner needs CMake <= 3.31 (handled in the next step). - if: ${{ !(runner.os == 'Windows' && inputs.arch == 'arm64') }} with: cmakeVersion: "~4.3.0" # use most recent 4.3.x version useLocalCache: true # <--= Use the local cache (default is 'false'). useCloudCache: true - - name: Install CMake 3.31.x (Windows ARM64) - # windows-11-arm ships CMake 4.x, which removed pre-3.5 policy - # compatibility AND has incomplete ASM_ARMASM linker modules - # (breaks Boost.Context on ARM64). Pin to the last 3.x release. - if: runner.os == 'Windows' && inputs.arch == 'arm64' - shell: pwsh - run: | - $ver = "3.31.6" - $url = "https://github.com/Kitware/CMake/releases/download/v$ver/cmake-$ver-windows-arm64.zip" - Invoke-WebRequest -Uri $url -OutFile "$env:RUNNER_TEMP\cmake.zip" - Expand-Archive -Path "$env:RUNNER_TEMP\cmake.zip" -DestinationPath "$env:RUNNER_TEMP\cmake" -Force - $cmakeBin = "$env:RUNNER_TEMP\cmake\cmake-$ver-windows-arm64\bin" - if (-not (Test-Path "$cmakeBin\cmake.exe")) { throw "cmake.exe not found at $cmakeBin" } - Add-Content -Path $env:GITHUB_PATH -Value $cmakeBin - - name: setup dev on Windows if: runner.os == 'Windows' uses: microsoft/setup-msbuild@v3 diff --git a/.github/workflows/build_orca.yml b/.github/workflows/build_orca.yml index 2ea72d0773..8c7674f4d7 100644 --- a/.github/workflows/build_orca.yml +++ b/.github/workflows/build_orca.yml @@ -54,28 +54,11 @@ jobs: fail-on-cache-miss: true - uses: lukka/get-cmake@latest - # The windows-11-arm runner needs CMake <= 3.31 (handled in the next step). - if: ${{ !(runner.os == 'Windows' && inputs.arch == 'arm64') }} with: cmakeVersion: "~4.3.0" # use most recent 4.3.x version useLocalCache: true # <--= Use the local cache (default is 'false'). useCloudCache: true - - name: Install CMake 3.31.x (Windows ARM64) - # windows-11-arm ships CMake 4.x, which removed pre-3.5 policy - # compatibility AND has incomplete ASM_ARMASM linker modules - # (breaks Boost.Context on ARM64). Pin to the last 3.x release. - if: runner.os == 'Windows' && inputs.arch == 'arm64' - shell: pwsh - run: | - $ver = "3.31.6" - $url = "https://github.com/Kitware/CMake/releases/download/v$ver/cmake-$ver-windows-arm64.zip" - Invoke-WebRequest -Uri $url -OutFile "$env:RUNNER_TEMP\cmake.zip" - Expand-Archive -Path "$env:RUNNER_TEMP\cmake.zip" -DestinationPath "$env:RUNNER_TEMP\cmake" -Force - $cmakeBin = "$env:RUNNER_TEMP\cmake\cmake-$ver-windows-arm64\bin" - if (-not (Test-Path "$cmakeBin\cmake.exe")) { throw "cmake.exe not found at $cmakeBin" } - Add-Content -Path $env:GITHUB_PATH -Value $cmakeBin - # Compiler cache. Pushes save it, so main keeps it warm; pull requests # restore it and discard what they compiled. Objects are keyed on the # preprocessed source, the compiler and the flags, so a leg only ever diff --git a/CMakeLists.txt b/CMakeLists.txt index f462525030..8607a33242 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1301,6 +1301,14 @@ if (WIN32) endif() set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) include(InstallRequiredSystemLibraries) + # A missing MSVC runtime is an error because an installer without it cannot start on a clean machine. + set(_orca_runtime_names ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) + list(TRANSFORM _orca_runtime_names REPLACE "^.*/" "") + if (MSVC AND (NOT "msvcp140.dll" IN_LIST _orca_runtime_names OR NOT "vcruntime140.dll" IN_LIST _orca_runtime_names)) + set(_orca_runtime_error "CMake ${CMAKE_VERSION} did not find msvcp140.dll and vcruntime140.dll for MSVC ${MSVC_VERSION}. Update CMake to a release that supports this Visual Studio.") + message(WARNING "${_orca_runtime_error}") + install(CODE "message(FATAL_ERROR \"${_orca_runtime_error}\")") + endif () install (PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ".") elseif (SLIC3R_FHS) # CMAKE_INSTALL_FULL_DATAROOTDIR: read-only architecture-independent data root (share) diff --git a/build_win.bat b/build_win.bat index dfb30e313b..098d6fe1ff 100644 --- a/build_win.bat +++ b/build_win.bat @@ -282,11 +282,7 @@ if "%install_deps%" == "ON" ( call :note_failed "Visual Studio" !errorlevel! ) - REM CMake 4 dropped pre-3.5 policy support and ships incomplete ASM_ARMASM - REM linker modules, which breaks Boost.Context on ARM64. CI pins the same way. - set "cmake_version_flag=" - if /I "%arch%" == "ARM64" set "cmake_version_flag=--version 3.31.8" - call :print_and_run winget install !winget_args! --id=Kitware.CMake !cmake_version_flag! + call :print_and_run winget install !winget_args! --id=Kitware.CMake call :note_failed CMake !errorlevel! call :print_and_run winget install !winget_args! --id=StrawberryPerl.StrawberryPerl call :note_failed Perl !errorlevel! diff --git a/scripts/test_build_win.ps1 b/scripts/test_build_win.ps1 index 65dec8ffa1..5f36fb7ac9 100644 --- a/scripts/test_build_win.ps1 +++ b/scripts/test_build_win.ps1 @@ -552,13 +552,6 @@ $cases = @( Contains = @('id=Microsoft.VisualStudio.2022.BuildTools') } @{ Name = '-l adds the clang compiler and the MSBuild toolset'; Args = @('-u', '--install-vs', 'buildtools', '-l') Contains = @('VC.Llvm.Clang ', 'VC.Llvm.ClangToolset') } - # CMake 4.x breaks Boost.Context on ARM64, so the installer pins 3.31 there - # and leaves x64 on the current release. - @{ Name = 'CMake is pinned to 3.31 when installing for arm64'; Args = @('-u', '--arch', 'arm64') - Contains = @('Kitware.CMake --version 3.31.8') } - @{ Name = 'CMake is not pinned for x64'; Args = @('-u', '--arch', 'x64') - Contains = @('Kitware.CMake') - NotContains = @('--version') } @{ Name = 'installing for arm64 asks for the ARM64 toolset'; Args = @('--install-vs', 'buildtools', '--arch', 'arm64') Contains = @('Microsoft.VisualStudio.Component.VC.Tools.ARM64') } @{ Name = 'an x64 install asks only for the x64 toolset'; Args = @('--install-vs', 'buildtools')