diff --git a/CMake/External/CMakeLists.txt b/CMake/External/CMakeLists.txt index c6b4108f4e9e31ce6311f33b4a97c13148f5193e..e658e3880847551a41eb101aeb1ad11befa85706 100644 --- a/CMake/External/CMakeLists.txt +++ b/CMake/External/CMakeLists.txt @@ -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} diff --git a/CMake/Utilities/imstkAddExecutable.cmake b/CMake/Utilities/imstkAddExecutable.cmake index 46aa3876c380f34d4d857784647da7d4da8fa8d7..18b7c7af4001d65b28c2deec66ee3a254410d71b 100644 --- a/CMake/Utilities/imstkAddExecutable.cmake +++ b/CMake/Utilities/imstkAddExecutable.cmake @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index eef86fa2cb897f8b9e1a92b54d1e55bab0e7e688..58c7030918f8a11e142e7c88f492b2a8f9b53799 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 #-----------------------------------------------------------------------------