1# Based on https://github.com/ldionne/hana/blob/master/.travis.yml 2 3language: cpp 4sudo: false 5notifications: 6 email: false 7 8# Use Linux unless specified otherwise 9os: linux 10dist: trusty 11 12cache: 13 directories: 14 - ${TRAVIS_BUILD_DIR}/deps 15 16matrix: 17 include: 18 19 ########################################################################## 20 # Clang on OSX 21 # Travis seems to take longer to start OSX instances, 22 # so leave this first for the overall build to be faster 23 ########################################################################## 24 25 # XCode 8.3 26 - env: COMPILER=clang++ BUILD_TYPE=Debug GSL_CXX_STANDARD=14 27 os: osx 28 osx_image: xcode8.3 29 compiler: clang 30 31 - env: COMPILER=clang++ BUILD_TYPE=Release GSL_CXX_STANDARD=14 32 os: osx 33 osx_image: xcode8.3 34 compiler: clang 35 36 # XCode 9.1 37 - env: COMPILER=clang++ BUILD_TYPE=Debug GSL_CXX_STANDARD=14 38 os: osx 39 osx_image: xcode9.1 40 compiler: clang 41 42 - env: COMPILER=clang++ BUILD_TYPE=Release GSL_CXX_STANDARD=14 43 os: osx 44 osx_image: xcode9.1 45 compiler: clang 46 47 ########################################################################## 48 # Clang on Linux 49 ########################################################################## 50 51 # Clang 3.6 52 - env: COMPILER=clang++-3.6 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 53 addons: &clang36 54 apt: 55 packages: 56 - clang-3.6 57 - g++-5 58 sources: 59 - ubuntu-toolchain-r-test 60 - llvm-toolchain-precise-3.6 61 62 - env: COMPILER=clang++-3.6 BUILD_TYPE=Release GSL_CXX_STANDARD=14 63 addons: *clang36 64 65 # Clang 3.7 66 - env: COMPILER=clang++-3.7 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 67 addons: &clang37 68 apt: 69 packages: 70 - clang-3.7 71 - g++-5 72 sources: 73 - ubuntu-toolchain-r-test 74 - llvm-toolchain-precise-3.7 75 76 - env: COMPILER=clang++-3.7 BUILD_TYPE=Release GSL_CXX_STANDARD=14 77 addons: *clang37 78 79 # Clang 3.8 80 - env: COMPILER=clang++-3.8 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 81 addons: &clang38 82 apt: 83 packages: 84 - clang-3.8 85 - g++-5 86 sources: 87 - ubuntu-toolchain-r-test 88 - llvm-toolchain-precise-3.8 89 90 - env: COMPILER=clang++-3.8 BUILD_TYPE=Release GSL_CXX_STANDARD=14 91 addons: *clang38 92 93 # Clang 3.9 94 - env: COMPILER=clang++-3.9 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 95 addons: &clang39 96 apt: 97 packages: 98 - clang-3.9 99 - g++-5 100 sources: 101 - ubuntu-toolchain-r-test 102 - llvm-toolchain-precise-3.9 103 104 - env: COMPILER=clang++-3.9 BUILD_TYPE=Release GSL_CXX_STANDARD=14 105 addons: *clang39 106 107 # Clang 4.0 108 - env: COMPILER=clang++-4.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 109 addons: &clang40 110 apt: 111 packages: 112 - clang-4.0 113 - g++-5 114 sources: 115 - ubuntu-toolchain-r-test 116 - llvm-toolchain-trusty-4.0 117 118 - env: COMPILER=clang++-4.0 BUILD_TYPE=Release GSL_CXX_STANDARD=14 119 addons: *clang40 120 121 # Clang 5.0 122 - env: COMPILER=clang++-5.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 123 addons: &clang50 124 apt: 125 packages: 126 - clang-5.0 127 - g++-7 128 sources: 129 - ubuntu-toolchain-r-test 130 - llvm-toolchain-trusty-5.0 131 - sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main' 132 key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' 133 134 - env: COMPILER=clang++-5.0 BUILD_TYPE=Release GSL_CXX_STANDARD=14 135 addons: *clang50 136 137 - env: COMPILER=clang++-5.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=17 138 addons: *clang50 139 140 - env: COMPILER=clang++-5.0 BUILD_TYPE=Release GSL_CXX_STANDARD=17 141 addons: *clang50 142 143 # Clang 6.0 144 - env: COMPILER=clang++-6.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 145 addons: &clang60 146 apt: 147 packages: 148 - clang-6.0 149 - g++-7 150 sources: 151 - ubuntu-toolchain-r-test 152 - llvm-toolchain-trusty-6.0 153 - sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main' 154 key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' 155 156 - env: COMPILER=clang++-6.0 BUILD_TYPE=Release GSL_CXX_STANDARD=14 157 addons: *clang60 158 159 # Clang 6.0 c++17 160 - env: COMPILER=clang++-6.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=17 161 addons: *clang60 162 163 - env: COMPILER=clang++-6.0 BUILD_TYPE=Release GSL_CXX_STANDARD=17 164 addons: *clang60 165 166 # Clang 7.0 167 - env: COMPILER=clang++-7 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 168 addons: &clang70 169 apt: 170 packages: 171 - clang-7 172 - g++-7 173 sources: 174 - ubuntu-toolchain-r-test 175 - llvm-toolchain-trusty-7 176 177 178 - env: COMPILER=clang++-7 BUILD_TYPE=Release GSL_CXX_STANDARD=14 179 addons: *clang70 180 181 # Clang 7.0 c++17 182 - env: COMPILER=clang++-7 BUILD_TYPE=Debug GSL_CXX_STANDARD=17 183 addons: *clang70 184 185 - env: COMPILER=clang++-7 BUILD_TYPE=Release GSL_CXX_STANDARD=17 186 addons: *clang70 187 188 ########################################################################## 189 # GCC on Linux 190 ########################################################################## 191 192 # GCC 5 193 - env: COMPILER=g++-5 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 194 addons: &gcc5 195 apt: 196 packages: g++-5 197 sources: 198 - ubuntu-toolchain-r-test 199 200 - env: COMPILER=g++-5 BUILD_TYPE=Release GSL_CXX_STANDARD=14 201 addons: *gcc5 202 203 # GCC 6 204 - env: COMPILER=g++-6 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 205 addons: &gcc6 206 apt: 207 packages: g++-6 208 sources: 209 - ubuntu-toolchain-r-test 210 211 - env: COMPILER=g++-6 BUILD_TYPE=Release GSL_CXX_STANDARD=14 212 addons: *gcc6 213 214 # GCC 7 215 - env: COMPILER=g++-7 BUILD_TYPE=Debug GSL_CXX_STANDARD=14 216 addons: &gcc7 217 apt: 218 packages: g++-7 219 sources: 220 - ubuntu-toolchain-r-test 221 222 - env: COMPILER=g++-7 BUILD_TYPE=Release GSL_CXX_STANDARD=14 223 addons: *gcc7 224 225 # GCC 7 c++17 226 - env: COMPILER=g++-7 BUILD_TYPE=Debug GSL_CXX_STANDARD=17 227 addons: *gcc7 228 229 - env: COMPILER=g++-7 BUILD_TYPE=Release GSL_CXX_STANDARD=17 230 addons: *gcc7 231 232install: 233 # Set the ${CXX} variable properly 234 - export CXX=${COMPILER} 235 - ${CXX} --version 236 237 # Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/ 238 - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" 239 - mkdir -p "${DEPS_DIR}" 240 - cd "${DEPS_DIR}" 241 242 # Travis machines have 2 cores 243 - JOBS=2 244 245 ############################################################################ 246 # Install a recent CMake (unless already installed on OS X) 247 ############################################################################ 248 - CMAKE_VERSION=3.7.2 249 - | 250 if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then 251 CMAKE_URL="https://cmake.org/files/v${CMAKE_VERSION%.[0-9]}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz" 252 mkdir cmake && travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake 253 export PATH=${DEPS_DIR}/cmake/bin:${PATH} 254 else 255 brew install cmake || brew upgrade cmake 256 fi 257 - cmake --version 258 259 ############################################################################ 260 # [linux]: Install the right version of libc++ 261 ############################################################################ 262 - | 263 LLVM_INSTALL=${DEPS_DIR}/llvm/install 264 # if in linux and compiler clang and llvm not installed 265 if [[ "${TRAVIS_OS_NAME}" == "linux" && "${CXX%%+*}" == "clang" && -n "$(ls -A ${LLVM_INSTALL})" ]]; then 266 if [[ "${CXX}" == "clang++-3.6" ]]; then LLVM_VERSION="3.6.2"; 267 elif [[ "${CXX}" == "clang++-3.7" ]]; then LLVM_VERSION="3.7.1"; 268 elif [[ "${CXX}" == "clang++-3.8" ]]; then LLVM_VERSION="3.8.1"; 269 elif [[ "${CXX}" == "clang++-3.9" ]]; then LLVM_VERSION="3.9.1"; 270 fi 271 LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz" 272 LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz" 273 LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz" 274 mkdir -p llvm llvm/build llvm/projects/libcxx llvm/projects/libcxxabi 275 travis_retry wget -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C llvm 276 travis_retry wget -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx 277 travis_retry wget -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi 278 (cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_INSTALL}) 279 (cd llvm/build/projects/libcxx && make install -j2) 280 (cd llvm/build/projects/libcxxabi && make install -j2) 281 export CXXFLAGS="-isystem ${LLVM_INSTALL}/include/c++/v1" 282 export LDFLAGS="-L ${LLVM_INSTALL}/lib -l c++ -l c++abi" 283 export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_INSTALL}/lib" 284 fi 285 286before_script: 287 # have CMake to generate build files 288 - cd "${TRAVIS_BUILD_DIR}" 289 - mkdir build && cd build 290 - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DGSL_CXX_STANDARD=$GSL_CXX_STANDARD 291 292script: 293 # build and run tests 294 - cmake --build . -- -j${JOBS} 295 - ctest --output-on-failure -j${JOBS} 296