forked from karkason/cppystruct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
110 lines (95 loc) · 3.63 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
# Based on https://github.com/Microsoft/GSL/blob/master/.travis.yml
language: cpp
sudo: false
notifications:
email: true
# Use Linux unless specified otherwise
os: linux
dist: trusty
cache:
directories:
- ${TRAVIS_BUILD_DIR}/DEPS_DIR
matrix:
include:
# Clang 5.0
- env: COMPILER=clang++-5.0 BUILD_TYPE=Debug
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-4.0 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
# GCC 7
- env: COMPILER=g++-7 BUILD_TYPE=Debug
addons: &gcc7
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
# 32bit
- env: COMPILER=g++-7 BUILD_TYPE=Release
addons: *gcc7
# Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
- env: COMPILER=g++-7 BUILD_TYPE=Release CMAKE_OPTIONS=-DCPPYSTRUCT_Coverage=ON
addons: &gcc7_coveralls
apt:
packages:
- g++-7
- lcov
sources:
- ubuntu-toolchain-r-test
before_script:
- pip install --user cpp-coveralls
after_success:
- coveralls --verbose -E /usr/include.* -e build/catch -e build/external -e build/internal -e tests --gcov-options '\-lp'
################
# build script #
################
install:
- sudo ln -s /usr/include/asm-generic /usr/include/asm
- uname -a
# 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
- |
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
script:
- cmake --version
- cd "${TRAVIS_BUILD_DIR}"
- mkdir -p build && cd build
- cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE ${CMAKE_OPTIONS}
- cmake --build . -- -j${JOBS}
- ctest --output-on-failure -j${JOBS}
- cd ..