IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 3663f5e3 authored by Hans Dembinski's avatar Hans Dembinski
Browse files

init

parent dd38818a
No related branches found
No related tags found
No related merge requests found
......@@ -22,12 +22,17 @@ set (CMAKE_CXX_EXTENSIONS OFF)
enable_testing ()
set (CTEST_OUTPUT_ON_FAILURE 1)
option(COVERAGE "Generate coverage data" OFF)
if(COVERAGE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
# Set a default build type if none was specified
set(default_build_type "Release")
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(default_build_type "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as no other was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
......@@ -37,11 +42,17 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
# enable warnings and disallow non-standard language
set(CMAKE_CXX_FLAGS "-Wall -pedantic -Wextra -Wno-ignored-qualifiers")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g") # -O2 would not trade speed for size, neither O2/3 use fast-math
set(CMAKE_Fortran_FLAGS "-std=legacy")
if(COVERAGE)
set(CMAKE_CXX_FLAGS "--coverage")
set(CMAKE_EXE_LINKER_FLAGS "--coverage")
set(CMAKE_SHARED_LINKER_FLAGS "--coverage")
endif()
# clang produces a lot of unecessary warnings without this:
add_compile_options("$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wno-nonportable-include-path>")
......@@ -52,18 +63,6 @@ if (WITH_COAST)
add_compile_options("-fPIC")
endif()
# unit testing coverage, does not work yet
#include (CodeCoverage)
##set(COVERAGE_LCOV_EXCLUDES 'Documentation/*')
##setup_target_for_coverage(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage)
#SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML (
# NAME corsika_coverage
# EXECUTABLE ctest
# #-j ${PROCESSOR_COUNT}
# # DEPENDENCIES corsika
# )
#add_custom_target (corsika_pre_build)
#add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py")
......
#!/bin/sh
# must be executed in project root folder
if [ -z $GCOV ]; then
GCOV=gcov
fi
LCOV_VERSION="1.13"
LCOV_DIR="lcov-${LCOV_VERSION}"
if [ ! -e $LCOV_DIR ]; then
wget -O - https://github.com/linux-test-project/lcov/releases/download/v${LCOV_VERSION}/lcov-${LCOV_VERSION}.tar.gz | tar zxf -
fi
# LCOV="$LCOV_EXE --gcov-tool=${GCOV} --rc lcov_branch_coverage=1"
LCOV="${LCOV_DIR}/bin/lcov --gcov-tool=${GCOV}" # no branch coverage
# collect raw data
$LCOV --base-directory `pwd` \
--directory `pwd` \
--capture --output-file coverage.info
# remove uninteresting entries
$LCOV --extract coverage.info "*/corsika/*" --output-file coverage.info
if [ $CI ]; then
echo "Coverage report on CI currently disabled"
# upload if on CI
# curl -s https://codecov.io/bash | bash -s - -f coverage.info -X gcov -x $GCOV
else
# otherwise just print
$LCOV_DIR/bin/genhtml coverage.info -o coverage-report
fi
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