Browse Source

rename cmake "Profile" to "Coverage" and add builds

master
Daniel Agar 8 years ago
parent
commit
5f2f6f0308
  1. 4
      .gitignore
  2. 41
      .travis.yml
  3. 94
      CMakeLists.txt
  4. 2
      test/CMakeLists.txt

4
.gitignore vendored

@ -1,10 +1,12 @@ @@ -1,10 +1,12 @@
*.orig
*.swp
*~
astyle/
build*/
cmake_install.cmake
CMakeCache.txt
CMakeFiles/
compile_commands.json
CPackConfig.cmake
CPackSourceConfig.cmake
CTestTestfile.cmake
@ -12,6 +14,7 @@ Makefile @@ -12,6 +14,7 @@ Makefile
test/attitude
test/cmake_install.cmake
test/CMakeFiles/
test/coverage.info
test/CTestTestfile.cmake
test/filter
test/hatvee
@ -22,6 +25,7 @@ test/Makefile @@ -22,6 +25,7 @@ test/Makefile
test/matrixAssignment
test/matrixMult
test/matrixScalarMult
test/out/
test/setIdentity
test/slice
test/squareMatrix

41
.travis.yml

@ -1,17 +1,40 @@ @@ -1,17 +1,40 @@
language: c
sudo: false
install:
- pip install --user cpp-coveralls
script:
- cmake -DCMAKE_BUILD_TYPE=Profile -DTESTING=ON -DFORMAT=ON .
- make check
after_success:
- cpp-coveralls -i matrix
env:
global:
- export COVERALLS_SERVICE_NAME=travis-ci
- secure: "dA+jGAR9O3f+xsh6h7e7coeM0dU1vHiiM7kIPh5TvbbifDQiF5s2uxFQziZVSnLuohRD9oNODiJFz077n+svp7S9t77sdks0+7r61pkD5LlVItZ6ol5jQCfiksyMw6q5ChEes9KSKEfdFRjuDvQUHwShgpsXVAurizA2Hs3MziWxfIlOPULY4UCCm5+TLoY+vXmfFc4bwk2knxpIP8pYRd+xKYAiN9QC1fJiglipuKHaYbo2+ZYrM92RD0Cl+BZdWyI7vD7zmeXV6mstzAFZ20c63NhNNCYRy0VIC3hLB8zKMuvCZdJnpmSRfFt5uJYJPNcORc1ypeY7/CGMm5Rq1lNwxehFO3/++/aHE8H7GR0cTiKndPO0jDu48j+GUB4k1HHSsVEpj7vO7F3FOO0619xxybDFk1zFjHw8KTbdSXmBERldYAKZOP0JKZxp6CU5DXOO2dunumZAzl6WHJjhRMPFqPheE4e+I2YOEHvXTwDcEO/lMwacr6nuaZZXxEh/TwEdqsIRd9bvsoG1zuVQnZm+atLp3oF4QW8nI5l6qe6R+3l5dEgJGtz5hOsiEpWrwWk6ub2VCdELcgpPZyZcdwu/bKvXx3ndW6LjqzcLxMGxM3rdxx6J+b7Es/vkmT1SXFcxiUjpKkUf04Bb8SmGdbJdAKRZuSRFtjqsU0tHPfo="
matrix:
fast_finish: true
include:
- os: linux
dist: trusty
compiler: gcc
env: CMAKE_BUILD_TYPE=Coverage
- os: linux
dist: trusty
compiler: clang
env: CMAKE_BUILD_TYPE=Release CC=clang CXX=clang++
- os: osx
osx_image: xcode8
env: CMAKE_BUILD_TYPE=Release
addons:
apt:
packages:
- cmake
- cmake
- gcc
- g++
- clang
install:
- pip install --user cpp-coveralls
script:
- cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DTESTING=ON -DFORMAT=ON .
- make check
after_success:
- if [[ "${CMAKE_BUILD_TYPE}" = "Coverage" && "${TRAVIS_BRANCH}" == "master" ]]; then cpp-coveralls -i matrix; fi

94
CMakeLists.txt

@ -7,69 +7,82 @@ set(VERSION_PATCH "2") @@ -7,69 +7,82 @@ set(VERSION_PATCH "2")
project(matrix CXX)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Profile" CACHE STRING "Build type" FORCE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type" FORCE)
message(STATUS "set build type to ${CMAKE_BUILD_TYPE}")
endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Profile")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebInfo;MinSizeRel;Coverage")
option(SUPPORT_STDIOSTREAM
"If enabled provides support for << operator (as used with std::cout)" OFF)
option(SUPPORT_STDIOSTREAM "If enabled provides support for << operator (as used with std::cout)" OFF)
option(TESTING "Enable testing" OFF)
option(FORMAT "Enable formatting" OFF)
option(COV_HTML "Display html for coverage" OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include_directories(${CMAKE_SOURCE_DIR})
if(SUPPORT_STDIOSTREAM)
add_definitions(-DSUPPORT_STDIOSTREAM)
endif()
set(CMAKE_CXX_FLAGS_PROFILE
${CMAKE_CXX_FLAGS_DEBUG}
--coverage
-fno-inline
-fno-inline-small-functions
-fno-default-inline
)
string(REPLACE ";" " " CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE}")
set(CMAKE_CXX_FLAGS_COVERAGE
"--coverage -fprofile-arcs -ftest-coverage -fno-default-inline -fno-inline -fno-inline-small-functions -fno-elide-constructors"
CACHE STRING "Flags used by the C++ compiler during coverage builds" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
"--coverage -ftest-coverage -lgcov"
CACHE STRING "Flags used for linking binaries during coverage builds" FORCE)
mark_as_advanced(CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE)
set(CMAKE_CXX_FLAGS
${CMAKE_CXX_FLAGS}
add_compile_options(
-pedantic
-Wall
-Wno-sign-compare
-Warray-bounds
-Wcast-align
-Wcast-qual
-Wconversion
-Wctor-dtor-privacy
-Wdisabled-optimization
-Werror
-Wextra
-Wshadow
-Wfloat-equal
-Wpointer-arith
-Wformat-security
-Wformat=2
-Winit-self
-Wlogical-op
-Wmissing-declarations
-Wmissing-include-dirs
-Wno-sign-compare
-Wno-unused
-Wno-unused-parameter
-Werror=format-security
-Werror=array-bounds
#-Wfatal-errors
-Werror=unused-variable
-Werror=reorder
-Werror=uninitialized
-Werror=init-self
-Wcast-qual
-Wconversion
-Wcast-align
-Werror
-pedantic -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2
-Winit-self -Wlogical-op -Wmissing-declarations
-Wmissing-include-dirs -Wnoexcept -Wold-style-cast
-Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion
-Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5
-Wswitch-default -Wundef -Werror -Wno-unused
-Wnoexcept
-Wold-style-cast
-Woverloaded-virtual
-Wpointer-arith
-Wredundant-decls
-Wreorder
-Wshadow
-Wsign-conversion
-Wsign-promo
-Wstrict-null-sentinel
-Wstrict-overflow=5
-Wswitch-default
-Wundef
-Wuninitialized
-Wunused-variable
)
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
include_directories(${CMAKE_SOURCE_DIR})
# clang tolerate unknown gcc options
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-Wno-error=unused-command-line-argument-hard-error-in-future -Wno-unknown-warning-option)
endif()
file(GLOB_RECURSE COV_SRCS matrix/*.hpp matrix/*.cpp)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
if(TESTING)
enable_testing()
add_subdirectory(test)
add_dependencies(check test_build)
endif()
if(FORMAT)
@ -94,11 +107,8 @@ if(FORMAT) @@ -94,11 +107,8 @@ if(FORMAT)
VERBATIM
DEPENDS ${astyle_exe}
)
endif()
if(TESTING AND FORMAT)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
add_dependencies(check test_build check_format)
add_dependencies(check check_format)
endif()
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})

2
test/CMakeLists.txt

@ -26,7 +26,7 @@ foreach(test_name ${tests}) @@ -26,7 +26,7 @@ foreach(test_name ${tests})
add_dependencies(test_build ${test_name})
endforeach()
if (${CMAKE_BUILD_TYPE} STREQUAL "Profile")
if (${CMAKE_BUILD_TYPE} STREQUAL "Coverage")
add_custom_target(coverage_build
COMMAND ${CMAKE_CTEST_COMMAND}

Loading…
Cancel
Save