# Ubuntu 14.04 Trusty support
sudo: required
dist: trusty

# Only build test master & travis
branches:
  only:
  - master
  - travis

# Enable C++ support
language: cpp

addons:
  apt:
    sources: &sources
      - ubuntu-toolchain-r-test
    packages: &packages
      - libegl1-mesa-dev
      - libgles2-mesa-dev
      - libwayland-dev
      - libx11-xcb-dev
      - libx11-dev
      - libgbm-dev

# Need MYCC and MYCXX as travis overwrites CC and CXX

matrix:
  include:
    - compiler: gcc
      addons:
        apt:
          sources: *sources
          packages: [*packages, 'g++-4.8']
      env: MYCC=gcc-4.8 MYCXX=g++-4.8

    - compiler: gcc
      addons:
        apt:
          sources: *sources
          packages: [*packages, 'g++-4.9']
      # g++-4.9 gives a warning, disable it
      env: MYCC=gcc-4.9 MYCXX=g++-4.9 CXXFLAGS=-Wno-maybe-uninitialized

    - compiler: gcc
      addons:
        apt:
          sources: *sources
          packages: [*packages, 'g++-5']
      env: MYCC=gcc-5 MYCXX=g++-5

    - compiler: gcc
      addons:
        apt:
          sources: *sources
          packages: [*packages, 'g++-6']
      env: MYCC=gcc-6 MYCXX=g++-6

    - compiler: gcc
      addons:
        apt:
          sources: *sources
          packages: [*packages, 'g++-7']
      env: MYCC=gcc-7 MYCXX=g++-7

    - compiler: clang
      addons:
        apt:
          sources: [*sources, 'llvm-toolchain-precise-3.8']
          packages: [*packages, 'clang-3.8']
      env: MYCC=clang-3.8 MYCXX=clang++-3.8

# Build steps
script:
  - mkdir build
  - cd build
  - CC=$MYCC CXX=$MYCXX cmake -DTREAT_WARNINGS_AS_ERRORS=1 -DKMSXX_ENABLE_KMSCUBE=1 -DKMSXX_ENABLE_PYTHON=1 .. && make VERBOSE=1

notifications:
  email:
    - tomi.valkeinen@iki.fi
