Skip to content

Merge pull request #4315 from rouault/hungarian_grids #3446

Merge pull request #4315 from rouault/hungarian_grids

Merge pull request #4315 from rouault/hungarian_grids #3446

Workflow file for this run

name: Windows build
on:
push:
paths-ignore:
- 'docs/**'
pull_request:
paths-ignore:
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
MSVC:
runs-on: windows-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
strategy:
fail-fast: false
matrix:
BUILD_SHARED_LIBS: [ON, OFF]
BUILD_TYPE: [Release, Debug]
env:
ARCH: x64
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
CMAKE_GENERATOR: Ninja
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: pip install pyyaml
- uses: ilammy/msvc-dev-cmd@v1
- name: Cache vcpkg packages
uses: actions/cache@v4
id: cache
with:
path: c:\vcpkg\installed
key: ${{ runner.os }}-vcpkg-${{ hashFiles('.github/workflows/windows.yml') }}
- name: Install build requirements
shell: cmd
if: steps.cache.outputs.cache-hit != 'true'
run: |
vcpkg install sqlite3[core,tool] tiff curl --triplet=${{ env.ARCH }}-windows
- name: Build
shell: cmd
run: |
set VCPKG_INSTALLED=c:\vcpkg\installed\${{ env.ARCH }}-windows
dir %VCPKG_INSTALLED%\bin
dir %VCPKG_INSTALLED%\tools
set PROJ_DB_CACHE_DIR=%VCPKG_INSTALLED%\cache
mkdir %PROJ_DB_CACHE_DIR%
set PATH=%VCPKG_INSTALLED%\bin;%VCPKG_INSTALLED%\tools;%PATH%
set PROJ_BUILD=%GITHUB_WORKSPACE%\build
mkdir %PROJ_BUILD%
cd %PROJ_BUILD%
set PROJ_DIR=%GITHUB_WORKSPACE%\proj_dir
:: Not directly linked to BUILD_SHARED_LIBS, but a way to test different C++ standard versions
if "${{ env.BUILD_SHARED_LIBS }}"=="ON" (set EXTRA_CXX_FLAGS="/std:c++20")
if "${{ env.BUILD_TYPE }}"=="Release" (set CMAKE_UNITY_BUILD_OPT="-DCMAKE_UNITY_BUILD=ON")
cmake -D CMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" ^
-D BUILD_SHARED_LIBS="${{ env.BUILD_SHARED_LIBS }}" ^
-D CMAKE_C_FLAGS="/WX" ^
-D CMAKE_CXX_FLAGS="/WX %EXTRA_CXX_FLAGS%" ^
-D CMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake ^
-D CMAKE_INSTALL_PREFIX="%PROJ_DIR%" ^
-D PROJ_DB_CACHE_DIR=%PROJ_DB_CACHE_DIR% ^
%CMAKE_UNITY_BUILD_OPT% ..
ninja -v
ninja install
dir %PROJ_DIR%\bin
- name: Run tests
shell: bash -l {0}
run: |
export VCPKG_ROOT=c:/vcpkg
export platform=${{ env.ARCH }}
export VCPKG_INSTALLED=${VCPKG_ROOT}/installed/${platform}-windows
export PATH=${VCPKG_INSTALLED}/bin:${PATH}
export PROJ_DIR=${GITHUB_WORKSPACE}/proj_dir
export PROJ_BUILD=${GITHUB_WORKSPACE}/build
cd ${PROJ_BUILD}
ctest --output-on-failure -C "${{ env.BUILD_TYPE }}"
- name: Post install checks
shell: cmd
run: |
set VCPKG_ROOT=c:\vcpkg
set platform=${{ env.ARCH }}
set VCPKG_INSTALLED=%VCPKG_ROOT%\installed\%platform%-windows
set PATH=%VCPKG_INSTALLED%\bin;%PATH%
set PROJ_DIR=%GITHUB_WORKSPACE%\proj_dir
set PROJ_BUILD=%GITHUB_WORKSPACE%\build
cd %PROJ_BUILD%
set PATH=%PROJ_DIR%\bin;%PATH%
set BUILD_MODE=shared
if "${{ env.BUILD_SHARED_LIBS }}"=="OFF" (set BUILD_MODE=static)
if "${{ env.BUILD_TYPE }}"=="Release" call %GITHUB_WORKSPACE%\test\postinstall\test_cmake.bat %PROJ_DIR% %BUILD_MODE%
if "${{ env.BUILD_TYPE }}"=="Release" proj
MSYS2:
runs-on: windows-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
defaults:
run:
shell: msys2 {0}
strategy:
fail-fast: false
matrix:
BUILD_SHARED_LIBS: [ON, OFF]
env:
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
BUILD_TYPE: Release
CMAKE_GENERATOR: "MSYS Makefiles"
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
id: cache
with:
path: ~/.ccache
key: ${{ runner.os }}-cache-msys-${{ hashFiles('.github/workflows/windows.yml') }}
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
git
make
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ccache
mingw-w64-x86_64-curl
mingw-w64-x86_64-gcc
mingw-w64-x86_64-libtiff
mingw-w64-x86_64-python-yaml
mingw-w64-x86_64-sqlite3
- name: Build
run: |
mkdir -p $HOME/.ccache
ccache -M 500M
ccache -s
PROJ_BUILD=${GITHUB_WORKSPACE}/build
PROJ_DIR=${GITHUB_WORKSPACE}/proj_dir
mkdir ${PROJ_BUILD}
cd ${PROJ_BUILD}
cmake -D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-D BUILD_SHARED_LIBS=${{ env.BUILD_SHARED_LIBS }} \
-D CMAKE_INSTALL_PREFIX="${PROJ_DIR}" \
-D CMAKE_C_FLAGS="-Werror" \
-D CMAKE_CXX_FLAGS="-Werror" \
-D USE_CCACHE=ON \
-D PROJ_DB_CACHE_DIR=$HOME/.ccache \
-D CMAKE_UNITY_BUILD=ON \
-D Python_ROOT_DIR=/mingw64 \
..
make -j 2
make install
ls ${PROJ_DIR}/bin
ccache -s
- name: Run tests
run: |
PROJ_BUILD=${GITHUB_WORKSPACE}/build
PROJ_DIR=${GITHUB_WORKSPACE}/proj_dir
cd ${PROJ_BUILD}
ctest --output-on-failure
export PATH=${PROJ_DIR}/bin:${PATH}
BUILD_MODE=shared
if [ ${{ env.BUILD_SHARED_LIBS }} == "OFF" ]; then BUILD_MODE=static; fi
../test/postinstall/test_cmake.sh ${PROJ_DIR} ${BUILD_MODE}
../test/postinstall/test_pkg-config.sh ${PROJ_DIR} ${BUILD_MODE}
proj