sudo: required
dist: trusty
language: generic

matrix:
  include:
    # CLang
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - clang
      env: CC='clang' CXX='clang++'
    # GCC 4.8
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-4.8
            - g++-4.8
      env: CC='gcc-4.8' CXX='g++-4.8'
    # GCC 4.9
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-4.9
            - g++-4.9
            - gfortran-4.9
      env: CC='gcc-4.9' CXX='g++-4.9' FC='gfortran-4.9'
    # GCC 5
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran-5
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5'
    # GCC 6
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-6
            - g++-6
            - gfortran-6
      env: CC='gcc-6' CXX='g++-6' FC='gfortran-6'
    # Ada
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran
            - gnat
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5' PLTEST='ADA'
    # D
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran-5
            - gdc
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5' PLTEST='D'
    # Lasi
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran-5
            - liblasi-dev
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5' PLTEST='LASI'
    # Libhpdf
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran-5
            - libhpdf-dev
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5' PLTEST='HPDF'
    # Lua
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran-5
            - liblua5.2-dev
            - lua5.2
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5' PLTEST='LUA'
    # ocaml
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran-5
            - camlidl
            - ocaml
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5' PLTEST='OCAML'
    # octave
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran-5
            - liboctave-dev
            - octave
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5' PLTEST='OCTAVE'
    # wxwidgets
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - gcc-5
            - g++-5
            - gfortran-5
            - libwxgtk3.0-dev
      env: CC='gcc-5' CXX='g++-5' FC='gfortran-5' PLTEST='WXWIDGETS'

before_install:
  - sudo apt-get -qq update
  - sudo apt-get --yes install cmake
  - sudo apt-get --yes install libqhull-dev
  - sudo apt-get --yes install libxml-dom-perl  
  - sudo apt-get --yes install libxml-parser-perl
  - sudo apt-get --yes install default-jdk
  - sudo apt-get --yes install default-jre
  - sudo apt-get --yes install itcl3
  - sudo apt-get --yes install itcl3-dev
  - sudo apt-get --yes install libcairo-dev
  - sudo apt-get --yes install libgtk2.0-dev
  - sudo apt-get --yes install libpango1.0-dev
  - sudo apt-get --yes install libpangocairo-1.0-0
  - sudo apt-get --yes install libshp-dev
  - sudo apt-get --yes install pdl 
  - sudo apt-get --yes install python-dev
  - sudo apt-get --yes install python-numpy
  - sudo apt-get --yes install python-qt4
  - sudo apt-get --yes install python-qt4-dev  
  - sudo apt-get --yes install sip-dev
  - sudo apt-get --yes install swig

#  - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get --yes --force-yes update && sudo apt-get --yes --force-yes install libgsl0-dev ; fi
#  - if [ $TRAVIS_OS_NAME == osx ]; then brew uninstall --force gcc carthage && brew update && brew upgrade && brew install ${BREW} ; fi

install:
  # Hand install a more recent version of cmake..
  - pwd
  - ls
  - cd ..
  - ls
  - mkdir cmake_tmp
  - cd cmake_tmp
  - wget https://cmake.org/files/v3.7/cmake-3.7.0-Linux-x86_64.tar.gz
  - tar -xf cmake-3.7.0-Linux-x86_64.tar.gz
  - sudo cp -r cmake-3.7.0-Linux-x86_64/bin/* /usr/local/bin/.
  - sudo cp -r cmake-3.7.0-Linux-x86_64/share/* /usr/local/share/.
  - cd ..
  - mkdir build
  - cd build
  - cmake --version

script:
  - cmake ../PLplot -DBUILD_TEST=ON -DENABLE_tk=OFF
  - make
  - ctest --verbose

branches:
  only:
    - master

notifications:
  email:
    recipients:
      - hbabcock@mac.com
    on_success: never
    on_failure: always
