diff --git a/.github/workflows/native-vcpkg.yml b/.github/workflows/native-vcpkg.yml new file mode 100644 index 0000000000..26c8124b43 --- /dev/null +++ b/.github/workflows/native-vcpkg.yml @@ -0,0 +1,129 @@ +# 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. + +name: Native Libraries (vcpkg) + +on: + pull_request: + branches: + - main + paths: + - "c/**" + - "ci/**" + - "glib/**" + - "go/**" + - "python/**" + - "ruby/**" + - ".github/workflows/native-vcpkg.yml" + push: + branches-ignore: + - 'dependabot/**' + paths: + - "c/**" + - "ci/**" + - "glib/**" + - "go/**" + - "python/**" + - "ruby/**" + - ".github/workflows/native-vcpkg.yml" + workflow_call: + +concurrency: + group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}-vcpkg + cancel-in-progress: true + +permissions: + contents: read + +defaults: + run: + shell: pwsh + +jobs: + drivers-vcpkg: + name: "C/C++ (${{ matrix.os }}/${{ matrix.config }})" + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - { os: windows-latest, arch: x64, config: debug, msystem: UCRT64, msysbin: mingw64, env: x86_64, triplet: x64-windows } + - { os: windows-latest, arch: x64, config: release, msystem: UCRT64, msysbin: mingw64, env: x86_64, triplet: x64-windows } + - { os: windows-11-arm, arch: arm64, config: release, msystem: CLANGARM64, msysbin: clangarm64, env: clang-aarch64, triplet: arm64-windows-release } + env: + VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-cache + VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} + VCPKG_ROOT: ${{ github.workspace }}/vcpkg + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0 + id: msys2 + with: + msystem: ${{ matrix.msystem }} + update: true + # Needed for gendef tool in GoUtils.cmake + install: | + mingw-w64-${{ matrix.env }}-tools + - name: Add msys2 toolchain to PATH + env: + MSYS_LOCATION: ${{ steps.msys2.outputs.msys2-location }} + run: | + "$($env:MSYS_LOCATION)\${{ matrix.msysbin }}\bin" | + Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Setup MSYS2 tools + if: matrix.arch == 'arm64' + shell: msys2 {0} + run: | + # Needed for CGO + pacman --noconfirm -S mingw-w64-${{ matrix.env }}-gcc-compat + - name: Ensure vcpkg binary cache directory + run: | + New-Item -ItemType Directory -Force ` + $env:VCPKG_DEFAULT_BINARY_CACHE | Out-Null + - name: Cache vcpkg packages + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }} + key: vcpkg-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('.env', 'ci/vcpkg/**', 'c/**/vcpkg.json', '.github/workflows/native-vcpkg.yml') }} + - name: Install vcpkg + shell: bash + run: ci/scripts/install_vcpkg.sh "$VCPKG_ROOT" + - name: Install vcpkg dependencies + working-directory: c + run: | + & "$($env:VCPKG_ROOT)\vcpkg.exe" install libpq sqlite3 ` + --overlay-triplets "$pwd\..\ci\vcpkg\triplets" + - name: Build and Install (No ASan) + env: + CMAKE_BUILD_TYPE: ${{ matrix.config }} + run: | + cmake .\c\ --preset windows-${{ matrix.config }} ` + -DCMAKE_VERBOSE_MAKEFILE=ON ` + -DVCPKG_OVERLAY_TRIPLETS="$pwd\ci\vcpkg\triplets" ` + "-DVCPKG_TARGET_TRIPLET=$($env:VCPKG_DEFAULT_TRIPLET)" + if (-not $?) { throw "failed to configure CMake" } + + cmake --build .\build\${{ matrix.config }} --target install --config ${{ matrix.config }} --parallel + - name: Test + env: + BUILD_ALL: "0" + BUILD_DRIVER_MANAGER: "1" + BUILD_DRIVER_MANAGER_USER_CONFIG_TEST: "1" + BUILD_DRIVER_SQLITE: "1" + run: .\ci\scripts\cpp_test.ps1 $pwd\build\${{ matrix.config }} $pwd\local\${{ matrix.config }} diff --git a/.github/workflows/native-windows.yml b/.github/workflows/native-windows.yml index 10e889a943..9a53aaf7e5 100644 --- a/.github/workflows/native-windows.yml +++ b/.github/workflows/native-windows.yml @@ -357,54 +357,3 @@ jobs: BUILD_ALL: "0" BUILD_DRIVER_SQLITE: "1" run: .\ci\scripts\python_test.ps1 $pwd $pwd\build - - # ------------------------------------------------------------ - # MSVC/vcpkg build (no Conda) - # ------------------------------------------------------------ - drivers-vcpkg: - name: "C/C++ (vcpkg/${{ matrix.os }}/${{ matrix.config }})" - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: ["windows-latest"] - arch: ["x64"] - config: ["debug", "release"] - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 - persist-credentials: false - - name: Setup MSYS2 tools - run: | - # msys64 is pre-installed on windows but not added to path - $env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin\;C:\msys64\ucrt64\bin;$env:PATH" - echo "PATH=$env:PATH" >> $env:GITHUB_ENV - - # Needed for gendef tool in GoUtils.cmake - pacman --noconfirm -S mingw-w64-x86_64-tools - - name: Install vcpkg - shell: bash - env: - VCPKG_ROOT: ${{ github.workspace }}/vcpkg - run: ci/scripts/install_vcpkg.sh "$VCPKG_ROOT" - - name: Install vcpkg dependencies - working-directory: c - env: - VCPKG_ROOT: ${{ github.workspace }}/vcpkg - run: | - ${{ github.workspace }}/vcpkg/vcpkg.exe install libpq sqlite3 --triplet ${{ matrix.arch }}-windows - - name: Build and Install (No ASan) - env: - CMAKE_BUILD_TYPE: ${{ matrix.config }} - VCPKG_ROOT: ${{ github.workspace }}/vcpkg - run: | - cmake .\c\ --preset windows-${{ matrix.config }} -DCMAKE_VERBOSE_MAKEFILE=ON - - cmake --build .\build\${{ matrix.config }} --target install --config ${{ matrix.config }} --parallel - - name: Test - env: - BUILD_ALL: "0" - BUILD_DRIVER_MANAGER: "1" - BUILD_DRIVER_MANAGER_USER_CONFIG_TEST: "1" - BUILD_DRIVER_SQLITE: "1" - run: .\ci\scripts\cpp_test.ps1 $pwd\build\${{ matrix.config }} $pwd\local\${{ matrix.config }} diff --git a/c/cmake_modules/GoUtils.cmake b/c/cmake_modules/GoUtils.cmake index 567dd75ffc..601ba5f85d 100644 --- a/c/cmake_modules/GoUtils.cmake +++ b/c/cmake_modules/GoUtils.cmake @@ -193,7 +193,7 @@ function(add_go_lib GO_MOD_DIR GO_LIBNAME) set(EXTLDFLAGS ",--version-script=${REPOSITORY_ROOT}/c/symbols.map") endif() - if(NOT APPLE) + if(NOT APPLE AND NOT WIN32) set(EXTLDFLAGS "${EXTLDFLAGS},-soname,${LIB_NAME_SHARED}.${ADBC_SO_VERSION}") endif() diff --git a/ci/vcpkg/triplets/arm64-windows-release.cmake b/ci/vcpkg/triplets/arm64-windows-release.cmake new file mode 100644 index 0000000000..a4f7c3d963 --- /dev/null +++ b/ci/vcpkg/triplets/arm64-windows-release.cmake @@ -0,0 +1,21 @@ +# 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 arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_BUILD_TYPE release)