cache: ccache
language: cpp
matrix:
  include:
    - os: linux
      dist: trusty
      compiler: clang
    - os: linux
      dist: trusty
      compiler: gcc
    - os: osx
      osx_image: xcode8.3
      compiler: clang

addons:
  apt:
    sources:
    - ubuntu-toolchain-r-test
    packages:
    - ccache
    - cmake
    - g++-4.9

before_install:
  - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew update; fi
  - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew install ccache; fi

script:
  # Output version info for compilers, cmake, and make
  - ${CC} -v
  - ${CXX} -v
  - cmake --version
  - make --version
  # Clone googletest
  - pushd .. && git clone https://github.com/google/googletest.git && popd
  # Configure and build
  - mkdir _travis_build && cd _travis_build
  - cmake -G "Unix Makefiles" -DENABLE_TESTS=ON -DENABLE_CCACHE=ON ..
  - make -j
  - ./draco_tests

cache: ccache
language: cpp
matrix:
  include:
    - os: linux
      dist: trusty
      compiler: clang
    - os: linux
      dist: trusty
      compiler: gcc
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-4.9
        env:
          - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
    - os: osx
      osx_image: xcode8.3
      compiler: clang

addons:
  apt:
    sources:
    - ubuntu-toolchain-r-test
    packages:
    - ccache
    - cmake

before_install:
  - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew update; fi
  - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then brew install ccache; fi
  - if [[ "${TRAVIS_OS_NAME}" == "linux" ]] && [[ "${CXX}" = "g++" ]]; then
      export CXX="g++-4.9" CC="gcc-4.9";
    fi

script:
  # Output version info for compilers, cmake, and make
  - ${CC} -v
  - ${CXX} -v
  - cmake --version
  - make --version
  # Clone googletest
  - pushd .. && git clone https://github.com/google/googletest.git && popd
  # Configure and build
  - mkdir _travis_build && cd _travis_build
  - cmake -G "Unix Makefiles" -DENABLE_TESTS=ON -DENABLE_CCACHE=ON ..
  - make -j10
  - ./draco_tests

Use g++4.9 for Travis GCC builds.
Use g++4.9 for Travis GCC builds.

Really this time. Previous commit installed the package, but
did not change compilers. This commit also caps the Travis-CI
make jobs at 10 to avoid OOM related internal compiler errors
in GCC builds.
