From caa4d22d1680f22e26c07f3a2c47354f121479da Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 29 Dec 2015 18:15:52 +0200 Subject: [PATCH 01/25] Initial attempt at moving travis to containerized infrastructure. --- .travis.yml | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index be06f35..0f7cfc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,12 @@ language: cpp - +sudo: false +cache: + - ccache compiler: - clang - gcc +addons: {apt: {packages: &default_packages [cmake, valgrind, doxygen]}} env: matrix: - CONF=debug ARCH=x86_64 @@ -11,31 +14,35 @@ env: - CONF=debug ARCH=x86 - CONF=release ARCH=x86 global: + - USE_CCACHE=1 + - CCACHE_SLOPPINESS=pch_defines,time_macros + - CCACHE_COMPRESS=1 + - CCACHE_MAXSIZE=100M - ARCH_FLAGS_x86='-m32' # #266: don't use SSE on 32-bit - ARCH_FLAGS_x86_64='-msse4.2' # use SSE4.2 on 64-bit - GITHUB_REPO='miloyip/rapidjson' - secure: "HrsaCb+N66EG1HR+LWH1u51SjaJyRwJEDzqJGYMB7LJ/bfqb9mWKF1fLvZGk46W5t7TVaXRDD5KHFx9DPWvKn4gRUVkwTHEy262ah5ORh8M6n/6VVVajeV/AYt2C0sswdkDBDO4Xq+xy5gdw3G8s1A4Inbm73pUh+6vx+7ltBbk=" -before_install: - - sudo apt-get update -qq - - sudo apt-get install -qq cmake valgrind - - sudo apt-get --no-install-recommends install doxygen # Don't install LaTeX stuffs - - if [ "$ARCH" = "x86" ]; then sudo apt-get install -qq g++-multilib libc6-dbg:i386; fi - - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then sudo pip install cpp-coveralls; export GCOV_FLAGS='--coverage'; fi - -install: true +matrix: + include: + env: CONF=debug ARCH=x86 + addons: {apt: {packages: [*default_packages, g++-multilib, libc6-dbg:i386]}} + include: + env: CONF=release ARCH=x86 + addons: {apt: {packages: [*default_packages, g++-multilib, libc6-dbg:i386]}} before_script: # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), # exposed by merging PR#163 (using -march=native) + - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then export GCOV_FLAGS='--coverage'; fi - sed -i "s/-march=native//" CMakeLists.txt - - mkdir build + - mkdir build - > eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ; - (cd build && cmake + (cd build && cmake -DRAPIDJSON_HAS_STDSTRING=ON - -DCMAKE_VERBOSE_MAKEFILE=ON - -DCMAKE_BUILD_TYPE=$CONF + -DCMAKE_VERBOSE_MAKEFILE=ON + -DCMAKE_BUILD_TYPE=$CONF -DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS" -DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS ..) @@ -48,4 +55,5 @@ script: - make travis_doc after_success: - - 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 + - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then pip install --user cpp-coveralls; fi + - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; 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; fi From feadfad2660cd5cc332f99b14bb3ec78bb3d02d3 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 12:18:39 +0200 Subject: [PATCH 02/25] Fix syntax errors. --- .travis.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f7cfc0..a0feeb7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,13 @@ compiler: - clang - gcc -addons: {apt: {packages: &default_packages [cmake, valgrind, doxygen]}} +addons: + apt: + packages: &default_packages + - cmake + - valgrind + - doxygen + env: matrix: - CONF=debug ARCH=x86_64 @@ -26,10 +32,20 @@ env: matrix: include: env: CONF=debug ARCH=x86 - addons: {apt: {packages: [*default_packages, g++-multilib, libc6-dbg:i386]}} + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 include: env: CONF=release ARCH=x86 - addons: {apt: {packages: [*default_packages, g++-multilib, libc6-dbg:i386]}} + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 before_script: # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), From 6d97d8bf7166afddbdb650bd0414d02b68432814 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 12:32:26 +0200 Subject: [PATCH 03/25] Fixed bash syntax error. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a0feeb7..3b3b91f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,4 +72,4 @@ script: after_success: - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then pip install --user cpp-coveralls; fi - - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; 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; fi + - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then 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; fi From 4fadfa5c223a8ea7fadd53cce228319f55cb6aea Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 13:06:53 +0200 Subject: [PATCH 04/25] Corrected the build matrix and removed inline logic. --- .travis.yml | 66 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3b3b91f..a52ac2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,26 +31,51 @@ env: matrix: include: - env: CONF=debug ARCH=x86 - addons: - apt: - packages: - - *default_packages - - g++-multilib - - libc6-dbg:i386 - include: - env: CONF=release ARCH=x86 - addons: - apt: - packages: - - *default_packages - - g++-multilib - - libc6-dbg:i386 + - env: CONF=debug ARCH=x86 + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 + - env: CONF=release ARCH=x86 + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 + - env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' + compiler: gcc + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 + after_success: + - ./travis-coveralls.sh + - env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage' + compiler: gcc + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 + after_success: + - ./travis-coveralls.sh + # These jobs report code coverage so they need extra environment variables + # and commands + exclude: + - env: CONF=debug ARCH=x86_64 + compiler: gcc + - env: CONF=debug ARCH=x86 + compiler: gcc before_script: -# hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), -# exposed by merging PR#163 (using -march=native) - - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then export GCOV_FLAGS='--coverage'; fi + # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), + # exposed by merging PR#163 (using -march=native) - sed -i "s/-march=native//" CMakeLists.txt - mkdir build - > @@ -69,7 +94,4 @@ script: - make examples - ctest -V `[ "$CONF" = "release" ] || echo "-E perftest"` - make travis_doc - -after_success: - - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then pip install --user cpp-coveralls; fi - - if [ "$CC" = "gcc" ] && [ "$CONF" = "debug" ]; then 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; fi + From 6400ab8d18cf115f67698f7014c3d2bb9bad6979 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 13:10:39 +0200 Subject: [PATCH 05/25] Added the missing coveralls script. --- travis-coveralls.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 travis-coveralls.sh diff --git a/travis-coveralls.sh b/travis-coveralls.sh new file mode 100755 index 0000000..7825265 --- /dev/null +++ b/travis-coveralls.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +pip install --user cpp-coveralls +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 From 2a7836c96119f0f6a248845753b440561389d2b2 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 13:11:39 +0200 Subject: [PATCH 06/25] Cached python packages as well for faster coverage reporting. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a52ac2d..7cabb6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: cpp sudo: false cache: - ccache + - pip compiler: - clang - gcc @@ -94,4 +95,3 @@ script: - make examples - ctest -V `[ "$CONF" = "release" ] || echo "-E perftest"` - make travis_doc - From 291bcf94b0245af34608e92eb2e32524da9f9e54 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 15:01:44 +0200 Subject: [PATCH 07/25] Fixed path to coverage script. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7cabb6e..4aae68c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ matrix: - g++-multilib - libc6-dbg:i386 after_success: - - ./travis-coveralls.sh + - ../travis-coveralls.sh - env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage' compiler: gcc addons: @@ -65,7 +65,7 @@ matrix: - g++-multilib - libc6-dbg:i386 after_success: - - ./travis-coveralls.sh + - ../travis-coveralls.sh # These jobs report code coverage so they need extra environment variables # and commands exclude: From 1f43a6f0b2b743a8e031d1e88bc77204665e4300 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 15:07:32 +0200 Subject: [PATCH 08/25] Added comment. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4aae68c..179b4cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,6 +46,7 @@ matrix: - *default_packages - g++-multilib - libc6-dbg:i386 + # coverage report - env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' compiler: gcc addons: From 3a01a252425c1b80cac0b730060c5185a1a31ce5 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 15:09:36 +0200 Subject: [PATCH 09/25] Explictly specify compiler in the matrix. --- .travis.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.travis.yml b/.travis.yml index 179b4cb..fe7f617 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,15 @@ env: matrix: include: - env: CONF=debug ARCH=x86 + compiler: gcc + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 + - env: CONF=debug ARCH=x86 + compiler: clang addons: apt: packages: @@ -40,6 +49,15 @@ matrix: - g++-multilib - libc6-dbg:i386 - env: CONF=release ARCH=x86 + compiler: gcc + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 + - env: CONF=release ARCH=x86 + compiler: clang addons: apt: packages: From c3cd3edad2dd78eabc1d48ec7ab052614c468db2 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 15:52:11 +0200 Subject: [PATCH 10/25] Explictly specify the entire matrix. --- .travis.yml | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index fe7f617..bced68d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,6 @@ sudo: false cache: - ccache - pip -compiler: - - clang - - gcc addons: apt: @@ -15,11 +12,6 @@ addons: - doxygen env: - matrix: - - CONF=debug ARCH=x86_64 - - CONF=release ARCH=x86_64 - - CONF=debug ARCH=x86 - - CONF=release ARCH=x86 global: - USE_CCACHE=1 - CCACHE_SLOPPINESS=pch_defines,time_macros @@ -32,22 +24,6 @@ env: matrix: include: - - env: CONF=debug ARCH=x86 - compiler: gcc - addons: - apt: - packages: - - *default_packages - - g++-multilib - - libc6-dbg:i386 - - env: CONF=debug ARCH=x86 - compiler: clang - addons: - apt: - packages: - - *default_packages - - g++-multilib - - libc6-dbg:i386 - env: CONF=release ARCH=x86 compiler: gcc addons: @@ -56,6 +32,18 @@ matrix: - *default_packages - g++-multilib - libc6-dbg:i386 + - env: CONF=release ARCH=x86_64 + compiler: gcc + - env: CONF=debug ARCH=x86 + compiler: clang + addons: + apt: + packages: + - *default_packages + - g++-multilib + - libc6-dbg:i386 + - env: CONF=debug ARCH=x86_64 + compiler: clang - env: CONF=release ARCH=x86 compiler: clang addons: @@ -64,6 +52,8 @@ matrix: - *default_packages - g++-multilib - libc6-dbg:i386 + - env: CONF=release ARCH=x86_64 + compiler: clang # coverage report - env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' compiler: gcc @@ -85,13 +75,6 @@ matrix: - libc6-dbg:i386 after_success: - ../travis-coveralls.sh - # These jobs report code coverage so they need extra environment variables - # and commands - exclude: - - env: CONF=debug ARCH=x86_64 - compiler: gcc - - env: CONF=debug ARCH=x86 - compiler: gcc before_script: # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), From db11011a5c12e4efa0e27a915737f5af4765454c Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 15:55:24 +0200 Subject: [PATCH 11/25] Script seems to fail to report coverage. Explictly specifying the commands. --- .travis.yml | 6 ++++-- travis-coveralls.sh | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) delete mode 100755 travis-coveralls.sh diff --git a/.travis.yml b/.travis.yml index bced68d..640c24d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,8 @@ matrix: - g++-multilib - libc6-dbg:i386 after_success: - - ../travis-coveralls.sh + - pip install --user cpp-coveralls + - 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 - env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage' compiler: gcc addons: @@ -74,7 +75,8 @@ matrix: - g++-multilib - libc6-dbg:i386 after_success: - - ../travis-coveralls.sh + - pip install --user cpp-coveralls + - 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 before_script: # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), diff --git a/travis-coveralls.sh b/travis-coveralls.sh deleted file mode 100755 index 7825265..0000000 --- a/travis-coveralls.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -pip install --user cpp-coveralls -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 From 3186e31b579c2b2151a3a8d4c965969dd3d0b4e1 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Wed, 30 Dec 2015 15:57:44 +0200 Subject: [PATCH 12/25] Print cache statistics. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 640c24d..981ea37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,6 +81,7 @@ matrix: before_script: # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), # exposed by merging PR#163 (using -march=native) + - ccache -s - sed -i "s/-march=native//" CMakeLists.txt - mkdir build - > From 84c56130d2cdc4ea378e5d9e33d68cf983467fcc Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 11:56:39 +0200 Subject: [PATCH 13/25] Adjust CMakeLists.txt files to use ccache when it's available. --- CMakeLists.txt | 6 ++++++ test/perftest/CMakeLists.txt | 6 ++++++ test/unittest/CMakeLists.txt | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51ee620..89a7634 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,12 @@ if(RAPIDJSON_HAS_STDSTRING) add_definitions(-DRAPIDJSON_HAS_STDSTRING) endif() +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) +endif(CCACHE_FOUND) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/test/perftest/CMakeLists.txt b/test/perftest/CMakeLists.txt index 4121bf9..f698382 100644 --- a/test/perftest/CMakeLists.txt +++ b/test/perftest/CMakeLists.txt @@ -9,6 +9,12 @@ target_link_libraries(perftest ${TEST_LIBRARIES}) add_dependencies(tests perftest) +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) +endif(CCACHE_FOUND) + IF(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug")) add_test(NAME perftest COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/perftest diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index fd2eb4d..ee5ff0c 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -18,6 +18,12 @@ set(UNITTEST_SOURCES valuetest.cpp writertest.cpp) +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) +endif(CCACHE_FOUND) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Weffc++ -Wswitch-default -Wfloat-equal") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") From 96fbaef1ec17a338ec8673fab7a4d461fed8a134 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 12:04:47 +0200 Subject: [PATCH 14/25] Workaround clang and ccache bugs described in http://petereisentraut.blogspot.co.il/2011/05/ccache-and-clang.html --- CMakeLists.txt | 2 +- test/perftest/CMakeLists.txt | 2 ++ test/unittest/CMakeLists.txt | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89a7634..ca47d81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ endif(CCACHE_FOUND) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror -Wno-missing-field-initializers") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror -Wno-missing-field-initializers -Qunused-arguments -fcolor-diagnostics") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) endif() diff --git a/test/perftest/CMakeLists.txt b/test/perftest/CMakeLists.txt index f698382..4329231 100644 --- a/test/perftest/CMakeLists.txt +++ b/test/perftest/CMakeLists.txt @@ -13,6 +13,8 @@ find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") endif(CCACHE_FOUND) IF(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug")) diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index ee5ff0c..8654753 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -22,6 +22,8 @@ find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") endif(CCACHE_FOUND) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") From 163c4b75832a25831f974a7d0a7958f08e7a08a7 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 12:07:28 +0200 Subject: [PATCH 15/25] Fixed cmake syntax errors. --- CMakeLists.txt | 5 ++++- test/perftest/CMakeLists.txt | 1 + test/unittest/CMakeLists.txt | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca47d81..3c6f4e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,12 +29,15 @@ find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") + endif() endif(CCACHE_FOUND) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror") elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror -Wno-missing-field-initializers -Qunused-arguments -fcolor-diagnostics") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -Wall -Wextra -Werror -Wno-missing-field-initializers") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") add_definitions(-D_CRT_SECURE_NO_WARNINGS=1) endif() diff --git a/test/perftest/CMakeLists.txt b/test/perftest/CMakeLists.txt index 4329231..ba8dc31 100644 --- a/test/perftest/CMakeLists.txt +++ b/test/perftest/CMakeLists.txt @@ -15,6 +15,7 @@ if(CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") + endif() endif(CCACHE_FOUND) IF(NOT (CMAKE_BUILD_TYPE STREQUAL "Debug")) diff --git a/test/unittest/CMakeLists.txt b/test/unittest/CMakeLists.txt index 8654753..c24ef84 100644 --- a/test/unittest/CMakeLists.txt +++ b/test/unittest/CMakeLists.txt @@ -24,6 +24,7 @@ if(CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") + endif() endif(CCACHE_FOUND) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") From 45ea872f2e23605cbcf01c49bce3dc7e3a527980 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 12:10:34 +0200 Subject: [PATCH 16/25] Set CCACHE_CPP2 environment variable to yes as described in http://petereisentraut.blogspot.co.il/2011/09/ccache-and-clang-part-2.html --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 981ea37..a0c3b07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,9 +42,9 @@ matrix: - *default_packages - g++-multilib - libc6-dbg:i386 - - env: CONF=debug ARCH=x86_64 + - env: CONF=debug ARCH=x86_64 CCACHE_CPP2=yes compiler: clang - - env: CONF=release ARCH=x86 + - env: CONF=release ARCH=x86 CCACHE_CPP2=yes compiler: clang addons: apt: @@ -52,7 +52,7 @@ matrix: - *default_packages - g++-multilib - libc6-dbg:i386 - - env: CONF=release ARCH=x86_64 + - env: CONF=release ARCH=x86_64 CCACHE_CPP2=yes compiler: clang # coverage report - env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' From 0cc5974b111f2f16993d66b316df14533ea13b4c Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 12:19:09 +0200 Subject: [PATCH 17/25] Missed one CCACHE_CPP2=yes --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a0c3b07..d516feb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ matrix: - libc6-dbg:i386 - env: CONF=release ARCH=x86_64 compiler: gcc - - env: CONF=debug ARCH=x86 + - env: CONF=debug ARCH=x86 CCACHE_CPP2=yes compiler: clang addons: apt: From 52e287a8c9fe9af888cb0f1f9acc7a40ef1e8ccd Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 12:32:17 +0200 Subject: [PATCH 18/25] Fail the build early if cmake cannot generate the Makefiles. --- .travis.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index d516feb..5681a22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,17 +84,17 @@ before_script: - ccache -s - sed -i "s/-march=native//" CMakeLists.txt - mkdir build - - > - eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ; - (cd build && cmake - -DRAPIDJSON_HAS_STDSTRING=ON - -DCMAKE_VERBOSE_MAKEFILE=ON - -DCMAKE_BUILD_TYPE=$CONF - -DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS" - -DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS - ..) script: + - > + eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ; + (cd build && cmake + -DRAPIDJSON_HAS_STDSTRING=ON + -DCMAKE_VERBOSE_MAKEFILE=ON + -DCMAKE_BUILD_TYPE=$CONF + -DCMAKE_CXX_FLAGS="$ARCH_FLAGS $GCOV_FLAGS" + -DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS + ..) - cd build - make tests - make examples From 5fb5002e9a154b57490964877aff132eabc44548 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 12:35:25 +0200 Subject: [PATCH 19/25] Run everything in 2 parallel threads. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5681a22..4565ebb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -96,7 +96,7 @@ script: -DCMAKE_EXE_LINKER_FLAGS=$GCOV_FLAGS ..) - cd build - - make tests - - make examples - - ctest -V `[ "$CONF" = "release" ] || echo "-E perftest"` + - make tests -j 2 + - make examples -j 2 + - ctest -j 2 -V `[ "$CONF" = "release" ] || echo "-E perftest"` - make travis_doc From 89631a6190858698061cbec7cdb93b596a3b6a46 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 13:05:57 +0200 Subject: [PATCH 20/25] Make documentation only in one of the build jobs. --- .travis.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4565ebb..9c6089f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ addons: packages: &default_packages - cmake - valgrind - - doxygen env: global: @@ -74,6 +73,10 @@ matrix: - *default_packages - g++-multilib - libc6-dbg:i386 + - doxygen + script: # Generate and push documentation + - *default_script + - make travis_doc after_success: - pip install --user cpp-coveralls - 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 @@ -85,7 +88,7 @@ before_script: - sed -i "s/-march=native//" CMakeLists.txt - mkdir build -script: +script: &default_script - > eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ; (cd build && cmake @@ -99,4 +102,4 @@ script: - make tests -j 2 - make examples -j 2 - ctest -j 2 -V `[ "$CONF" = "release" ] || echo "-E perftest"` - - make travis_doc + From 8e40b2062ed76ede53a6f26c8e31ac7736f3ef1e Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 13:29:39 +0200 Subject: [PATCH 21/25] Split the documentation task from the rest since references to script doesn't work. --- .travis.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9c6089f..b84f7bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -73,13 +73,17 @@ matrix: - *default_packages - g++-multilib - libc6-dbg:i386 - - doxygen - script: # Generate and push documentation - - *default_script - - make travis_doc after_success: - pip install --user cpp-coveralls - 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 + - script: + - cd build + - cmake -DRAPIDJSON_HAS_STDSTRING=ON -DCMAKE_VERBOSE_MAKEFILE=ON + - make travis_doc + addons: + apt: + packages: + - doxygen before_script: # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), @@ -88,7 +92,7 @@ before_script: - sed -i "s/-march=native//" CMakeLists.txt - mkdir build -script: &default_script +script: - > eval "ARCH_FLAGS=\${ARCH_FLAGS_${ARCH}}" ; (cd build && cmake @@ -102,4 +106,3 @@ script: &default_script - make tests -j 2 - make examples -j 2 - ctest -j 2 -V `[ "$CONF" = "release" ] || echo "-E perftest"` - From 5337e73f34017f6d2d626f1ea3c95dbdca36d027 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 13:41:51 +0200 Subject: [PATCH 22/25] Fix path. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b84f7bd..acc3a04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -78,7 +78,7 @@ matrix: - 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 - script: - cd build - - cmake -DRAPIDJSON_HAS_STDSTRING=ON -DCMAKE_VERBOSE_MAKEFILE=ON + - cmake .. -DRAPIDJSON_HAS_STDSTRING=ON -DCMAKE_VERBOSE_MAKEFILE=ON - make travis_doc addons: apt: From 918fafc611401d7cf0198fc1ce6f4f5333bef2d8 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 13:56:35 +0200 Subject: [PATCH 23/25] Disable cache for doxygen. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index acc3a04..449fdc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -80,6 +80,7 @@ matrix: - cd build - cmake .. -DRAPIDJSON_HAS_STDSTRING=ON -DCMAKE_VERBOSE_MAKEFILE=ON - make travis_doc + cache: false addons: apt: packages: From 83a2e13efb25503c7e05efeb3c7f3d53634838f3 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 14:21:23 +0200 Subject: [PATCH 24/25] Add pip caching only when reporting coverage. --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 449fdc3..865b9d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: cpp sudo: false cache: - ccache - - pip addons: apt: @@ -56,6 +55,9 @@ matrix: # coverage report - env: CONF=debug ARCH=x86 GCOV_FLAGS='--coverage' compiler: gcc + cache: + - ccache + - pip addons: apt: packages: @@ -67,6 +69,9 @@ matrix: - 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 - env: CONF=debug ARCH=x86_64 GCOV_FLAGS='--coverage' compiler: gcc + cache: + - ccache + - pip addons: apt: packages: From 53557c898899f813759bf217da759eea4d077521 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Thu, 31 Dec 2015 16:17:14 +0200 Subject: [PATCH 25/25] Moved comment to the right place and added a TODO. Added another comment about the documentation task. --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 865b9d5..57b1b1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -81,7 +81,7 @@ matrix: after_success: - pip install --user cpp-coveralls - 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 - - script: + - script: # Documentation task - cd build - cmake .. -DRAPIDJSON_HAS_STDSTRING=ON -DCMAKE_VERBOSE_MAKEFILE=ON - make travis_doc @@ -92,9 +92,10 @@ matrix: - doxygen before_script: - # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), - # exposed by merging PR#163 (using -march=native) - ccache -s + # hack to avoid Valgrind bug (https://bugs.kde.org/show_bug.cgi?id=326469), + # exposed by merging PR#163 (using -march=native) + # TODO: Since this bug is already fixed. Remove this when valgrind can be upgraded. - sed -i "s/-march=native//" CMakeLists.txt - mkdir build