diff --git a/CMakeLists.txt b/CMakeLists.txt index 454c2242bda030850e1d0deaf9ca0bfd5520a479..48c55c05ccf0e8ceaed2b01d64c40928e219f8e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,10 +66,19 @@ IF( INSTALL_DOC ) ENDIF() -find_package(DDSegmentation REQUIRED) +#------ allow to use a pre-built DDSegmentation ---------------------------- + +find_package(DDSegmentation QUIET) + +#if it does not exist, simply build DDSegmentation as part of DD4hep: +if( NOT DDSegmentation_FOUND ) + add_subdirectory(DDSegmentation) + SET( DDSegmentation_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/DDSegmentation/include) + SET( DDSegmentation_LIBRARIES DDSegmentation) +endif() #---Packages------------------------------------------------------------------------ -#add_subdirectory(DDSegmentation) + add_subdirectory(DDCore) add_subdirectory(DDSurfaces) add_subdirectory(DDRec) diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index 9c80a05042ec9cf66fc3519dad7f541098f1ce17..459c38812c83a5db4d7a7bb86a403ff0ddd90f3a 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -22,11 +22,11 @@ else() file(GLOB parser_sources ) endif() -# Find the DDSegmentation libraries -find_library(DDSegmentation_LIBS - NAMES ${DDSegmentation_LIBRARIES} - PATHS ${DDSegmentation_LIBRARY_DIR} -) +## Find the DDSegmentation libraries +#find_library(DDSegmentation_LIBS +# NAMES ${DDSegmentation_LIBRARIES} +# PATHS ${DDSegmentation_LIBRARY_DIR} +#) file(GLOB headers include/DD4hep/*.h) file(GLOB internal_headers include/DD4hep/objects/*.h) @@ -48,7 +48,7 @@ include(DD4hep_XML_setup) add_library(DD4hepCore SHARED ${sources} ${parser_sources} ) -target_link_libraries(DD4hepCore ${ROOT_LIBRARIES} ${XML_LIBRARIES} ${DDSegmentation_LIBS} Geom Reflex ${libraries}) +target_link_libraries(DD4hepCore ${ROOT_LIBRARIES} ${XML_LIBRARIES} ${DDSegmentation_LIBRARIES} Geom Reflex ${libraries}) add_library(DD4hepPlugins SHARED ${plugin_sources}) target_link_libraries(DD4hepPlugins ${ROOT_LIBRARIES} ${XML_LIBRARIES} DD4hepCore Geom Reflex ${libraries}) diff --git a/DDRec/CMakeLists.txt b/DDRec/CMakeLists.txt index 2a0ea9dd8ce7fc0dd3093b76cdf3256a02f244a1..8800bd0bf7c7fdfc71bbb04ea70e5d30c14b295d 100644 --- a/DDRec/CMakeLists.txt +++ b/DDRec/CMakeLists.txt @@ -26,14 +26,14 @@ endif() add_library(DD4hepRec SHARED ${sources} ) -# Find the DDSegmentation libraries -find_library(DDSegmentation_LIBS - NAMES ${DDSegmentation_LIBRARIES} - PATHS ${DDSegmentation_LIBRARY_DIR} -) +## Find the DDSegmentation libraries +#find_library(DDSegmentation_LIBS +# NAMES ${DDSegmentation_LIBRARIES} +# PATHS ${DDSegmentation_LIBRARY_DIR} +#) if(DD4HEP_WITH_GEAR) - target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBS} DD4hepCore Geom Reflex ${libraries} ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES}) + target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBRARIES} DD4hepCore Geom Reflex ${libraries} ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES}) #------ binary ---------- @@ -45,7 +45,7 @@ if(DD4HEP_WITH_GEAR) ) else() - target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBS} DD4hepCore Geom Reflex ${libraries}) + target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBRARIES} DD4hepCore Geom Reflex ${libraries}) endif(DD4HEP_WITH_GEAR) diff --git a/ReadMe.txt b/ReadMe.txt index eba04b0330cf166a131bcb987176ed1e6535749f..aa78b9618b99644fca02983923e40522439f9da1 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -68,7 +68,7 @@ To build and run the simulation examples Geant4 will be required. ( minimum is: export ROOTSYS=/data/ilcsoft/root/5.34.03 ) -- configure and build DDSegmentation +- optionally configure and build DDSegmentation beforehand cd DD4hep/DDSegmentation mkdir build; cd build @@ -77,7 +77,7 @@ To build and run the simulation examples Geant4 will be required. cd ../../.. export CMAKE_PREFIX_PATH=`pwd`/DD4hep/DDSegmentation/ -- configure and build: +- configure and build (builds DDSegmentation if not yet done): cd DD4hep mkdir build; cd build