diff --git a/.travis.yml b/.travis.yml index 320e87d..ba53431 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ +# Kudos to these guys: # http://genbattle.bitbucket.org/blog/2016/01/17/c++-travis-ci/ +# https://github.com/ticapix/arduino-toolbox/blob/master/.travis.yml # Ubuntu 14.04 Trusty support sudo: required @@ -45,14 +47,38 @@ matrix: before_install: - sudo apt-get update -qq + - sudo apt-get install lcov - source <(curl -SLs https://raw.githubusercontent.com/fortyseveneffects/travis-ci-arduino/master/install.sh) +install: + # Install lcov from source + - wget http://ftp.fr.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz + - tar xf lcov_1.11.orig.tar.gz + - sudo make -C lcov-1.11/ install + - gem install coveralls-lcov + - lcov --version + +before_script: + # init coverage to 0 (optional) + - lcov --directory . --zerocounters + script: + # Build examples with Arduino IDE on each available platform / board - build_main_platforms + + # Build and run unit tests with regular C++ compiler - mkdir build && cd build - cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug .. - - make - - ctest -V + - make all + - ctest --verbose + +after_success: + # Generate code coverage information & send to Coveralls + - cd build + - lcov --directory . --capture --output-file coverage.info + - lcov --remove coverage.info 'test/*' '/usr/*' 'external/*' --output-file coverage.info + - lcov --list coverage.info + - coveralls-lcov --repo-token ${COVERALLS_TOKEN} coverage.info notifications: email: false diff --git a/CMakeLists.txt b/CMakeLists.txt index a65df53..a06c2e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 2.8.7) -project(arduino_midi_library) +project(arduino_midi_library CXX) -set(ROOT_SOURCE_DIR ${PROJECT_SOURCE_DIR}) -include_directories(${ROOT_SOURCE_DIR}) +add_subdirectory(builder) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - -enable_testing() +setup_builder() add_subdirectory(external) add_subdirectory(src) diff --git a/builder/CMakeLists.txt b/builder/CMakeLists.txt new file mode 100644 index 0000000..684103b --- /dev/null +++ b/builder/CMakeLists.txt @@ -0,0 +1,15 @@ + +macro(setup_builder) + enable_testing() + + set(ROOT_SOURCE_DIR ${PROJECT_SOURCE_DIR} CACHE INTERNAL "Repository root directory") + set(ROOT_BINARY_DIR "${ROOT_SOURCE_DIR}/build") + + include_directories(${ROOT_SOURCE_DIR}) + + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +endmacro()