Skip to content

Commit

Permalink
add support for coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
agauniyal committed Mar 22, 2016
1 parent 4453a8e commit 8adb9df
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "coveralls-cmake"]
path = coveralls-cmake
url = https://github.com/JoakimSoderberg/coveralls-cmake.git
27 changes: 12 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,26 @@ matrix:
env:
- COMPILER=clang++-3.7

- os: linux
compiler: clang
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise']
packages: ['clang-3.8']
env:
- COMPILER=clang++-3.8

install:
- sudo apt-get update -q
- sudo apt-get install -y build-essential cmake
- sudo apt-get update -qq
- sudo apt-get install -y -qq build-essential cmake curl lcov

before_script:
- export CXX=$COMPILER

- export COVERALLS_SERVICE_NAME=travis-ci
- export COVERALLS_REPO_TOKEN=abc12345

- git submodule update --init
- mkdir build
- cd build
- cmake ..
- cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug ..

script:
- make
- ./bin/runTest
- ./bin/vTest
- cmake --build .

after_script:
- cmake --build . --target coveralls

notifications:
email: false
24 changes: 20 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,26 @@ else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

SET(GCC_COVERAGE_COMPILE_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
SET(GCC_COVERAGE_LINK_FLAGS "-lgcov")
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" )
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}" )

option(COVERALLS "Turn on coveralls support" OFF)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${PROJECT_SOURCE_DIR}/coveralls-cmake/cmake)

if (COVERALLS)
include(Coveralls)
coveralls_turn_on_coverage()
endif()


if (COVERALLS)
set(COVERAGE_SRCS ${PROJECT_SOURCE_DIR}/include/rang.hpp)

coveralls_setup(
"${COVERAGE_SRCS}"
ON
"${PROJECT_SOURCE_DIR}/coveralls-cmake/cmake")
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

Expand Down
1 change: 1 addition & 0 deletions coveralls-cmake
Submodule coveralls-cmake added at 127e0b

0 comments on commit 8adb9df

Please sign in to comment.