Commit d3dce7b9 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

NEW enabling testing and coverage report for CEP is easier now

Wiki documentation also updated
parent 23cdfb9a
......@@ -13,6 +13,8 @@
#! [DEFAULT_APPLICATION exeName]
#! [NEEDS_CEP cep1 cep2...]
#! [LICENSE licenseName]
#! [ENABLE_TESTING]
#! [ENABLE_TEST_COVERAGE]
#! )
#! \endcode
#!
......@@ -23,13 +25,17 @@
#! If you specify a name here, the directory name will be ignored
#! \param DESCRIPTION A (not so) small description of this CEP (objective, content, implementation information)
#! \param DEFAULT_APPLICATION The default application to run (for MSVC launchers), default is camitk-imp
#! \param NEEDS_CEP (TODO) Dependencies to other CEP
#! \param LICENSE The name of the license for this CEP, default is LGPL-v3
#! \param ENABLE_TESTING Enable the testing framework ("make test" will run all the test)
#! \param ENABLE_TEST_COVERAGE Enable the test coverage report ("make camitk-test-coverage" will run all the test and generate
#! a report in the camitk-test-coverage subdirectory. Only works with the g++ compiler.
#! \param NEEDS_CEP (TODO) Dependencies to other CEP
#!
macro(camitk_extension_project)
get_directory_name(${CMAKE_CURRENT_SOURCE_DIR} CEP_DIR_NAME)
set(options ENABLED)
set(options ENABLED ENABLE_TESTING ENABLE_TEST_COVERAGE)
set(oneValueArgs DEFAULT_APPLICATION DESCRIPTION CONTACT NAME LICENSE)
set(multiValueArgs NEEDS_CEP)
cmake_parse_arguments(${CEP_DIR_NAME}_CMAKE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
......@@ -53,10 +59,23 @@ macro(camitk_extension_project)
set(CEP_${CEP_NAME_CMAKE} ${CEP_${CEP_NAME_CMAKE}_ENABLED} CACHE BOOL "Build CEP ${CEP_NAME}")
set(CEP_${CEP_NAME_CMAKE}_INTERNAL TRUE CACHE INTERNAL "Is variable CAMITK_CEP_${CEP_NAME_CMAKE} already created?")
endif()
if(CEP_${CEP_NAME_CMAKE})
message(STATUS "Building CEP ${CEP_NAME}")
if (${CEP_DIR_NAME}_CMAKE_ENABLE_TESTING OR ${CEP_DIR_NAME}_CMAKE_ENABLE_TEST_COVERAGE)
include(CTest)
enable_testing()
message(STATUS "Testing framework enabled")
endif()
if (${CEP_DIR_NAME}_CMAKE_ENABLE_TEST_COVERAGE)
set(${CEP_DIR_NAME}_CMAKE_ENABLE_TESTING ON)
# to create specific target: camitk-test-coverage
option(CAMITK_TEST_COVERAGE "Code coverage" ON)
include(macros/camitk/test/CamiTKTestCoverage)
endif()
project(${CEP_NAME})
if(NOT DEFINED ${CEP_DIR_NAME}_CMAKE_CONTACT)
......
......@@ -11,21 +11,16 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
find_package(CamiTK REQUIRED)
include(${CAMITK_USE_FILE})
# Uncomment next two lines if you want to enable component and action automatic tests
#include(CTest)
#enable_testing()
# For gcc compiler, uncomment next two lines if you want to get a test coverage html report
# Build the project, then the specific target camitk-test-coverage
# Open the build directory camitk-test-coverage/index.html in your browser to view the coverage report
#option(CAMITK_TEST_COVERAGE "Code coverage" OFF)
#include(macros/camitk/test/CamiTKTestCoverage)
# define the CEP
camitk_extension_project(NAME "@PROJECT_NAME@"
CONTACT "@CONTACT@"
DESCRIPTION "@DESCRIPTION@"
ENABLED
# Uncomment the next line to activate the CamiTK testing framework
# and enable component and action automatic tests
#ENABLE_TESTING
# Uncomment the next line to be able to generate a test coverage html report
#ENABLE_TEST_COVERAGE
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment