dist: trusty
sudo: true
language: cpp
cache: ccache
addons:
  apt:
    sources:
    - ubuntu-toolchain-r-test
    packages:
    - g++-7
    - gcc-7
    - libblas-dev
    - libboost-filesystem-dev
    - libboost-system-dev
    - libboost-thread-dev
    - libglu1-mesa-dev
    - liblapack-dev
    - libmpfr-dev
    - libpython3-dev
    - python3-setuptools
    - xorg-dev
  homebrew:
    packages:
    - ccache
matrix:
  include:
  - os: linux
    compiler: gcc # 4.8.4 by default on Trusty
    env:
    - MATRIX_EVAL="export CONFIG=Release PYTHON=python3"
  - os: linux
    compiler: gcc-7
    env:
    - MATRIX_EVAL="export CC=gcc-7 CXX=g++-7 CONFIG=Release PYTHON=python3"
  - os: linux # same config like above but with -DLIBIGL_USE_STATIC_LIBRARY=OFF to test static and header-only builds
    compiler: gcc-7
    env:
    - MATRIX_EVAL="export CC=gcc-7 CXX=g++-7 CONFIG=Release PYTHON=python3 CMAKE_EXTRA='-DLIBIGL_USE_STATIC_LIBRARY=OFF'"
  - os: linux
    compiler: gcc-7
    env:
    - MATRIX_EVAL="export CC=gcc-7 CXX=g++-7 CONFIG=Release PYTHON=python3 CMAKE_EXTRA='-DLIBIGL_EIGEN_VERSION=3.3.7'"
  - os: osx
    compiler: clang
    env:
    - MATRIX_EVAL="export CONFIG=Debug PYTHON=python3 LIBIGL_NUM_THREADS=1"
  - os: osx # same config like above but with -DLIBIGL_USE_STATIC_LIBRARY=OFF to test static and header-only builds
    compiler: clang
    env:
    - MATRIX_EVAL="export CONFIG=Debug PYTHON=python3 LIBIGL_NUM_THREADS=1 CMAKE_EXTRA='-DLIBIGL_USE_STATIC_LIBRARY=OFF'"
  - os: osx
    compiler: clang
    env:
    - MATRIX_EVAL="export CONFIG=Debug PYTHON=python3 LIBIGL_NUM_THREADS=1 CMAKE_EXTRA='-DLIBIGL_EIGEN_VERSION=3.3.7'""

install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi
- eval "${MATRIX_EVAL}"
- ccache --max-size=5.0G
- ccache -V && ccache --show-stats && ccache --zero-stats

script:
# Tutorials and tests
- mkdir build
- pushd build
- cmake ${CMAKE_EXTRA}
    -DCMAKE_BUILD_TYPE=$CONFIG
    -DLIBIGL_CHECK_UNDEFINED=ON
    -DLIBIGL_WITH_CGAL=ON
    ../
- make -j 2
- ctest --verbose
- popd
- pushd python/tutorial
- ${PYTHON} 101_FileIO.py
- popd
- rm -rf build
- ccache --show-stats
