-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
157 lines (144 loc) · 5.41 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
language: cpp
os: linux # default
dist: trusty # default
sudo: false
matrix:
include:
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
env:
- MATRIX_EVAL="CCCOMPILER=gcc-6 && CXXCOMPILER=g++-6"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env:
- MATRIX_EVAL="CCCOMPILER=gcc-7 && CXXCOMPILER=g++-7"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
env:
- MATRIX_EVAL="CCCOMPILER=gcc-8 && CXXCOMPILER=g++-8"
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-3.9
packages:
- clang-3.9
env:
- MATRIX_EVAL="CCCOMPILER=clang-3.9 && CXXCOMPILER=clang++-3.9"
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-4.0
packages:
- clang-4.0
env:
- MATRIX_EVAL="CCCOMPILER=clang-4.0 && CXXCOMPILER=clang++-4.0"
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
env:
- MATRIX_EVAL="CCCOMPILER=clang-5.0 && CXXCOMPILER=clang++-5.0"
- os: osx
osx_image: xcode9.4
env:
- MATRIX_EVAL="CCCOMPILER=clang && CXXCOMPILER=clang++"
- os: osx
osx_image: xcode10
env:
- MATRIX_EVAL="CCCOMPILER=clang && CXXCOMPILER=clang++"
before_install:
- eval "${MATRIX_EVAL}"
install:
- export CXX=${CXXCOMPILER}
- export CC=${CCCOMPILER}
############################################################################
# Preparation
############################################################################
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir ${DEPS_DIR} && cd ${DEPS_DIR}
- |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
if [[ "${CCCOMPILER}" == "gcc-8" ]]; then
brew install gcc
brew link --overwrite gcc
fi
fi
############################################################################
# Update CMake
############################################################################
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export CMAKE_VER="3.13.2"
travis_retry wget --no-check-certificate https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.tar.gz
tar -xvf cmake-${CMAKE_VER}-Linux-x86_64.tar.gz > /dev/null
PATH=${DEPS_DIR}/cmake-${CMAKE_VER}-Linux-x86_64:${DEPS_DIR}/cmake-${CMAKE_VER}-Linux-x86_64/bin:$PATH
cd ${TRAVIS_BUILD_DIR}
cmake --version
fi
############################################################################
# Clang specific setup (inspired by boost::hana!)
############################################################################
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
if [[ "${CXX%%+*}" == "clang" ]]; then
if [[ "${CXX}" == "clang++-3.8" ]]; then LLVM_VERSION="3.8.1";
elif [[ "${CXX}" == "clang++-3.9" ]]; then LLVM_VERSION="3.9.1";
elif [[ "${CXX}" == "clang++-4.0" ]]; then LLVM_VERSION="4.0.1";
elif [[ "${CXX}" == "clang++-5.0" ]]; then LLVM_VERSION="5.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 || exit 1
travis_retry wget -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx || exit 1
travis_retry wget -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi || exit 1
(cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${DEPS_DIR}/llvm/install) || exit 1
(cd llvm/build/projects/libcxx && make install -j2) || exit 1
(cd llvm/build/projects/libcxxabi && make install -j2) || exit 1
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
fi
############################################################################
# Compile GTest
############################################################################
- cd ${DEPS_DIR}
- git clone https://github.com/google/googletest.git
- cd googletest && mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${DEPS_DIR}/googletest/install ..
- make -j4 && make install
before_script:
- cd ${TRAVIS_BUILD_DIR}
- export GTEST_ROOT=${DEPS_DIR}/googletest/install
script:
- cd ${TRAVIS_BUILD_DIR}/src && mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/.local/ ..
- cmake --build . --target install
- cd ${TRAVIS_BUILD_DIR}/test && mkdir build && cd build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/.local/ ..
- make
- ctest -VV
# after_success:
# - bash <(curl -s https://codecov.io/bash)