Merge pull request #3866 from OSGeo/backport-3864-to-9.3 #2620
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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@v3 | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Cache vcpkg packages | |
uses: actions/cache@v3 | |
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 | |
cmake -DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" -DBUILD_SHARED_LIBS="${{ env.BUILD_SHARED_LIBS }}" -DCMAKE_C_FLAGS="/WX" -DCMAKE_CXX_FLAGS="/WX" -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX="%PROJ_DIR%" -DPROJ_DB_CACHE_DIR=%PROJ_DB_CACHE_DIR% .. | |
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@v3 | |
- name: Cache | |
uses: actions/cache@v3 | |
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 -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 |