-
Notifications
You must be signed in to change notification settings - Fork 17
287 lines (254 loc) · 10.4 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: Windows
on: [push, pull_request]
jobs:
build-mingw:
if: false
name: ${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
env:
CCACHE_DIR: ${{github.workspace}}/ccache
strategy:
fail-fast: true
matrix:
build_type: [Release, Debug]
sys: [mingw32, mingw64]
lib: [shared, static]
components: [minimal, lgpl, gpl]
metis: [no-metis, metis]
exclude:
# METIS is only usable if CHOLMOD is compiled
- components: minimal
metis: metis
include:
- sys: mingw32
env: i686
- sys: mingw64
env: x86_64
steps:
- uses: actions/checkout@v3
- 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}}-gcc
mingw-w64-${{matrix.env}}-gcc-fortran
mingw-w64-${{matrix.env}}-intel-tbb
mingw-w64-${{matrix.env}}-lapack
mingw-w64-${{matrix.env}}-ninja
mingw-w64-${{matrix.env}}-openblas
mingw-w64-${{matrix.env}}-openmp
unzip
wget
- name: Setup METIS Dependencies
if: ${{matrix.metis == 'metis'}}
run: >-
pacman --noconfirm -S
mingw-w64-${{matrix.env}}-metis
- 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@v3
with:
path: ${{env.CCACHE_DIR}}
key: ${{runner.os}}-${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}-ccache-${{github.run_id}}
restore-keys: ${{runner.os}}-${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}-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 \
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=ccache \
-DCMAKE_INSTALL_PREFIX:PATH=./install \
-DCMAKE_REQUIRE_FIND_PACKAGE_METIS=${{matrix.metis == 'metis'}} \
-DWITH_GPL=${{matrix.components == 'gpl'}} \
-DWITH_LGPL=${{contains(matrix.components, 'gpl')}} \
-DWITH_METIS=${{matrix.metis == 'metis'}} \
-G Ninja
- name: Build
run: |
cmake --build build_${{matrix.build_type}}/ \
--config ${{matrix.build_type}}
- name: Install
run: |
cmake --build build_${{matrix.build_type}}/ \
--config ${{matrix.build_type}} \
--target install
build-msvc:
name: ${{matrix.msvc}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}
runs-on: ${{matrix.os}}
env:
CCACHE_DIR: ${{github.workspace}}/ccache
CL: /MP
defaults:
run:
shell: powershell
strategy:
fail-fast: true
matrix:
build_type: [Release, Debug]
msvc: [VS-17-2022]
sys: [mingw64]
lib: [shared]
components: [gpl]
metis: [metis]
include:
- sys: mingw64
env: x86_64
system: Win64
- msvc: VS-17-2022
generator: "Visual Studio 17 2022"
os: windows-2022
marker: vc17
steps:
- uses: actions/checkout@v3
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
path-type: inherit
install: >-
wget
mingw-w64-${{matrix.env}}-ccache
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-gcc-fortran
mingw-w64-${{matrix.env}}-ninja
- name: Setup MSYS2 Deployment
if: ${{matrix.build_type == 'Release'}}
shell: msys2 {0}
run: |
echo INSTALL_TARGET_SUFFIX=/strip >> $GITHUB_ENV
- name: Cache METIS
if: matrix.metis == 'metis'
id: cache-metis
uses: actions/cache@v3
with:
path: metis/
key: ${{matrix.sys}}-metis-5.1.1-${{matrix.build_type}}-shared
- name: Download METIS
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true'
run: |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/KarypisLab/METIS/archive/refs/tags/v5.1.1-DistDGL-v0.5.zip", "v5.1.1-DistDGL-v0.5.zip");
(New-Object System.Net.WebClient).DownloadFile("https://github.com/KarypisLab/GKlib/archive/refs/tags/METIS-v5.1.1-DistDGL-0.5.zip", "v5.1.1-DistDGL-v0.5-GKlib.zip");
7z x v5.1.1-DistDGL-v0.5.zip;
7z x v5.1.1-DistDGL-v0.5-GKlib.zip;
- name: Build METIS
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
sed -i '/sys\/resource.h/d' ./GKlib-METIS-v5.1.1-DistDGL-0.5/gk_arch.h
sed -i -E 's|\<__(arg[cv])\>|\1|g' ./GKlib-METIS-v5.1.1-DistDGL-0.5/gk_getopt.h
pushd ./METIS-5.1.1-DistDGL-v0.5/
mkdir -p ./build/xinclude/
echo '#define IDXTYPEWIDTH 32' > ./build/xinclude/metis.h
echo '#define REALTYPEWIDTH 32' >> ./build/xinclude/metis.h
cat ./include/metis.h >> ./build/xinclude/metis.h
cp ./include/CMakeLists.txt ./build/xinclude/
popd
cmake -S ./METIS-5.1.1-DistDGL-v0.5/ -B ./build-metis/ \
-DCMAKE_GNUtoMS=ON \
-DCMAKE_C_STANDARD_LIBRARIES=-lregex \
-DSHARED=ON \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DGKLIB_PATH='${{github.workspace}}/GKlib-METIS-v5.1.1-DistDGL-0.5' \
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/metis'
cmake --build ./build-metis/ --target install/${{env.INSTALL_TARGET_SUFFIX}}
mv '${{github.workspace}}/metis/lib/libmetis.lib' '${{github.workspace}}/metis/lib/metis.lib'
- name: Cache LAPACK
id: cache-lapack
uses: actions/cache@v3
with:
path: |
${{env.CCACHE_DIR}}
${{github.workspace}}/install
key: ${{matrix.msvc}}-lapack-3.11.0-${{matrix.build_type}}
- name: Download LAPACK
if: steps.cache-lapack.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.11.tar.gz
tar xvf v3.11.tar.gz
- name: Build LAPACK
if: steps.cache-lapack.outputs.cache-hit != 'true'
shell: msys2 {0}
run: |
cmake -S lapack-3.11 -B build_lapack_${{matrix.build_type}}/ \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \
-DCMAKE_GNUtoMS=ON \
-DCMAKE_INSTALL_PREFIX=./install \
-G Ninja
cmake --build build_lapack_${{matrix.build_type}}/ \
--config ${{matrix.build_type}} \
--target install/${{env.INSTALL_TARGET_SUFFIX}}
- name: Setup MSYS2 Environment
shell: msys2 {0}
run: |
echo "$(cygpath -m /${{matrix.sys}}/bin)" >> $GITHUB_PATH
- name: Setup Environment
run: |
echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "${{github.workspace}}/metis/lib" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "VERSION_SUFFIX=${{github.ref_name}}-${{matrix.marker}}-${{matrix.system}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}".replace('/', '-') | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Configure
run: |
cmake -S . -B build_${{matrix.build_type}}/ `
-A x64 `
-DBLAS_blas_LIBRARY=${{github.workspace}}/install/lib/libblas.lib `
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} `
-DCMAKE_Fortran_COMPILER= `
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install-suitesparse `
-DCMAKE_PREFIX_PATH=${{github.workspace}}/metis `
-DCMAKE_REQUIRE_FIND_PACKAGE_METIS=${{matrix.metis == 'metis'}} `
-DLAPACK_lapack_LIBRARY=${{github.workspace}}/install/lib/liblapack.lib `
-DWITH_FORTRAN=OFF `
-DWITH_GPL=${{matrix.components == 'gpl'}} `
-DWITH_LGPL=${{contains(matrix.components, 'gpl')}} `
-DWITH_METIS=${{matrix.metis == 'metis'}} `
-G "${{matrix.generator}}"
- name: Build
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}}
- name: Install
run: |
cmake --build build_${{matrix.build_type}}/ `
--config ${{matrix.build_type}} `
--target install
- name: Prepare Deployment
run: |
New-Item -ItemType "directory" -Path "${{github.workspace}}/deploy"
Copy-Item -Path "${{github.workspace}}/install/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force
Copy-Item -Path "${{github.workspace}}/install-suitesparse/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force
- name: Prepare METIS Deployment
if: matrix.metis == 'metis'
run: |
Copy-Item -Path "${{github.workspace}}/metis/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force
- name: Generate Archive
run: |
Compress-Archive -Path "${{github.workspace}}/deploy/*" -Destination "SuiteSparse-${{env.VERSION_SUFFIX}}.zip"
- uses: actions/upload-artifact@v3
with:
name: SuiteSparse-${{env.VERSION_SUFFIX}}
path: |
deploy/
- name: Deploy
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.lib == 'shared'
with:
files:
SuiteSparse-${{env.VERSION_SUFFIX}}.zip