diff --git a/DDDetectors/CMakeLists.txt b/DDDetectors/CMakeLists.txt index e6d14b1af4daadfec21d96a7fbd580da09f25d1a..fd4231d78e23e27c7a6b38b74722050a80f3f1a4 100644 --- a/DDDetectors/CMakeLists.txt +++ b/DDDetectors/CMakeLists.txt @@ -23,7 +23,7 @@ include_directories(${CMAKE_SOURCE_DIR}/DDCore/include file(GLOB sources src/*.cpp ) add_library( DD4hepDetectors SHARED ${sources}) -target_link_libraries( DD4hepDetectors DD4hepCore DD4hepRec ${ROOT_LIBRARIES} ) +target_link_libraries( DD4hepDetectors DD4hepCore DDRec ${ROOT_LIBRARIES} ) # #---Rootmap generation-------------------------------------------------------------- dd4hep_generate_rootmap( DD4hepDetectors ) diff --git a/DDRec/CMakeLists.txt b/DDRec/CMakeLists.txt index 0da5652b1ab331dff514aa7feb48832ffa46edce..3190337bd8aae2f25fed295fbbecf8c37c44ef1c 100644 --- a/DDRec/CMakeLists.txt +++ b/DDRec/CMakeLists.txt @@ -2,67 +2,60 @@ cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) project(DDRec) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${DDSegmentation_INCLUDE_DIRS} - ${ROOT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/DDSurfaces/include + ${CMAKE_SOURCE_DIR}/DDSurfaces/include ${CMAKE_SOURCE_DIR}/DDCore/include) file(GLOB sources src/*.cpp) +set(rec_link_libraries DD4hepCore ${DDSegmentation_LIBRARIES} ${ROOT_LIBRARIES} Geom Reflex) #--------------------------- GEAR wrappers for backward compatibility ----------- if(DD4HEP_USE_GEAR) find_package(GEAR REQUIRED COMPONENTS geartgeo) + include_directories(SYSTEM ${GEAR_INCLUDE_DIRS}) + add_definitions("-D DD4HEP_USE_GEAR") - include_directories( ${GEAR_INCLUDE_DIRS} ) + list(APPEND sources src/gear/DDGear.cpp) + list(APPEND plugin_sources src/gear/createGearForILD.cpp src/gear/createGearForCLIC.cpp) + list(APPEND rec_link_libraries ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES}) - set(sources ${sources} src/gear/DDGear.cpp src/gear/createGearForILD.cpp src/gear/createGearForCLIC.cpp) + add_executable(convertToGear src/convertToGear.cc) - add_definitions("-D DD4HEP_USE_GEAR") + target_link_libraries(convertToGear ${PackageName} ${DD4hep_LIBRARIES} DDRec + ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} ${GEAR_LIBRARIES} + ) + + install(TARGETS convertToGear + RUNTIME DESTINATION bin + ) endif() #------------------------------------------------------------------------------------- -add_library(DD4hepRec SHARED ${sources} ) - -if(DD4HEP_USE_GEAR) - target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBRARIES} DD4hepCore Geom Reflex ${libraries} ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES}) - - #------ binary ---------- - - add_executable( convertToGear src/convertToGear.cc) - - target_link_libraries(convertToGear ${PackageName} ${DD4hep_LIBRARIES} DD4hepRec - ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES} - ${GEAR_LIBRARIES} - ) +add_library(DDRec SHARED ${sources}) +target_link_libraries(DDRec ${rec_link_libraries}) -else() - target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBRARIES} DD4hepCore Geom Reflex ${libraries}) -endif(DD4HEP_USE_GEAR) +# Add the DDRecPlugin, as there are currently only gear plugins, we need to check if we want to create the plugin +if( plugin_sources ) + add_dd4hep_plugin(DDRecPlugins SHARED ${plugin_sources}) + target_link_libraries(DDRecPlugins ${rec_link_libraries}) +endif() -SET(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long") -SET_TARGET_PROPERTIES( DD4hepRec PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) +#SET(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long") +SET_TARGET_PROPERTIES(DDRec PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) #--- install target------------------------------------- install(DIRECTORY include/DDRec DESTINATION include PATTERN ".svn" EXCLUDE ) -if(DD4HEP_USE_GEAR) - install(TARGETS DD4hepRec convertToGear - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib +install(TARGETS DDRec + LIBRARY DESTINATION lib ) -else() - install(TARGETS DD4hepRec - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ) -endif() - # to do: add corresponding uninstall... #------------------------------------------------------- diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt index 8bfd9565be7aff796dfd7924a23732dff84ceea0..39096aafc7d4c645da7bb23fc23f93410709a6a7 100644 --- a/DDTest/CMakeLists.txt +++ b/DDTest/CMakeLists.txt @@ -15,9 +15,9 @@ if(DD4HEP_USE_GEANT4) endif() if(DD4HEP_USE_GEANT4) - link_libraries(DD4hepG4 DD4hepCore DD4hepRec DDSegmentation ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) + link_libraries(DD4hepG4 DD4hepCore DDRec DDSegmentation ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) else() - link_libraries(DD4hepCore DD4hepRec DDSegmentation ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) + link_libraries(DD4hepCore DDRec DDSegmentation ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) endif() #-------------------------------------------------- diff --git a/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt index a6c4bfc824d5a0afe334944c921157fa2b3d6f09..790766db8bf022803853c68be81b30808c5c7a0a 100644 --- a/UtilityApps/CMakeLists.txt +++ b/UtilityApps/CMakeLists.txt @@ -18,13 +18,13 @@ add_executable(geoPluginRun src/plugin_runner.cpp) target_link_libraries(geoPluginRun DD4hepCore) #----------------------------------------------------------------------------------- add_executable( print_materials src/print_materials.cpp) -target_link_libraries(print_materials DD4hepCore DD4hepRec) +target_link_libraries(print_materials DD4hepCore DDRec) #----------------------------------------------------------------------------------- add_executable( materialScan src/materialScan.cpp) -target_link_libraries(materialScan DD4hepCore DD4hepRec) +target_link_libraries(materialScan DD4hepCore DDRec) #----------------------------------------------------------------------------------- add_executable( dumpdetector src/dumpdetector.cpp) -target_link_libraries(dumpdetector DD4hepCore DD4hepRec) +target_link_libraries(dumpdetector DD4hepCore DDRec) #----------------------------------------------------------------------------------- @@ -35,11 +35,11 @@ if(DD4HEP_USE_LCIO) add_executable(teveDisplay src/teve_display.cpp G__teve.cxx src/next_event_lcio.cpp) add_executable(test_surfaces src/test_surfaces.cpp ) - target_link_libraries(test_surfaces DD4hepCore DD4hepRec ${LCIO_LIBRARIES} ) + target_link_libraries(test_surfaces DD4hepCore DDRec ${LCIO_LIBRARIES} ) else() add_executable(teveDisplay src/teve_display.cpp G__teve.cxx src/next_event_dummy.cpp) endif() -target_link_libraries( teveDisplay DD4hepCore ${ROOT_EVE_LIBRARIES} DD4hepRec ${LCIO_LIBRARIES} ) +target_link_libraries( teveDisplay DD4hepCore ${ROOT_EVE_LIBRARIES} DDRec ${LCIO_LIBRARIES} ) #--- install target------------------------------------- diff --git a/cmake/DD4hepConfig.cmake.in b/cmake/DD4hepConfig.cmake.in index b459432e435ab235a3b57fbbda8c83927d0baf04..03b21f05c1bc430cf39f4e702ebf1d8a11c37269 100644 --- a/cmake/DD4hepConfig.cmake.in +++ b/cmake/DD4hepConfig.cmake.in @@ -50,7 +50,7 @@ INCLUDE( ${DD4hep_ROOT}/cmake/DD4hepMacros.cmake ) # additional components are set by cmake in variable PKG_FIND_COMPONENTS # first argument should be the package name if(@DD4HEP_USE_GEANT4@) - CHECK_PACKAGE_LIBS( DD4hep DD4hepCore DDSegmentation DD4hepRec DD4hepG4 ) + CHECK_PACKAGE_LIBS(DD4hep DD4hepCore DDSegmentation DDRec DD4hepG4) #--- if geant 4 was built with CLHEP we need to export this to client packages if( @GEANT4_USE_CLHEP@) @@ -60,7 +60,7 @@ if(@DD4HEP_USE_GEANT4@) set( Geant4_DIR @Geant4_DIR@) else() - CHECK_PACKAGE_LIBS( DD4hep DD4hepCore DDSegmentation DD4hepRec ) + CHECK_PACKAGE_LIBS(DD4hep DD4hepCore DDSegmentation DDRec) endif()