forked from microsoft/GSL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
295 lines (246 loc) · 9.24 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# Based on https://github.com/ldionne/hana/blob/master/.travis.yml
language: cpp
sudo: false
notifications:
email: false
# Use Linux unless specified otherwise
os: linux
dist: trusty
cache:
directories:
- ${TRAVIS_BUILD_DIR}/deps
matrix:
include:
##########################################################################
# Clang on OSX
# Travis seems to take longer to start OSX instances,
# so leave this first for the overall build to be faster
##########################################################################
# XCode 8.3
- env: COMPILER=clang++ BUILD_TYPE=Debug GSL_CXX_STANDARD=14
os: osx
osx_image: xcode8.3
compiler: clang
- env: COMPILER=clang++ BUILD_TYPE=Release GSL_CXX_STANDARD=14
os: osx
osx_image: xcode8.3
compiler: clang
# XCode 9.1
- env: COMPILER=clang++ BUILD_TYPE=Debug GSL_CXX_STANDARD=14
os: osx
osx_image: xcode9.1
compiler: clang
- env: COMPILER=clang++ BUILD_TYPE=Release GSL_CXX_STANDARD=14
os: osx
osx_image: xcode9.1
compiler: clang
##########################################################################
# Clang on Linux
##########################################################################
# Clang 3.6
- env: COMPILER=clang++-3.6 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &clang36
apt:
packages:
- clang-3.6
- g++-5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- env: COMPILER=clang++-3.6 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *clang36
# Clang 3.7
- env: COMPILER=clang++-3.7 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &clang37
apt:
packages:
- clang-3.7
- g++-5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
- env: COMPILER=clang++-3.7 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *clang37
# Clang 3.8
- env: COMPILER=clang++-3.8 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &clang38
apt:
packages:
- clang-3.8
- g++-5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- env: COMPILER=clang++-3.8 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *clang38
# Clang 3.9
- env: COMPILER=clang++-3.9 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &clang39
apt:
packages:
- clang-3.9
- g++-5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
- env: COMPILER=clang++-3.9 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *clang39
# Clang 4.0
- env: COMPILER=clang++-4.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &clang40
apt:
packages:
- clang-4.0
- g++-5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- env: COMPILER=clang++-4.0 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *clang40
# Clang 5.0
- env: COMPILER=clang++-5.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &clang50
apt:
packages:
- clang-5.0
- g++-7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- env: COMPILER=clang++-5.0 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *clang50
- env: COMPILER=clang++-5.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=17
addons: *clang50
- env: COMPILER=clang++-5.0 BUILD_TYPE=Release GSL_CXX_STANDARD=17
addons: *clang50
# Clang 6.0
- env: COMPILER=clang++-6.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &clang60
apt:
packages:
- clang-6.0
- g++-7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- env: COMPILER=clang++-6.0 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *clang60
# Clang 6.0 c++17
- env: COMPILER=clang++-6.0 BUILD_TYPE=Debug GSL_CXX_STANDARD=17
addons: *clang60
- env: COMPILER=clang++-6.0 BUILD_TYPE=Release GSL_CXX_STANDARD=17
addons: *clang60
# Clang 7.0
- env: COMPILER=clang++-7 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &clang70
apt:
packages:
- clang-7
- g++-7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-7
- env: COMPILER=clang++-7 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *clang70
# Clang 7.0 c++17
- env: COMPILER=clang++-7 BUILD_TYPE=Debug GSL_CXX_STANDARD=17
addons: *clang70
- env: COMPILER=clang++-7 BUILD_TYPE=Release GSL_CXX_STANDARD=17
addons: *clang70
##########################################################################
# GCC on Linux
##########################################################################
# GCC 5
- env: COMPILER=g++-5 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &gcc5
apt:
packages: g++-5
sources:
- ubuntu-toolchain-r-test
- env: COMPILER=g++-5 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *gcc5
# GCC 6
- env: COMPILER=g++-6 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &gcc6
apt:
packages: g++-6
sources:
- ubuntu-toolchain-r-test
- env: COMPILER=g++-6 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *gcc6
# GCC 7
- env: COMPILER=g++-7 BUILD_TYPE=Debug GSL_CXX_STANDARD=14
addons: &gcc7
apt:
packages: g++-7
sources:
- ubuntu-toolchain-r-test
- env: COMPILER=g++-7 BUILD_TYPE=Release GSL_CXX_STANDARD=14
addons: *gcc7
# GCC 7 c++17
- env: COMPILER=g++-7 BUILD_TYPE=Debug GSL_CXX_STANDARD=17
addons: *gcc7
- env: COMPILER=g++-7 BUILD_TYPE=Release GSL_CXX_STANDARD=17
addons: *gcc7
install:
# Set the ${CXX} variable properly
- export CXX=${COMPILER}
- ${CXX} --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}"
# Travis machines have 2 cores
- JOBS=2
############################################################################
# Install a recent CMake (unless already installed on OS X)
############################################################################
- CMAKE_VERSION=3.7.2
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="https://cmake.org/files/v${CMAKE_VERSION%.[0-9]}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
else
brew install cmake || brew upgrade cmake
fi
- cmake --version
############################################################################
# [linux]: Install the right version of libc++
############################################################################
- |
LLVM_INSTALL=${DEPS_DIR}/llvm/install
# if in linux and compiler clang and llvm not installed
if [[ "${TRAVIS_OS_NAME}" == "linux" && "${CXX%%+*}" == "clang" && -n "$(ls -A ${LLVM_INSTALL})" ]]; then
if [[ "${CXX}" == "clang++-3.6" ]]; then LLVM_VERSION="3.6.2";
elif [[ "${CXX}" == "clang++-3.7" ]]; then LLVM_VERSION="3.7.1";
elif [[ "${CXX}" == "clang++-3.8" ]]; then LLVM_VERSION="3.8.1";
elif [[ "${CXX}" == "clang++-3.9" ]]; then LLVM_VERSION="3.9.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=${LLVM_INSTALL})
(cd llvm/build/projects/libcxx && make install -j2)
(cd llvm/build/projects/libcxxabi && make install -j2)
export CXXFLAGS="-isystem ${LLVM_INSTALL}/include/c++/v1"
export LDFLAGS="-L ${LLVM_INSTALL}/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_INSTALL}/lib"
fi
before_script:
# have CMake to generate build files
- cd "${TRAVIS_BUILD_DIR}"
- mkdir build && cd build
- cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DGSL_CXX_STANDARD=$GSL_CXX_STANDARD
script:
# build and run tests
- cmake --build . -- -j${JOBS}
- ctest --output-on-failure -j${JOBS}