Skip to content

Commit dbcae2c

Browse files
mfepBeanavil
andauthored
Update CI, CD (#88)
* Add DEB packaging * Update check-format script * Android build in CI * Add linux CI * Remove the C headers, C++ headers and loader from the SDK deb package * Submodules update * Add Windows CI job * Add MacOS CI job * Unify C/C++ standards * Fix warnings and errors gcc * Fix warnings and errors clang * Fix multi-config * Fix MacOS errors * Fix Windows errors * Install Windows OpenCL runtime * Fix blur/blurcpp samples failures * Fix MacOS test execution * Fixed blur/blucpp OpenCL 2.0 check * Various minor improvements * Updated release scripts * Building and packaging clinfo * Minor fixes and improvements * Removed ToDos * Updated RELEASE.md * Removed _get_platform(cl_platform_id platform) from mako * Fixed resource release bug in binaries sample * Remove null pointer checks * Re-added whereami * Using upstream main for OpenCL-Headers submodule * Bump deprecated actions * Removed MSVC++ v141 jobs * Whereami workaround * fix(ci): Fetch a newer version of SFML, update patch * fix(ci): Set up OSX architecture * fix(binaries): Sample lang in binary name * fix(ci): Fixed system deps in Linux builds * Update docker images * Fix MSVC compiler toolset version * Removed OpenCL 2.0 check and cl_khr_subgroups from blur sample * Fixed compiler options being reset * Bumped version of pocl * Updated submodules' repository URL --------- Co-authored-by: Beatriz Navidad Vilches <beatriz@streamhpc.com>
1 parent 3410509 commit dbcae2c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1669
-253
lines changed

.github/workflows/presubmit.yml

+756-77
Large diffs are not rendered by default.

.github/workflows/release.yml

+127-36
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,26 @@ name: Create Release
88
jobs:
99
windows-binary:
1010
runs-on: windows-2022
11+
defaults:
12+
run:
13+
shell: pwsh
1114
strategy:
1215
matrix:
1316
VER: [v143]
1417
GEN: [Visual Studio 17 2022]
1518
BIN: [x64, x86]
16-
19+
env:
20+
UseMultiToolTask: true
21+
EnforceProcessCountAcrossBuilds: true
22+
MultiProcMaxCount: 3
1723
steps:
1824
- name: Checkout OpenCL-SDK
19-
uses: actions/checkout@v2
20-
21-
- name: Initialize git submodules
22-
shell: pwsh
23-
run: |
24-
& git submodule init
25-
& git submodule update
26-
27-
- name: Create Build Environment
28-
shell: pwsh
29-
run: |
30-
# Parallelize MSBuild across projects
31-
[Environment]::SetEnvironmentVariable('UseMultiToolTask', 'true', [EnvironmentVariableTarget]::User)
32-
[Environment]::SetEnvironmentVariable('EnforceProcessCountAcrossBuilds', 'true', [EnvironmentVariableTarget]::User)
33-
[Environment]::SetEnvironmentVariable('MultiProcMaxCount', "$env:NUMBER_OF_PROCESSORS", [EnvironmentVariableTarget]::User)
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
submodules: recursive
3429

3530
- name: Configure
36-
shell: pwsh
3731
run: |
3832
$Bin = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
3933
& cmake `
@@ -42,15 +36,16 @@ jobs:
4236
-T ${{matrix.VER}} `
4337
-S "${env:GITHUB_WORKSPACE}" `
4438
-B "${env:GITHUB_WORKSPACE}\build" `
39+
-D CMAKE_INSTALL_PREFIX="${env:GITHUB_WORKSPACE}\install" `
4540
-D BUILD_DOCS=OFF `
4641
-D BUILD_TESTING=OFF `
4742
-D BUILD_EXAMPLES=OFF `
4843
-D OPENCL_SDK_BUILD_SAMPLES=OFF `
4944
-D OPENCL_ICD_LOADER_BUILD_TESTING=OFF `
5045
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW
46+
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }
5147
5248
- name: Check version number
53-
shell: pwsh
5449
run: |
5550
if ( -not (`
5651
Get-Content ${env:GITHUB_WORKSPACE}\build\CMakeCache.txt | `
@@ -59,30 +54,29 @@ jobs:
5954
{ throw 'CMake project version mismatches Git tag name (without leading "v")'}
6055
6156
- name: Build
62-
shell: pwsh
6357
run: |
6458
foreach ($Config in "Debug","Release") { `
6559
& cmake `
6660
--build "${env:GITHUB_WORKSPACE}\build" `
6761
--config $Config `
6862
-- `
6963
/verbosity:minimal `
70-
/noLogo `
64+
/noLogo
65+
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-SDK in $Config failed." }
7166
}
72-
67+
7368
- name: Package Binary
74-
shell: pwsh
7569
run: |
7670
& cpack `
7771
--config "${env:GITHUB_WORKSPACE}\build\CPackConfig.cmake" `
7872
-G ZIP `
7973
-C 'Debug;Release' `
8074
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Win-${{matrix.BIN}}' `
8175
-B "${env:GITHUB_WORKSPACE}\package"
76+
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK failed." }
8277
8378
- name: Upload Package
8479
uses: softprops/action-gh-release@v1
85-
if: startsWith(github.ref, 'refs/tags/')
8680
with:
8781
draft: true
8882
files: |
@@ -91,22 +85,24 @@ jobs:
9185
source:
9286
name: Source Release (${{ matrix.os }})
9387
runs-on: ${{ matrix.os }}
88+
defaults:
89+
run:
90+
shell: pwsh
9491
strategy:
9592
matrix:
9693
OS: [ubuntu-20.04, windows-2022]
9794

95+
env:
96+
DEB_INSTALLATION_PATH: /usr
97+
9898
steps:
9999
- name: Checkout OpenCL-SDK
100-
uses: actions/checkout@v2
101-
102-
- name: Initialize git submodules
103-
shell: pwsh
104-
run: |
105-
& git submodule init
106-
& git submodule update
100+
uses: actions/checkout@v4
101+
with:
102+
fetch-depth: 0
103+
submodules: recursive
107104

108105
- name: Configure
109-
shell: pwsh
110106
run: |
111107
& cmake `
112108
-S "${env:GITHUB_WORKSPACE}" `
@@ -116,19 +112,29 @@ jobs:
116112
-D BUILD_EXAMPLES=OFF `
117113
-D OPENCL_SDK_BUILD_SAMPLES=OFF `
118114
-D OPENCL_ICD_LOADER_BUILD_TESTING=OFF `
119-
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW
115+
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW `
116+
-D CPACK_PACKAGING_INSTALL_PREFIX=$DEB_INSTALLATION_PATH
117+
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }
120118
121119
- name: Check version number
122-
shell: pwsh
123120
run: |
124121
if ( -not (`
125122
Get-Content ${env:GITHUB_WORKSPACE}/build/CMakeCache.txt | `
126123
Select-String -Pattern ('CMAKE_PROJECT_VERSION:STATIC=' + '${{github.ref_name}}'.Replace('v','')) `
127124
)) `
128125
{ throw 'CMake project version mismatches Git tag name (without leading "v")'}
129126
127+
- name: Package DEB
128+
if: ${{ contains(matrix.OS, 'ubuntu') }}
129+
run: |
130+
cpack `
131+
--config "${env:GITHUB_WORKSPACE}/build/CPackSourceConfig.cmake" `
132+
-G DEB `
133+
-C Release `
134+
"${env:GITHUB_WORKSPACE}/package-deb"
135+
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK deb failed." }
136+
130137
- name: Package Source
131-
shell: pwsh
132138
run: |
133139
$Generator = if('${{matrix.OS}}' -match 'windows') {'ZIP'} else {'TGZ'}
134140
& cpack `
@@ -138,11 +144,96 @@ jobs:
138144
-D CPACK_SOURCE_IGNORE_FILES="/\\.git/;/\\.gitignore;/\\.gitmodules;/\\.gitlab/;/\\.github/;/\\.reuse/;/\\.appveyor.yml;/build/;/install/;/package/" `
139145
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Source' `
140146
-B "${env:GITHUB_WORKSPACE}/package"
147+
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK source failed." }
141148
142149
- name: Release Source
143150
uses: softprops/action-gh-release@v1
144-
if: startsWith(github.ref, 'refs/tags/')
145151
with:
146152
draft: true
147153
files: |
148-
package/OpenCL-SDK-${{github.ref_name}}-Source.*
154+
package/OpenCL-SDK-${{github.ref_name}}-Source.*
155+
156+
ppa:
157+
runs-on: ubuntu-latest
158+
defaults:
159+
run:
160+
shell: bash
161+
env:
162+
OPENCL_HEADERS_REPOSITORY: mfep/OpenCL-Headers
163+
OPENCL_ICD_LOADER_REPOSITORY: mfep/OpenCL-ICD-Loader
164+
OPENCL_CLHPP_REPOSITORY: mfep/OpenCL-CLHPP
165+
distroseries: jammy
166+
steps:
167+
- name: Add PPA
168+
run: sudo add-apt-repository -y ppa:${{ vars.PPA }}
169+
170+
- name: Install prerequisites
171+
run: sudo apt-get update -qq && sudo apt-get install -y
172+
cmake
173+
devscripts
174+
debhelper-compat=13
175+
opencl-c-headers
176+
opencl-clhpp-headers
177+
khronos-opencl-loader-libopencl1
178+
khronos-opencl-loader-opencl-dev
179+
clinfo
180+
181+
- name: Import GPG signing key
182+
run: echo "${{ secrets.DEB_SIGNING_KEY }}" | gpg --import
183+
184+
- name: Download and extract source code (OpenCL-SDK)
185+
run: |
186+
wget -O $GITHUB_WORKSPACE/source.orig.tar.gz https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
187+
tar -xvf $GITHUB_WORKSPACE/source.orig.tar.gz -C $GITHUB_WORKSPACE
188+
mv $GITHUB_WORKSPACE/OpenCL-SDK-* $GITHUB_WORKSPACE/OpenCL-SDK
189+
190+
- name: Download and extract source code (OpenCL-Headers)
191+
run: |
192+
wget -O $GITHUB_WORKSPACE/opencl-headers.tar.gz https://github.com/$OPENCL_HEADERS_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
193+
tar -xvf $GITHUB_WORKSPACE/opencl-headers.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
194+
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers
195+
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers
196+
197+
- name: Download and extract source code (OpenCL-ICD-Loader)
198+
run: |
199+
wget -O $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz https://github.com/$OPENCL_ICD_LOADER_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
200+
tar -xvf $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
201+
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader
202+
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader
203+
204+
- name: Download and extract source code (OpenCL-CLHPP)
205+
run: |
206+
wget -O $GITHUB_WORKSPACE/opencl-clhpp.tar.gz https://github.com/$OPENCL_CLHPP_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
207+
tar -xvf $GITHUB_WORKSPACE/opencl-clhpp.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
208+
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP
209+
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP
210+
211+
- name: Configure project out-of-tree
212+
run: cmake
213+
-S $GITHUB_WORKSPACE/OpenCL-SDK*
214+
-B $GITHUB_WORKSPACE/../build
215+
-D CMAKE_BUILD_TYPE=Release
216+
-D CMAKE_INSTALL_PREFIX=/usr
217+
-D BUILD_TESTING=OFF
218+
-D OPENCL_SDK_BUILD_SAMPLES=OFF
219+
-D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME
220+
-D CPACK_DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}"
221+
-D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }}
222+
223+
- name: Generate packaging scripts
224+
run: cmake
225+
-D CMAKE_CACHE_PATH=$GITHUB_WORKSPACE/../build/CMakeCache.txt
226+
-D ORIG_ARCHIVE=$GITHUB_WORKSPACE/source.orig.tar.gz
227+
-D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME
228+
-D DEBIAN_DISTROSERIES=${{ env.distroseries }}
229+
-D DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}"
230+
-D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }}
231+
-P $GITHUB_WORKSPACE/OpenCL-SDK*/cmake/DebSourcePkg.cmake
232+
233+
- name: Build source package
234+
run: |
235+
cd $GITHUB_WORKSPACE/OpenCL-SDK*/
236+
debuild -S -sa
237+
238+
- name: Push source package to the PPA
239+
run: dput ppa:${{ vars.PPA }} $GITHUB_WORKSPACE/*source.changes

.gitignore

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1-
build/
2-
install/
1+
# Build dir
2+
[Bb]uild/
3+
4+
# Install dir
5+
[Ii]nstall/
6+
7+
# Package dirs
8+
[Pp]ackage/
9+
[Pp]ackage-deb/
10+
11+
# Cmake
12+
CMakeFiles/
313

414
# vim
515
*~

CMakeLists.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.0)
15+
cmake_minimum_required(VERSION 3.16)
1616

1717
set(CMAKE_CXX_STANDARD 14)
1818

@@ -28,6 +28,11 @@ cmake_dependent_option(OPENCL_SDK_BUILD_SAMPLES "Build sample code" ON OPENCL_SD
2828
cmake_dependent_option(OPENCL_SDK_BUILD_OPENGL_SAMPLES "Build OpenCL-OpenGL interop sample code" ON OPENCL_SDK_BUILD_SAMPLES OFF)
2929
cmake_dependent_option(OPENCL_SDK_TEST_SAMPLES "Add CTest to samples (where applicable)" ON OPENCL_SDK_BUILD_SAMPLES OFF)
3030

31+
option(OPENCL_SDK_BUILD_CLINFO "Build clinfo utility" ON)
32+
if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
33+
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libstdc++")
34+
endif()
35+
3136
include(CTest)
3237

3338
if (NOT CMAKE_BUILD_TYPE)
@@ -48,6 +53,7 @@ list(APPEND CMAKE_MODULE_PATH
4853
${PROJECT_SOURCE_DIR}/cmake/Modules
4954
)
5055
include(Dependencies)
56+
include(Package)
5157
if(OPENCL_SDK_BUILD_UTILITY_LIBRARIES)
5258
add_subdirectory(lib)
5359
endif()
@@ -71,6 +77,7 @@ set(config_package_location ${CMAKE_INSTALL_DATADIR}/cmake/OpenCL)
7177
install(
7278
FILES ${PROJECT_BINARY_DIR}/OpenCL/OpenCLConfig.cmake
7379
DESTINATION ${config_package_location}
80+
COMPONENT binary
7481
)
7582

7683
unset(CMAKE_SIZEOF_VOID_P)
@@ -83,6 +90,7 @@ write_basic_package_version_file(
8390
install(
8491
FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenCL/OpenCLConfigVersion.cmake
8592
DESTINATION ${config_package_location}
93+
COMPONENT binary
8694
)
8795

8896
include(CPack)

0 commit comments

Comments
 (0)