-
Notifications
You must be signed in to change notification settings - Fork 791
157 lines (135 loc) · 5.39 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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
# 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@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 -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