From cd11f1210f00e1806023b2e0cde9f96555d0c9d5 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 6 May 2026 11:21:26 +0900 Subject: [PATCH] build: target VS2022 using VS2026 toolchain The Windows images now use VS2026: https://github.com/actions/runner-images/issues/13638 --- .github/workflows/packaging.yml | 12 +++++++--- ci/scripts/python_wheel_windows_build.bat | 6 +++-- .../triplets/x64-windows-static-2019.cmake | 23 +++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 ci/vcpkg/triplets/x64-windows-static-2019.cmake diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index 148d2734f3..9dd9c16481 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -291,7 +291,12 @@ jobs: BUILD_ALL: 0 BUILD_DRIVER_MANAGER: 1 CMAKE_BUILD_TYPE: Release + PLATFORM: ${{ matrix.os }} run: | + if [[ "${PLATFORM}" == "Windows" ]]; then + # Target VS2022 + export CMAKE_GENERATOR_TOOLSET=v143 + fi ./ci/scripts/cpp_build.sh $(pwd) $(pwd)/build_driver_manager ./ci/scripts/java_build.sh $(pwd) ./ci/scripts/java_jni_build.sh $(pwd) $(pwd)/build_jni $(pwd)/build_driver_manager/local @@ -962,6 +967,9 @@ jobs: PYTHON_VERSION: "${{ matrix.python_version }}" # Where to install vcpkg VCPKG_ROOT: "${{ github.workspace }}\\vcpkg" + # Target VS2022 from VS2026 + CMAKE_GENERATOR: Visual Studio 18 2026 + CMAKE_GENERATOR_TOOLSET: v143 steps: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: @@ -1009,7 +1017,7 @@ jobs: shell: pwsh run: | echo $env:VCPKG_VERSION - git clone --shallow-since=2022-06-01 https://github.com/microsoft/vcpkg $env:VCPKG_ROOT + git clone --shallow-since=2024-06-01 https://github.com/microsoft/vcpkg $env:VCPKG_ROOT pushd $env:VCPKG_ROOT .\bootstrap-vcpkg.bat -disableMetrics popd @@ -1031,8 +1039,6 @@ jobs: # TODO(https://github.com/apache/arrow-adbc/issues/4269): remove cmd.exe usage shell: cmd # zizmor: ignore[misfeature] run: | - where python.exe - CALL "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" pushd adbc set SETUPTOOLS_SCM_PRETEND_VERSION=%VERSION% .\ci\scripts\python_wheel_windows_build.bat %cd% %cd%\build diff --git a/ci/scripts/python_wheel_windows_build.bat b/ci/scripts/python_wheel_windows_build.bat index fbc5273266..804d4b14be 100644 --- a/ci/scripts/python_wheel_windows_build.bat +++ b/ci/scripts/python_wheel_windows_build.bat @@ -23,11 +23,13 @@ set build_dir=%2 echo "=== (%PYTHON_VERSION%) Building ADBC libpq driver ===" set CMAKE_BUILD_TYPE=RelWithDebInfo -set CMAKE_GENERATOR=Visual Studio 17 2022 +set CMAKE_GENERATOR=Visual Studio 18 2026 set CMAKE_GENERATOR_PLATFORM=x64 set CMAKE_UNITY_BUILD=ON set VCPKG_FEATURE_FLAGS=-manifests -set VCPKG_TARGET_TRIPLET=x64-windows-static +set VCPKG_TARGET_TRIPLET=x64-windows-static-2019 +set VCPKG_DEFAULT_HOST_TRIPLET=x64-windows-static-2019 +set VCPKG_OVERLAY_TRIPLETS=%source_dir%\ci\vcpkg\triplets IF NOT DEFINED VCPKG_ROOT (echo "Must set VCPKG_ROOT" && exit /B 1) diff --git a/ci/vcpkg/triplets/x64-windows-static-2019.cmake b/ci/vcpkg/triplets/x64-windows-static-2019.cmake new file mode 100644 index 0000000000..5bd3e3f2e0 --- /dev/null +++ b/ci/vcpkg/triplets/x64-windows-static-2019.cmake @@ -0,0 +1,23 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) + +# Target VS2022 +set(VCPKG_PLATFORM_TOOLSET v142)