From 002769b96a014119dd079a5986f331e1f1628052 Mon Sep 17 00:00:00 2001 From: rulrich <ralf.m.ulrich@kit.edu> Date: Sun, 31 May 2020 08:53:28 +0200 Subject: [PATCH] eigen3 and pythia targets --- CMakeLists.txt | 4 ++-- Framework/Geometry/CMakeLists.txt | 11 +++++---- Framework/Utilities/CMakeLists.txt | 1 + Framework/Utilities/testCOMBoost.cc | 2 -- Processes/Pythia/CMakeLists.txt | 2 +- ThirdParty/CMakeLists.txt | 37 ++++++++++++++--------------- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b745c862..4299084b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,11 +146,11 @@ if (WITH_EIGEN3) message ("Using eigen3 installed at location ${WITH_EIGEN3}") list (APPEND CMAKE_MODULE_PATH "${WITH_EIGEN3}/cmake") # set (EIGEN3_INCLUDE_DIR "${WITH_EIGEN3}" CACHE PATH "eigen3 directory") - find_package (Eigen3 REQUIRED) + find_package (Eigen3 REQUIRED NO_MODULE) endif () else (WITH_EIGEN3) message ("Searching eigen3 installed at system-level") - find_package (Eigen3) # if not found here, will automatically pick ThirdParty version + find_package (Eigen3 NO_MODULE) # if not found here, will automatically pick ThirdParty version endif (WITH_EIGEN3) # some final info output diff --git a/Framework/Geometry/CMakeLists.txt b/Framework/Geometry/CMakeLists.txt index 5735e7a1a..1a2754d1c 100644 --- a/Framework/Geometry/CMakeLists.txt +++ b/Framework/Geometry/CMakeLists.txt @@ -41,6 +41,7 @@ target_link_libraries ( CORSIKAgeometry CORSIKAunits CORSIKAutilities + CORSIKAeigen3 ) target_include_directories ( @@ -50,11 +51,11 @@ target_include_directories ( $<INSTALL_INTERFACE:include/include> ) -target_include_directories ( - CORSIKAgeometry - SYSTEM - PUBLIC "${EIGEN3_INCLUDE_DIR}" - ) +#target_include_directories ( +# CORSIKAgeometry +# SYSTEM +# PUBLIC "${EIGEN3_INCLUDE_DIR}" +# ) install ( TARGETS CORSIKAgeometry diff --git a/Framework/Utilities/CMakeLists.txt b/Framework/Utilities/CMakeLists.txt index 13b544518..1cd925d90 100644 --- a/Framework/Utilities/CMakeLists.txt +++ b/Framework/Utilities/CMakeLists.txt @@ -54,6 +54,7 @@ target_link_libraries ( CORSIKAgeometry CORSIKAunits CORSIKAboost # so far only for MetaProgramming + CORSIKAeigen3 # for COMboost ) target_include_directories ( diff --git a/Framework/Utilities/testCOMBoost.cc b/Framework/Utilities/testCOMBoost.cc index b665c5fc0..572839296 100644 --- a/Framework/Utilities/testCOMBoost.cc +++ b/Framework/Utilities/testCOMBoost.cc @@ -16,8 +16,6 @@ #include <corsika/units/PhysicalUnits.h> #include <corsika/utl/COMBoost.h> -#include <Eigen/Dense> - #include <iostream> using namespace corsika::geometry; diff --git a/Processes/Pythia/CMakeLists.txt b/Processes/Pythia/CMakeLists.txt index 9a30ba573..047c6283c 100644 --- a/Processes/Pythia/CMakeLists.txt +++ b/Processes/Pythia/CMakeLists.txt @@ -40,7 +40,7 @@ target_link_libraries ( CORSIKAenvironment CORSIKAsetup CORSIKArandom - CORSIKAPythia8 + CORSIKApythia8 ) target_include_directories ( diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index 824b9b6ed..ea6f2483b 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -43,28 +43,26 @@ if (NOT Boost_FOUND) set (Boost_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/externals/boost) install (DIRECTORY ${Boost_PREFIX}/ DESTINATION ${Boost_INSTALL_DIR}) + message ("Use ThirdParty boost include dir ${Boost_INCLUDE_DIR}") set_target_properties ( CORSIKAboost PROPERTIES INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}> ) - message ("Use ThirdParty boost include dir ${Boost_INCLUDE_DIR}") - include_directories (${Boost_INCLUDE_DIR}) - + else (NOT Boost_FOUND) message ("Using system-level boost version ${Boost_VERSION} at ${Boost_INCLUDE_DIR}") set_target_properties ( CORSIKAboost PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES - $<BUILD_INTERFACE:${Boost_INCLUDE_DIR}> + INTERFACE_LINK_LIBRARIES Boost::headers ) - + endif (NOT Boost_FOUND) # eigen3 -add_library (CORSIKAEigen3 INTERFACE IMPORTED GLOBAL) +add_library (CORSIKAeigen3 INTERFACE IMPORTED GLOBAL) if (NOT Eigen3_FOUND) set (_C8_Eigen3_VERSION "eigen-eigen-b3f3d4950030") @@ -82,11 +80,11 @@ if (NOT Eigen3_FOUND) ) set (HAVE_Eigen3 1 CACHE BOOL "presence of eigen3, via external-project-add in ThirdParty folder") set (Eigen3_FOUND 1 PARENT_SCOPE) - ExternalProject_Get_Property (boost INSTALL_DIR) + ExternalProject_Get_Property (eigen3 INSTALL_DIR) set (Eigen3_PREFIX ${INSTALL_DIR}/..) set (Eigen3_INCLUDE_DIR ${Eigen3_PREFIX}) set (Eigen3_LIBRARY_DIR ${Eigen3_PREFIX}) - add_dependencies (CORSIKAboost boost) + add_dependencies (CORSIKAeigen3 eigen3) # create include directory at config time file (MAKE_DIRECTORY ${Eigen3_INCLUDE_DIR}) @@ -94,25 +92,26 @@ if (NOT Eigen3_FOUND) set (Eigen3_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/externals/eigen3) install (DIRECTORY ${Eigen3_PREFIX}/ DESTINATION ${Eigen3_INSTALL_DIR}) + message ("Use ThirdParty eigen3 include dir ${Eigen3_INCLUDE_DIR}") set_target_properties ( - CORSIKAEigen3 PROPERTIES + CORSIKAeigen3 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES $<BUILD_INTERFACE:${Eigen3_INCLUDE_DIR}> ) - + else (NOT Eigen3_FOUND) + message ("Using system-level eigen3 version ${Eigen3_VERSION} at ${Eigen3_INCLUDE_DIR}") set_target_properties ( - CORSIKAEigen3 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES - $<BUILD_INTERFACE:${Eigen3_INCLUDE_DIR}> - ) + CORSIKAeigen3 PROPERTIES + INTERFACE_LINK_LIBRARIES Eigen3::Eigen + ) endif (NOT Eigen3_FOUND) # Pythia8 -add_library (CORSIKAPythia8 STATIC IMPORTED GLOBAL) +add_library (CORSIKApythia8 STATIC IMPORTED GLOBAL) if (NOT Pythia8_FOUND) set (_C8_Pythia8_VERSION "8235") message ("Building ThirdParty/pythia8 using pythia${_C8_Pythia8_VERSION}-stripped.tar.bz2") @@ -133,7 +132,7 @@ if (NOT Pythia8_FOUND) set (Pythia8_PREFIX ${INSTALL_DIR}) set (Pythia8_INCLUDE_DIR ${Pythia8_PREFIX}/include) set (Pythia8_LIBRARY ${Pythia8_PREFIX}/lib/libpythia8.a) - add_dependencies (CORSIKAPythia8 pythia8) + add_dependencies (CORSIKApythia8 pythia8) # create include directory at config time file (MAKE_DIRECTORY ${Pythia8_INCLUDE_DIR}) @@ -142,7 +141,7 @@ if (NOT Pythia8_FOUND) install (DIRECTORY ${INSTALL_DIR}/ DESTINATION ${Pythia8_INSTALL_DIR}) set_target_properties ( - CORSIKAPythia8 PROPERTIES + CORSIKApythia8 PROPERTIES IMPORTED_LOCATION ${Pythia8_LIBRARY} IMPORTED_LINK_INTERFACE_LIBRARIES dl INTERFACE_INCLUDE_DIRECTORIES @@ -153,7 +152,7 @@ else (NOT Pythia8_FOUND) message ("Using system-level Pythia8 version ${Pythia8_VERSION} at ${Pythia8_INCLUDE_DIR}") set_target_properties ( - CORSIKAPythia8 PROPERTIES + CORSIKApythia8 PROPERTIES IMPORTED_LOCATION ${Pythia8_LIBRARY} IMPORTED_LINK_INTERFACE_LIBRARIES dl INTERFACE_INCLUDE_DIRECTORIES ${Pythia8_INCLUDE_DIR} -- GitLab