language: cpp
sudo: false
matrix:
  include:
  - addons: &1
      apt:
        sources:
        - george-edison55-precise-backports
        - ubuntu-toolchain-r-test
        - llvm-toolchain-trusty-3.9
        packages:
        - g++-4.9
        - clang-3.9
    compiler: clang
    env: COMPILER_VERSION=3.9 BUILD_TYPE=Debug
  - addons: *1
    compiler: clang
    env: COMPILER_VERSION=3.9 BUILD_TYPE=Release
  - addons: &2
      apt:
        sources:
        - george-edison55-precise-backports
        - ubuntu-toolchain-r-test
        packages:
        - g++-4.9
    compiler: gcc
    env: COMPILER_VERSION=4.9 BUILD_TYPE=Debug EXTRA_CXXFLAGS="-fsanitize=address"
  - addons: *2
    compiler: gcc
    env: COMPILER_VERSION=4.9 BUILD_TYPE=Release EXTRA_CXXFLAGS="-fsanitize=address"
  - addons: *1
    compiler: clang
    env: COMPILER_VERSION=3.9 BUILD_TYPE=Debug CFLAGS="-O0" CXXFLAGS="-O0"
  - addons: &3
      apt:
        sources:
        - ubuntu-toolchain-r-test
        packages:
        - g++-4.8
    compiler: gcc
    env: COMPILER_VERSION=4.8 BUILD_TYPE=Debug
  - addons: *3
    compiler: gcc
    env: COMPILER_VERSION=4.8 BUILD_TYPE=Release

before_install:
  - ./.travis-before-install.sh


script:
  - export CC="${CC}-${COMPILER_VERSION}"
  - export CXX="${CXX}-${COMPILER_VERSION}"
  - ${CC} -v
  - ${CXX} ${EXTRA_CXXFLAGS} -std=c++11 -Wall -g -o loader_example loader_example.cc
  - ./loader_example ./models/Cube/Cube.gltf
  - cd tests
  - clang++ -v
  - make
  - ./tester
  - ./tester_noexcept
  - cd ../examples/raytrace
  - ../../premake5 gmake
  - make
