1# Based on https://github.com/ldionne/hana/blob/master/.travis.yml 2 3language: cpp 4sudo: false 5 6cache: 7 directories: 8 - ${TRAVIS_BUILD_DIR}/deps/cmake 9 - ${TRAVIS_BUILD_DIR}/deps/llvm-3.5.2/install 10 - ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2/install 11 - ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1/install 12 - ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1/install 13 - ${TRAVIS_BUILD_DIR}/deps/llvm-3.9.0/install 14 15matrix: 16 include: 17 - env: BUILD_TYPE=Debug 18 os: osx 19 osx_image: xcode8 20 compiler: clang 21 - env: BUILD_TYPE=Release 22 os: osx 23 osx_image: xcode8 24 compiler: clang 25 - env: CLANG_VERSION=3.6 BUILD_TYPE=Debug 26 os: linux 27 addons: &clang36 28 apt: 29 packages: 30 - clang-3.6 31 - g++-5 32 sources: &sources 33 - ubuntu-toolchain-r-test 34 - llvm-toolchain-precise-3.6 35 - env: CLANG_VERSION=3.6 BUILD_TYPE=Release 36 os: linux 37 addons: *clang36 38 - env: CLANG_VERSION=3.7 BUILD_TYPE=Debug 39 os: linux 40 addons: &clang37 41 apt: 42 packages: 43 - clang-3.7 44 - g++-5 45 sources: &sources 46 - ubuntu-toolchain-r-test 47 - llvm-toolchain-precise-3.7 48 - env: CLANG_VERSION=3.7 BUILD_TYPE=Release 49 os: linux 50 addons: *clang37 51 - env: CLANG_VERSION=3.8 BUILD_TYPE=Debug 52 os: linux 53 addons: &clang38 54 apt: 55 packages: 56 - clang-3.8 57 - g++-5 58 sources: &sources 59 - ubuntu-toolchain-r-test 60 - llvm-toolchain-precise-3.8 61 - env: CLANG_VERSION=3.8 BUILD_TYPE=Release 62 os: linux 63 addons: *clang38 64 - env: GCC_VERSION=5 BUILD_TYPE=Debug 65 os: linux 66 addons: &gcc5 67 apt: 68 packages: g++-5 69 sources: *sources 70 - env: GCC_VERSION=5 BUILD_TYPE=Release 71 os: linux 72 addons: *gcc5 73 - env: GCC_VERSION=6 BUILD_TYPE=Debug 74 os: linux 75 addons: &gcc6 76 apt: 77 packages: g++-6 78 sources: *sources 79 - env: GCC_VERSION=6 BUILD_TYPE=Release 80 os: linux 81 addons: *gcc6 82 83install: 84 - if [[ -n "$CLANG_VERSION" ]]; then export CXX=clang++-$CLANG_VERSION CC=clang-$CLANG_VERSION; fi 85 - if [[ -n "$GCC_VERSION" ]]; then export CXX=g++-$GCC_VERSION CC=gcc-$GCC_VERSION; fi 86 - JOBS=2 87 - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" 88 - mkdir -p "${DEPS_DIR}" && cd "${DEPS_DIR}" 89 90 ############################################################################ 91 # Install a recent CMake (unless already installed on OS X) 92 ############################################################################ 93 - | 94 if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then 95 if [[ -z "$(ls -A ${DEPS_DIR}/cmake/bin)" ]]; then 96 CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz" 97 mkdir -p cmake && travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake 98 fi 99 export PATH="${DEPS_DIR}/cmake/bin:${PATH}" 100 else 101 if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi 102 fi 103 104 ############################################################################ 105 # [linux]: Install the right version of libc++ 106 ############################################################################ 107 - | 108 if [[ -n "$CLANG_VERSION" && "${TRAVIS_OS_NAME}" == "linux" && "${STDLIB}" != "libstdc++" ]]; then 109 if [[ "$CLANG_VERSION" == "3.5" ]]; then LLVM_VERSION="3.5.2"; fi 110 if [[ "$CLANG_VERSION" == "3.6" ]]; then LLVM_VERSION="3.6.2"; fi 111 if [[ "$CLANG_VERSION" == "3.7" ]]; then LLVM_VERSION="3.7.1"; fi 112 if [[ "$CLANG_VERSION" == "3.8" ]]; then LLVM_VERSION="3.8.1"; fi 113 if [[ "$CLANG_VERSION" == "3.9" ]]; then LLVM_VERSION="3.9.0"; fi 114 LLVM_ROOT="${DEPS_DIR}/llvm-${LLVM_VERSION}" 115 LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz" 116 LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz" 117 LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz" 118 if [[ -z "$(ls -A ${LLVM_ROOT}/install/include)" ]]; then 119 mkdir -p "${LLVM_ROOT}" "${LLVM_ROOT}/build" "${LLVM_ROOT}/projects/libcxx" "${LLVM_ROOT}/projects/libcxxabi" 120 travis_retry wget --quiet -O - "${LLVM_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}" 121 travis_retry wget --quiet -O - "${LIBCXX_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxx" 122 travis_retry wget --quiet -O - "${LIBCXXABI_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxxabi" 123 (cd "${LLVM_ROOT}/build" && cmake .. -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}/install" -DCMAKE_BUILD_TYPE=$BUILD_TYPE) 124 (cd "${LLVM_ROOT}/build/projects/libcxx" && make install -j$JOBS) 125 (cd "${LLVM_ROOT}/build/projects/libcxxabi" && make install -j$JOBS) 126 fi 127 export CXXFLAGS="-I ${LLVM_ROOT}/install/include/c++/v1" 128 export LDFLAGS="-L ${LLVM_ROOT}/install/lib -lc++ -lc++abi" 129 export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_ROOT}/install/lib" 130 fi 131 132before_script: 133 - cd "${TRAVIS_BUILD_DIR}" 134 - cmake . -Bbuild -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" -DCMAKE_BUILD_TYPE=$BUILD_TYPE 135 - cmake --build build -- -j$JOBS 136 137script: 138 - cd build 139 - ctest --output-on-failure -j$JOBS 140 141notifications: 142 email: false 143