Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit c66b202

Browse files
committed
Merge remote-tracking branch 'upstream/master' into subcommand
2 parents c58c402 + 2bfd8b2 commit c66b202

31 files changed

Lines changed: 8535 additions & 5394 deletions

.gitattributes

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This sets the default behaviour, overriding core.autocrlf
2+
* text=auto
3+
4+
# All source files should have unix line-endings in the repository,
5+
# but convert to native line-endings on checkout
6+
*.cpp text
7+
*.h text
8+
*.hpp text
9+
10+
# Windows specific files should retain windows line-endings
11+
*.sln text eol=crlf
12+
13+
# Keep executable scripts with LFs so they can be run after being
14+
# checked out on Windows
15+
*.py text eol=lf
16+
17+
18+
# Keep the single include header with LFs to make sure it is uploaded,
19+
# hashed etc with LF
20+
single_include/*.hpp eol=lf
21+
# Also keep the LICENCE file with LFs for the same reason
22+
LICENCE.txt eol=lf

.travis.yml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
language: cpp
2+
sudo: false
3+
4+
common_sources: &all_sources
5+
- ubuntu-toolchain-r-test
6+
- llvm-toolchain-trusty
7+
- llvm-toolchain-trusty-3.9
8+
- llvm-toolchain-trusty-4.0
9+
- llvm-toolchain-trusty-5.0
10+
11+
matrix:
12+
include:
13+
14+
# 1/ Linux Clang Builds
15+
- os: linux
16+
compiler: clang
17+
addons:
18+
apt:
19+
sources: *all_sources
20+
packages: ['valgrind', 'lcov', 'clang-3.5']
21+
env: COMPILER='clang++-3.5' VALGRIND=1
22+
23+
- os: linux
24+
compiler: clang
25+
addons:
26+
apt:
27+
sources: *all_sources
28+
packages: ['valgrind', 'lcov', 'clang-3.6']
29+
env: COMPILER='clang++-3.6' VALGRIND=1
30+
31+
# Travis's containers do not seem to have Clang 3.7 in apt, no matter what sources I add.
32+
# - os: linux
33+
# compiler: clang
34+
# addons:
35+
# apt:
36+
# sources: *all_sources
37+
# packages: ['valgrind', 'clang-3.7']
38+
# env: COMPILER='clang++-3.7' VALGRIND=1
39+
40+
- os: linux
41+
compiler: clang
42+
addons:
43+
apt:
44+
sources: *all_sources
45+
packages: ['valgrind', 'lcov', 'clang-3.8']
46+
env: COMPILER='clang++-3.8' VALGRIND=1
47+
48+
- os: linux
49+
compiler: clang
50+
addons:
51+
apt:
52+
sources: *all_sources
53+
packages: ['clang-3.9', 'valgrind', 'lcov']
54+
env: COMPILER='clang++-3.9' VALGRIND=1
55+
56+
- os: linux
57+
compiler: clang
58+
addons:
59+
apt:
60+
sources: *all_sources
61+
packages: ['clang-4.0', 'valgrind', 'lcov']
62+
env: COMPILER='clang++-4.0' VALGRIND=1
63+
64+
- os: linux
65+
compiler: clang
66+
addons:
67+
apt:
68+
sources: *all_sources
69+
packages: ['clang-5.0', 'valgrind', 'lcov']
70+
env: COMPILER='clang++-5.0' VALGRIND=1
71+
72+
# 2/ Linux GCC Builds
73+
- os: linux
74+
compiler: gcc
75+
addons:
76+
apt:
77+
sources: ['ubuntu-toolchain-r-test']
78+
packages: ['valgrind', 'lcov', 'g++-4.8']
79+
env: COMPILER='g++-4.8' VALGRIND=1 COVERAGE=1
80+
81+
- os: linux
82+
compiler: gcc
83+
addons:
84+
apt:
85+
sources: *all_sources
86+
packages: ['valgrind', 'lcov', 'g++-4.9']
87+
env: COMPILER='g++-4.9' VALGRIND=1
88+
89+
- os: linux
90+
compiler: gcc
91+
addons:
92+
apt:
93+
sources: *all_sources
94+
packages: ['valgrind', 'lcov', 'g++-5']
95+
env: COMPILER='g++-5' VALGRIND=1
96+
97+
- os: linux
98+
compiler: gcc
99+
addons: &gcc6
100+
apt:
101+
sources: *all_sources
102+
packages: ['valgrind', 'lcov', 'g++-6']
103+
env: COMPILER='g++-6' VALGRIND=1
104+
105+
- os: linux
106+
compiler: gcc
107+
addons: &gcc7
108+
apt:
109+
sources: *all_sources
110+
packages: ['valgrind', 'lcov', 'g++-7']
111+
env: COMPILER='g++-7' VALGRIND=1
112+
113+
- os: linux
114+
compiler: gcc
115+
addons: *gcc7
116+
env: COMPILER='g++-7' CPP17=1 COVERAGE=1
117+
118+
# 5/ OSX Clang Builds
119+
- os: osx
120+
osx_image: xcode8.3
121+
compiler: clang
122+
env: COMPILER='clang++'
123+
124+
- os: osx
125+
osx_image: xcode9
126+
compiler: clang
127+
env: COMPILER='clang++'
128+
129+
- os: osx
130+
osx_image: xcode9.1
131+
compiler: clang
132+
env: COMPILER='clang++'
133+
134+
- os: osx
135+
osx_image: xcode9.1
136+
compiler: clang
137+
env: COMPILER='clang++' CPP14=1
138+
139+
140+
install:
141+
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
142+
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
143+
- |
144+
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
145+
CMAKE_URL="http://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz"
146+
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
147+
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
148+
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
149+
which cmake || brew install cmake;
150+
fi
151+
152+
before_script:
153+
- export CXX=${COMPILER}
154+
- cd ${TRAVIS_BUILD_DIR}
155+
# Use Debug builds for collecting coverage
156+
- cmake -H. -BBuild-Debug -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=${COVERAGE} -DUSE_CPP14=${CPP14} -DUSE_CPP17=${CPP17}
157+
# Don't bother with release build for coverage build
158+
- cmake -H. -BBuild-Release -DCMAKE_BUILD_TYPE=Release
159+
160+
161+
script:
162+
- cd Build-Debug
163+
- make -j 2
164+
- CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2
165+
- |
166+
# Coverage collection does not work for OS X atm
167+
if [[ "${COVERAGE}" == "1" ]]; then
168+
make gcov
169+
make lcov
170+
bash <(curl -s https://codecov.io/bash) -X gcov || echo "Codecov did not collect coverage reports"
171+
fi
172+
# Go to release build
173+
- cd ../Build-Release
174+
- make -j 2
175+
- CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2

CMake/FindGcov.cmake

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# This file is part of CMake-codecov.
2+
#
3+
# Copyright (c)
4+
# 2015-2017 RWTH Aachen University, Federal Republic of Germany
5+
#
6+
# See the LICENSE file in the package base directory for details
7+
#
8+
# Written by Alexander Haase, alexander.haase@rwth-aachen.de
9+
#
10+
11+
12+
# include required Modules
13+
include(FindPackageHandleStandardArgs)
14+
15+
16+
# Search for gcov binary.
17+
set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
18+
set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})
19+
20+
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
21+
foreach (LANG ${ENABLED_LANGUAGES})
22+
# Gcov evaluation is dependend on the used compiler. Check gcov support for
23+
# each compiler that is used. If gcov binary was already found for this
24+
# compiler, do not try to find it again.
25+
if (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN)
26+
get_filename_component(COMPILER_PATH "${CMAKE_${LANG}_COMPILER}" PATH)
27+
28+
if ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "GNU")
29+
# Some distributions like OSX (homebrew) ship gcov with the compiler
30+
# version appended as gcov-x. To find this binary we'll build the
31+
# suggested binary name with the compiler version.
32+
string(REGEX MATCH "^[0-9]+" GCC_VERSION
33+
"${CMAKE_${LANG}_COMPILER_VERSION}")
34+
35+
find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov
36+
HINTS ${COMPILER_PATH})
37+
38+
elseif ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Clang")
39+
# Some distributions like Debian ship llvm-cov with the compiler
40+
# version appended as llvm-cov-x.y. To find this binary we'll build
41+
# the suggested binary name with the compiler version.
42+
string(REGEX MATCH "^[0-9]+.[0-9]+" LLVM_VERSION
43+
"${CMAKE_${LANG}_COMPILER_VERSION}")
44+
45+
# llvm-cov prior version 3.5 seems to be not working with coverage
46+
# evaluation tools, but these versions are compatible with the gcc
47+
# gcov tool.
48+
if(LLVM_VERSION VERSION_GREATER 3.4)
49+
find_program(LLVM_COV_BIN NAMES "llvm-cov-${LLVM_VERSION}"
50+
"llvm-cov" HINTS ${COMPILER_PATH})
51+
mark_as_advanced(LLVM_COV_BIN)
52+
53+
if (LLVM_COV_BIN)
54+
find_program(LLVM_COV_WRAPPER "llvm-cov-wrapper" PATHS
55+
${CMAKE_MODULE_PATH})
56+
if (LLVM_COV_WRAPPER)
57+
set(GCOV_BIN "${LLVM_COV_WRAPPER}" CACHE FILEPATH "")
58+
59+
# set additional parameters
60+
set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV
61+
"LLVM_COV_BIN=${LLVM_COV_BIN}" CACHE STRING
62+
"Environment variables for llvm-cov-wrapper.")
63+
mark_as_advanced(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV)
64+
endif ()
65+
endif ()
66+
endif ()
67+
68+
if (NOT GCOV_BIN)
69+
# Fall back to gcov binary if llvm-cov was not found or is
70+
# incompatible. This is the default on OSX, but may crash on
71+
# recent Linux versions.
72+
find_program(GCOV_BIN gcov HINTS ${COMPILER_PATH})
73+
endif ()
74+
endif ()
75+
76+
77+
if (GCOV_BIN)
78+
set(GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN "${GCOV_BIN}" CACHE STRING
79+
"${LANG} gcov binary.")
80+
81+
if (NOT CMAKE_REQUIRED_QUIET)
82+
message("-- Found gcov evaluation for "
83+
"${CMAKE_${LANG}_COMPILER_ID}: ${GCOV_BIN}")
84+
endif()
85+
86+
unset(GCOV_BIN CACHE)
87+
endif ()
88+
endif ()
89+
endforeach ()
90+
91+
92+
93+
94+
# Add a new global target for all gcov targets. This target could be used to
95+
# generate the gcov files for the whole project instead of calling <TARGET>-gcov
96+
# for each target.
97+
if (NOT TARGET gcov)
98+
add_custom_target(gcov)
99+
endif (NOT TARGET gcov)
100+
101+
102+
103+
# This function will add gcov evaluation for target <TNAME>. Only sources of
104+
# this target will be evaluated and no dependencies will be added. It will call
105+
# Gcov on any source file of <TNAME> once and store the gcov file in the same
106+
# directory.
107+
function (add_gcov_target TNAME)
108+
set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
109+
110+
# We don't have to check, if the target has support for coverage, thus this
111+
# will be checked by add_coverage_target in Findcoverage.cmake. Instead we
112+
# have to determine which gcov binary to use.
113+
get_target_property(TSOURCES ${TNAME} SOURCES)
114+
set(SOURCES "")
115+
set(TCOMPILER "")
116+
foreach (FILE ${TSOURCES})
117+
codecov_path_of_source(${FILE} FILE)
118+
if (NOT "${FILE}" STREQUAL "")
119+
codecov_lang_of_source(${FILE} LANG)
120+
if (NOT "${LANG}" STREQUAL "")
121+
list(APPEND SOURCES "${FILE}")
122+
set(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})
123+
endif ()
124+
endif ()
125+
endforeach ()
126+
127+
# If no gcov binary was found, coverage data can't be evaluated.
128+
if (NOT GCOV_${TCOMPILER}_BIN)
129+
message(WARNING "No coverage evaluation binary found for ${TCOMPILER}.")
130+
return()
131+
endif ()
132+
133+
set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
134+
set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")
135+
136+
137+
set(BUFFER "")
138+
foreach(FILE ${SOURCES})
139+
get_filename_component(FILE_PATH "${TDIR}/${FILE}" PATH)
140+
141+
# call gcov
142+
add_custom_command(OUTPUT ${TDIR}/${FILE}.gcov
143+
COMMAND ${GCOV_ENV} ${GCOV_BIN} ${TDIR}/${FILE}.gcno > /dev/null
144+
DEPENDS ${TNAME} ${TDIR}/${FILE}.gcno
145+
WORKING_DIRECTORY ${FILE_PATH}
146+
)
147+
148+
list(APPEND BUFFER ${TDIR}/${FILE}.gcov)
149+
endforeach()
150+
151+
152+
# add target for gcov evaluation of <TNAME>
153+
add_custom_target(${TNAME}-gcov DEPENDS ${BUFFER})
154+
155+
# add evaluation target to the global gcov target.
156+
add_dependencies(gcov ${TNAME}-gcov)
157+
endfunction (add_gcov_target)

0 commit comments

Comments
 (0)