diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c90dae238aa7e57e02d1498681450af76cf6fd5..6b1760cd29019f798f3a2deeeec27b9e64c2f494 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ endif () # targets and settings needed to generate coverage reports if (CMAKE_BUILD_TYPE STREQUAL Coverage) find_package (Perl REQUIRED) + set (GCOV gcov CACHE STRING "gcov executable" FORCE) set (LCOV_BIN_DIR "${PROJECT_SOURCE_DIR}/ThirdParty/lcov/bin") # collect coverage data @@ -119,7 +120,14 @@ add_test (NAME clang_format COMMAND ./do-clang-format.sh check WORKING_DIRECTORY if (WITH_PYTHIA) find_package (Pythia8) # optional endif (WITH_PYTHIA) -find_package (Eigen3 REQUIRED) + +# check if system level eigen3 is present +find_package (Eigen3 QUIET) +if (NOT Eigen3_FOUND) + # ...no -> use our own header only version + set (THIRDPARTY_Eigen3 "yes") + message ("use ThirdParty/eigen3") +endif (NOT Eigen3_FOUND) # order of subdirectories add_subdirectory (ThirdParty) @@ -134,3 +142,12 @@ add_subdirectory (Tools) if (WITH_COAST) add_subdirectory (COAST) endif () + +# now check if Eigen3 was previsouly found, or need to be checked again +if (THIRDPARTY_Eigen3) + list (APPEND CMAKE_MODULE_PATH "${EIGEN3_INCLUDE_DIR}/cmake") + find_package (Eigen3 REQUIRED) +endif (THIRDPARTY_Eigen3) + +# some final info output +message ("Use eigen3 version: ${EIGEN3_VERSION} from ${EIGEN3_INCLUDE_DIR}") diff --git a/CMakeModules/CorsikaUtilities.cmake b/CMakeModules/CorsikaUtilities.cmake index abe8e4a761cb30e0bbae0900258ab4817b22683d..090e26065dc987d602d28b246412574566e18ea2 100644 --- a/CMakeModules/CorsikaUtilities.cmake +++ b/CMakeModules/CorsikaUtilities.cmake @@ -126,30 +126,30 @@ endmacro(CORSIKA_ADD_FILES_ABSOLUTE) # TEMPORARY: All sanitizers are currently globally disabled by default, to enable them, # set CORSIKA_SANITIZERS_ENABLED to TRUE. function (CORSIKA_ADD_TEST) - cmake_parse_arguments(PARSE_ARGV 1 _ "" "SANITIZE" "SOURCES") + cmake_parse_arguments (PARSE_ARGV 1 _ "" "SANITIZE" "SOURCES") - set(name ${ARGV0}) + set (name ${ARGV0}) if (NOT __SOURCES) - set(sources ${name}.cc) - else() - set(sources ${__SOURCES}) - endif() + set (sources ${name}.cc) + else () + set (sources ${__SOURCES}) + endif () if (NOT __SANITIZE) set(sanitize "address,undefined") - else() + else () set(sanitize ${__SANITIZE}) - endif() + endif () - add_executable(${name} ${sources}) - target_compile_options(${name} PRIVATE -g) # do not skip asserts + add_executable (${name} ${sources}) + target_compile_options (${name} PRIVATE -g) # do not skip asserts target_include_directories (${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/test_outputs/) if (CORSIKA_SANITIZERS_ENABLED) # -O1 is suggested in clang docs to get reasonable performance - target_compile_options(${name} PRIVATE -O1 -fno-omit-frame-pointer -fsanitize=${sanitize} -fno-sanitize-recover=all) - set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=${sanitize}") - endif() + target_compile_options (${name} PRIVATE -O1 -fno-omit-frame-pointer -fsanitize=${sanitize} -fno-sanitize-recover=all) + set_target_properties (${name} PROPERTIES LINK_FLAGS "-fsanitize=${sanitize}") + endif () add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -s -r junit) endfunction (CORSIKA_ADD_TEST) diff --git a/Framework/Geometry/CMakeLists.txt b/Framework/Geometry/CMakeLists.txt index c8e80d31ca74928744bd4113dda7e5771bea734b..f2b260a71238b2a53dac84c960bda8a79c8504aa 100644 --- a/Framework/Geometry/CMakeLists.txt +++ b/Framework/Geometry/CMakeLists.txt @@ -47,7 +47,6 @@ target_include_directories ( CORSIKAgeometry SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR} - INTERFACE ${EIGEN3_INCLUDE_DIR} ) target_include_directories ( diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index 4eb0c17439854330bd88ee7c3589ca2c0cddf07d..afff12f356fbb249cb9012d22e433d74dfa0a872 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -9,4 +9,13 @@ target_include_directories (CORSIKAthirdparty SYSTEM install (DIRECTORY phys DESTINATION include/ThirdParty/) install (DIRECTORY catch2 DESTINATION include/ThirdParty/) -install (DIRECTORY boost DESTINATION include/ThirdParty/boost/) \ No newline at end of file +install (DIRECTORY boost DESTINATION include/ThirdParty/boost/) + +if (THIRDPARTY_Eigen3) + set (LOCAL_Eigen3_VERSION "eigen-eigen-b3f3d4950030") + execute_process ( + COMMAND ${CMAKE_COMMAND} -E tar xjf ${LOCAL_Eigen3_VERSION}.tar.bz2 + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + set (EIGEN3_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${LOCAL_Eigen3_VERSION}" PARENT_SCOPE) +endif (THIRDPARTY_Eigen3)