-
Notifications
You must be signed in to change notification settings - Fork 130
860 lines (798 loc) · 35.4 KB
/
presubmit.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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
name: Presubmit
on: [push, pull_request]
jobs:
linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
CMAKE: [3.26.4]
COMPILER:
- C_NAME: gcc
CXX_NAME: g++
VER: 11
- C_NAME: gcc
CXX_NAME: g++
VER: 13
- C_NAME: clang
CXX_NAME: clang++
VER: 14
- C_NAME: clang
CXX_NAME: clang++
VER: 16
BIN: [64]
CXXSTD: [11, 17]
CONF:
- GEN: Unix Makefiles
CONFIG: Debug
- GEN: Unix Makefiles
CONFIG: Release
- GEN: Ninja Multi-Config
CONFIG: Release
IMAGE:
- khronosgroup/docker-images:opencl-sdk-base-ubuntu-22.04.20230717
include:
- CMAKE: system
COMPILER:
C_NAME: gcc
CXX_NAME: g++
VER: 9
BIN: 64
CXXSTD: 11
CONF:
GEN: Unix Makefiles
CONFIG: Debug
IMAGE: khronosgroup/docker-images:opencl-sdk-base-ubuntu-20.04.20230717
- CMAKE: system
COMPILER:
C_NAME: gcc
CXX_NAME: g++
VER: 9
BIN: 64
CXXSTD: 11
CONF:
GEN: Unix Makefiles
CONFIG: Release
IMAGE: khronosgroup/docker-images:opencl-sdk-base-ubuntu-20.04.20230717
- CMAKE: system
COMPILER:
C_NAME: gcc
CXX_NAME: g++
VER: 9
BIN: 32
CXXSTD: 11
CONF:
GEN: Unix Makefiles
CONFIG: Debug
IMAGE: khronosgroup/docker-images:opencl-sdk-base-ubuntu-20.04.20230717
- CMAKE: system
COMPILER:
C_NAME: gcc
CXX_NAME: g++
VER: 9
BIN: 32
CXXSTD: 11
CONF:
GEN: Unix Makefiles
CONFIG: Release
IMAGE: khronosgroup/docker-images:opencl-sdk-base-ubuntu-20.04.20230717
container: ${{matrix.IMAGE}}
env:
CMAKE_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/cmake
CPACK_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/cpack
CTEST_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/ctest
DEB_INSTALLATION_PATH: /usr
CC: ${{matrix.COMPILER.C_NAME}}-${{matrix.COMPILER.VER}}
CXX: ${{matrix.COMPILER.CXX_NAME}}-${{matrix.COMPILER.VER}}
CFLAGS: -Wall -Wextra -pedantic -Werror -m${{matrix.BIN}}
CXXFLAGS: -Wall -Wextra -pedantic -Werror -m${{matrix.BIN}}
steps:
- name: Install system CMake
if: ${{matrix.CMAKE}} == 'system'
run: apt-get update -qq && apt-get install -y cmake &&
echo "CMAKE_EXE=cmake" >> "$GITHUB_ENV" &&
echo "CPACK_EXE=cpack" >> "$GITHUB_ENV" &&
echo "CTEST_EXE=ctest" >> "$GITHUB_ENV"
- name: Checkout OpenCL-CLHPP
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout OpenCL-Headers
uses: actions/checkout@v4
with:
path: external/OpenCL-Headers
repository: KhronosGroup/OpenCL-Headers
- name: Checkout OpenCL-ICD-Loader
uses: actions/checkout@v4
with:
path: external/OpenCL-ICD-Loader
repository: KhronosGroup/OpenCL-ICD-Loader
- name: Configure, install & package OpenCL-Headers
run: $CMAKE_EXE
-G "${{matrix.CONF.GEN}}"
`if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi`
-D CMAKE_C_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-Headers/install
-D CPACK_PACKAGING_INSTALL_PREFIX=$DEB_INSTALLATION_PATH
-D BUILD_TESTING=OFF
-S $GITHUB_WORKSPACE/external/OpenCL-Headers
-B $GITHUB_WORKSPACE/external/OpenCL-Headers/build &&
$CMAKE_EXE
--build $GITHUB_WORKSPACE/external/OpenCL-Headers/build
--target install
--parallel `nproc` &&
$CPACK_EXE
--config "$GITHUB_WORKSPACE/external/OpenCL-Headers/build/CPackConfig.cmake"
-G DEB
-C ${{matrix.CONF.CONFIG}}
-B "$GITHUB_WORKSPACE/external/OpenCL-Headers/package-deb"
- name: Configure & install OpenCL-ICD-Loader
run: $CMAKE_EXE
-G "${{matrix.CONF.GEN}}"
`if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi`
-D CMAKE_C_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/install
-D BUILD_TESTING=OFF
-S $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader
-B $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/build &&
$CMAKE_EXE
--build $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/build
--target install
--parallel `nproc`
- name: Configure
run: $CMAKE_EXE
-G "${{matrix.CONF.GEN}}"
-D BUILD_TESTING=ON
-D BUILD_EXAMPLES=ON
`if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi`
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}}
-D CMAKE_CXX_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-D CPACK_PACKAGING_INSTALL_PREFIX=$DEB_INSTALLATION_PATH
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install"
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build
- name: Build
run: if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]];
then
$CMAKE_EXE --build $GITHUB_WORKSPACE/build --config ${{matrix.CONF.CONFIG}} --parallel `nproc`;
else
$CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Debug;
$CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Release;
fi
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-CLHPP/build
run: if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]];
then
$CTEST_EXE --output-on-failure --no-tests=error --parallel `nproc`;
else
$CTEST_EXE --output-on-failure --no-tests=error -C Debug --parallel `nproc`;
$CTEST_EXE --output-on-failure --no-tests=error -C Release --parallel `nproc`;
fi
- name: Package DEB
run: $CPACK_EXE
--config "$GITHUB_WORKSPACE/build/CPackConfig.cmake"
-G DEB
-C ${{matrix.CONF.CONFIG}}
-B "$GITHUB_WORKSPACE/package-deb"
- name: Consume (DEB)
run: dpkg -i $GITHUB_WORKSPACE/external/OpenCL-Headers/package-deb/*.deb &&
dpkg -i $GITHUB_WORKSPACE/package-deb/*.deb &&
$CMAKE_EXE
-G "${{matrix.CONF.GEN}}"
`if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi`
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}}
-D CMAKE_CXX_EXTENSIONS=OFF
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install
-S $GITHUB_WORKSPACE/tests/pkgconfig/bare
-B $GITHUB_WORKSPACE/build_package &&
if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]];
then
$CMAKE_EXE --build $GITHUB_WORKSPACE/build_package --config ${{matrix.CONF.CONFIG}} --parallel `nproc`;
else
$CMAKE_EXE --build $GITHUB_WORKSPACE/build_package --config Debug;
$CMAKE_EXE --build $GITHUB_WORKSPACE/build_package --config Release;
fi
- name: Run consume test (DEB)
if: matrix.BIN != 32
working-directory: ${{runner.workspace}}/OpenCL-CLHPP/build_package
run: if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]];
then
$CTEST_EXE -C ${{matrix.CONF.CONFIG}} --output-on-failure --no-tests=error --parallel `nproc`;
else
$CTEST_EXE -C Debug --output-on-failure --no-tests=error --parallel `nproc`;
$CTEST_EXE -C Release --output-on-failure --no-tests=error --parallel `nproc`;
fi
- name: Test pkg-config (DEB)
# /usr/include is already on the include search path,
# we don't expect any output
run: |
# First check if OpenCL-Headers is locatable
pkg-config OpenCL-CLHPP --cflags
# Then check if the output is empty
if [[ "$(pkg-config OpenCL-CLHPP --cflags)" ]];
then
exit 1;
fi;
- name: Uninstall (DEB)
run: apt-get remove -y opencl-c-headers opencl-clhpp-headers
- name: Test install
run: $CMAKE_EXE --build $GITHUB_WORKSPACE/build --target install --config ${{matrix.CONF.CONFIG}} --parallel `nproc`
- name: Consume (install)
run: $CMAKE_EXE
-G "${{matrix.CONF.GEN}}"
`if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]]; then echo "-D CMAKE_BUILD_TYPE=${{matrix.CONF.CONFIG}}"; fi`
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install;$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/install"
-S $GITHUB_WORKSPACE/tests/pkgconfig/bare
-B $GITHUB_WORKSPACE/build_install &&
if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]];
then
$CMAKE_EXE --build $GITHUB_WORKSPACE/build_install --parallel `nproc`;
else
$CMAKE_EXE --build $GITHUB_WORKSPACE/build_install --config Debug;
$CMAKE_EXE --build $GITHUB_WORKSPACE/build_install --config Release;
fi
- name: Run consume test (install)
if: matrix.BIN != 32
working-directory: ${{runner.workspace}}/OpenCL-CLHPP/build_install
run: if [[ "${{matrix.CONF.GEN}}" == "Unix Makefiles" ]];
then
$CTEST_EXE -C ${{matrix.CONF.CONFIG}} --output-on-failure --no-tests=error --parallel `nproc`;
else
$CTEST_EXE -C Debug --output-on-failure --no-tests=error --parallel `nproc`;
$CTEST_EXE -C Release --output-on-failure --no-tests=error --parallel `nproc`;
fi
- name: Test pkg-config (install)
run: PKG_CONFIG_PATH=$GITHUB_WORKSPACE/install/share/pkgconfig:$GITHUB_WORKSPACE/external/OpenCL-Headers/install/share/pkgconfig
pkg-config OpenCL-CLHPP --cflags | grep -q "\-I$GITHUB_WORKSPACE/install/include"
windows:
runs-on: windows-latest
defaults:
run:
shell: pwsh
strategy:
matrix:
VER: [v142, v143, clangcl]
GEN: [Visual Studio 17 2022, Ninja Multi-Config]
BIN: [x64]
CXXSTD: [11, 17]
exclude:
- VER: clangcl
GEN: Ninja Multi-Config
include:
- VER: v142
GEN: Visual Studio 17 2022
BIN: x86
CXXSTD: 11
env:
NINJA_URL: https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip
NINJA_ROOT: C:\Tools\Ninja
VS_ROOT: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise'
UseMultiToolTask: true # Better parallel MSBuild execution
EnforceProcessCountAcrossBuilds: 'true' # -=-
MultiProcMaxCount: '3' # -=-
# C4152: nonstandard extension, function/data pointer conversion in expression
# C4201: nonstandard extension used: nameless struct/union
# C4310: cast truncates constant value
CFLAGS: /W4 /WX /wd4152 /wd4201 /wd4310
CXXFLAGS: /W4 /WX
steps:
- name: Cache Ninja install
if: matrix.GEN == 'Ninja Multi-Config'
id: ninja-install
uses: actions/cache@v4
with:
path: |
C:\Tools\Ninja
key: ${{runner.os}}-ninja-${{env.NINJA_URL}}
- name: Install Ninja
if: matrix.GEN == 'Ninja Multi-Config' && steps.ninja-install.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest ${env:NINJA_URL} -OutFile ~\Downloads\ninja-win.zip
Expand-Archive ~\Downloads\ninja-win.zip -DestinationPath ${env:NINJA_ROOT}\
Remove-Item ~\Downloads\*
- name: Checkout OpenCL-CLHPP
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout OpenCL-Headers
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-Headers
path: external/OpenCL-Headers
- name: Checkout OpenCL-ICD-Loader
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-ICD-Loader
path: external/OpenCL-ICD-Loader
- name: Build & install OpenCL-Headers (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
run: |
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
& cmake `
-G '${{matrix.GEN}}' `
-A $BIN `
-T ${{matrix.VER}} `
-D BUILD_TESTING=OFF `
-D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install `
-S ${env:GITHUB_WORKSPACE}\external\OpenCL-Headers `
-B ${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\build
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-Headers failed." }
& cmake `
--build "${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\build" `
--target install `
--config Release `
-- `
/verbosity:minimal `
/maxCpuCount `
/noLogo
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-Headers failed." }
- name: Build & install OpenCL-Headers (Ninja Multi-Config)
if: matrix.GEN == 'Ninja Multi-Config'
run: |
$VER = switch ('${{matrix.VER}}') { `
'v142' {'14.2'} `
'v143' {'14.4'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER"
& cmake `
-G '${{matrix.GEN}}' `
-D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" `
-D BUILD_TESTING=OFF `
-D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install `
-S ${env:GITHUB_WORKSPACE}\external\OpenCL-Headers `
-B ${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\build
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-Headers failed." }
& cmake `
--build "${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\build" `
--target install `
--config Release
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-Headers failed." }
- name: Build & install OpenCL-ICD-Loader (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
run: |
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
& cmake `
-G '${{matrix.GEN}}' `
-A $BIN `
-T ${{matrix.VER}} `
-D BUILD_TESTING=OFF `
-D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\install `
-D CMAKE_PREFIX_PATH=${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install `
-S ${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader `
-B ${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\build
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-ICD-Loader failed." }
& cmake `
--build "${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\build" `
--target install `
--config Release `
-- `
/verbosity:minimal `
/maxCpuCount `
/noLogo
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-ICD-Loader failed." }
- name: Build & install OpenCL-ICD-Loader (Ninja Multi-Config)
if: matrix.GEN == 'Ninja Multi-Config'
run: |
$VER = switch ('${{matrix.VER}}') { `
'v142' {'14.2'} `
'v143' {'14.4'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER"
& cmake `
-G '${{matrix.GEN}}' `
-D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" `
-D BUILD_TESTING=OFF `
-D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\install `
-D CMAKE_PREFIX_PATH=${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install `
-S ${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader `
-B ${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\build
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-ICD-Loader failed." }
& cmake `
--build "${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\build" `
--target install `
--config Release
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-ICD-Loader failed." }
- name: Configure (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
run: |
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
& cmake `
-G '${{matrix.GEN}}' `
-A $BIN `
-T ${{matrix.VER}} `
-D BUILD_TESTING=ON `
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}} `
-D CMAKE_CXX_EXTENSIONS=OFF `
-D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\install `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\install" `
-S ${env:GITHUB_WORKSPACE} `
-B ${env:GITHUB_WORKSPACE}\build
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-CLHPP failed." }
- name: Configure (Ninja Multi-Config)
if: matrix.GEN == 'Ninja Multi-Config'
run: |
$VER = switch ('${{matrix.VER}}') { `
'v142' {'14.2'} `
'v143' {'14.4'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER"
& cmake `
-G '${{matrix.GEN}}' `
-D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" `
-D BUILD_TESTING=ON `
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}} `
-D CMAKE_CXX_EXTENSIONS=OFF `
-D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL `
-D CMAKE_INSTALL_PREFIX=${env:GITHUB_WORKSPACE}\install `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\install" `
-S ${env:GITHUB_WORKSPACE} `
-B ${env:GITHUB_WORKSPACE}\build
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-CLHPP failed." }
- name: Build (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
run: |
foreach ($Config in 'Release','Debug') {
& cmake `
--build "${env:GITHUB_WORKSPACE}\build" `
--config ${Config} `
-- `
/verbosity:minimal `
/maxCpuCount `
/noLogo
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-CLHPP in $Config failed." }
}
- name: Build (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
run: |
$VER = switch ('${{matrix.VER}}') { `
'v142' {'14.2'} `
'v143' {'14.4'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER"
foreach ($Config in 'Release','Debug') {
& cmake `
--build "${env:GITHUB_WORKSPACE}\build" `
--config ${Config}
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-CLHPP in $Config failed." }
}
- name: Test
run: |
foreach ($Config in 'Release','Debug') {
& ctest `
--test-dir "${env:GITHUB_WORKSPACE}\build" `
--build-config ${Config} `
--output-on-failure `
--no-tests=error `
--parallel ${env:NUMBER_OF_PROCESSORS}
if ($LASTEXITCODE -ne 0) { throw "Testing OpenCL-CLHPP in $Config failed." }
}
- name: Install
run: |
& cmake `
--install "${env:GITHUB_WORKSPACE}\build" `
--prefix "${env:GITHUB_WORKSPACE}\install" `
--config Release
if ($LASTEXITCODE -ne 0) { throw "Installing OpenCL-CLHPP failed." }
- name: "Consume (MSBuild standalone): Configure/Build/Test"
if: matrix.GEN == 'Visual Studio 17 2022'
run: |
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
& cmake `
-G '${{matrix.GEN}}' `
-A ${BIN} `
-T ${{matrix.VER}} `
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}} `
-D CMAKE_CXX_EXTENSIONS=OFF `
-D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\install;${env:GITHUB_WORKSPACE}\install" `
-S "${env:GITHUB_WORKSPACE}\tests\pkgconfig\bare" `
-B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare"
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-CLHPP standalone consume test failed." }
foreach ($Config in 'Release','Debug') {
& cmake `
--build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare" `
--config ${Config}
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-CLHPP standalone consume test in $Config failed." }
& cd ${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare
& ctest --output-on-failure --no-tests=error -C ${Config}
if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-CLHPP standalone consume test in $Config failed." }
}
- name: "Consume (Ninja-Multi-Config standalone): Configure/Build/Test"
if: matrix.GEN == 'Ninja Multi-Config'
run: |
$VER = switch ('${{matrix.VER}}') { `
'v142' {'14.2'} `
'v143' {'14.4'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=$VER"
& cmake `
-G '${{matrix.GEN}}' `
-D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" `
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}} `
-D CMAKE_CXX_EXTENSIONS=OFF `
-D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\install;${env:GITHUB_WORKSPACE}\install" `
-S "${env:GITHUB_WORKSPACE}\tests\pkgconfig\bare" `
-B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare"
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-CLHPP standalone consume test failed." }
foreach ($Config in 'Release','Debug') {
& cmake `
--build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare" `
--config ${Config}
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-CLHPP standalone consume test in $Config failed." }
& cd ${env:GITHUB_WORKSPACE}\downstream\pkgconfig\bare
& ctest --output-on-failure --no-tests=error -C ${Config}
if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-CLHPP standalone consume test in $Config failed." }
}
- name: Consume (Emulate SDK presence)
run: |
New-Item -Type Directory -Path ${env:GITHUB_WORKSPACE}\install\share\cmake\OpenCL
$workspace = ${env:GITHUB_WORKSPACE}.replace("\", "/")
New-Item -Type File -Path ${env:GITHUB_WORKSPACE}\install\share\cmake\OpenCL\OpenCLConfig.cmake -Value "include(`"$workspace/external/OpenCL-Headers/install/share/cmake/OpenCLHeaders/OpenCLHeadersTargets.cmake`")`r`ninclude(`"$workspace/external/OpenCL-ICD-Loader/install/share/cmake/OpenCLICDLoader/OpenCLICDLoaderTargets.cmake`")`r`ninclude(`"`${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeadersCpp/OpenCLHeadersCppTargets.cmake`")"
- name: "Consume (MSBuild SDK): Configure/Build/Test"
if: matrix.GEN == 'Visual Studio 17 2022'
run: |
$BIN = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
& cmake `
-G '${{matrix.GEN}}' `
-A ${BIN} `
-T ${{matrix.VER}} `
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}} `
-D CMAKE_CXX_EXTENSIONS=OFF `
-D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\install;${env:GITHUB_WORKSPACE}\install" `
-S "${env:GITHUB_WORKSPACE}\tests\pkgconfig\sdk" `
-B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk"
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-CLHPP in-SDK consume test failed." }
foreach ($Config in 'Release','Debug') {
& cmake `
--build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk" `
--config ${Config}
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-CLHPP in-SDK consume test in $Config failed." }
& cd ${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk
& ctest --output-on-failure --no-tests=error -C ${Config}
if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-CLHPP in-SDK consume test in $Config failed." }
}
- name: "Consume (Ninja-Multi-Config SDK): Configure/Build/Test"
if: matrix.GEN == 'Ninja Multi-Config'
run: |
$VER = switch ('${{matrix.VER}}') { `
'v142' {'14.2'} `
'v143' {'14.4'} }
Import-Module "${env:VS_ROOT}\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath ${env:VS_ROOT} -SkipAutomaticLocation -DevCmdArguments "-host_arch=x64 -arch=${{matrix.BIN}} -vcvars_ver=${VER}"
& cmake `
-G '${{matrix.GEN}}' `
-D CMAKE_MAKE_PROGRAM="${env:NINJA_ROOT}\ninja.exe" `
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}} `
-D CMAKE_CXX_EXTENSIONS=OFF `
-D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL `
-D CMAKE_PREFIX_PATH="${env:GITHUB_WORKSPACE}\external\OpenCL-Headers\install;${env:GITHUB_WORKSPACE}\external\OpenCL-ICD-Loader\install;${env:GITHUB_WORKSPACE}\install" `
-S "${env:GITHUB_WORKSPACE}\tests\pkgconfig\sdk" `
-B "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk"
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-CLHPP in-SDK consume test failed." }
foreach ($Config in 'Release','Debug') { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk" `
--config ${Config}
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-CLHPP in-SDK consume test in $Config failed." }
& cd ${env:GITHUB_WORKSPACE}\downstream\pkgconfig\sdk
& ctest --output-on-failure --no-tests=error -C ${Config}
if ($LASTEXITCODE -ne 0) { throw "Running OpenCL-CLHPP in-SDK consume test in $Config failed." }
}
macos:
runs-on: macos-latest
defaults:
run:
shell: bash
strategy:
matrix:
COMPILER:
- C_NAME: /usr/bin/clang
CXX_NAME: /usr/bin/clang++
# Disabled due to problems with __has_cpp_attribute
# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114007
#- C_NAME: gcc-11
# CXX_NAME: g++-11
# Disabled due to problems with the __API_AVAILABLE macro
# - C_NAME: gcc-13
# CXX_NAME: g++-13
# # A workaround for a bug in the toolset
# # See https://forums.developer.apple.com/forums/thread/737707
# EXTRA_FLAGS: -Wl,-ld_classic
GEN:
- Xcode
- Ninja Multi-Config
CXXSTD: [11, 17]
exclude:
# These entries are excluded, since XCode selects its own compiler
- COMPILER:
C_NAME: gcc-11
CXX_NAME: g++-11
GEN: Xcode
- COMPILER:
C_NAME: gcc-13
CXX_NAME: g++-13
GEN: Xcode
env:
CC: ${{matrix.COMPILER.C_NAME}}
CXX: ${{matrix.COMPILER.CXX_NAME}}
CFLAGS: -Wall -Wextra -pedantic -Wno-format -Werror ${{matrix.COMPILER.EXTRA_FLAGS}}
CXXFLAGS: -Wall -Wextra -pedantic -Wno-format -Werror ${{matrix.COMPILER.EXTRA_FLAGS}}
steps:
- name: Checkout OpenCL-CLHPP
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout OpenCL-Headers
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-Headers
path: external/OpenCL-Headers
- name: Checkout OpenCL-ICD-Loader
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-ICD-Loader
path: external/OpenCL-ICD-Loader
- name: Create Build Environment
run: |
# Install Ninja only if it's the selected generator and it's not available.
if [[ "${{matrix.GEN}}" == "Ninja Multi-Config" && ! `which ninja` ]]; then brew install ninja; fi &&
if [[ ! `which pkg-config` ]]; then brew install pkg-config; fi;
cmake --version
- name: Build & install OpenCL-Headers
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=OFF
-D CMAKE_C_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-Headers/install
-S $GITHUB_WORKSPACE/external/OpenCL-Headers
-B $GITHUB_WORKSPACE/external/OpenCL-Headers/build &&
cmake
--build $GITHUB_WORKSPACE/external/OpenCL-Headers/build
--target install
--config Release
--parallel `sysctl -n hw.logicalcpu`
- name: Build & install OpenCL-ICD-Loader
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=OFF
-D CMAKE_C_EXTENSIONS=OFF
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/install
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install
-S $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader
-B $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/build &&
cmake
--build $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/build
--target install
--config Release
--parallel `sysctl -n hw.logicalcpu`
- name: Configure
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}}
-D CMAKE_CXX_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install"
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build
- name: Build
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --parallel `sysctl -n hw.logicalcpu`
cmake --build $GITHUB_WORKSPACE/build --config Debug --parallel `sysctl -n hw.logicalcpu`
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-CLHPP/build
run: |
ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`
ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`
- name: Test install
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target install
- name: Consume (install)
run: cmake
-G "${{matrix.GEN}}"
-D CMAKE_CXX_STANDARD=${{matrix.CXXSTD}}
-D CMAKE_CXX_EXTENSIONS=OFF
-D CMAKE_CXX_STANDARD_REQUIRED=ON
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install;$GITHUB_WORKSPACE/install"
-S $GITHUB_WORKSPACE/tests/pkgconfig/bare
-B $GITHUB_WORKSPACE/build_install &&
cmake --build $GITHUB_WORKSPACE/build_install --config Release --parallel `sysctl -n hw.logicalcpu` &&
cmake --build $GITHUB_WORKSPACE/build_install --config Debug --parallel `sysctl -n hw.logicalcpu` &&
cd $GITHUB_WORKSPACE/build_install &&
ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` &&
ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`
- name: Test pkg-config
run: |
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/install/share/pkgconfig:$GITHUB_WORKSPACE/external/OpenCL-Headers/install/share/pkgconfig:$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install/lib/pkgconfig
pkg-config OpenCL-CLHPP --cflags | grep -q "\-I$GITHUB_WORKSPACE/install/include"
- name: Test pkg-config dependency
run: |
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/install/share/pkgconfig:$GITHUB_WORKSPACE/external/OpenCL-Headers/install/share/pkgconfig:$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install/lib/pkgconfig
pkg-config OpenCL-CLHPP --cflags | grep -q "\-I$GITHUB_WORKSPACE/external/OpenCL-Headers/install/include"
android:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
ABI:
- arm64-v8a
- x86_64
API_LEVEL:
- android-19
- android-33
CONFIG:
- Debug
- Release
env:
CFLAGS: -Wall -Wextra -pedantic -Werror
CXXFLAGS: -Wall -Wextra -pedantic -Werror
steps:
- name: Checkout OpenCL-CLHPP
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout OpenCL-Headers
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-Headers
path: external/OpenCL-Headers
- name: Checkout OpenCL-ICD-Loader
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-ICD-Loader
path: external/OpenCL-ICD-Loader
- name: Configure & install OpenCL-Headers
run: cmake
-G "Unix Makefiles"
-D CMAKE_BUILD_TYPE=${{matrix.CONFIG}}
-D CMAKE_C_EXTENSIONS=OFF
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-Headers/install
-D BUILD_TESTING=OFF
-S $GITHUB_WORKSPACE/external/OpenCL-Headers
-B $GITHUB_WORKSPACE/external/OpenCL-Headers/build &&
cmake
--build $GITHUB_WORKSPACE/external/OpenCL-Headers/build
--target install
--
-j`nproc`
- name: Configure & install OpenCL-ICD-Loader
run: cmake
-G "Unix Makefiles"
-D CMAKE_BUILD_TYPE=${{matrix.CONFIG}}
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install
-D BUILD_TESTING=ON
-D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake
-D ANDROID_ABI=${{matrix.ABI}}
-D ANDROID_PLATFORM=${{matrix.API_LEVEL}}
-D CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY
-D CMAKE_FIND_ROOT_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/install
-S $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader
-B $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/build &&
sudo cmake
--build $GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/build
--target install
--
-j`nproc`
- name: Configure
run: cmake
-G "Unix Makefiles"
-D BUILD_TESTING=ON
-D BUILD_EXAMPLES=ON
-D CMAKE_BUILD_TYPE=${{matrix.CONFIG}}
-D CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake
-D ANDROID_ABI=${{matrix.ABI}}
-D ANDROID_PLATFORM=${{matrix.API_LEVEL}}
-D CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY
-D CMAKE_FIND_ROOT_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/external/OpenCL-ICD-Loader/install"
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build
- name: Build
run: cmake --build $GITHUB_WORKSPACE/build -j `nproc`