language: cpp

compiler:
  - gcc
  - clang

env:
  - BUILDSYSTEM=cmake
  - BUILDSYSTEM=cmake-flint-nmzintegrate
  - BUILDSYSTEM=autotools
  - BUILDSSYTEM=autotools CONFIGURE_FLAGS="--disable-openmp"
  - BUILDSYSTEM=autotools-makedistcheck
  - BUILDSYSTEM=autotools-makedistcheck-nmzintegrate
  - BUILDSYSTEM=autotools-flint-nmzintegrate
  - BUILDSYSTEM=classic
  - BUILDSYSTEM=classic-flint-nmzintegrate

matrix:
  include:
    ## Build "static" Mac binary distribution and deploy to Normaliz-bindist
    - os: osx
      osx_image: xcode8.3
      compiler: clang
      env: BUILDSYSTEM=autotools-nmzintegrate CONFIGURE_FLAGS=--disable-shared
      before_script:
       - mkdir -p lib && install -m 0644 `brew --prefix`/opt/gmp/lib/libgmp*.a lib/
       - export LDFLAGS=-L`pwd`/lib
      after_success:
       - ./.make-bindist.sh
    ## Test that the distribution created by 'make distcheck'
    ## contains everything for the cmake and classic builds.
    - env: BUILDSYSTEM=cmake-flint-nmzintegrate
      compiler: gcc
      before_install:
       - BUILDSYSTEM=autotools-makedistcheck ./.travis-build.sh
       - tar xf normaliz-*.tar.gz
       - cd normaliz-*
    - env: BUILDSYSTEM=classic-flint-nmzintegrate
      compiler: gcc
      before_install:
       - BUILDSYSTEM=autotools-makedistcheck ./.travis-build.sh
       - tar xf normaliz-*.tar.gz
       - cd normaliz-*
    ## Test on Mac OS X, current XCode version
    - os: osx
      osx_image: xcode9.2
      compiler: clang
      env: BUILDSYSTEM=cmake-flint-nmzintegrate
    - os: osx
      osx_image: xcode9.2
      compiler: clang
      env: BUILDSYSTEM=cmake
    - os: osx
      osx_image: xcode9.2
      compiler: clang
      env: BUILDSYSTEM=autotools-makedistcheck-nmzintegrate
    - os: osx
      osx_image: xcode9.2
      compiler: clang
      env: BUILDSYSTEM=autotools-flint-nmzintegrate
    ## Test on Mac OS X with LLVM from Homebrew for OpenMP support
    - os: osx
      compiler: clang
      before_install:
       - brew update
       - brew install llvm || brew outdated llvm || brew upgrade llvm
       - export PATH="`brew --prefix`/opt/llvm/bin/:$PATH"
       - export LDFLAGS="-L`brew --prefix`/opt/llvm/lib -Wl,-rpath,`brew --prefix`/opt/llvm/lib"
      env: COMPILER_OVERRIDE=homebrew-llvm BUILDSYSTEM=autotools-nmzintegrate CONFIGURE_FLAGS=--enable-openmp      
    ## Test on Mac OS X with older XCode versions
    - os: osx
      osx_image: xcode8.3
      compiler: clang
      env: BUILDSYSTEM=autotools-makedistcheck-nmzintegrate
    - os: osx
      osx_image: xcode8.3
      compiler: clang
      env: BUILDSYSTEM=autotools-flint-nmzintegrate
    - os: osx
      osx_image: xcode7.3
      compiler: clang
      env: BUILDSYSTEM=autotools-flint-nmzintegrate
    - os: osx
      osx_image: xcode6.4
      compiler: clang
      env: BUILDSYSTEM=autotools-flint-nmzintegrate
    ## Test on a newer Linux distribution (trusty)
    - os: linux
      sudo: required
      dist: trusty
      compiler: gcc
      env: BUILDSYSTEM=autotools-makedistcheck-nmzintegrate
    - os: linux
      sudo: required
      dist: trusty
      compiler: gcc
      env: BUILDSYSTEM=autotools-flint-nmzintegrate
      

branches:
  except:
    - gh-pages

addons:
  apt_packages:
      - libgmp-dev
      - libboost-dev
      - autoconf
      - automake
      - libtool
      - time

script: ./.travis-build.sh

dist: precise
