-
Notifications
You must be signed in to change notification settings - Fork 136
246 lines (224 loc) · 13.9 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
name: Windows
on: [push, pull_request]
jobs:
tools:
runs-on: windows-2022
strategy:
matrix:
CMAKE: [3.22.0]
NINJA: [1.10.2]
env:
CMAKE_URL: https://github.com/Kitware/CMake/releases/download/v${{matrix.CMAKE}}/cmake-${{matrix.CMAKE}}-windows-x86_64.zip
NINJA_URL: https://github.com/ninja-build/ninja/releases/download/v${{matrix.NINJA}}/ninja-win.zip
steps:
- name: Cache CMake
uses: actions/cache@v3
id: cmake
env:
cache-name: cache-cmake
with:
path: ~/Downloads/cmake-${{matrix.CMAKE}}-windows-x86_64.zip
key: ${{ runner.os }}-${{ env.cache-name }}-${{matrix.CMAKE}}
- name: Cache Ninja
uses: actions/cache@v3
id: ninja
env:
cache-name: cache-ninja
with:
path: ~/Downloads/ninja-win.zip
key: ${{ runner.os }}-${{ env.cache-name }}-${{matrix.NINJA}}
- name: Checkout CMake
if: steps.cmake.outputs.cache-hit != 'true'
shell: pwsh
run: Invoke-WebRequest ${env:CMAKE_URL} -OutFile ~\Downloads\cmake-${{matrix.CMAKE}}-windows-x86_64.zip
- name: Checkout Ninja
if: steps.ninja.outputs.cache-hit != 'true'
shell: pwsh
run: Invoke-WebRequest ${env:NINJA_URL} -OutFile ~\Downloads\ninja-win.zip
msvc:
needs: [tools]
runs-on: windows-2022
strategy:
matrix:
VER: [v141, v142, v143]
EXT: [ON, OFF]
GEN: [Visual Studio 17 2022, Ninja Multi-Config]
BIN: [x64, x86]
STD: [90, 11, 17]
CMAKE: [3.22.0]
NINJA: [1.10.2]
env:
CMAKE_EXE: C:\Tools\Kitware\CMake\${{matrix.CMAKE}}\bin\cmake.exe
CTEST_EXE: C:\Tools\Kitware\CMake\${{matrix.CMAKE}}\bin\ctest.exe
NINJA_EXE: C:\Tools\Ninja\ninja.exe
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: Restore CMake
uses: actions/cache@v3
id: cmake
env:
cache-name: cache-cmake
with:
path: ~/Downloads/cmake-${{matrix.CMAKE}}-windows-x86_64.zip
key: ${{ runner.os }}-${{ env.cache-name }}-${{matrix.CMAKE}}
- name: Restore Ninja
uses: actions/cache@v3
id: ninja
env:
cache-name: cache-ninja
with:
path: ~/Downloads/ninja-win.zip
key: ${{ runner.os }}-${{ env.cache-name }}-${{matrix.NINJA}}
- name: Create Build Environment
shell: pwsh
run: |
Expand-Archive ~\Downloads\cmake-${{matrix.CMAKE}}-windows-x86_64.zip -DestinationPath C:\Tools\Kitware\CMake\
Rename-Item C:\Tools\Kitware\CMake\* ${{matrix.CMAKE}}
Expand-Archive ~\Downloads\ninja-win.zip -DestinationPath C:\Tools\Ninja\
& ${env:CMAKE_EXE} --version
& ${env:NINJA_EXE} --version
- name: Build & install OpenCL-Headers (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
shell: cmd
run: |
set C_FLAGS="/W4 /WX"
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
%CMAKE_EXE% -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D CMAKE_C_FLAGS=%C_FLAGS% -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_EXE% --build %GITHUB_WORKSPACE%/external/OpenCL-Headers/build --target install --config Release -- /verbosity:minimal /maxCpuCount /noLogo
- name: Build & install OpenCL-Headers (Ninja Multi-Config)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
run: |
set C_FLAGS="/W4 /WX"
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.VER}}"=="v143" (set VER=14.3)
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
%CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D CMAKE_C_FLAGS=%C_FLAGS% -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_EXE% --build %GITHUB_WORKSPACE%/external/OpenCL-Headers/build --target install -- -j%NUMBER_OF_PROCESSORS%
- name: Configure (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
shell: cmd
# no /WX during configuration because:
# warning C4459: declaration of 'platform' hides global declaration
# warning C4100: 'input_headers': unreferenced formal parameter
run: |
set C_FLAGS="/W4"
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
%CMAKE_EXE% -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -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: Configure (Ninja Multi-Config)
if: matrix.GEN == 'Ninja Multi-Config'
shell: cmd
# no /WX during configuration because:
# warning C4459: declaration of 'platform' hides global declaration
# warning C4100: 'input_headers': unreferenced formal parameter
run: |
set C_FLAGS="/W4"
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.VER}}"=="v143" (set VER=14.3)
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
%CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -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 (MSBuild)
if: matrix.GEN == 'Visual Studio 17 2022'
shell: cmd
run: |
%CMAKE_EXE% --build %GITHUB_WORKSPACE%\build --config Release -- /verbosity:minimal /maxCpuCount /noLogo
%CMAKE_EXE% --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
if /I "${{matrix.VER}}"=="v143" set VER=14.3
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
%CMAKE_EXE% --build %GITHUB_WORKSPACE%\build --config Release
%CMAKE_EXE% --build %GITHUB_WORKSPACE%\build --config Debug
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-ICD-Loader/build
shell: cmd
run: |
if /I "${{matrix.BIN}}"=="x64" set REG=reg
if /I "${{matrix.BIN}}"=="x86" set REG=%systemroot%\Syswow64\reg.exe
%REG% ADD HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors /v %GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll /t REG_DWORD /d 0
%CTEST_EXE% -C Release --output-on-failure --parallel %NUMBER_OF_PROCESSORS%
if errorlevel 1 (
exit /b %errorlevel%
)
%REG% DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors /v %GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll /f
%REG% ADD HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors /v %GITHUB_WORKSPACE%/build/Debug/OpenCLDriverStub.dll /t REG_DWORD /d 0
%CTEST_EXE% -C Debug --output-on-failure --parallel %NUMBER_OF_PROCESSORS%
if errorlevel 1 (
exit /b %errorlevel%
)
%REG% DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors /v %GITHUB_WORKSPACE%/build/Debug/OpenCLDriverStub.dll /f
- name: Install
shell: cmd
run: |
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/build --config Release --target install
- name: "Consume (MSBuild standalone): Configure/Build/Test"
shell: cmd
run: |
set C_FLAGS="/W4"
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
%CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\install" -D DRIVER_STUB_PATH=%GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll -B %GITHUB_WORKSPACE%/build/downstream/bare -S %GITHUB_WORKSPACE%/test/pkgconfig/bare
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/test/pkgconfig/bare --config Release
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/test/pkgconfig/bare --config Debug
cd %GITHUB_WORKSPACE%/test/pkgconfig/bare
%CTEST_EXE% --output-on-failure -C Release
%CTEST_EXE% --output-on-failure -C Debug
- name: "Consume (MSBuild SDK): Configure/Build/Test"
shell: cmd
run: |
set C_FLAGS="/W4"
if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64)
%CMAKE_EXE% -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL
echo -e 'include("/home/runner/work/OpenCL-ICD-Loader/OpenCL-ICD-Loader/external/OpenCL-Headers/install/share/cmake/OpenCLHeaders/OpenCLHeadersTargets.cmake")\ninclude("${CMAKE_CURRENT_LIST_DIR}/../OpenCLICDLoader/OpenCLICDLoaderTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake
%CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\install" -D DRIVER_STUB_PATH=%GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll -B %GITHUB_WORKSPACE%/build/downstream/bare -S %GITHUB_WORKSPACE%/test/pkgconfig/bare
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/test/pkgconfig/bare --config Release
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/test/pkgconfig/bare --config Debug
cd %GITHUB_WORKSPACE%/test/pkgconfig/bare
%CTEST_EXE% --output-on-failure -C Release
%CTEST_EXE% --output-on-failure -C Debug
- name: "Consume (Ninja-Multi-Config standalone): Configure/Build/Test"
shell: cmd
run: |
set C_FLAGS="/W4"
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.VER}}"=="v143" (set VER=14.3)
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER%
%CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\install" -D DRIVER_STUB_PATH=%GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll -B %GITHUB_WORKSPACE%/build/downstream/bare -S %GITHUB_WORKSPACE%/test/pkgconfig/bare
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/test/pkgconfig/bare --config Release
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/test/pkgconfig/bare --config Debug
cd %GITHUB_WORKSPACE%/test/pkgconfig/bare
%CTEST_EXE% --output-on-failure -C Release
%CTEST_EXE% --output-on-failure -C Debug
- name: "Consume (Ninja-Multi-Config SDK): Configure/Build/Test"
shell: cmd
run: |
set C_FLAGS="/W4"
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.VER}}"=="v143" (set VER=14.3)
%CMAKE_EXE% -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL
echo -e 'include("/home/runner/work/OpenCL-ICD-Loader/OpenCL-ICD-Loader/external/OpenCL-Headers/install/share/cmake/OpenCLHeaders/OpenCLHeadersTargets.cmake")\ninclude("${CMAKE_CURRENT_LIST_DIR}/../OpenCLICDLoader/OpenCLICDLoaderTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake
%CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\install" -D DRIVER_STUB_PATH=%GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll -B %GITHUB_WORKSPACE%/build/downstream/bare -S %GITHUB_WORKSPACE%/test/pkgconfig/bare
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/test/pkgconfig/bare --config Release
%CMAKE_EXE% --build %GITHUB_WORKSPACE%/test/pkgconfig/bare --config Debug
cd %GITHUB_WORKSPACE%/test/pkgconfig/bare
%CTEST_EXE% --output-on-failure -C Release
%CTEST_EXE% --output-on-failure -C Debug