Skip to content

Match 9.4.1 tag contents #4

Match 9.4.1 tag contents

Match 9.4.1 tag contents #4

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: 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 -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" -DBUILD_SHARED_LIBS="${{ env.BUILD_SHARED_LIBS }}" -DCMAKE_C_FLAGS="/WX" -DCMAKE_CXX_FLAGS="/WX %EXTRA_CXX_FLAGS%" -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX="%PROJ_DIR%" -DPROJ_DB_CACHE_DIR=%PROJ_DB_CACHE_DIR% %CMAKE_UNITY_BUILD_OPT% ..
ninja -v
ninja install
dir %PROJ_DIR%\bin
- name: Run tests
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%
ctest --output-on-failure -C "${{ env.BUILD_TYPE }}"
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-sqlite3
- name: Build
run: |
ccache -M 500M
ccache -s
PROJ_BUILD=${GITHUB_WORKSPACE}/build
PROJ_DIR=${GITHUB_WORKSPACE}/proj_dir
mkdir ${PROJ_BUILD}
cd ${PROJ_BUILD}
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DBUILD_SHARED_LIBS=${{ env.BUILD_SHARED_LIBS }} -DCMAKE_INSTALL_PREFIX="${PROJ_DIR}" -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" -DUSE_CCACHE=ON -DCMAKE_UNITY_BUILD=ON -DPROJ_DB_CACHE_DIR=$HOME/.ccache ..
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