forked from ceres-solver/ceres-solver
-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (217 loc) · 8.7 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: Windows
on: [push, pull_request]
jobs:
build-mingw:
name: ${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
env:
CCACHE_DIR: ${{github.workspace}}/ccache
strategy:
fail-fast: true
matrix:
build_type: [Release]
sys: [mingw32, mingw64]
lib: [shared, static]
include:
- sys: mingw32
env: i686
- sys: mingw64
env: x86_64
steps:
- uses: actions/checkout@v2
- name: Setup Dependencies
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
install: >-
mingw-w64-${{matrix.env}}-ccache
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-eigen3
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-gflags
mingw-w64-${{matrix.env}}-glog
mingw-w64-${{matrix.env}}-metis
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-suitesparse
- name: Setup Environment
if: ${{matrix.build_type == 'Release'}}
run: |
echo 'CFLAGS=-flto' >> ~/.bash_profile
echo 'CXXFLAGS=-flto' >> ~/.bash_profile
- name: Cache Build
id: cache-build
uses: actions/cache@v2
with:
path: ${{env.CCACHE_DIR}}
key: ${{runner.os}}-${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-ccache-${{github.run_id}}
restore-keys: ${{runner.os}}-${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-ccache-
- name: Configure
run: |
cmake -S . -B build_${{matrix.build_type}}/ \
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache \
-G Ninja
- name: Build
run: |
cmake --build build_${{matrix.build_type}}/ \
--config ${{matrix.build_type}}
- name: Test
run: |
cd build_${{matrix.build_type}}/
ctest --config ${{matrix.build_type}} \
--output-on-failure \
-j$(nproc)
- name: Install
run: |
cmake --build build_${{matrix.build_type}}/ \
--config ${{matrix.build_type}} \
--target install
build-msvc:
name: ${{matrix.msvc}}-${{matrix.arch}}-${{matrix.build_type}}-${{matrix.lib}}
runs-on: ${{matrix.os}}
defaults:
run:
shell: powershell
env:
CL: /MP
CMAKE_GENERATOR: ${{matrix.generator}}
CMAKE_GENERATOR_PLATFORM: ${{matrix.arch}}
strategy:
fail-fast: true
matrix:
arch:
- x64
build_type:
- Release
msvc:
- VS-16-2019
- VS-17-2022
lib:
- shared
include:
- msvc: VS-16-2019
os: windows-2019
generator: 'Visual Studio 16 2019'
marker: vc16
- msvc: VS-17-2022
os: windows-2022
generator: 'Visual Studio 17 2022'
marker: vc17
steps:
- uses: actions/checkout@v2
- name: Cache gflags
id: cache-gflags
uses: actions/cache@v2
with:
path: gflags/
key: ${{matrix.msvc}}-gflags-2.2.2-${{matrix.arch}}-${{matrix.build_type}}-${{matrix.lib}}
- name: Download gflags
if: steps.cache-gflags.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.zip", "v2.2.2.zip");
Expand-Archive -Path v2.2.2.zip -DestinationPath .;
- name: Setup gflags
if: steps.cache-gflags.outputs.cache-hit != 'true'
run: |
cmake -S gflags-2.2.2 -B build-gflags `
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
-DBUILD_TESTING=OFF `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/gflags
cmake --build build-gflags `
--config ${{matrix.build_type}} `
--target install
- name: Cache glog
id: cache-glog
uses: actions/cache@v2
with:
path: glog/
key: ${{matrix.msvc}}-glog-0.6.0-${{matrix.arch}}-${{matrix.build_type}}-${{matrix.lib}}
- name: Download glog
if: steps.cache-glog.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/google/glog/archive/refs/tags/v0.6.0.zip", "v0.6.0.zip");
Expand-Archive -Path v0.6.0.zip -DestinationPath .;
- name: Setup glog
if: steps.cache-glog.outputs.cache-hit != 'true'
run: |
cmake -S glog-0.6.0 -B build-glog `
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
-DBUILD_TESTING=OFF `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/glog `
-DCMAKE_PREFIX_PATH=${{github.workspace}}/gflags
cmake --build build-glog `
--config ${{matrix.build_type}} `
--target install
- name: Cache SuiteSparse
id: cache-suitesparse
uses: actions/cache@v2
with:
path: suitesparse/
key: ${{matrix.msvc}}-suitesparse-5.13.0-cmake.3-${{matrix.arch}}-${{matrix.build_type}}-${{matrix.lib}}
- name: Download SuiteSparse
if: steps.cache-suitesparse.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/sergiud/SuiteSparse/releases/download/5.13.0-cmake.3/SuiteSparse-5.13.0-cmake.3-${{matrix.marker}}-Win64-${{matrix.build_type}}-${{matrix.lib}}-gpl-metis.zip", "suitesparse.zip");
Expand-Archive -Path suitesparse.zip -DestinationPath ${{github.workspace}}/suitesparse;
- name: Cache Eigen
id: cache-eigen
uses: actions/cache@v2
with:
path: eigen/
key: ${{runner.os}}-eigen-3.4.0
- name: Download Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip", "eigen-3.4.0.zip");
Expand-Archive -Path eigen-3.4.0.zip -DestinationPath .;
- name: Setup Eigen
if: steps.cache-eigen.outputs.cache-hit != 'true'
run: |
cmake -S eigen-3.4.0 -B build-eigen `
-DBUILD_TESTING=OFF `
-DCMAKE_Fortran_COMPILER= `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/eigen `
-DEIGEN_BUILD_DOC=OFF
cmake --build build-eigen `
--config ${{matrix.build_type}} `
--target install
- name: Setup Build Environment
run: |
echo "Eigen3_ROOT=${{github.workspace}}/eigen" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "gflags_ROOT=${{github.workspace}}/gflags" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "glog_ROOT=${{github.workspace}}/glog" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CMAKE_PREFIX_PATH=${{github.workspace}}/suitesparse" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup Runtime Environment
run: |
echo '${{github.workspace}}\gflags\bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo '${{github.workspace}}\glog\bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo '${{github.workspace}}\suitesparse\bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure
run: |
cmake -S . -B build_${{matrix.build_type}}/ `
-DBLAS_blas_LIBRARY=${{github.workspace}}/suitesparse/lib/libblas.lib `
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
-DCMAKE_CONFIGURATION_TYPES=${{matrix.build_type}} `
-DCMAKE_INSTALL_PREFIX:PATH=${{github.workspace}}/install `
-DLAPACK_lapack_LIBRARY=${{github.workspace}}/suitesparse/lib/liblapack.lib
- name: Build
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}}
- name: Test
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}} `
--target RUN_TESTS
- name: Install
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}} `
--target INSTALL