language: c

# Default linux jobs
os: linux
sudo: required
dist: trusty

# Include osx jobs
matrix:
  include:
    - os: osx
      osx_image: xcode8
      compiler: gcc
      env:
        - LABEL="osx-gcc"
    - os: osx
      compiler: clang # use default apple clang
      env:
        - LABEL="osx-clang"
    - os: linux
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
          packages:
            - g++-7
      env:
        - LABEL="x86_64-gcc"
    - os: linux
      addons:
        apt:
          sources:
            - llvm-toolchain-trusty-5.0
          packages:
            - clang-5.0
      env:
        - LABEL="x86_64-clang"
    - os: linux
      services: docker
      env:
        - LABEL="aarch64-gcc"
        - ENABLE_DOCKER="true"
    - os: linux
      services: docker
      env:
        - LABEL="armhf-gcc"
        - ENABLE_DOCKER="true"
    - os: linux
      services: docker
      env:
        - LABEL="ppc64el-clang"
        - ENABLE_DOCKER="true"

before_install:
     - export PATH=$PATH:/usr/bin:${TRAVIS_BUILD_DIR}/sde-external-8.12.0-2017-10-23-lin
     - cd ${TRAVIS_BUILD_DIR}
     - chmod +x ${TRAVIS_BUILD_DIR}/travis/*.sh
     - if [[ "${ENABLE_DOCKER}" == "true" ]]; then ${TRAVIS_BUILD_DIR}/travis/setupdocker.sh; fi
     - if [[ "${ENABLE_DOCKER}" == "true" ]]; then docker exec xenial /build/travis/before_install.${LABEL}.sh; fi
     - if [[ ( "${LABEL}" == "x86_64-gcc"   ) && ( "{SDE_URL}" != "" ) ]]; then wget -q ${SDE_URL}; fi
     - if [[ ( "${LABEL}" == "x86_64-clang" ) && ( "{SDE_URL}" != "" ) ]]; then wget -q ${SDE_URL}; fi
     - if [[ "${ENABLE_DOCKER}" != "true" ]]; then ${TRAVIS_BUILD_DIR}/travis/before_install.${LABEL}.sh; fi

before_script:
     - if [[ "${ENABLE_DOCKER}" == "true" ]]; then docker exec xenial /build/travis/before_script.${LABEL}.sh; fi
     - if [[ "${ENABLE_DOCKER}" != "true" ]]; then ${TRAVIS_BUILD_DIR}/travis/before_script.${LABEL}.sh; fi

script:
     - if [[ "${ENABLE_DOCKER}" == "true" ]]; then docker exec xenial /build/travis/script.${LABEL}.sh; fi
     - if [[ "${ENABLE_DOCKER}" != "true" ]]; then ${TRAVIS_BUILD_DIR}/travis/script.${LABEL}.sh; fi
