-
Notifications
You must be signed in to change notification settings - Fork 136
132 lines (115 loc) · 5.09 KB
/
macos.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
name: MacOS
on: [push, pull_request]
env:
OPENCL_PKGCONFIG_PATHS: ${{ github.workspace }}/install/lib/pkgconfig:${{ github.workspace }}/external/OpenCL-Headers/install/share/pkgconfig
jobs:
macos-gcc:
#runs-on: macos-latest
runs-on: macos-11 # temporary, macos-latest only supports gcc-12
strategy:
matrix:
VER: [9, 10, 11]
EXT: [ON, OFF]
GEN: [Xcode, Ninja Multi-Config]
STD: [99, 11] # 90 results in errors
steps:
- name: Checkout OpenCL-ICD-Loader
uses: actions/checkout@v3
- name: Checkout OpenCL-Headers
uses: actions/checkout@v3
with:
repository: KhronosGroup/OpenCL-Headers
path: external/OpenCL-Headers
- name: Install gcc if required
run: |
if [[ ! `which /usr/local/bin/gcc-${{matrix.VER}}` ]]; then brew install gcc@${{matrix.VER}}; fi;
- 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: Build & install OpenCL-Headers
run: cmake
-G "${{matrix.GEN}}"
-D CMAKE_C_FLAGS="-w"
-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/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
--config Release
--parallel `sysctl -n hw.logicalcpu`
- name: Configure CMake
# no -Werror during configuration because:
# warning: ISO C forbids assignment between function pointer and ‘void *’ [-Wpedantic]
# warning: unused parameter [-Wunused-parameter]
shell: bash
run: cmake
-G "${{matrix.GEN}}"
-D BUILD_TESTING=ON
-D CMAKE_C_FLAGS="-Wall -Wextra -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
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/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 --parallel `sysctl -n hw.logicalcpu`
cmake --build $GITHUB_WORKSPACE/build --config Debug --parallel `sysctl -n hw.logicalcpu`
- name: Build (Ninja)
if: matrix.GEN == 'Ninja Multi-Config'
shell: bash
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-ICD-Loader/build
shell: bash
run: |
ctest -C Release --output-on-failure --parallel `sysctl -n hw.logicalcpu`
ctest -C Debug --output-on-failure --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: Test pkg-config --cflags
shell: bash
run: |
if [[ ! `which pkg-config` ]]; then brew install pkg-config; fi;
PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" pkg-config OpenCL --cflags | grep -q "\-I$GITHUB_WORKSPACE/external/OpenCL-Headers/install/include"
- name: Test pkg-config --libs
shell: bash
run: PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" pkg-config OpenCL --libs | grep -q "\-L$GITHUB_WORKSPACE/install/lib -lOpenCL"
- name: Consume pkg-config
shell: bash
run: PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" cmake
-G "${{matrix.GEN}}"
-D CMAKE_C_FLAGS="-Wall -Wextra -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 DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/Release/libOpenCLDriverStub.dylib
-B $GITHUB_WORKSPACE/build/downstream/pkgconfig
-S $GITHUB_WORKSPACE/test/pkgconfig/pkgconfig;
cmake --build $GITHUB_WORKSPACE/build/downstream/pkgconfig --config Release;
cmake --build $GITHUB_WORKSPACE/build/downstream/pkgconfig --config Debug;
cd $GITHUB_WORKSPACE/build/downstream/pkgconfig;
ctest --output-on-failure -C Release
ctest --output-on-failure -C Debug