mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Since we have added support for unified SVM in the upstream headers, we no longer need to build CI from the unified SVM header branch.
192 lines
8.2 KiB
YAML
192 lines
8.2 KiB
YAML
name: Presubmit
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
name: Build ${{ matrix.os }} ${{ matrix.arch }}${{ matrix.extra }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build-type: [Release]
|
|
gl: [0]
|
|
os: [ubuntu-22.04, macos-latest, windows-latest, windows-11-arm]
|
|
include:
|
|
- os: ubuntu-22.04
|
|
gl: 1
|
|
extra: " gl"
|
|
- os: ubuntu-22.04
|
|
arch: arm
|
|
- os: ubuntu-22.04
|
|
arch: aarch64
|
|
build-type: Debug
|
|
extra: " debug"
|
|
- os: ubuntu-22.04
|
|
arch: android-arm
|
|
android_arch_abi: armeabi-v7a
|
|
- os: ubuntu-22.04
|
|
arch: android-aarch64
|
|
android_arch_abi: arm64-v8a
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- name: Setup Ninja
|
|
uses: seanmiddleditch/gha-setup-ninja@master
|
|
- name: Install Arm and AArch64 compilers
|
|
if: ${{ matrix.arch == 'arm' || matrix.arch == 'aarch64' }}
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
gcc-12-arm-linux-gnueabihf g++-12-arm-linux-gnueabihf \
|
|
gcc-12-aarch64-linux-gnu g++-12-aarch64-linux-gnu
|
|
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-12 12
|
|
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-12 12
|
|
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-12 12
|
|
sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-12 12
|
|
- name: Setup OpenGL build dependencies
|
|
if: ${{ matrix.gl }}
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get -y install libglu1-mesa-dev freeglut3-dev mesa-common-dev libglew-dev
|
|
- name: Setup MSVC with Ninja
|
|
uses: ilammy/msvc-dev-cmd@v1
|
|
- name: Setup ccache
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
with:
|
|
variant: sccache
|
|
key: ${{ matrix.os }}-${{ matrix.arch }}
|
|
- name: Fetch OpenCL Headers
|
|
shell: bash
|
|
run: |
|
|
git clone https://github.com/KhronosGroup/OpenCL-Headers.git
|
|
cd OpenCL-Headers
|
|
ln -s CL OpenCL # For OSX builds
|
|
cd ..
|
|
- name: Fetch SPIR-V Headers
|
|
shell: bash
|
|
run: |
|
|
git clone https://github.com/KhronosGroup/SPIRV-Headers.git
|
|
- name: Install Vulkan SDK
|
|
uses: humbletim/install-vulkan-sdk@main
|
|
with:
|
|
version: 1.4.309.0
|
|
cache: true
|
|
- name: Install Android NDK
|
|
if: ${{ matrix.arch == 'android-arm' || matrix.arch == 'android-aarch64' }}
|
|
run: |
|
|
wget https://dl.google.com/android/repository/android-ndk-r28c-linux.zip -O android-ndk.zip
|
|
unzip android-ndk.zip -d $HOME
|
|
export ANDROID_NDK=$HOME/android-ndk-r28c
|
|
echo "ANDROID_NDK=$ANDROID_NDK" >> $GITHUB_ENV
|
|
export ANDROID_ARCH_ABI=${{ matrix.android_arch_abi }}
|
|
echo "ANDROID_ARCH_ABI=$ANDROID_ARCH_ABI" >> $GITHUB_ENV
|
|
echo "ANDROID_PLATFORM=29" >> $GITHUB_ENV
|
|
- name: Prepare CMake Toolchain file
|
|
shell: bash
|
|
run: |
|
|
if [[ '${{ matrix.arch }}' == android-* ]]; then
|
|
TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
|
else
|
|
TOOLCHAIN_FILE='${{ github.workspace }}'/toolchain.cmake
|
|
touch ${TOOLCHAIN_FILE}
|
|
fi
|
|
|
|
TOOLCHAIN_PREFIX_arm=arm-linux-gnueabihf
|
|
TOOLCHAIN_PREFIX_aarch64=aarch64-linux-gnu
|
|
|
|
if [[ '${{ matrix.arch }}' != android-* ]]; then
|
|
if [[ '${{ matrix.arch }}' != "" && ${RUNNER_OS} != "Windows" ]]; then
|
|
TOOLCHAIN_PREFIX_VAR=TOOLCHAIN_PREFIX_${{ matrix.arch }}
|
|
TOOLCHAIN_PREFIX=${!TOOLCHAIN_PREFIX_VAR}
|
|
|
|
echo "SET(CMAKE_SYSTEM_NAME Linux)" >> ${TOOLCHAIN_FILE}
|
|
echo "SET(CMAKE_SYSTEM_PROCESSOR ${{ matrix.arch }})" >> ${TOOLCHAIN_FILE}
|
|
echo "SET(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)" >> ${TOOLCHAIN_FILE}
|
|
echo "SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)" >> ${TOOLCHAIN_FILE}
|
|
echo "SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> ${TOOLCHAIN_FILE}
|
|
echo "SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> ${TOOLCHAIN_FILE}
|
|
echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> ${TOOLCHAIN_FILE}
|
|
fi
|
|
fi
|
|
echo "TOOLCHAIN_FILE=${TOOLCHAIN_FILE}" >> $GITHUB_ENV
|
|
- name: Prepare Android CMake arguments
|
|
if: ${{ matrix.arch == 'android-arm' || matrix.arch == 'android-aarch64' }}
|
|
shell: bash
|
|
run: |
|
|
echo "CMAKE_ADDITIONAL_CONFIG_ARGS=-DCMAKE_ANDROID_ARCH_ABI=${ANDROID_ARCH_ABI} -DANDROID_PLATFORM=${ANDROID_PLATFORM}" >> $GITHUB_ENV
|
|
- name: Fetch and build OpenCL ICD Loader
|
|
shell: bash
|
|
run: |
|
|
git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git
|
|
cd OpenCL-ICD-Loader
|
|
mkdir build
|
|
cd build
|
|
cmake .. -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
|
|
-DOPENCL_ICD_LOADER_HEADERS_DIR='${{ github.workspace }}'/OpenCL-Headers/ \
|
|
${CMAKE_ADDITIONAL_CONFIG_ARGS}
|
|
cmake --build . --parallel
|
|
- name: Fetch Vulkan Headers
|
|
shell: bash
|
|
run: |
|
|
git clone https://github.com/KhronosGroup/Vulkan-Headers.git
|
|
- name: Fetch and build Vulkan Loader
|
|
if: ${{ matrix.arch != 'android-arm' && matrix.arch != 'android-aarch64' }}
|
|
shell: bash
|
|
run: |
|
|
git clone https://github.com/KhronosGroup/Vulkan-Loader.git
|
|
cd Vulkan-Loader
|
|
mkdir build
|
|
cd build
|
|
python3 ../scripts/update_deps.py
|
|
cmake .. -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
|
|
-DBUILD_WSI_XLIB_SUPPORT=OFF \
|
|
-DBUILD_WSI_XCB_SUPPORT=OFF \
|
|
-DBUILD_WSI_WAYLAND_SUPPORT=OFF \
|
|
-C helper.cmake ..
|
|
cmake --build . --parallel
|
|
- name: Configure and build
|
|
shell: bash
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
if [[ ${RUNNER_OS} == "Windows" ]]; then
|
|
CMAKE_OPENCL_LIBRARIES_OPTION="OpenCL"
|
|
CMAKE_ADDITIONAL_CONFIG_ARGS="-DD3D10_IS_SUPPORTED=ON -DD3D11_IS_SUPPORTED=ON"
|
|
else
|
|
CMAKE_OPENCL_LIBRARIES_OPTION="-lOpenCL"
|
|
if [[ '${{ matrix.arch }}' != android-* ]]; then
|
|
CMAKE_OPENCL_LIBRARIES_OPTION="${CMAKE_OPENCL_LIBRARIES_OPTION} -lpthread"
|
|
fi
|
|
fi
|
|
cmake .. -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
|
|
-DCL_INCLUDE_DIR='${{ github.workspace }}'/OpenCL-Headers \
|
|
-DSPIRV_INCLUDE_DIR='${{ github.workspace }}'/SPIRV-Headers \
|
|
-DCL_LIB_DIR='${{ github.workspace }}'/OpenCL-ICD-Loader/build \
|
|
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
|
|
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=./bin \
|
|
-DOPENCL_LIBRARIES="${CMAKE_OPENCL_LIBRARIES_OPTION}" \
|
|
-DUSE_CL_EXPERIMENTAL=ON \
|
|
-DGL_IS_SUPPORTED=${{ matrix.gl }} \
|
|
-DVULKAN_IS_SUPPORTED=ON \
|
|
-DVULKAN_INCLUDE_DIR='${{ github.workspace }}'/Vulkan-Headers/include/ \
|
|
-DVULKAN_LIB_DIR='${{ github.workspace }}'/Vulkan-Loader/build/loader/ \
|
|
${CMAKE_ADDITIONAL_CONFIG_ARGS}
|
|
cmake --build . --parallel
|
|
formatcheck:
|
|
name: Check code format
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Install packages
|
|
run: sudo apt install -y clang-format clang-format-14
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Check code format
|
|
run: ./check-format.sh origin/cl_khr_unified_svm
|