-
Notifications
You must be signed in to change notification settings - Fork 61
362 lines (337 loc) · 17.9 KB
/
build-windows.yml
File metadata and controls
362 lines (337 loc) · 17.9 KB
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
name: build-windows
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
workflow_call:
env:
armadillo_version: 12.6.7
QWT_version: 6.1.6
openCV_version: 4.6.0
QT_version: 5.15.2
lapack_version: 3.11.0
mingw_version: 810
jobs:
cache-mingw-from-QT:
runs-on: windows-latest
steps:
# this will restore/cache everything in /Tools depending on cache hit/miss
- name: Cache minGW
id: cache-minGW
uses: actions/cache@v4
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
# all what follows is only run on cache miss
- name: install aqtinstall tool
if: steps.cache-minGW.outputs.cache-hit != 'true'
run: pip install aqtinstall
- name: install correct minGW version
if: steps.cache-minGW.outputs.cache-hit != 'true'
run: aqt install-tool windows desktop tools_mingw qt.tools.win64_mingw${{env.mingw_version}}
# path is Tools\mingw${{env.mingw_version}}_64\bin\
- name: install QT installer framework
if: steps.cache-minGW.outputs.cache-hit != 'true'
run: aqt install-tool windows desktop tools_ifw
# path is Tools\QtInstallerFramework\4.7\bin\
build-openCV-with-QT:
runs-on: windows-latest
needs: cache-mingw-from-QT
steps:
# this will restore/cache everything depending on cache hit/miss
- name: Cache QT and openCV
uses: actions/cache/@v4
id: cache-openCV-QT
with:
path: |
build_openCV\install\x64\mingw\bin\*.dll
build_openCV\install\include\*
${{env.QT_version}}\mingw81_64\bin\*
${{env.QT_version}}\mingw81_64\include\*
${{env.QT_version}}\mingw81_64\lib\*
${{env.QT_version}}\mingw81_64\mkspecs\*
${{env.QT_version}}\mingw81_64\plugins\platforms\*
${{env.QT_version}}\mingw81_64\plugins\imageformats\*
key: ${{ runner.os }}-openCV-${{env.openCV_version}}-QT-${{env.QT_version}}
# all what follows is only run on cache miss
# restore cached minGW
- uses: actions/cache/restore@v4
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
- name: install aqtinstall tool
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: pip install aqtinstall
- name: install QT
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: aqt install-qt windows desktop ${{env.QT_version}} win64_mingw81 -m qtcharts qtdatavis3d
- uses: actions/checkout@v4
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
with:
repository: 'opencv/opencv'
ref: '${{env.openCV_version}}'
path: './openCV'
- name: cmake generate
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: cmake -G "MinGW Makefiles" -S openCV -B build_openCV -D WITH_QT=ON -D WITH_OPENGL=ON -D Qt5_DIR=:./${{env.QT_version}}/mingw81_64/lib/cmake/Qt5
- name: cmake generate again
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: cmake -G "MinGW Makefiles" -S openCV -B build_openCV
- name: cmake build
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: cmake --build ./build_openCV -j4
- name: cmake install
if: steps.cache-openCV-QT.outputs.cache-hit != 'true'
run: cmake --install ./build_openCV
build-QWT:
runs-on: windows-latest
needs: cache-mingw-from-QT
steps:
# this will restore/cache everything depending on cache hit/miss
- name: cache QWT
uses: actions/cache/@v4
id: cache-QWT
with:
path: |
qwt-${{env.QWT_version}}\src
qwt-${{env.QWT_version}}\lib\*.dll
key: ${{ runner.os }}-QWT-${{env.QWT_version}}
# all what follows is only run on cache miss
# restore cached minGW
- uses: actions/cache/restore@v4
if: steps.cache-QWT.outputs.cache-hit != 'true'
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
if: steps.cache-QWT.outputs.cache-hit != 'true'
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
- name: install wget
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: choco install -y wget
- name: download QWT
if: steps.cache-QWT.outputs.cache-hit != 'true'
# I specified the mirror because one of the random mirrors did not work during my tests
run: wget -O qwt-${{env.QWT_version}}.zip https://sourceforge.net/projects/qwt/files/qwt/${{env.QWT_version}}/qwt-${{env.QWT_version}}.zip/download?use_mirror=pilotfiber
- name: extract archive
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: 7z x qwt-${{env.QWT_version}}.zip
- name: install aqtinstall tool
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: pip install aqtinstall
- name: install qmake
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: aqt install-qt windows desktop ${{env.QT_version}} win64_mingw81 --archives qtbase qtsvg
- name: qmake
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: cd qwt-${{env.QWT_version}} ; ..\${{env.QT_version}}\mingw81_64\bin\qmake.exe
- name: build
if: steps.cache-QWT.outputs.cache-hit != 'true'
run: cd qwt-${{env.QWT_version}} ; mingw32-make -j4
build-lapack-armadillo:
runs-on: windows-latest
needs: cache-mingw-from-QT
steps:
# this will restore/cache everything depending on cache hit/miss
- name: Cache lapack build
id: cache-lapack
uses: actions/cache@v4
with:
path: |
build_lapack\bin\liblapack.dll
build_lapack\bin\libblas.dll
build_armadillo\tmp\include
key: ${{ runner.os }}-lapack-${{env.lapack_version}}-armadillo-${{env.armadillo_version}}
# all what follows is only run on cache miss
# restore cached minGW
- uses: actions/cache/restore@v4
if: steps.cache-lapack.outputs.cache-hit != 'true'
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
if: steps.cache-lapack.outputs.cache-hit != 'true'
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
- uses: actions/checkout@v4
if: steps.cache-lapack.outputs.cache-hit != 'true'
with:
repository: 'Reference-LAPACK/lapack'
ref: 'v${{env.lapack_version}}'
path: './lapack'
# See https://github.com/Reference-LAPACK/lapack/issues/305 : CMAKE_SHARED_LINKER_FLAGS is fixing a build issue
- name: cmake generate
if: steps.cache-lapack.outputs.cache-hit != 'true'
run: cmake -G "MinGW Makefiles" -S lapack -B build_lapack -D BUILD_SHARED_LIBS=ON -D CMAKE_SHARED_LINKER_FLAGS="-Wl,--allow-multiple-definition"
- name: cmake build
if: steps.cache-lapack.outputs.cache-hit != 'true'
run: cmake --build ./build_lapack -j4
# now that Lapack is built, do the Armadillo build
- name: install wget
if: steps.cache-lapack.outputs.cache-hit != 'true'
run: choco install -y wget
- name: download armadillo
if: steps.cache-lapack.outputs.cache-hit != 'true'
# I specified the mirror because one of the random mirrors did not work during my tests
run: wget -O armadillo-${{env.armadillo_version}}.tar.xz http://sourceforge.net/projects/arma/files/armadillo-${{env.armadillo_version}}.tar.xz/download?use_mirror=versaweb
# Extract in two step. First step write to stdo and second step read from stdi.
# This avoids intermediate file creation
# It must run in CMD because powershell corrupts pipes
- name: extract archive
if: steps.cache-lapack.outputs.cache-hit != 'true'
run: 7z x -so armadillo-${{env.armadillo_version}}.tar.xz | 7z x -si -ttar
shell: cmd
# Armadillo relies on Lapack, it's important it knowns where it is during genration to be configured correctly
- name: cmake generate
if: steps.cache-lapack.outputs.cache-hit != 'true'
run: cmake -D CMAKE_PREFIX_PATH=${{github.workspace}}/build_lapack -G "MinGW Makefiles" -S armadillo-${{env.armadillo_version}} -B build_armadillo
- name: cmake build
if: steps.cache-lapack.outputs.cache-hit != 'true'
run: cmake --build ./build_armadillo -j4
build-DFTFringe:
runs-on: windows-latest
needs: [cache-mingw-from-QT, build-lapack-armadillo, build-QWT, build-openCV-with-QT]
steps:
# because problem matcher will not work when chechout in a subfolder,
# checkout at root and then copy everything in folder.
# Match will be done in build folder, and file at root will be used to link the match
# Note checkouting twice is not working.
# This copy is done before adding any more file into folders
- uses: actions/checkout@v4
# with:
# path: 'DFTFringe'
# copy all files for problem matcher to work
- name: copy files into build folder (problem matcher workaround)
run: |
mkdir ".\DFTFringe"
Copy-Item ".\*" -Destination ".\DFTFringe" -Exclude @("DFTFringe") -Recurse
# restore cached minGW
- uses: actions/cache/restore@v4
id: cache-minGW
with:
path: Tools
key: ${{ runner.os }}-mingw${{env.mingw_version}}_64
fail-on-cache-miss: true
- name: add minGW to path
shell: bash
run: echo "${{github.workspace}}\Tools\mingw${{env.mingw_version}}_64\bin" >> $GITHUB_PATH
# restore cached lapack and armadillo
- uses: actions/cache/restore@v4
id: cache-lapack
with:
path: |
build_lapack\bin\liblapack.dll
build_lapack\bin\libblas.dll
build_armadillo\tmp\include
key: ${{ runner.os }}-lapack-${{env.lapack_version}}-armadillo-${{env.armadillo_version}}
fail-on-cache-miss: true
# restore cached QWT
- uses: actions/cache/restore@v4
id: cache-QWT
with:
path: |
qwt-${{env.QWT_version}}\src
qwt-${{env.QWT_version}}\lib\*.dll
key: ${{ runner.os }}-QWT-${{env.QWT_version}}
fail-on-cache-miss: true
# restore cached openCV and QT
- uses: actions/cache/restore@v4
id: cache-openCV-QT
with:
path: |
build_openCV\install\x64\mingw\bin\*.dll
build_openCV\install\include\*
${{env.QT_version}}\mingw81_64\bin\*
${{env.QT_version}}\mingw81_64\include\*
${{env.QT_version}}\mingw81_64\lib\*
${{env.QT_version}}\mingw81_64\mkspecs\*
${{env.QT_version}}\mingw81_64\plugins\platforms\*
${{env.QT_version}}\mingw81_64\plugins\imageformats\*
key: ${{ runner.os }}-openCV-${{env.openCV_version}}-QT-${{env.QT_version}}
fail-on-cache-miss: true
# this enables the problem matcher
- uses: ammaraskar/gcc-problem-matcher@master
# Update the 2 strings automatically
# MY_AUTOMATED_VERSION_STRING
# MY_AUTOMATED_DATE_STRING
- name: Put release name into a variable (pull request)
if: ${{ github.event_name == 'pull_request' }}
# suffix will be c18a74e0f4f4db36eddc66a68eb08e91cd6c6a1c_5108ce7c3ac60bec1e0867bb10c4497db67e3606
# Because build is a merge commit, clearly identifies the PR commit and base commit
run: |
echo "WORKFLOW_VERSION=${{github.event.pull_request.head.sha}}_${{github.event.pull_request.base.sha}}" >> $env:GITHUB_ENV
- name: Put release name into a variable (tag)
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
# suffix will be tag like v1.2.3 or v1.0.0-beta+exp.sha.5114f8512 as long as it respects semver
run: |
echo "WORKFLOW_VERSION=${{github.ref_name}}" >> $env:GITHUB_ENV
- name: Put release name into a variable (single commit)
if: ${{ !startsWith(github.event.ref, 'refs/tags/v') && github.event_name != 'pull_request'}}
# suffix will be commit sha 5108ce7c3ac60bec1e0867bb10c4497db67e3606
run: |
echo "WORKFLOW_VERSION=${{github.sha}}" >> $env:GITHUB_ENV
- name: Find and Replace MY_AUTOMATED_VERSION_STRING
run: |
echo "${{env.WORKFLOW_VERSION}}"
(Get-Content DFTFringe/DFTFringeInstaller/config/config.xml).replace('MY_AUTOMATED_VERSION_STRING', '${{env.WORKFLOW_VERSION}}') | Set-Content DFTFringe/DFTFringeInstaller/config/config.xml
(Get-Content DFTFringe/DFTFringeInstaller/packages/com.githubdoe.DFTFringe/meta/package.xml).replace('MY_AUTOMATED_VERSION_STRING', '${{env.WORKFLOW_VERSION}}') | Set-Content DFTFringe/DFTFringeInstaller/packages/com.githubdoe.DFTFringe/meta/package.xml
(Get-Content DFTFringe/DFTFringe.pro).replace('MY_AUTOMATED_VERSION_STRING', '${{env.WORKFLOW_VERSION}}') | Set-Content DFTFringe/DFTFringe.pro
- name: Put current date into a variable
run: |
$NOW=& Get-Date -format yyyy-MM-dd
echo "NOW=$NOW" >> $env:GITHUB_ENV
- name: Find and Replace MY_AUTOMATED_DATE_STRING
run: |
echo "${{env.NOW}}"
(Get-Content DFTFringe/DFTFringeInstaller/packages/com.githubdoe.DFTFringe/meta/package.xml).replace('MY_AUTOMATED_DATE_STRING', '${{env.NOW}}') | Set-Content DFTFringe/DFTFringeInstaller/packages/com.githubdoe.DFTFringe/meta/package.xml
- run: cd DFTFringe ; ..\${{env.QT_version}}\mingw81_64\bin\qmake.exe
- run: echo "::add-matcher::.github/matcher/uic_matcher.json"
- run: cd DFTFringe ; mingw32-make -j4
- run: echo "::remove-matcher owner=uic-problem-matcher::"
- name: copy needed dlls not found by windeployqt
run: |
Copy-Item ".\DFTFringe\Release\DFTFringe.exe.debug" -Destination ".\"
mkdir ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\DFTFringe\Release\DFTFringe.exe" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_lapack\bin\liblapack.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_lapack\bin\libblas.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_calib3d460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_core460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_features2d460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_flann460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_highgui460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_imgcodecs460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\build_openCV\install\x64\mingw\bin\libopencv_imgproc460.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\qwt-${{env.QWT_version}}\lib\qwt.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\${{env.QT_version}}\mingw81_64\bin\Qt5OpenGL.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\tools\mingw${{env.mingw_version}}_64\bin\libquadmath-0.dll" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
Copy-Item ".\DFTFringe\ColorMaps" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\ColorMaps" -Recurse
mkdir ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\res"
Copy-Item ".\DFTFringe\res\surface_LeY_icon.ico" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\res"
Copy-Item ".\DFTFringe\res\help" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\res\help" -Recurse
Copy-Item ".\DFTFringe\RevisionHistory.html" -Destination ".\DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data"
- name: automatically add QT dependencies with windeployqt
run: .\${{env.QT_version}}\mingw81_64\bin\windeployqt.exe DFTFringe\DFTFringeInstaller\packages\com.githubdoe.DFTFringe\data\DFTFringe.exe
- name: make installer using QT installer framework
run: Tools\QtInstallerFramework\4.7\bin\binarycreator.exe -c DFTFringe\DFTFringeInstaller\config\config.xml -p DFTFringe\DFTFringeInstaller\packages DFTFringeInstaller_${{env.WORKFLOW_VERSION}}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: DFTFringe-windows-build-artifact
path: |
DFTFringeInstaller_${{env.WORKFLOW_VERSION}}.exe
DFTFringe.exe.debug