1#!/usr/bin/env bash 2 3set -e 4 5export TOP=$(pwd) 6 7TOOLCHAIN_URL_arm="https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/arm-linux-gnueabihf/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz" 8TOOLCHAIN_URL_aarch64="https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz" 9 10TOOLCHAIN_PREFIX_arm=arm-linux-gnueabihf 11TOOLCHAIN_PREFIX_aarch64=aarch64-linux-gnu 12 13TOOLCHAIN_FILE=${TOP}/toolchain.cmake 14touch ${TOOLCHAIN_FILE} 15BUILD_OPENGL_TEST="OFF" 16 17cmake --version 18echo 19 20# Prepare toolchain if needed 21if [[ ${JOB_ARCHITECTURE} != "" && ${RUNNER_OS} != "Windows" ]]; then 22 TOOLCHAIN_URL_VAR=TOOLCHAIN_URL_${JOB_ARCHITECTURE} 23 TOOLCHAIN_URL=${!TOOLCHAIN_URL_VAR} 24 wget ${TOOLCHAIN_URL} 25 TOOLCHAIN_ARCHIVE=${TOOLCHAIN_URL##*/} 26 tar xf ${TOOLCHAIN_ARCHIVE} 27 TOOLCHAIN_DIR=${TOP}/${TOOLCHAIN_ARCHIVE%.tar.xz} 28 export PATH=${TOOLCHAIN_DIR}/bin:${PATH} 29 30 TOOLCHAIN_PREFIX_VAR=TOOLCHAIN_PREFIX_${JOB_ARCHITECTURE} 31 TOOLCHAIN_PREFIX=${!TOOLCHAIN_PREFIX_VAR} 32 33 echo "SET(CMAKE_SYSTEM_NAME Linux)" >> ${TOOLCHAIN_FILE} 34 echo "SET(CMAKE_SYSTEM_PROCESSOR ${JOB_ARCHITECTURE})" >> ${TOOLCHAIN_FILE} 35 echo "SET(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)" >> ${TOOLCHAIN_FILE} 36 echo "SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)" >> ${TOOLCHAIN_FILE} 37 echo "SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> ${TOOLCHAIN_FILE} 38 echo "SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> ${TOOLCHAIN_FILE} 39 echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> ${TOOLCHAIN_FILE} 40fi 41 42if [[ ( ${JOB_ARCHITECTURE} == "" && ${JOB_ENABLE_GL} == "1" ) ]]; then 43 BUILD_OPENGL_TEST="ON" 44fi 45 46if [[ ${JOB_ENABLE_DEBUG} == 1 ]]; then 47 BUILD_CONFIG="Debug" 48else 49 BUILD_CONFIG="Release" 50fi 51 52#Vulkan Headers 53git clone https://github.com/KhronosGroup/Vulkan-Headers.git 54 55# Get and build loader 56git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git 57cd ${TOP}/OpenCL-ICD-Loader 58mkdir build 59cd build 60cmake .. -G Ninja \ 61 -DCMAKE_BUILD_TYPE=Release \ 62 -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ 63 -DOPENCL_ICD_LOADER_HEADERS_DIR=${TOP}/OpenCL-Headers/ 64cmake --build . -j2 65 66#Vulkan Loader 67cd ${TOP} 68git clone https://github.com/KhronosGroup/Vulkan-Loader.git 69cd Vulkan-Loader 70mkdir build 71cd build 72python3 ../scripts/update_deps.py 73cmake .. -G Ninja \ 74 -DCMAKE_BUILD_TYPE=Release \ 75 -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ 76 -DBUILD_WSI_XLIB_SUPPORT=OFF \ 77 -DBUILD_WSI_XCB_SUPPORT=OFF \ 78 -DBUILD_WSI_WAYLAND_SUPPORT=OFF \ 79 -DUSE_GAS=OFF \ 80 -C helper.cmake .. 81cmake --build . -j2 82 83# Build CTS 84cd ${TOP} 85ls -l 86mkdir build 87cd build 88if [[ ${RUNNER_OS} == "Windows" ]]; then 89 CMAKE_OPENCL_LIBRARIES_OPTION="OpenCL" 90 CMAKE_CACHE_OPTIONS="" 91else 92 CMAKE_OPENCL_LIBRARIES_OPTION="-lOpenCL -lpthread" 93 CMAKE_CACHE_OPTIONS="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache" 94fi 95cmake .. -G Ninja \ 96 -DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" \ 97 ${CMAKE_CACHE_OPTIONS} \ 98 -DCL_INCLUDE_DIR=${TOP}/OpenCL-Headers \ 99 -DCL_LIB_DIR=${TOP}/OpenCL-ICD-Loader/build \ 100 -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ 101 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=./bin \ 102 -DOPENCL_LIBRARIES="${CMAKE_OPENCL_LIBRARIES_OPTION}" \ 103 -DUSE_CL_EXPERIMENTAL=ON \ 104 -DGL_IS_SUPPORTED=${BUILD_OPENGL_TEST} \ 105 -DVULKAN_INCLUDE_DIR=${TOP}/Vulkan-Headers/include/ \ 106 -DVULKAN_LIB_DIR=${TOP}/Vulkan-Loader/build/loader/ 107cmake --build . -j3 108