Skip to content
Snippets Groups Projects
Commit 31ecbfa5 authored by Harald Scheirich's avatar Harald Scheirich
Browse files

ENH: Add code coverage target to innerbuild

Known issue, has to be built explicitely, needs lcov installed
parent 988a88d7
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,7 @@ ExternalProject_Add( ${PROJECT_NAME}
-D${PROJECT_NAME}_USE_VRPN:BOOL=${${PROJECT_NAME}_USE_VRPN}
-D${PROJECT_NAME}_COLOR_OUTPUT:BOOL=${${PROJECT_NAME}_COLOR_OUTPUT}
-D${PROJECT_NAME}_USE_VTK_OSMESA:BOOL=${${PROJECT_NAME}_USE_VTK_OSMESA}
-D${PROJECT_NAME}_COVERAGE:BOOL=${${PROJECT_NAME}_COVERAGE}
# External Libraries
-DEigen3_DIR:PATH=${Eigen3_DIR}
-DGTest_DIR:PATH=${GTest_DIR}
......
......@@ -15,13 +15,13 @@ macro(imstk_add_executable target)
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wno-unused-function -fdiagnostics-color=always>
$<$<CXX_COMPILER_ID:MSVC>:
-W4 -MP -wd4505>)
-W4 -MP -wd4505 /bigobj /permissive->)
else()
target_compile_options(${target} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wno-unused-function>
$<$<CXX_COMPILER_ID:MSVC>:
-W4 -MP -wd4505 /bigobj>)
-W4 -MP -wd4505 /bigobj /permissive->)
endif()
set_target_properties(${target} PROPERTIES
......
......@@ -91,13 +91,15 @@ endif ()
if (UNIX)
option(${PROJECT_NAME}_USE_MODEL_REDUCTION "Build with model reduction, requires a VegaFEM built with Intel MKL and arpack" OFF)
option(${PROJECT_NAME}_COLOR_OUTPUT "For coloring output in gcc" OFF)
option(${PROJECT_NAME}_COVERAGE "Build for calculating coverage" OFF)
option(${PROJECT_NAME}_USE_VTK_OSMESA "Build with VTK OSMesa rendering" OFF)
if (${PROJECT_NAME}_COVERAGE AND NOT ${CMAKE_BUILD_TYPE} MATCHES [Dd][Ee][Bb][Uu][Gg])
message(WARNING "Coverage requires a debug build forcing debug")
set(CMAKE_BUILD_TYPE "DEBUG")
endif()
endif()
option(${PROJECT_NAME}_USE_VRPN "Build with VRPN support" OFF)
option(${PROJECT_NAME}_USE_VTK_OSMESA "Build with VTK OSMesa rendering" OFF)
if (${${PROJECT_NAME}_USE_VTK_OSMESA} AND NOT UNIX)
message(WARNING "OSMesa only works on unix, building without")
set(${PROJECT_NAME}_USE_VTK_OSMESA FALSE CACHE BOOL "Build with VTK OSMesa rendering" FORCE)
endif()
#-----------------------------------------------------------------------------
# CTest/Dashboards
......@@ -301,18 +303,35 @@ endif()
include(imstkAddExecutable)
# Uncrustify
find_program(Uncrustify_EXECUTABLE uncrustify)
include(SetupUncrustifyConfig)
# include(SetupUncrustifyConfig)
if(Uncrustify_EXECUTABLE)
include(imstkAddUncrustifyCustomTarget)
else(Uncrustify_EXECUTABLE)
message(WARNING "uncrustify not found! Cannot run code-style test.")
endif(Uncrustify_EXECUTABLE)
# Google Test
#-----------------------------------------------------------------------------
# Testing
#----------------------------------------------------------------------
if(${PROJECT_NAME}_BUILD_TESTING)
find_package( GTest REQUIRED NO_DEFAULT_PATH)
endif()
#-----------------------------------------------------------------------------
# Code Coverage
#----------------------------------------------------------------------
if(${PROJECT_NAME}_COVERAGE)
# Note HS Had to add ALL in setup_target_for_coverage to force the code coverage pass
set(CODE_COVERAGE_VERBOSE ON)
include(CodeCoverage)
append_coverage_compiler_flags()
setup_target_for_coverage_lcov(
NAME Coverage
EXECUTABLE ctest -E "(CodeFormatTest|RenderTest.*)"
EXCLUDE "${CMAKE_BINARY_DIR}/../install/include/*" "/usr/*" "*/Testing/*"
)
endif()
#-----------------------------------------------------------------------------
# Download the external data needed for both testing and examples
#-----------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment