IAP GITLAB

Skip to content
Snippets Groups Projects
Commit cee39d50 authored by Alan Coleman's avatar Alan Coleman
Browse files

Resolve "Refactory Coverage builds and measurements"

parent 054c9326
No related branches found
No related tags found
1 merge request!630Resolve "Refactory Coverage builds and measurements"
...@@ -20,9 +20,9 @@ include (GNUInstallDirs) ...@@ -20,9 +20,9 @@ include (GNUInstallDirs)
# version is: "8.major.minor.patch" # version is: "8.major.minor.patch"
# major: API changes # major: API changes
# minor: no API changes # minor: no API changes
# patch: bug fix and small improvements # patch: bug fix and small improvements
# #
set (c8_version 8.0.0.0) set (c8_version 8.0.0.0)
project ( project (
corsika corsika
VERSION ${c8_version} VERSION ${c8_version}
...@@ -66,7 +66,7 @@ set (CORSIKA8_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake") ...@@ -66,7 +66,7 @@ set (CORSIKA8_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH}) set (CMAKE_MODULE_PATH "${CORSIKA8_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
if(DEFINED CONAN_CMAKE_DIR) if(DEFINED CONAN_CMAKE_DIR)
list(APPEND CMAKE_MODULE_PATH "${CONAN_CMAKE_DIR}") list(APPEND CMAKE_MODULE_PATH "${CONAN_CMAKE_DIR}")
endif(DEFINED CONAN_CMAKE_DIR) endif(DEFINED CONAN_CMAKE_DIR)
set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be done with `make VERBOSE=1` set (CMAKE_VERBOSE_MAKEFILE OFF) # this can be done with `make VERBOSE=1`
...@@ -129,18 +129,18 @@ add_subdirectory (externals/cnpy) ...@@ -129,18 +129,18 @@ add_subdirectory (externals/cnpy)
# #
# targets and settings needed to generate coverage reports # targets and settings needed to generate coverage reports
#if (CMAKE_BUILD_TYPE STREQUAL Coverage) #if (CMAKE_BUILD_TYPE STREQUAL Coverage)
SET(COVERAGE_BUILD OFF CACHE BOOL "Activate coverage build") SET(COVERAGE_BUILD OFF CACHE BOOL "Activate coverage build")
if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug")) if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
message(INFO "\n|==========> COVERAGE TARGET ACTIVATED.\n") message(INFO "\n|==========> COVERAGE TARGET ACTIVATED.\n")
find_package (Perl REQUIRED) find_package (Perl REQUIRED)
# compile coverage under -O0 to avoid any optimization, function elimation etc. # compile coverage under -O0 to avoid any optimization, function elimation etc.
add_compile_options ("-O0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 --coverage")
# search for local lcov # search for local lcov
find_program (c8_lcov_bin lcov) find_program (c8_lcov_bin lcov)
...@@ -158,23 +158,23 @@ if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug")) ...@@ -158,23 +158,23 @@ if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
set (GCOV gcov CACHE STRING "gcov executable" FORCE) set (GCOV gcov CACHE STRING "gcov executable" FORCE)
# collect coverage data # collect coverage data
add_custom_command ( add_custom_command (
OUTPUT raw-coverage.info OUTPUT raw-coverage.info
COMMAND ${CMAKE_COMMAND} -E echo "Note: you need to run ctest at least once to generate the coverage data" COMMAND ${CMAKE_COMMAND} -E echo "Note: you need to run ctest at least once to generate the coverage data"
COMMAND ${c8_lcov_bin} --gcov-tool=${GCOV} --rc lcov_branch_coverage=1 COMMAND ${c8_lcov_bin} --gcov-tool=${GCOV} --rc lcov_branch_coverage=1
--directory . --capture --output-file raw-coverage.info --directory . --capture --output-file raw-coverage.info
) )
# remove uninteresting entries # remove uninteresting entries
add_custom_command ( add_custom_command (
OUTPUT coverage.info OUTPUT coverage.info
COMMAND ${c8_lcov_bin} -q --remove raw-coverage.info "*/usr/*" "/usr/*" --output-file coverage2.info COMMAND ${c8_lcov_bin} -q --remove raw-coverage.info "*/usr/*" "/usr/*" --output-file coverage2.info
COMMAND ${c8_lcov_bin} --remove coverage2.info COMMAND ${c8_lcov_bin} --remove coverage2.info
"*/externals/*" "*/tests/*" "*/sibyll2.3d.cpp" "*/.conan/*" "*/externals/*" "*/tests/*" "*/sibyll2.3d.cpp" "*/.conan/*"
"*/include/Pythia8/*" "*/install/*" "*/include/Pythia8/*" "*/install/*"
"${CMAKE_SOURCE_DIR}/modules/*" "${CMAKE_BINARY_DIR}/modules/*" "${CMAKE_SOURCE_DIR}/modules/*" "${CMAKE_BINARY_DIR}/modules/*"
"*/cxroot/*" "*/cxroot/*" "*/.conan2/*" "/boost/*"
--output-file coverage.info --output-file coverage.info
COMMAND ${CMAKE_COMMAND} -E remove coverage2.info COMMAND ${CMAKE_COMMAND} -E remove coverage2.info
DEPENDS raw-coverage.info DEPENDS raw-coverage.info
...@@ -186,7 +186,7 @@ if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug")) ...@@ -186,7 +186,7 @@ if( COVERAGE_BUILD AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
DEPENDS coverage.info DEPENDS coverage.info
) )
add_custom_target (coverage DEPENDS coverage-report) add_custom_target (coverage DEPENDS coverage-report)
endif () endif ()
#+++++++++++++++++++++++++++++ #+++++++++++++++++++++++++++++
...@@ -342,7 +342,7 @@ install ( ...@@ -342,7 +342,7 @@ install (
DESTINATION lib/cmake/corsika DESTINATION lib/cmake/corsika
) )
if(DEFINED CONAN_CMAKE_DIR) if(DEFINED CONAN_CMAKE_DIR)
install ( install (
DIRECTORY conan_cmake/ DIRECTORY conan_cmake/
DESTINATION lib/cmake/dependencies DESTINATION lib/cmake/dependencies
) )
...@@ -356,7 +356,7 @@ configure_package_config_file ( ...@@ -356,7 +356,7 @@ configure_package_config_file (
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX} INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}
) )
# #
# corsikaDefines # corsikaDefines
# #
configure_package_config_file ( configure_package_config_file (
cmake/corsikaDefines.cmake cmake/corsikaDefines.cmake
...@@ -412,8 +412,8 @@ install ( ...@@ -412,8 +412,8 @@ install (
) )
# #
# also install-level config.hpp # also install-level config.hpp
# #
install (FILES install (FILES
${PROJECT_BINARY_DIR}/corsika.hpp-install ${PROJECT_BINARY_DIR}/corsika.hpp-install
RENAME corsika.hpp RENAME corsika.hpp
DESTINATION include/corsika DESTINATION include/corsika
......
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