language: cpp

os:
  - linux

# Use Ubuntu 18.04 LTS (Bionic) as the Linux testing environment.
dist: bionic

git:
  depth: 1

branches:
  only:
    - master

env:
  global:
    - LLVM_VERSION=12
  matrix:
    - BUILD_TYPE=Release
    - BUILD_TYPE=Debug

before_install:
  - curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
  - echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee -a ${TRAVIS_ROOT}/etc/apt/sources.list
  - sudo apt-get update
  - sudo apt-get -yq --no-install-suggests --no-install-recommends install
      llvm-${LLVM_VERSION}-dev
      llvm-${LLVM_VERSION}-tools
      libclang-${LLVM_VERSION}-dev
      libclang-cpp${LLVM_VERSION}-dev

install:
  - wget https://github.com/KhronosGroup/SPIRV-LLVM-Translator/releases/download/dev-build/SPIRV-LLVM-Translator-dev-build-linux-Release.zip -O /tmp/SPIRV-LLVM-Translator-dev-build-linux-${BUILD_TYPE}.zip
  - unzip /tmp/SPIRV-LLVM-Translator-dev-build-linux-${BUILD_TYPE}.zip -d spirv-llvm-translator

compiler:
  - gcc
  - clang

script:
  - mkdir build && cd build
  - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLLVM_NO_DEAD_STRIP=ON -DLLVMSPIRV_INCLUDED_IN_LLVM=OFF -DSPIRV_TRANSLATOR_DIR=./spirv-llvm-translator -DCMAKE_INSTALL_PREFIX=./install ..
  - make install
