Skip to content

Commit 15d76b3

Browse files
committed
Adding travis and codecov support
1 parent 5e622d1 commit 15d76b3

File tree

4 files changed

+62
-3
lines changed

4 files changed

+62
-3
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "cmake-modules"]
2+
path = cmake-modules
3+
url = https://github.com/bilke/cmake-modules.git

.travis.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
language: cpp
2+
sudo: required
3+
env:
4+
global:
5+
# Workaround for https://github.com/travis-ci/travis-ci/issues/4681
6+
matrix:
7+
- TRAVIS_EMPTY_JOB_WORKAROUND=true
8+
9+
matrix:
10+
exclude:
11+
- env: TRAVIS_EMPTY_JOB_WORKAROUND=true
12+
13+
include:
14+
- os: linux
15+
dist: trusty
16+
env: CC=gcc-7 CXX=g++-7 BOOST_ROOT=/usr/include/boost
17+
compiler: gcc
18+
before_install:
19+
- sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
20+
- sudo apt-get update
21+
- sudo apt-get install g++-7
22+
- export BOOST_URL="https://downloads.sourceforge.net/project/boost/boost/1.67.0/boost_1_67_0.tar.gz"
23+
- mkdir -p /tmp/boost
24+
- wget --quiet -O - ${BOOST_URL} | tar --strip-components=1 -xz -C /tmp/boost || exit 1
25+
- cd /tmp/boost/tools/build && ./bootstrap.sh && ./b2 install --prefix=/tmp/b2
26+
- export PATH=/tmp/b2/bin:${PATH}
27+
- cd /tmp/boost && b2 toolset=gcc cxxflags="-std=c++14 ${CXXFLAGS}"
28+
- os: osx
29+
osx_image: xcode9.4
30+
env:
31+
before_install:
32+
- brew install lcov
33+
after_success:
34+
# Creating report
35+
- cd ${TRAVIS_BUILD_DIR}
36+
- lcov --directory . --capture --output-file coverage.info # capture coverage info
37+
- lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
38+
- lcov --list coverage.info #debug info
39+
# Uploading report to CodeCov
40+
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
41+
42+
allow_failures:
43+
- os: linux
44+
45+
script:
46+
- cmake -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles" . && make && make test

CMakeLists.txt

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
cmake_minimum_required(VERSION 3.8)
22
project(Boost.Real)
3-
set (Boost.Real 1)
4-
set (Boost.Real 0)
3+
set (Boost.Real_VERSION_MAJOR 1)
4+
set (Boost.Real_VERSION_MINOR 0)
55

6-
add_library(Boost.Real INTERFACE)
6+
#Add coverage support to CMAKE in debug mode
7+
IF(CMAKE_BUILD_TYPE MATCHES Debug)
8+
message("debug mode adding coverage report tools and flags")
9+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules")
10+
include(CodeCoverage)
11+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -O0 -fprofile-arcs -ftest-coverage")
12+
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
713

814
# Check for standard to use
915
include(CheckCXXCompilerFlag)
@@ -15,10 +21,13 @@ else()
1521
endif()
1622

1723
#Detect Boost.Test framework
24+
set(Boost_USE_MULTITHREADED OFF)
1825
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
1926

2027
include_directories(include ${Boost_INCLUDE_DIRS})
2128

29+
add_library(Boost.Real INTERFACE)
30+
2231
# Unit tests
2332
enable_testing()
2433
FILE(GLOB TestSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} test/*_test.cpp)

cmake-modules

Submodule cmake-modules added at fcfc049

0 commit comments

Comments
 (0)