Skip to content

Commit

Permalink
Merge pull request #96 from DARMA-tasking/devel
Browse files Browse the repository at this point in the history
Merging old code over to master
  • Loading branch information
David Hollman committed May 15, 2018
2 parents f21bc9a + 23e2f9d commit fc7a619
Show file tree
Hide file tree
Showing 114 changed files with 4,657 additions and 6,308 deletions.
57 changes: 57 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
sudo: true
dist: trusty
language: cpp
matrix:
include:
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
env:
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env:
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && COVERALLS_CMAKE_OPTIONS='-DDARMA_ENABLE_COVERALLS=On
-DDARMA_COVERALLS_UPLOAD=On -DCMAKE_BUILD_TYPE=Debug' && DO_COVERALLS=true"
addons:
apt:
packages:
- lcov
- curl
before_install:
- eval "${MATRIX_EVAL}"
- wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz -O /tmp/gtest.tar.gz
- tar -xvf /tmp/gtest.tar.gz
- export GTEST=$PWD/googletest-release-1.8.0
install:
- cd $GTEST
- mkdir build
- cd build
- cmake -DCMAKE_INSTALL_PREFIX=$GTEST/install -DCMAKE_CXX_COMPILER=$CXX ..
- make
- make install
script:
- export COVERALLS_SERVICE_NAME=travis-ci
- cd $TRAVIS_BUILD_DIR
- mkdir build
- cd build
- cmake -DDARMA_FE_ENABLE_TESTS=On -DCMAKE_CXX_COMPILER=$CXX -DGTEST_DIR=$GTEST/install
${COVERALLS_CMAKE_OPTIONS} ..
- make VERBOSE=1
- make VERBOSE=1 test
- if [ $DO_COVERALLS == true ]; then make coveralls; fi
notifications:
slack:
secure: bMpQX03z3t2EKC3E7hi3gOTxE5y6V7Iuc6YKCR19Je8Yq2dWSXmVv0rbOOENs0FT0wnjvm1gbixzbM9sokIPP14SBvufc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gM/mU+TVqt+46Zf/Oo+f+IQ5Q+haHPFWtAThFxEv6PdrTBghLKBdOdqGB3aiwlUH/Qz6Aa8TF+yaOc4QkJrNNvmuTP8cQXFxHFvUOLot5AhLDCTiqI3T3OGxUA0a03RQr2CkNTG3V3TL/YW80IYbjpJQN7r0OPqP5xMn73n3+AjZ7aRk2pVWOFzMgtG/mGaKJtgnRxz0y1P58Y=
50 changes: 39 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ set (DARMA_FE_REPO_ROOT ${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DARMA_FE_REPO_ROOT}/cmake-modules)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DARMA_FE_REPO_ROOT}/cmake-modules/coveralls/cmake)


option (DARMA_FE_ENABLE_TESTS "Enable build of frontend tests" Off)
option (DARMA_CT_ENABLE_TESTS "Enable compilation time tests" Off)
option (DARMA_ENABLE_COVERALLS "Enable coveralls coverage suport" Off)
option (DARMA_COVERALLS_UPLOAD "Upload coveralls results" Off)
mark_as_advanced(DARMA_COVERALLS_UPLOAD)

set (DARMA_TESTS False)
if (DARMA_FE_ENABLE_TESTS OR DARMA_CT_ENABLE_TESTS)
Expand All @@ -46,25 +50,49 @@ endif()
# indicate that CMAKE was used, so config-generated.h can be used
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDARMA_CONFIG_GENERATED_H_AVAILABLE" )

option (DARMA_GENERATE_OO_MACRO_FILES
"Generate OO macro expansions for testing and debugging purposes in test_oo"
OFF
)


option(DARMA_COVERAGE "Whether to setup coverage targets for tests" Off)

if (DARMA_COVERAGE)
include(CodeCoverage)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
if (DARMA_ENABLE_COVERALLS)
if (!DARMA_FE_ENABLE_TESTS)
message(FATAL_ERROR "Can't run coveralls coverage without tests enabled")
endif()
include(Coveralls)
coveralls_turn_on_coverage()
file(GLOB_RECURSE all_source_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" src/include/darma/*.h)
coveralls_setup(
"${all_source_files}"
${DARMA_COVERALLS_UPLOAD}
"${PROJECT_SOURCE_DIR}/cmake-modules/coveralls/cmake"
)
endif()

include (CheckCXXCompilerFlag)
include (CheckCXXSourceCompiles)

if (NOT CMAKE_VERSION VERSION_LESS 3.4)
CHECK_CXX_COMPILER_FLAG("-fconcepts" DARMA_HAS_CXX_CONCEPTS_FLAG)
CHECK_CXX_COMPILER_FLAG("-fconcepts" DARMA_HAS_CXX_CONCEPTS_FLAG)
endif()

add_subdirectory(src)

add_library(darma_frontend INTERFACE)
target_include_directories(darma_frontend INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>
)
install(TARGETS darma_frontend EXPORT darma_frontend)
install(EXPORT darma_frontend DESTINATION cmake)

configure_file(
cmake/darma_frontendConfig.cmake.in
"${PROJECT_BINARY_DIR}/darma_frontendConfig.cmake" @ONLY
)
install(
FILES
"${PROJECT_BINARY_DIR}/darma_frontendConfig.cmake"
DESTINATION cmake
)





2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interested in both on-node tasking (MPI+X) or for distributed memory tasking.
For installation directions (either custom or Spack), see the
INSTALL file in the top-level directory.

[![Build Status](https://travis-ci.org/DARMA-tasking/darma-frontend.svg?branch=devel)](https://travis-ci.org/DARMA-tasking/darma-frontend)
[![Coverage Status](https://coveralls.io/repos/github/DARMA-tasking/darma-frontend/badge.svg?branch=devel)](https://coveralls.io/github/DARMA-tasking/darma-frontend?branch=devel)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

Under the terms of Contract DE-NA0003525 with Sandia Corporation,
Expand Down
21 changes: 21 additions & 0 deletions cmake-modules/coveralls/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Joakim Söderberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
123 changes: 123 additions & 0 deletions cmake-modules/coveralls/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
Coveralls Generator for CMake
=============================

This is a set of CMake scripts that are meant to be used to generate
and upload coverage data to http://coveralls.io/.

This is achieved by specifying which source files that you want to
gather the coverage data for and then running your unit tests, which
then will generate a coveralls compatible JSON file.

> **Note:** This was designed for use with http://travis-ci.org and has
> not been tested with any other Continous Integration service.
Dependencies
------------
For these scripts to work, the following dependencies are required:

* `gcov`- Needed to generate coverage data.
* `gcc` or `clang` - A compiler that supports adding coverage data
that can be read by gcov.
* `curl` - Needed to upload the generated json file to coveralls.

Example project
---------------

Here an example CMake project can be found that shows how these
scripts can be used:
https://github.com/JoakimSoderberg/coveralls-cmake-example

Usage
-----

To use the script in your CMake project you need to do three things:

**1. Include the Coveralls.cmake script in CMakeLists.txt**

Place the files under your projects CMakeModules directory.
For example `${PROJECT_SOURCE_DIR}/cmake`, and include them.

```cmake
cmake_minimum_required(VERSION 2.8)
project(myproject)
# Add project cmake modules to path.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# We probably don't want this to run on every build.
option(COVERALLS "Generate coveralls data" OFF)
if (COVERALLS)
include(Coveralls)
endif()
... # Setup the rest of your project
```

**2. Add coverage settings to your compile flags**

Either by using the supplied helper function.

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

or you can add it yourself:

```cmake
if (COVERALLS)
include(Coveralls)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
endif()
```

**3. Setup your target**

Explicitly tell what files that you want to gather the
coverage for (usually this is all your code files).

```cmake
if (COVERALLS)
set(COVERAGE_SRCS awesome.c code.c files.c)
# Create the coveralls target.
coveralls_setup(
"${COVERAGE_SRCS}" # The source files.
ON # If we should upload.
"${PROJECT_SOURCE_DIR}/CMakeModules/") # (Optional) Alternate project cmake module path.
endif()
```

That's it! If you did everything right, you can do:

> (Note build type must be Debug to get proper coverage data!).
```bash
$ mkdir build && cd build
$ cmake -DCOVERALLS=ON -DCMAKE_BUILD_TYPE=Debug ..
$ make
$ make coveralls
```

FAQ
---

**Q**: After I've setup everything according to the guide I get this message when running the script on Travis-ci:

{"message":"Couldn't find a repository matching this job.","error":true}

What is wrong?

**A**: Not sure why this happens sometimes. But one thing to try is to try the solution mentioned in this ticket: https://github.com/lemurheavy/coveralls-public/issues/279

That is, adding this to your `.travis.yml` before `cmake` is run

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

Loading

0 comments on commit fc7a619

Please sign in to comment.