From 3ce596a9567ac3944a783f24903af3ad6bbe1ba1 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 12 Feb 2026 17:59:18 +0100 Subject: [PATCH] msvc: VS2026: unlock picky warning in cmake, test in CI Upgrade a GHA/windows job to VS2026 (from VS2022), using a runner image released a week ago. It also comes with the same Windows SDK as VS2022: v10.0.26100.0. The runner image uses Windows 2025 unfortunately, which makes the job run significantly slower than before this patch: - configure: 49s -> 1m10s - build: 3s -> 5s - install test prereqs: 23s -> 27s - run tests: 3m18s -> 4m11s - build examples: 15s -> 25s It's a shame. Also: - cmake: enable picky warnings for VS2026 internal version 19.50. Build is clean with existing options. - GHA/windows: make the built-in OpenSSH intall path recognize the windows-2025-vs2026 image as windows-2025. - windows-2025-vs2026 is able to load the cached stunnel made on the windows-2022 runner. - disk use of the build is almost identical to VS2022. Before: https://github.com/curl/curl/actions/runs/21955482367/job/63418133880 After: https://github.com/curl/curl/actions/runs/21957589847/job/63426546943 Ref: https://github.com/actions/runner-images/blob/71f0157880be328a2b0a4dc81cda61735ba6c45d/images/windows/Windows2025-VS2026-Readme.md Ref: #20575 Closes #20577 --- .github/workflows/windows.yml | 9 +++++++-- CMake/PickyWarnings.cmake | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index de6bc75575..eecc91eca1 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -808,6 +808,7 @@ jobs: env: 'ucrt-x86_64' plat: 'windows' type: 'Debug' + image: 'windows-2025-vs2026' chkprefill: '_chkprefill' config: >- -DENABLE_DEBUG=ON @@ -910,9 +911,11 @@ jobs: # Officially this requires the vcvarsall.bat MS-DOS batch file (as of # VS2022). Since it integrates badly with CI steps and shell scripts, # reproduce the necessary build configuration manually, without envs. + MSVC_EDITION='2022/Enterprise/vc/tools/msvc' + [[ "${MATRIX_IMAGE}" = *'vs2026'* ]] && MSVC_EDITION='18/Enterprise/vc/tools/msvc' [[ "$(uname -s)" = *'ARM64'* ]] && MSVC_HOST='arm64' || MSVC_HOST='x64' # x86 MSVC_ROOTD="$(cygpath --mixed --short-name "$PROGRAMFILES/Microsoft Visual Studio")" # to avoid spaces in directory names - MSVC_ROOTU="$(/usr/bin/find "$(cygpath --unix "$MSVC_ROOTD/2022/Enterprise/vc/tools/msvc")" -mindepth 1 -maxdepth 1 -type d -name '*.*' | sort | tail -n 1)" + MSVC_ROOTU="$(/usr/bin/find "$(cygpath --unix "$MSVC_ROOTD/$MSVC_EDITION")" -mindepth 1 -maxdepth 1 -type d -name '*.*' | sort | tail -n 1)" MSVC_ROOTW="$(cygpath --mixed "$MSVC_ROOTU")" MSVC_ROOTU="$(cygpath --unix "$MSVC_ROOTW")" MSVC_BINU="$MSVC_ROOTU/bin/Host$MSVC_HOST/$MATRIX_ARCH" @@ -938,6 +941,8 @@ jobs: options+=" -DCMAKE_MT=$MSDK_BINU/mt.exe" options+=" -DCMAKE_C_COMPILER=$MSVC_BINU/cl.exe" export CMAKE_GENERATOR='Ninja Multi-Config' # pass it via env to avoid space issues + echo "Using MSVC: ${MSVC_ROOTW}" + echo "Using Windows SDK: ${MSDK_VER}" fi [ "${_chkprefill}" = '_chkprefill' ] && options+=' -D_CURL_PREFILL=OFF' if [ -n "${MATRIX_INSTALL_VCPKG}" ]; then @@ -1009,7 +1014,7 @@ jobs: /usr/bin/pacman --noconfirm --noprogressbar --sync --needed openssh elif [ "${MATRIX_OPENSSH}" = 'OpenSSH-Windows-builtin' ]; then # https://learn.microsoft.com/windows-server/administration/openssh/openssh_install_firstuse - if [ "${MATRIX_IMAGE}" != 'windows-2025' ]; then + if [[ "${MATRIX_IMAGE}" = *'windows-2025'* ]]; then pwsh -Command 'Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0' pwsh -Command 'Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0' fi diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index 980e017f30..fff4deddc9 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -395,7 +395,7 @@ if(PICKY_COMPILER) list(APPEND _picky "-Wno-conversion") # Avoid false positives endif() endif() - elseif(MSVC AND MSVC_VERSION LESS_EQUAL 1944) # Skip for untested/unreleased newer versions + elseif(MSVC AND MSVC_VERSION LESS_EQUAL 1950) # Skip for untested/unreleased newer versions list(APPEND _picky "-Wall") list(APPEND _picky "-wd4061") # enumerator 'A' in switch of enum 'B' is not explicitly handled by a case label list(APPEND _picky "-wd4191") # 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)(void)'