Skip to content

Commit 9de81eb

Browse files
committed
Travis-CI: add packages for the various clang versions
I tried to set up the matrix for various clang. I had trouble with: - linux + clang-3.5 (libstdc++ didnt work with this version and I couldnt figure out how to get it to use libc++) - linux + clang-3.8 (appears that this isnt ready yet) - linux + gcc-5 (the tool "gcc-5" wasnt found) Anyway, the matrix seems to work in these configs at least. Hint: it's the red pill.
1 parent 6600771 commit 9de81eb

File tree

2 files changed

+53
-6
lines changed

2 files changed

+53
-6
lines changed

.travis.yml

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,54 @@
11
language: cpp
2-
32
sudo: false # Use the new container infrastructure
43

5-
compiler:
6-
- clang
7-
- gcc
4+
matrix:
5+
include:
6+
- os: linux
7+
env:
8+
- COMPILER=clang++-3.6 STDLIB=libc++
9+
addons:
10+
apt:
11+
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
12+
packages: ["clang-3.6"]
13+
14+
- os: linux
15+
env:
16+
- COMPILER=clang++-3.7 STDLIB=libc++
17+
addons:
18+
apt:
19+
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7']
20+
packages: ["clang-3.7"]
21+
22+
- os: osx
23+
osx_image: xcode6.4
24+
env:
25+
- COMPILER=clang++ V='Apple LLVM 6.4'
26+
- COMPILER=clang++ V='Apple LLVM 6.4' WITH_CPP14=true
27+
28+
- os: osx
29+
osx_image: xcode7
30+
env:
31+
- COMPILER=clang++ V='Apple LLVM 7.0'
32+
- COMPILER=clang++ V='Apple LLVM 7.0' WITH_CPP14=true
33+
34+
before_install:
35+
- |
36+
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
37+
brew install cmake
38+
fi
39+
40+
- CMAKE_CXX_FLAGS+=" -Wall"
41+
42+
- if [[ "${WITH_CPP14}" == "true" ]]; then CMAKE_OPTIONS+=" -DWITH_CPP14=1"; fi
43+
- if [[ "${STDLIB}" == "libc++" ]]; then CMAKE_CXX_FLAGS+=" -stdlib=libc++"; fi
44+
45+
- sh ${COMPILER} --version || true
846

947
before_script:
10-
- cmake -DWITH_TESTS=1 -DWITH_EXAMPLE=1 .
48+
- rm -rf build/
49+
- mkdir build
50+
- cd build
51+
- cmake -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DWITH_TESTS=1 -DWITH_EXAMPLE=1 ${CMAKE_OPTIONS} ..
1152

1253
script:
1354
- cmake --build .

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 2.6.4)
33
option(WITH_TESTS "Build tests." OFF)
44
option(WITH_EXAMPLE "Build example." OFF)
55
option(WITH_STATIC "Build static libs." ON)
6+
option(WITH_CPP11 "Build with C++11." ON)
7+
option(WITH_CPP14 "Build with C++14." OFF)
68

79
project(docopt.cpp)
810
include_directories("${PROJECT_SOURCE_DIR}")
@@ -22,7 +24,11 @@ if(WITH_STATIC)
2224
endif()
2325
add_library(docopt SHARED ${DOCOPT_SRC})
2426

25-
add_definitions("-std=c++11")
27+
if(WITH_CPP14)
28+
add_definitions("-std=c++14")
29+
elseif(WITH_CPP11)
30+
add_definitions("-std=c++11")
31+
endif()
2632

2733
########################################################################
2834
# tests

0 commit comments

Comments
 (0)