-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
210 lines (189 loc) · 8.19 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
# Copyright Rein Halbersma 2019-2024.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
language: cpp
os: linux
dist: focal
matrix:
include:
# Temporariliy disabled until Clang supports lambdas in unevaluated contexts (p0315r4)
# - env: TOOLSET=clang TOOLSET_VER=10 STDLIB=libstdc++ STDLIB_VER=10
# addons:
# apt:
# packages:
# - clang-10
# - g++-10
# sources:
# - sourceline: 'ppa:ubuntu-toolchain-r/test'
# - sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main'
# key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
# - env: TOOLSET=clang TOOLSET_VER=11 STDLIB=libstdc++ STDLIB_VER=10
# addons:
# apt:
# packages:
# - clang-11
# - g++-10
# sources:
# - sourceline: 'ppa:ubuntu-toolchain-r/test'
# - sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main'
# key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
# - env: TOOLSET=clang TOOLSET_VER=12 STDLIB=libstdc++ STDLIB_VER=10
# addons:
# apt:
# packages:
# - clang-12
# - g++-10
# sources:
# - sourceline: 'ppa:ubuntu-toolchain-r/test'
# - sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal main'
# key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
# - env: TOOLSET=clang TOOLSET_VER=12 STDLIB=libc++ STDLIB_VER=11
# addons:
# apt:
# packages:
# - clang-12
# - libc++-12-dev
# - libc++abi-12-dev
# sources:
# - sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal main'
# key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- env: TOOLSET=gcc TOOLSET_VER=10 STDLIB=libstdc++ STDLIB_VER=10
addons:
apt:
packages:
- g++-10
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
- env: TOOLSET=gcc TOOLSET_VER=10 STDLIB=libstdc++ STDLIB_VER=10 CODE_COVERAGE=true
addons:
apt:
packages:
- g++-10
sources:
- sourceline: 'ppa:ubuntu-toolchain-r/test'
- env: TOOLSET=gcc TOOLSET_VER=11 STDLIB=libstdc++ STDLIB_VER=11
install:
################################################################################
# Third party dependencies are installed in ${TRAVIS_BUILD_DIR}/../third_party
################################################################################
- |
THIRD_PARTY_DIR="${TRAVIS_BUILD_DIR}/../third_party"
mkdir -p ${THIRD_PARTY_DIR}
cd ${THIRD_PARTY_DIR}
################################################################################
# Install gcc-latest
################################################################################
- |
if [[ "${STDLIB}" == "libstdc++" && "${STDLIB_VER}" == "11" ]]; then
wget http://kayari.org/gcc-latest/gcc-latest.deb
sudo dpkg -i gcc-latest.deb
sudo ln -s /opt/gcc-latest/bin/gcc /usr/bin/gcc-${TOOLSET_VER}
sudo ln -s /opt/gcc-latest/bin/g++ /usr/bin/g++-${TOOLSET_VER}
sudo ln -s /opt/gcc-latest/bin/gcov /usr/bin/gcov-${TOOLSET_VER}
sudo ln -s /opt/gcc-latest/bin/gcov-dump /usr/bin/gcov-dump-${TOOLSET_VER}
sudo ln -s /opt/gcc-latest/bin/gcov-tool /usr/bin/gcov-tool-${TOOLSET_VER}
sudo ln -s /opt/gcc-latest/bin/gcc-ar /usr/bin/gcc-ar-${TOOLSET_VER}
sudo ln -s /opt/gcc-latest/bin/gcc-nm /usr/bin/gcc-nm-${TOOLSET_VER}
sudo ln -s /opt/gcc-latest/bin/gcc-ranlib /usr/bin/gcc-ranlib-${TOOLSET_VER}
sudo ldconfig /opt/gcc-latest/lib64
fi
################################################################################
# Set clang, clang++, gcc, g++ and gcov to latest versions that are installed
################################################################################
- |
if [[ "${TOOLSET}" == "clang" ]]; then
sudo update-alternatives \
--install /usr/bin/clang clang /usr/bin/clang-${TOOLSET_VER} 10 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-${TOOLSET_VER}
sudo rm -rf /usr/local/clang-7.0.0
clang --version
clang++ --version
fi
if [[ "${STDLIB}" == "libstdc++" ]]; then
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-${STDLIB_VER} 10 \
--slave /usr/bin/g++ g++ /usr/bin/g++-${STDLIB_VER} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${STDLIB_VER} \
--slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-${STDLIB_VER} \
--slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-${STDLIB_VER} \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-${STDLIB_VER} \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-${STDLIB_VER} \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-${STDLIB_VER}
gcc --version
g++ --version
gcov --version
fi
################################################################################
# Install the latest Boost and build Boost.Test (compiled with the latest gcc)
################################################################################
- |
BOOST_VERSION=1.74.0
BOOST_DIR=${THIRD_PARTY_DIR}/boost-${BOOST_VERSION}
BOOST_URL="https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION//\./_}.tar.bc2"
BOOST_LIBS="test"
BOOST_BUILD_TYPE="link=static variant=release"
mkdir -p ${BOOST_DIR} && travis_retry wget --quiet -O - ${BOOST_URL} | tar --strip-components=1 -xj -C ${BOOST_DIR}
cd ${BOOST_DIR}
if [[ "${STDLIB}" == "libstdc++" ]]; then
./bootstrap.sh --with-toolset=gcc --with-libraries=${BOOST_LIBS}
sudo ./b2 -d0 -j10 install toolset=gcc ${BOOST_BUILD_TYPE}
elif [[ "${STDLIB}" == "libc++" ]]; then
./bootstrap.sh --with-toolset=clang --with-libraries=${BOOST_LIBS}
sudo ./b2 -d0 -j10 install toolset=clang ${BOOST_BUILD_TYPE} cxxflags="-stdlib=libc++"
fi
cd ${THIRD_PARTY_DIR}
################################################################################
# Install the latest CMake
################################################################################
- |
CMAKE_VERSION=3.18.1
CMAKE_DIR=${THIRD_PARTY_DIR}/cmake-${CMAKE_VERSION}
CMAKE_URL="http://www.cmake.org/files/v${CMAKE_VERSION%.[0-9]}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
mkdir -p ${CMAKE_DIR} && travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR}
export PATH=${CMAKE_DIR}/bin:${PATH}
cmake --version
################################################################################
# Install the latest lcov
################################################################################
- |
if [[ "${CODE_COVERAGE}" == "true" ]]; then
sudo apt-get install -y libjson-perl libperlio-gzip-perl
git clone https://github.com/linux-test-project/lcov.git
LCOV_DIR=${THIRD_PARTY_DIR}/lcov
export PATH=${LCOV_DIR}/bin:${PATH}
lcov --version
fi
before_script:
- |
cd ${TRAVIS_BUILD_DIR}
mkdir build && cd build
if [[ "${TOOLSET}" == "clang" ]]; then
CXX_COMPILER=clang++-${TOOLSET_VER}
elif [[ "${TOOLSET}" == "gcc" ]]; then
CXX_COMPILER=g++-${TOOLSET_VER}
fi
if [[ "${TOOLSET}" == "clang" && "${STDLIB}" == "libc++" ]]; then
cmake .. \
-DCMAKE_CXX_COMPILER=${CXX_COMPILER} \
-DCMAKE_CXX_FLAGS="-stdlib=libc++"
elif [[ "${CODE_COVERAGE}" == "true" ]]; then
cmake .. \
-DCMAKE_CXX_COMPILER=${CXX_COMPILER} \
-DCMAKE_CXX_FLAGS="-g -O0 --coverage"
else
cmake .. \
-DCMAKE_CXX_COMPILER=${CXX_COMPILER}
fi
script:
- |
cmake --build . -v
ctest
after_success:
- |
if [[ "${CODE_COVERAGE}" == "true" ]]; then
lcov --directory . --capture --output-file coverage.info
bash <(curl -s https://codecov.io/bash) -v -f coverage.info || echo 'Codecov failed to upload'
fi
notifications:
email: false