1sudo: required
2dist: precise
3
4language: cpp
5cache:
6  - ccache
7
8env:
9  global:
10    - USE_CCACHE=1
11    - CCACHE_SLOPPINESS=pch_defines,time_macros
12    - CCACHE_COMPRESS=1
13    - CCACHE_MAXSIZE=100M
14    - ARCH_FLAGS_x86='-m32'        # #266: don't use SSE on 32-bit
15    - ARCH_FLAGS_x86_64='-msse4.2' #       use SSE4.2 on 64-bit
16    - GITHUB_REPO='miloyip/rapidjson'
17    - secure: "HrsaCb+N66EG1HR+LWH1u51SjaJyRwJEDzqJGYMB7LJ/bfqb9mWKF1fLvZGk46W5t7TVaXRDD5KHFx9DPWvKn4gRUVkwTHEy262ah5ORh8M6n/6VVVajeV/AYt2C0sswdkDBDO4Xq+xy5gdw3G8s1A4Inbm73pUh+6vx+7ltBbk="
18
19before_install:
20    - sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test
21    - sudo apt-get update -qq
22    - sudo apt-get install -y cmake valgrind g++-multilib libc6-dbg:i386
23
24matrix:
25  include:
26    # gcc
27    - env: CONF=release ARCH=x86    CXX11=ON
28      compiler: gcc
29    - env: CONF=release ARCH=x86_64 CXX11=ON
30      compiler: gcc
31    - env: CONF=debug   ARCH=x86    CXX11=OFF
32      compiler: gcc
33    - env: CONF=debug   ARCH=x86_64 CXX11=OFF
34      compiler: gcc
35    # clang
36    - env: CONF=debug   ARCH=x86    CXX11=ON CCACHE_CPP2=yes
37      compiler: clang
38    - env: CONF=debug   ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
39      compiler: clang
40    - env: CONF=debug   ARCH=x86    CXX11=OFF CCACHE_CPP2=yes
41      compiler: clang
42    - env: CONF=debug   ARCH=x86_64 CXX11=OFF CCACHE_CPP2=yes
43      compiler: clang
44    - env: CONF=release ARCH=x86    CXX11=ON CCACHE_CPP2=yes
45      compiler: clang
46    - env: CONF=release ARCH=x86_64 CXX11=ON CCACHE_CPP2=yes
47      compiler: clang
48    # coverage report
49    - env: CONF=debug   ARCH=x86    CXX11=ON GCOV_FLAGS='--coverage'
50      compiler: gcc
51      cache:
52        - ccache
53        - pip
54      after_success:
55        - pip install --user cpp-coveralls
56        - coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
57    - env: CONF=debug   ARCH=x86_64 GCOV_FLAGS='--coverage'
58      compiler: gcc
59      cache:
60        - ccache
61        - pip
62      after_success:
63        - pip install --user cpp-coveralls
64        - coveralls -r .. --gcov-options '\-lp' -e thirdparty -e example -e test -e build/CMakeFiles -e include/rapidjson/msinttypes -e include/rapidjson/internal/meta.h -e include/rapidjson/error/en.h
65    - script: # Documentation task
66      - cd build
67      - cmake .. -DRAPIDJSON_HAS_STDSTRING=ON -DCMAKE_VERBOSE_MAKEFILE=ON
68      - make travis_doc
69      cache: false
70      addons:
71        apt:
72          packages:
73            - doxygen
74
75before_script:
76    - ccache -s
77      #   hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469),
78      #   exposed by merging PR#163 (using -march=native)
79      #   TODO: Since this bug is already fixed. Remove this when valgrind can be upgraded.
80    - sed -i "s/-march=native//" CMakeLists.txt
81    - mkdir build
82
83script:
84  - if [ "$CXX" = "clang++" ]; then export CXXFLAGS="-stdlib=libc++ ${CXXFLAGS}"; fi
85  - >
86      eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ;
87      (cd build && cmake
88      -DRAPIDJSON_HAS_STDSTRING=ON
89      -DRAPIDJSON_BUILD_CXX11=$CXX11
90      -DCMAKE_VERBOSE_MAKEFILE=ON
91      -DCMAKE_BUILD_TYPE=$CONF
92      -DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS"
93      -DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS
94      ..)
95  - cd build
96  - make tests -j 2
97  - make examples -j 2
98  - ctest -j 2 -V `[ "$CONF" = "release" ] || echo "-E perftest"`
99