From bb34ae05dfc813e017811188a6df5e2d90dd1675 Mon Sep 17 00:00:00 2001 From: rulrich <ralf.m.ulrich@kit.edu> Date: Sun, 31 May 2020 13:11:43 +0200 Subject: [PATCH] make conex work --- CMakeLists.txt | 16 ++++++++++ Processes/CMakeLists.txt | 3 ++ Processes/Pythia/CMakeLists.txt | 7 ----- ThirdParty/CMakeLists.txt | 55 +++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4299084b3..1aa80e6cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,22 @@ else (WITH_PYTHIA8) find_package (Pythia8) # if not found here, will automatically pick ThirdParty version endif (WITH_PYTHIA8) +# check for CxRoot/CONEX: either use ThirdParty/cxroot or system-level installation +message ("***** Configuring CxRoot/CONEX version") +if (WITH_CONEX) + string (TOLOWER ${WITH_CONEX} WITH_CONEX_LOWER) + if ("x_${WITH_CONEX_LOWER}" STREQUAL "x_c8") + message ("Use CONEX from ThirdParty folder") + else () + message ("Searching CxRoot/CONEX installed at location ${WITH_CONEX}") + set (CONEX_DIR ${WITH_CONEX}) + find_package (CONEX REQUIRED) + endif () +else (WITH_CONEX) + message ("Searching CxRoot/CONEX installed at system-level") + find_package (CONEX) # if not found here, will automatically pick ThirdParty version +endif (WITH_CONEX) + # check for Eigen3: either use ThirdParty/eigen3 or system-level installation message ("***** Configuring eigen3 version") if (WITH_EIGEN3) diff --git a/Processes/CMakeLists.txt b/Processes/CMakeLists.txt index d9c8d628e..536077c5b 100644 --- a/Processes/CMakeLists.txt +++ b/Processes/CMakeLists.txt @@ -8,6 +8,9 @@ add_subdirectory (QGSJetII) if (Pythia8_FOUND) add_subdirectory (Pythia) endif (Pythia8_FOUND) +if (CONEX_FOUND) + add_subdirectory (CONEX) +endif (CONEX_FOUND) add_subdirectory (HadronicElasticModel) add_subdirectory (UrQMD) diff --git a/Processes/Pythia/CMakeLists.txt b/Processes/Pythia/CMakeLists.txt index 047c6283c..e5028dd93 100644 --- a/Processes/Pythia/CMakeLists.txt +++ b/Processes/Pythia/CMakeLists.txt @@ -50,13 +50,6 @@ target_include_directories ( $<INSTALL_INTERFACE:include/include> ) -target_include_directories ( - ProcessPythia8 - SYSTEM - PUBLIC ${PYTHIA8_INCLUDE_DIR} - INTERFACE ${PYTHIA8_INCLUDE_DIR} - ) - install ( TARGETS ProcessPythia8 LIBRARY DESTINATION lib diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index ea6f2483b..05ddcd26d 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -160,3 +160,58 @@ else (NOT Pythia8_FOUND) endif (NOT Pythia8_FOUND) + + +# CONEX/CXROOT + +add_library (CORSIKAconex STATIC IMPORTED GLOBAL) +if (NOT CONEX_FOUND) + message ("Building ThirdParty/cxroot is obtained via git and compiled") + message ("This will take a bit.....") + ExternalProject_Add (cxroot + GIT_REPOSITORY https://gitlab.ikp.kit.edu/AirShowerPhysics/cxroot.git + GIT_TAG origin/master + GIT_SHALLOW 1 + GIT_PROGRESS 1 + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/cxroot/source + INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/cxroot/source + CONFIGURE_COMMAND "" + BUILD_COMMAND make CX_NO_ROOT=1 all + INSTALL_COMMAND "" + BUILD_IN_SOURCE ON + EXCLUDE_FROM_ALL TRUE + ) + set (HAVE_CONEX 1 CACHE BOOL "presence of conex, via external-project-add in ThirdParty folder") + set (CONEX_FOUND 1 PARENT_SCOPE) + ExternalProject_Get_Property (cxroot INSTALL_DIR) + set (CONEX_PREFIX ${INSTALL_DIR}) + set (CONEX_INCLUDE_DIR ${CONEX_PREFIX}/src) + set (CONEX_INCLUDE_DIR ${CONEX_PREFIX}/src PARENT_SCOPE) + add_dependencies (CORSIKAconex cxroot) + + # create include directory at config time + file (MAKE_DIRECTORY ${CONEX_INCLUDE_DIR}) + + set (CONEX_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/externals/cxroot) + install (DIRECTORY ${INSTALL_DIR}/ DESTINATION ${CONEX_INSTALL_DIR}) + + set_target_properties ( + CORSIKAconex PROPERTIES + IMPORTED_LOCATION ${CONEX_PREFIX}/lib/Linux/libCONEXdynamic.a + IMPORTED_LINK_INTERFACE_LIBRARIES dl + INTERFACE_INCLUDE_DIRECTORIES + $<BUILD_INTERFACE:${CONEX_INCLUDE_DIR}> + ) + +else (NOT CONEX_FOUND) + + message ("Using system-level CONEX version at ${CXROOT_INCLUDE_DIR}") + set_target_properties ( + CORSIKAconex PROPERTIES + IMPORTED_LOCATION ${CONEX_PREFIX}/lib/${CMAKE_SYSTEM_NAME}/libCONEXdynamic.a + IMPORTED_LINK_INTERFACE_LIBRARIES dl + INTERFACE_INCLUDE_DIRECTORIES ${CONEX_INCLUDE_DIR} + ) + +endif (NOT CONEX_FOUND) + -- GitLab