diff --git a/CMakeLists.txt b/CMakeLists.txt index 4299084b3179cb709682e2633652c7ec580cd1bc..1aa80e6cf4161d463931c95ba97dc2b0e12b551a 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 d9c8d628ef5ea85a45ae6c721b489c28eb3a093c..536077c5bd0487b5b23da6e3bef7224aa281a6b2 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 047c6283cbc4ebf8634e2bd1eaf1b2298a85d9dc..e5028dd933a931d91ae63e8796937787f6e1a1a4 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 ea6f2483bab9bbafb29e2162a141c28e9c1791a2..05ddcd26df339f745f99e583cbd7511288962d4a 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) +