#=========================== begin_copyright_notice ============================
#
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
#============================ end_copyright_notice =============================

language: cpp
compiler: gcc

notifications:
    email:
        recipients: igc.git.maintainers@intel.com
    on_success: never # default: change
    on_failure: change # default: always

dist: focal
os: linux

matrix:
  include:
    - os: linux
      dist: focal # Ubuntu 20.04
      compiler: gcc
      env: LLVM_VER=10 BUILD_TYPE=Release
      addons:
        apt:
          packages:
            - libc6=2.31-0ubuntu9.2
    - os: linux
      dist: focal # Ubuntu 20.04
      compiler: clang-10
      env: LLVM_VER=10 BUILD_TYPE=Release COMPILER_EXTRA="-DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10"
      addons:
        apt:
          packages:
            - libc6=2.31-0ubuntu9.2

git:
  depth: false

branches:
  only:
    - master

script:
  - wget https://apt.llvm.org/llvm.sh
  - chmod +x llvm.sh
  - sudo ./llvm.sh ${LLVM_VER}

  - sudo apt-get update
  - sudo apt-get install flex bison libz-dev cmake build-essential

  - mkdir Old_IGC
  - cd Old_IGC
  - curl -s https://api.github.com/repos/intel/intel-graphics-compiler/releases/latest | grep browser_download_url | cut -d '"' -f 4 | wget -qi -
  - sudo dpkg -i *.deb
  - cd ..


  - git clone https://github.com/intel/vc-intrinsics ../vc-intrinsics
  - git clone -b llvm_release_100 https://github.com/KhronosGroup/SPIRV-LLVM-Translator ../llvm-project/llvm/projects/llvm-spirv
  - mkdir build && cd build
  - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DIGC_OPTION__LLVM_PREFERRED_VERSION=${LLVM_VER} -DCCLANG_FROM_SYSTEM=TRUE -DIGC_OPTION__LLVM_MODE=Prebuilds ${COMPILER_EXTRA} ../
  - make -j`nproc`
