Skip to content

Commit

Permalink
Minor fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mfep committed Oct 16, 2023
1 parent aef5172 commit bd5f0fa
Show file tree
Hide file tree
Showing 10 changed files with 143 additions and 162 deletions.
197 changes: 83 additions & 114 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,11 @@ jobs:
$CTEST_EXE -C Release --output-on-failure --no-tests=error --parallel `nproc`;
fi

- name: Run clinfo (DEB)
run: clinfo

- name: Uninstall (DEB)
# ToDo: khronos-opencl-loader*
run: apt-get remove -y "ocl-icd*" opencl-c-headers opencl-clhpp-headers opencl-sdk
run: apt-get remove -y "khronos-opencl-loader*" opencl-c-headers opencl-clhpp-headers opencl-sdk clinfo

- name: Test install
run: $CMAKE_EXE
Expand Down Expand Up @@ -623,16 +625,6 @@ jobs:
shell: bash
strategy:
matrix:
COMPILER:
- C_NAME: /usr/bin/clang
CXX_NAME: /usr/bin/clang++
EXCLUSIVE_C_FLAGS: -Wno-conditional-uninitialized
- C_NAME: /usr/local/bin/gcc-11
CXX_NAME: /usr/local/bin/g++-11
EXCLUSIVE_C_FLAGS: -Wno-maybe-uninitialized
- C_NAME: /usr/local/bin/gcc-13
CXX_NAME: /usr/local/bin/g++-13
EXCLUSIVE_C_FLAGS: -Wno-maybe-uninitialized
GEN:
- Xcode
- Ninja Multi-Config
Expand All @@ -645,114 +637,91 @@ jobs:
CXX: 14
- C: 17
CXX: 17
exclude:
# These entries are excluded, since XCode selects its own compiler
- COMPILER:
C_NAME: /usr/local/bin/gcc-11
CXX_NAME: /usr/local/bin/g++-11
EXCLUSIVE_C_FLAGS: -Wno-maybe-uninitialized
GEN: Xcode
- COMPILER:
C_NAME: /usr/local/bin/gcc-13
CXX_NAME: /usr/local/bin/g++-13
EXCLUSIVE_C_FLAGS: -Wno-maybe-uninitialized
GEN: Xcode
# The gnu binaries are not compatible with the Homebrew installed binaries
- COMPILER:
C_NAME: /usr/local/bin/gcc-11
CXX_NAME: /usr/local/bin/g++-11
EXCLUSIVE_C_FLAGS: -Wno-maybe-uninitialized
DEPS: system
- COMPILER:
C_NAME: /usr/local/bin/gcc-13
CXX_NAME: /usr/local/bin/g++-13
EXCLUSIVE_C_FLAGS: -Wno-maybe-uninitialized
DEPS: system
env:
CC: ${{matrix.COMPILER.C_NAME}}
CXX: ${{matrix.COMPILER.CXX_NAME}}
CC: /usr/bin/clang
CXX: /usr/bin/clang++
steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Checkout OpenCL-SDK
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive

- 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 &&
# We need to provide an OpenCL driver for Intel CPU on mac
brew install pocl
cmake --version
- name: Install dependencies (Homebrew)
if: matrix.DEPS == 'system'
run: brew install tclap glm glew sfml mesa-glu

- name: Install dependencies (vcpkg)
if: matrix.DEPS == 'vcpkg'
run: |
git clone https://github.com/Microsoft/vcpkg.git vcpkg
./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg install tclap glm glew sfml stb
- 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 &&
# We need to provide an OpenCL driver for Intel CPU on mac
brew install pocl
cmake --version
- name: Set up compiler flags
run: |
# Not using -pedantic: error: ISO C forbids braced-groups within expressions
# The flags
# * -Wno-missing-field-initializers
# * matrix.COMPILER.EXCLUSIVE_C_FLAGS
# have been added because of Std compilation errors
echo "CFLAGS=-Wall -Wextra -Werror -Wno-missing-field-initializers ${{ matrix.COMPILER.EXCLUSIVE_C_FLAGS }}" >> $GITHUB_ENV;
# The flags
# * -Wno-deprecated-declarations
# * -Wno-missing-field-initializers
# have been added because of Std compilation errors
echo "CXXFLAGS=-Wall -Wextra -pedantic -Wno-format -Werror -Wno-missing-field-initializers -Wno-deprecated-declarations" >> $GITHUB_ENV;
- name: Configure
run: cmake
-G "${{matrix.GEN}}"
`if [[ "${{matrix.DEPS}}" == "vcpkg" ]]; then echo "-D CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake"; fi`
-D BUILD_DOCS=ON
-D BUILD_TESTING=ON
-D BUILD_EXAMPLES=ON
-D OPENCL_SDK_BUILD_SAMPLES=ON
-D CMAKE_C_STANDARD=${{matrix.STD.C}}
-D CMAKE_CXX_STANDARD=${{matrix.STD.CXX}}
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build

- name: Build
run: |
cmake --build $GITHUB_WORKSPACE/build --config Debug --parallel `sysctl -n hw.logicalcpu`
cmake --build $GITHUB_WORKSPACE/build --config Release --parallel `sysctl -n hw.logicalcpu`
- name: Install dependencies (Homebrew)
if: matrix.DEPS == 'system'
run: brew install tclap glm glew sfml mesa-glu

- name: Test
working-directory: ${{runner.workspace}}/OpenCL-SDK/build
run: |
OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`
OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`
- name: Install dependencies (vcpkg)
if: matrix.DEPS == 'vcpkg'
run: |
git clone https://github.com/Microsoft/vcpkg.git vcpkg
./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg install tclap glm glew sfml stb
- name: Install
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target install
- name: Consume (install)
run: cmake
-G "${{matrix.GEN}}"
-D CMAKE_C_STANDARD=${{matrix.STD.C}}
-D CMAKE_CXX_STANDARD=${{matrix.STD.CXX}}
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/install"
-S $GITHUB_WORKSPACE/test/cmake/pkgconfig/useutil
-B $GITHUB_WORKSPACE/build_install &&
cmake --build $GITHUB_WORKSPACE/build_install --config Debug --parallel `sysctl -n hw.logicalcpu` &&
cmake --build $GITHUB_WORKSPACE/build_install --config Release --parallel `sysctl -n hw.logicalcpu` &&
cd $GITHUB_WORKSPACE/build_install &&
OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` &&
OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`
- name: Set up compiler flags
run: |
# Not using -pedantic: error: ISO C forbids braced-groups within expressions
# The flags
# * -Wno-missing-field-initializers
# * -Wno-conditional-uninitialized
# have been added because of Std compilation errors
echo "CFLAGS=-Wall -Wextra -Werror -Wno-missing-field-initializers -Wno-conditional-uninitialized" >> $GITHUB_ENV;
# The flags
# * -Wno-deprecated-declarations
# * -Wno-missing-field-initializers
# have been added because of Std compilation errors
echo "CXXFLAGS=-Wall -Wextra -pedantic -Wno-format -Werror -Wno-missing-field-initializers -Wno-deprecated-declarations" >> $GITHUB_ENV;
- name: Configure
run: cmake
-G "${{matrix.GEN}}"
`if [[ "${{matrix.DEPS}}" == "vcpkg" ]]; then echo "-D CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake"; fi`
-D BUILD_DOCS=ON
-D BUILD_TESTING=ON
-D BUILD_EXAMPLES=ON
-D OPENCL_SDK_BUILD_SAMPLES=ON
-D CMAKE_C_STANDARD=${{matrix.STD.C}}
-D CMAKE_CXX_STANDARD=${{matrix.STD.CXX}}
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install
-S $GITHUB_WORKSPACE
-B $GITHUB_WORKSPACE/build

- name: Build
run: |
cmake --build $GITHUB_WORKSPACE/build --config Debug --parallel `sysctl -n hw.logicalcpu`
cmake --build $GITHUB_WORKSPACE/build --config Release --parallel `sysctl -n hw.logicalcpu`
- name: Test
working-directory: ${{runner.workspace}}/OpenCL-SDK/build
run: |
OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`
OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`
- name: Install
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target install
- name: Consume (install)
run: cmake
-G "${{matrix.GEN}}"
-D CMAKE_C_STANDARD=${{matrix.STD.C}}
-D CMAKE_CXX_STANDARD=${{matrix.STD.CXX}}
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/install"
-S $GITHUB_WORKSPACE/test/cmake/pkgconfig/useutil
-B $GITHUB_WORKSPACE/build_install &&
cmake --build $GITHUB_WORKSPACE/build_install --config Debug --parallel `sysctl -n hw.logicalcpu` &&
cmake --build $GITHUB_WORKSPACE/build_install --config Release --parallel `sysctl -n hw.logicalcpu` &&
cd $GITHUB_WORKSPACE/build_install &&
OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors ctest -C Debug --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu` &&
OCL_ICD_VENDORS=/usr/local/etc/OpenCL/vendors ctest -C Release --output-on-failure --no-tests=error --parallel `sysctl -n hw.logicalcpu`

python:
name: Exercise Python examples on ${{matrix.os}}
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ name: Create Release

jobs:
windows-binary:
if: false
runs-on: windows-2022
defaults:
run:
Expand Down Expand Up @@ -84,7 +83,6 @@ jobs:
package/OpenCL-SDK-${{github.ref_name}}-Win-${{matrix.BIN}}.zip
source:
if: false
name: Source Release (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
Expand Down Expand Up @@ -178,6 +176,7 @@ jobs:
opencl-clhpp-headers
khronos-opencl-loader-libopencl1
khronos-opencl-loader-opencl-dev
clinfo

- name: Import GPG signing key
run: echo "${{ secrets.DEB_SIGNING_KEY }}" | gpg --import
Expand All @@ -191,7 +190,7 @@ jobs:
- name: Download and extract source code (OpenCL-Headers)
run: |
# ToDo remove
export GITHUB_REF_NAME=v2023.02.01
export GITHUB_REF_NAME=v2023.02.11
wget -O $GITHUB_WORKSPACE/opencl-headers.tar.gz https://github.com/$OPENCL_HEADERS_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-headers.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers
Expand All @@ -200,7 +199,7 @@ jobs:
- name: Download and extract source code (OpenCL-ICD-Loader)
run: |
# ToDo remove
export GITHUB_REF_NAME=v2023.02.01
export GITHUB_REF_NAME=v2023.02.11
wget -O $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz https://github.com/$OPENCL_ICD_LOADER_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader
Expand All @@ -209,7 +208,7 @@ jobs:
- name: Download and extract source code (OpenCL-CLHPP)
run: |
# ToDo remove
export GITHUB_REF_NAME=v2023.02.01
export GITHUB_REF_NAME=v2023.02.11
wget -O $GITHUB_WORKSPACE/opencl-clhpp.tar.gz https://github.com/$OPENCL_CLHPP_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-clhpp.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 14)

project(OpenCL-SDK
VERSION 2023.04.17
# ToDo
VERSION 2023.02.07
LANGUAGES
C CXX
)
Expand All @@ -28,6 +29,9 @@ cmake_dependent_option(OPENCL_SDK_BUILD_OPENGL_SAMPLES "Build OpenCL-OpenGL inte
cmake_dependent_option(OPENCL_SDK_TEST_SAMPLES "Add CTest to samples (where applicable)" ON OPENCL_SDK_BUILD_SAMPLES OFF)

option(OPENCL_SDK_BUILD_CLINFO "Build clinfo utility" ON)
if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libstdc++")
endif()

include(CTest)

Expand Down
16 changes: 1 addition & 15 deletions cmake/DebSourcePkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ endif()
set(PROJECT_VERSION "${CMAKE_MATCH_1}")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
# Also get the package details for clinfo
set(OPENCL_SDK_BUILD_CLINFO ON)
# Package.cmake contains all details for packaging
include(PackageSetup)

# Append a space after every newline in the description. This format is required
# in the control file.
string(REPLACE "\n" "\n " CPACK_DEBIAN_DESCRIPTION "${CPACK_DEBIAN_DESCRIPTION}")
string(REPLACE "\n" "\n " CPACK_DEBIAN_CLINFO_DESCRIPTION "${CPACK_DEBIAN_CLINFO_DESCRIPTION}")

set(DEB_SOURCE_PKG_DIR "${CMAKE_CURRENT_LIST_DIR}/../debian")
# Write debian/control
Expand All @@ -73,16 +70,6 @@ Architecture: any
Multi-Arch: same
Depends: ${CPACK_DEBIAN_BINARY_PACKAGE_DEPENDS}
Description: ${CPACK_DEBIAN_DESCRIPTION}
Package: ${CPACK_DEBIAN_CLINFO_PACKAGE_NAME}
Architecture: any
Multi-Arch: same
Depends: ${CPACK_DEBIAN_CLINFO_PACKAGE_DEPENDS}
Conflicts: ${CPACK_DEBIAN_CLINFO_PACKAGE_CONFLICTS}
Replaces: ${CPACK_DEBIAN_CLINFO_PACKAGE_REPLACES}
Provides: ${CPACK_DEBIAN_CLINFO_PACKAGE_PROVIDES}
Section: ${CPACK_DEBIAN_CLINFO_PACKAGE_SECTION}
Description: ${CPACK_DEBIAN_CLINFO_DESCRIPTION}
"
)
# Write debian/changelog
Expand All @@ -101,13 +88,12 @@ file(WRITE "${DEB_SOURCE_PKG_DIR}/rules"
\tdh $@
override_dh_auto_configure:
\tdh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DOPENCL_SDK_BUILD_SAMPLES=OFF
\tdh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DOPENCL_SDK_BUILD_SAMPLES=OFF -DOPENCL_SDK_BUILD_CLINFO=OFF
override_dh_auto_install:
override_dh_install:
\tcmake --install obj-* --component binary --prefix ./debian/${CPACK_DEBIAN_BINARY_PACKAGE_NAME}/usr
\tcmake --install obj-* --component clinfo --prefix ./debian/${CPACK_DEBIAN_CLINFO_PACKAGE_NAME}/usr
")

if(DEFINED ORIG_ARCHIVE)
Expand Down
10 changes: 0 additions & 10 deletions cmake/Dependencies/clinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ target_compile_definitions(clinfo PRIVATE
)
add_test(NAME clinfo COMMAND $<TARGET_FILE:clinfo>)

# if (APPLE)
# set(RBASE "@loader_path")
# else ()
# set(RBASE "$ORIGIN")
# endif ()
# file(RELATIVE_PATH REL_LIB_DIR
# "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}"
# "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"
# )
# set_target_properties(clinfo PROPERTIES INSTALL_RPATH "${RBASE}/${REL_LIB_DIR}")
install(
TARGETS clinfo
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
Expand Down
2 changes: 1 addition & 1 deletion cmake/PackageSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set(CPACK_DEBIAN_BINARY_FILE_NAME "${CPACK_DEBIAN_BINARY_PACKAGE_NAME}_${PACKAGE
# Replacements
# ToDo
# set(CPACK_DEBIAN_BINARY_PACKAGE_DEPENDS "opencl-c-headers (>= 3.0~${PROJECT_VERSION}), opencl-clhpp-headers (>= 3.0~${PROJECT_VERSION}), khronos-opencl-loader-libopencl1 (>= 3.0~${PROJECT_VERSION}), khronos-opencl-loader-opencl-dev (>= 3.0~${PROJECT_VERSION})")
set(CPACK_DEBIAN_BINARY_PACKAGE_DEPENDS "opencl-c-headers, opencl-clhpp-headers, khronos-opencl-loader-libopencl1, khronos-opencl-loader-opencl-dev")
set(CPACK_DEBIAN_BINARY_PACKAGE_DEPENDS "opencl-c-headers, opencl-clhpp-headers, khronos-opencl-loader-libopencl1, khronos-opencl-loader-opencl-dev, clinfo")
set(CPACK_DEBIAN_BINARY_PACKAGE_SECTION "libdevel")

# Package clinfo, if enabled
Expand Down
Loading

0 comments on commit bd5f0fa

Please sign in to comment.