-
Notifications
You must be signed in to change notification settings - Fork 44
/
.travis.yml
120 lines (100 loc) · 4.72 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Copyright Louis Dionne 2017
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
language: cpp
os: linux # Use Linux unless specified otherwise
dist: xenial # Use 'xenial' unless specified otherwise
sudo: false
# Do not build branches of the form "pr/*". By prefixing pull requests coming
# from branches inside the repository with pr/, this avoids building both the
# branch push _and_ the pull request.
branches:
except: /pr\/.*/
matrix:
include:
- env: COMPILER=clang++-7
addons: { apt: { packages: ["clang-7"], sources: ["llvm-toolchain-xenial-7", "ubuntu-toolchain-r-test"] } }
- env: COMPILER=g++-7
addons: { apt: { packages: ["g++-7"], sources: ["ubuntu-toolchain-r-test"] } }
- os: osx
env: COMPILER=clang++
osx_image: xcode9.1
- os: osx
env: COMPILER=clang++
osx_image: xcode10.2
- os: osx
env: COMPILER=clang++
osx_image: xcode11
# Build without the optional dependencies
- env: COMPILER=clang++-7 NO_OPTIONAL_DEPENDENCIES=true
addons: { apt: { packages: ["clang-7"], sources: ["llvm-toolchain-xenial-7", "ubuntu-toolchain-r-test"] } }
allow_failures:
- env: COMPILER=g++-7
install:
# Set the ${CXX} and ${CC} variables properly. They are picked up by CMake
# to determine the C++ and C compilers, respectively.
- export CXX=${COMPILER}
- if [[ "${CXX}" == "g++"* ]]; then export CC="${CXX/++/cc}"; fi
- if [[ "${CXX}" == "clang++"* ]]; then export CC="${CXX/++/}"; fi
- echo "CXX = ${CXX}" && ${CXX} --version
- echo "CC = ${CC}" && ${CC} --version
# Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
# Install a recent CMake
- CMAKE_VERSION=3.15.0
- CMAKE_DIR=${DEPS_DIR}/cmake-${CMAKE_VERSION}
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
mkdir -p ${CMAKE_DIR}
(travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR}) || exit 1
export PATH=${CMAKE_DIR}/bin:${PATH}
else
brew install cmake || brew upgrade cmake
fi
- cmake --version
# On Linux, install libc++ and libc++abi when building with Clang.
# Otherwise, it uses the libstdc++ provided with the system.
- |
if [[ "${CXX}" == "clang"* && "${TRAVIS_OS_NAME}" == "linux" ]]; then
if [[ "${CXX}" == "clang++-7" ]]; then LLVM_VERSION="7.0.1"; fi
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
mkdir -p llvm llvm/build llvm/projects/libcxx llvm/projects/libcxxabi
travis_retry wget -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C llvm
travis_retry wget -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx
travis_retry wget -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi
(cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${DEPS_DIR}/llvm/install)
(cd llvm/build/projects/libcxx && make install -j2)
(cd llvm/build/projects/libcxxabi && make install -j2)
export CXXFLAGS="-isystem ${DEPS_DIR}/llvm/install/include/c++/v1"
export LDFLAGS="-L ${DEPS_DIR}/llvm/install/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${DEPS_DIR}/llvm/install/lib"
fi
# Install Boost headers
- BOOST_VERSION=1.65.1
- BOOST_DIR=${DEPS_DIR}/boost-${BOOST_VERSION}
- |
if [[ "${NO_OPTIONAL_DEPENDENCIES}" != "true" ]]; then
BOOST_URL="https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION//\./_}.tar.gz"
mkdir -p ${BOOST_DIR}
{ travis_retry wget -O - ${BOOST_URL} | tar --strip-components=1 -xz -C ${BOOST_DIR}; } || exit 1
fi
# Install other dependencies
- |
if [[ "${NO_OPTIONAL_DEPENDENCIES}" == "true" ]]; then
(cd "${TRAVIS_BUILD_DIR}/dependencies" && ./install.sh --minimal)
else
(cd "${TRAVIS_BUILD_DIR}/dependencies" && ./install.sh)
fi
before_script:
- cd "${TRAVIS_BUILD_DIR}"
- (mkdir build && cd build && cmake .. -DBOOST_ROOT="${BOOST_DIR}" -DCMAKE_PREFIX_PATH="${TRAVIS_BUILD_DIR}/dependencies/install" -DCMAKE_INSTALL_PREFIX="${TRAVIS_BUILD_DIR}/build/install")
script:
- cmake --build build --target check
- |
if [[ "${NO_OPTIONAL_DEPENDENCIES}" != "true" ]]; then
cmake --build build --target benchmarks
fi