forked from KhronosGroup/OpenCL-Headers
-
Notifications
You must be signed in to change notification settings - Fork 0
363 lines (318 loc) · 15.5 KB
/
cmake.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
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
363
name: Build
on: [push, pull_request]
jobs:
linux-gcc:
runs-on: ubuntu-18.04
strategy:
matrix:
#VER: [7, 8, 9]
VER: [7, 9] # gcc-8 is not installed on the Ubuntu 18.04 image
EXT: [ON, OFF]
GEN: [Unix Makefiles, Ninja]
VAR: [Debug, Release]
STD: [99, 11] # 90 results in errors
BIN: [32, 64]
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
run: sudo apt-get update -q;
cmake -E make_directory $GITHUB_WORKSPACE/build;
cmake -E make_directory $GITHUB_WORKSPACE/install;
cmake -E make_directory $GITHUB_WORKSPACE/downstream/pkgconfig/bare;
cmake -E make_directory $GITHUB_WORKSPACE/downstream/pkgconfig/sdk;
if [[ "${{matrix.GEN}}" == "Ninja" && ! `which ninja` ]]; then sudo apt install -y ninja-build; fi;
if [[ "${{matrix.BIN}}" == "32" ]]; then sudo apt install -y gcc-multilib gcc-8-multilib gcc-9-multilib; fi
# Install Ninja only if it's the selected generator and it's not available.
- name: Configure CMake
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_BUILD_TYPE=${{matrix.VAR}}
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}"
-D CMAKE_C_COMPILER=gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build
- name: Build
shell: bash
run: cmake
--build $GITHUB_WORKSPACE/build
--
-j`nproc`
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-Headers/build
shell: bash
run: ctest --parallel `nproc`
- name: Install
shell: bash
run: cmake
--build $GITHUB_WORKSPACE/build
--target install
--
-j`nproc`
- name: Consume (Configure PkgConfig - bare)
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_BUILD_TYPE=${{matrix.VAR}}
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}"
-D CMAKE_C_COMPILER=gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/bare
-B $GITHUB_WORKSPACE/downstream/pkgconfig/bare
- name: Consume (Build PkgConfig - bare)
shell: bash
run: cmake
--build $GITHUB_WORKSPACE/downstream/pkgconfig/bare
--
-j`nproc`
- name: Consume (Emulate SDK presence)
shell: bash
run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL;
echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake
- name: Consume (Configure PkgConfig - SDK)
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_BUILD_TYPE=${{matrix.VAR}}
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}"
-D CMAKE_C_COMPILER=gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/sdk
-B $GITHUB_WORKSPACE/downstream/pkgconfig/sdk
- name: Consume (Build PkgConfig - SDK)
shell: bash
run: cmake
--build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk
--
-j`nproc`
windows-msvc:
runs-on: windows-latest
strategy:
matrix:
VER: [v140, v141, v142]
EXT: [ON, OFF]
GEN: [Visual Studio 16 2019, Ninja Multi-Config]
BIN: [x64, x86]
#STD Proper 11, 17 incoming: https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
shell: cmd
run: |
cmake -E make_directory $GITHUB_WORKSPACE/build;
cmake -E make_directory $GITHUB_WORKSPACE/install;
- name: Configure (MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%/build
- name: Configure (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" (set VER=14.0)
if /I "${{matrix.VER}}"=="v141" (set VER=14.1)
if /I "${{matrix.VER}}"=="v142" (set VER=14.2)
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%/build
- name: Build (MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
cmake --build %GITHUB_WORKSPACE%\build --config Release -- /verbosity:minimal /maxCpuCount /noLogo
cmake --build %GITHUB_WORKSPACE%\build --config Debug -- /verbosity:minimal /maxCpuCount /noLogo
- name: Build (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" set VER=14.0
if /I "${{matrix.VER}}"=="v141" set VER=14.1
if /I "${{matrix.VER}}"=="v142" set VER=14.2
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake --build %GITHUB_WORKSPACE%\build --config Release
cmake --build %GITHUB_WORKSPACE%\build --config Debug
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-Headers/build
shell: cmd
run: |
ctest -C Release --parallel %NUMBER_OF_PROCESSORS%
- name: Install
shell: cmd
run: |
cmake --build %GITHUB_WORKSPACE%/build --config Release --target install
- name: Consume (Configure PkgConfig - bare MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\bare -B %GITHUB_WORKSPACE%\downstream\pkgconfig\bare
- name: Consume (Configure PkgConfig - bare Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" (set VER=14.0)
if /I "${{matrix.VER}}"=="v141" (set VER=14.1)
if /I "${{matrix.VER}}"=="v142" (set VER=14.2)
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\bare -B %GITHUB_WORKSPACE%\downstream\pkgconfig\bare
- name: Consume (Build PkgConfig - bare MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Release -- /verbosity:minimal /maxCpuCount /noLogo
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Debug -- /verbosity:minimal /maxCpuCount /noLogo
- name: Consume (Build PkgConfig - bare Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" set VER=14.0
if /I "${{matrix.VER}}"=="v141" set VER=14.1
if /I "${{matrix.VER}}"=="v142" set VER=14.2
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Release
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Debug
- name: Consume (Emulate SDK presence)
shell: bash
run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL;
echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake
- name: Consume (Configure PkgConfig - SDK MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\sdk -B %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk
- name: Consume (Configure PkgConfig - SDK Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" (set VER=14.0)
if /I "${{matrix.VER}}"=="v141" (set VER=14.1)
if /I "${{matrix.VER}}"=="v142" (set VER=14.2)
if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001")
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\sdk -B %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk
- name: Consume (Build PkgConfig - SDK MSBuild)
if: matrix.GEN == 'Visual Studio 16 2019'
shell: cmd
run: |
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Release -- /verbosity:minimal /maxCpuCount /noLogo
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Debug -- /verbosity:minimal /maxCpuCount /noLogo
- name: Consume (Build PkgConfig - SDK Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
if /I "${{matrix.VER}}"=="v140" set VER=14.0
if /I "${{matrix.VER}}"=="v141" set VER=14.1
if /I "${{matrix.VER}}"=="v142" set VER=14.2
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Release
cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Debug
macos-gcc:
runs-on: macos-latest
strategy:
matrix:
VER: [8, 9]
EXT: [ON, OFF]
#GEN: [Xcode, Ninja Multi-Config]
GEN: [Xcode] # Disabling Ninja - need to investigate setup-ninja?
STD: [99, 11] # 90 results in errors
steps:
- uses: actions/checkout@v2
- name: Create Build Environment
run: |
cmake -E make_directory $GITHUB_WORKSPACE/build;
cmake -E make_directory $GITHUB_WORKSPACE/install;
if [[ "${{matrix.GEN}}" == "Ninja Multi-Config" && ! `which ninja` ]]; then brew install ninja; fi;
# Install Ninja only if it's the selected generator and it's not available.
- name: Configure CMake
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format"
-D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build
- name: Build (Xcode)
if: matrix.GEN == 'Xcode'
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release
cmake --build $GITHUB_WORKSPACE/build --config Debug
- name: Build (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release
cmake --build $GITHUB_WORKSPACE/build --config Debug
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-Headers/build
shell: bash
run: ctest -C Release --parallel `sysctl -n hw.logicalcpu`
- name: Install (Xcode)
if: matrix.GEN == 'Xcode'
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target install
- name: Install (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target install
- name: Consume (Configure PkgConfig - bare)
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format"
-D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/bare
-B $GITHUB_WORKSPACE/downstream/pkgconfig/bare
- name: Consume (Build PkgConfig - bare)
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/bare --config Release
cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/bare --config Debug
- name: Consume (Emulate SDK presence)
shell: bash
run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL;
echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake
- name: Consume (Configure PkgConfig - SDK)
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format"
-D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}}
-D CMAKE_C_STANDARD=${{matrix.STD}}
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}}
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/sdk
-B $GITHUB_WORKSPACE/downstream/pkgconfig/sdk
- name: Consume (Build PkgConfig - SDK)
shell: bash
run: |
cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk --config Release
cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk --config Debug