Skip to content

cl_khr_icd 2.0.0 loader managed dispatch #254

cl_khr_icd 2.0.0 loader managed dispatch

cl_khr_icd 2.0.0 loader managed dispatch #254

Workflow file for this run

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