diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | cmake/GCov.cmake | 51 | ||||
-rw-r--r-- | cmake/GdbusCodegen.cmake | 36 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 |
4 files changed, 3 insertions, 92 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9302542..bb7568e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ set(SERVICE_LIB ${PACKAGE}) set(SERVICE_EXEC "${PACKAGE}-service") option(enable_tests "Build the package's automatic tests." ON) -option(enable_lcov "Generate lcov code coverage reports." ON) +option(enable_coverage "Generate code coverage reports." ON) ## ## GNU standard paths @@ -74,8 +74,8 @@ add_compile_options(-std=c++14 -fPIC -g) if(${enable_tests}) enable_testing() - if(${enable_lcov}) - include(GCov) + if(${enable_coverage}) + include(EnableCoverageReport) endif() endif() diff --git a/cmake/GCov.cmake b/cmake/GCov.cmake deleted file mode 100644 index 81c0c40..0000000 --- a/cmake/GCov.cmake +++ /dev/null @@ -1,51 +0,0 @@ -if (CMAKE_BUILD_TYPE MATCHES coverage) - set(GCOV_FLAGS "${GCOV_FLAGS} --coverage") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCOV_FLAGS}") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${GCOV_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCOV_FLAGS}") - set(GCOV_LIBS ${GCOV_LIBS} gcov) - - find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin") - if (NOT GCOVR_EXECUTABLE) - message(STATUS "Gcovr binary was not found, can not generate XML coverage info.") - else () - message(STATUS "Gcovr found, can generate XML coverage info.") - add_custom_target (coverage-xml - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" -x -r "${CMAKE_SOURCE_DIR}" - --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml) - endif() - - find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin") - find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT}) - if (NOT LCOV_EXECUTABLE) - message(STATUS "Lcov binary was not found, can not generate HTML coverage info.") - else () - if(NOT GENHTML_EXECUTABLE) - message(STATUS "Genthml binary not found, can not generate HTML coverage info.") - else() - message(STATUS "Lcov and genhtml found, can generate HTML coverage info.") - add_custom_target (coverage-html - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMAND "${CMAKE_CTEST_COMMAND}" --force-new-ctest-process --verbose - COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture | ${CMAKE_SOURCE_DIR}/trim-lcov.py > dconf-lcov.info - COMMAND "${LCOV_EXECUTABLE}" -r dconf-lcov.info /usr/include/\\* -o nosys-lcov.info - COMMAND LANG=C "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory lcov-html --legend --show-details nosys-lcov.info - COMMAND ${CMAKE_COMMAND} -E echo "" - COMMAND ${CMAKE_COMMAND} -E echo "file://${CMAKE_BINARY_DIR}/lcov-html/index.html" - COMMAND ${CMAKE_COMMAND} -E echo "") - #COMMAND "${LCOV_EXECUTABLE}" --directory ${CMAKE_BINARY_DIR} --capture --output-file coverage.info --no-checksum - #COMMAND "${GENHTML_EXECUTABLE}" --prefix ${CMAKE_BINARY_DIR} --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info - #COMMAND ${CMAKE_COMMAND} -E echo "\\#define foo \\\"bar\\\"" - #) - endif() - endif() -endif() - - - #$(MAKE) $(AM_MAKEFLAGS) check - #lcov --directory $(top_builddir) --capture --test-name dconf | $(top_srcdir)/trim-lcov.py > dconf-lcov.info - #LANG=C genhtml --prefix $(top_builddir) --output-directory lcov-html --legend --show-details dconf-lcov.info - #@echo - #@echo " file://$(abs_top_builddir)/lcov-html/index.html" - #@echo diff --git a/cmake/GdbusCodegen.cmake b/cmake/GdbusCodegen.cmake deleted file mode 100644 index ddb2995..0000000 --- a/cmake/GdbusCodegen.cmake +++ /dev/null @@ -1,36 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -if(POLICY CMP0011) - cmake_policy(SET CMP0011 NEW) -endif(POLICY CMP0011) - -find_program(GDBUS_CODEGEN NAMES gdbus-codegen DOC "gdbus-codegen executable") -if(NOT GDBUS_CODEGEN) - message(FATAL_ERROR "Excutable gdbus-codegen not found") -endif() - -macro(add_gdbus_codegen outfiles name prefix service_xml) - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c" - COMMAND "${GDBUS_CODEGEN}" - --interface-prefix "${prefix}" - --generate-c-code "${name}" - "${service_xml}" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${ARGN} "${service_xml}" - ) - list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c") -endmacro(add_gdbus_codegen) - -macro(add_gdbus_codegen_with_namespace outfiles name prefix namespace service_xml) - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c" - COMMAND "${GDBUS_CODEGEN}" - --interface-prefix "${prefix}" - --generate-c-code "${name}" - --c-namespace "${namespace}" - "${service_xml}" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${ARGN} "${service_xml}" - ) - list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c") -endmacro(add_gdbus_codegen_with_namespace) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 63c236d..d3a021b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,6 @@ add_definitions(-DG_LOG_DOMAIN="${CMAKE_PROJECT_NAME}") add_compile_options( ${CXX_WARNING_ARGS} - ${GCOV_FLAGS} ) add_library( @@ -26,7 +25,6 @@ target_link_libraries(${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES} ${THREAD_LINK_LIBRARIES} - ${GCOV_LIBS} ) install( |