diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b26745ed22dce0ebb0b0ff4bfc3de981227198b..1827a9398e5344675980c60608e17ec1a9cffc32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,8 @@ set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard used for compiling") set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +SET(DD4hep_DIR ${CMAKE_SOURCE_DIR} CACHE STRING "DD4hep directory") + IF(${CMAKE_CXX_STANDARD} LESS 14) MESSAGE(FATAL_ERROR "DD4hep requires at least CXX Standard 14 to compile") ENDIF() @@ -67,6 +69,13 @@ option(DD4HEP_USE_GEAR "Build gear wrapper for backward compatibility" OFF) option(DD4HEP_USE_LCIO "Build lcio extensions" OFF) option(BUILD_TESTING "Enable and build tests" ON) option(CMAKE_MACOSX_RPATH "Build with rpath on macos" ON) +SET(DD4HEP_BUILD_PACKAGES "DDRec DDDetectors DDCond DDAlign DDDigi DDG4 DDEve UtilityApps" + CACHE STRING "List of DD4hep packages to build") +SEPARATE_ARGUMENTS(DD4HEP_BUILD_PACKAGES) +MESSAGE(STATUS "Will be building these packages: ${DD4HEP_BUILD_PACKAGES}") + +OPTION(DD4HEP_BUILD_EXAMPLES "Build all the examples" OFF) +OPTION(DD4HEP_DEBUG_CMAKE "Print debugging information for DD4hep CMAKE" OFF) ##################### # Configure version # @@ -124,9 +133,6 @@ dd4hep_set_compiler_flags() #################### # Include packages # #################### - -add_subdirectory ( GaudiPluginService ) - include(DD4hep) include(DD4hepMacros) @@ -135,23 +141,26 @@ if( DEFINED DD4HEP_WITH_GEANT4 OR DEFINED DD4HEP_WITH_GEAR ) endif() include(DD4hep_XML_setup) -add_subdirectory(DDParsers) -add_subdirectory(DDCore) -add_subdirectory(DDRec) -add_subdirectory(DDDetectors) -add_subdirectory(DDCond) -add_subdirectory(DDAlign) -add_subdirectory(DDDigi) -add_subdirectory(DDG4) - -# Note the order: DDEve partially depends on variables from DDG4! -add_subdirectory(DDEve) + +#These pacakges are mandatory +FOREACH(DDPackage GaudiPluginService DDParsers DDCore) + dd4hep_print("|> Building ${DDPackage}") + add_subdirectory(${DDPackage}) +ENDFOREACH() + +FOREACH(DDPackage IN LISTS DD4HEP_BUILD_PACKAGES) + dd4hep_print("|> Building ${DDPackage}") + add_subdirectory(${DDPackage}) +ENDFOREACH() if(BUILD_TESTING) dd4hep_enable_tests() add_subdirectory(DDTest) endif() -add_subdirectory(UtilityApps) + +if(DD4HEP_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() ####################### # Treatment for Apple # diff --git a/DDAlign/CMakeLists.txt b/DDAlign/CMakeLists.txt index a6045095d6e899e488f8b17f7796b095da9205e3..4a3f56d9cc44e27dddb9e8cbd72e075ca61ff6ac 100644 --- a/DDAlign/CMakeLists.txt +++ b/DDAlign/CMakeLists.txt @@ -13,6 +13,7 @@ SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME DDAlign) file(GLOB DDAlign_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(DDAlign SHARED ${DDAlign_SOURCES}) +add_library(DD4hep::DDAlign ALIAS DDAlign) target_include_directories(DDAlign PUBLIC diff --git a/DDCond/CMakeLists.txt b/DDCond/CMakeLists.txt index 22800c72acd1a88dc63af3ac100b47715f85f4ae..f611348fefdcbaf47bde81f1dac1243c75823dab 100644 --- a/DDCond/CMakeLists.txt +++ b/DDCond/CMakeLists.txt @@ -13,12 +13,13 @@ SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME DDCond) dd4hep_add_dictionary(G__DDCond SOURCES ../DDCore/include/ROOT/Warnings.h src/ConditionsDictionary.h LINKDEF ../DDCore/include/ROOT/LinkDef.h - USES DDCore DDParsers + USES DD4hep::DDCore DD4hep::DDParsers ) file(GLOB DDCond_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(DDCond SHARED ${DDCond_SOURCES} G__DDCond.cxx) +add_library(DD4hep::DDCond ALIAS DDCond) target_include_directories(DDCond PUBLIC @@ -26,11 +27,11 @@ target_include_directories(DDCond $<INSTALL_INTERFACE:include> ) -target_link_libraries(DDCond PUBLIC DDCore) +target_link_libraries(DDCond PUBLIC DD4hep::DDCore) dd4hep_add_plugin(DDCondPlugins SOURCES src/plugins/*.cpp src/Type1/*.cpp - USES DDCond + USES DD4hep::DDCond ) set_target_properties(DDCond DDCondPlugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index a79d51f40b1f8710a6b5f556c51aee37718e2996..d9544d497409a3afb8730d0513fde91d5d242b40 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -64,6 +64,7 @@ add_library(DDCore SHARED ${DDCore_SOURCES} ${DDCore_BOOST_SOURCES} G__DD4hepProperties.cxx G__DD4hepGeo.cxx ) +add_library(DD4hep::DDCore ALIAS DDCore) target_include_directories(DDCore PUBLIC @@ -73,8 +74,8 @@ target_include_directories(DDCore target_link_libraries(DDCore PUBLIC - DD4hepGaudiPluginMgr - DDParsers + DD4hep::DD4hepGaudiPluginMgr + DD4hep::DDParsers ROOT::Core ROOT::Rint ROOT::Tree ROOT::Physics ROOT::Geom ROOT::GenVector ${XML_LIBRARIES} ) @@ -94,7 +95,7 @@ IF(TARGET ROOT::Gdml) dd4hep_print("|++> Found Root::GDML: Creating DDGDMLPlugins") dd4hep_add_plugin(DDGDMLPlugins SOURCES src/gdml/*.cpp - USES DDCore ROOT::Core ROOT::Gdml + USES DD4hep::DDCore ROOT::Core ROOT::Gdml ) set_target_properties(DDGDMLPlugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) install(TARGETS DDGDMLPlugins EXPORT DD4hep LIBRARY DESTINATION lib) diff --git a/DDDetectors/CMakeLists.txt b/DDDetectors/CMakeLists.txt index 1003df0fa7d889083db7c1077b64a9754ab3f484..8e248693e0edbfa191efc925d6787c63bdaa868f 100644 --- a/DDDetectors/CMakeLists.txt +++ b/DDDetectors/CMakeLists.txt @@ -20,7 +20,7 @@ SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME DDDetectors) dd4hep_add_plugin(DDDetectors SOURCES src/*.cpp - USES DDRec + USES DD4hep::DDRec INCLUDES $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> ) diff --git a/DDDigi/CMakeLists.txt b/DDDigi/CMakeLists.txt index 5480fb4787f3db614971df5241a7967256973185..1816c2c3f6332682de5ae7608fe8896823b6f41a 100644 --- a/DDDigi/CMakeLists.txt +++ b/DDDigi/CMakeLists.txt @@ -11,9 +11,10 @@ SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME DDDigi) file(GLOB DDDigi_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(DDDigi SHARED ${DDDigi_SOURCES}) +add_library(DD4hep::DDDigi ALIAS DDDigi) target_link_libraries(DDDigi PUBLIC - DDCore Boost::boost ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO) + DD4hep::DDCore Boost::boost ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO) target_include_directories(DDDigi PUBLIC @@ -37,13 +38,13 @@ endif() dd4hep_add_dictionary(G__DDDigi SOURCES ../DDCore/include/ROOT/Warnings.h python/DDDigiDict.C LINKDEF ../DDCore/include/ROOT/LinkDef.h - USES DDCore ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO Boost::boost + USES DD4hep::DDCore ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO Boost::boost ) #--------------------------- Plugin library for the digitization framework ------- dd4hep_add_plugin(DDDigiPlugins SOURCES plugins/*.cpp GENERATED G__DDDigi.cxx - USES DDDigi + USES DD4hep::DDDigi ) #---Package installation procedure(s) ---------------------------------------------- diff --git a/DDEve/CMakeLists.txt b/DDEve/CMakeLists.txt index a66a3fe8acd36fc628662c8e3d7771598a55bced..3c8fbdf6ee570fe3a0a89e1ffeb41756e7f036f5 100644 --- a/DDEve/CMakeLists.txt +++ b/DDEve/CMakeLists.txt @@ -11,6 +11,7 @@ SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME DDEve) add_library(DDEve_Interface INTERFACE) +add_library(DD4hep::DDEve_Interface ALIAS DDEve_Interface) target_include_directories(DDEve_Interface INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> @@ -25,7 +26,7 @@ dd4hep_add_dictionary(G__DDEve include/DDEve/HitActors.h include/DDEve/Factories.h LINKDEF ../DDCore/include/ROOT/LinkDef.h - USES DDCore + USES DD4hep::DDCore ) if(TARGET LCIO::LCIO) @@ -35,17 +36,17 @@ endif() dd4hep_add_plugin(DDEvePlugins SOURCES src/*.cpp ${DDEVE_LCIO_SOURCES} GENERATED G__DDEve.cxx - USES DDCore DDEve_Interface ${DDEVE_LCIO_LINK} + USES DD4hep::DDCore DD4hep::DDEve_Interface ${DDEVE_LCIO_LINK} ) if(DD4HEP_USE_GEANT4) dd4hep_add_dictionary(G__DDG4IO SOURCES ../DDCore/include/ROOT/Warnings.h DDEve/DDG4IO.C LINKDEF ../DDCore/include/ROOT/LinkDef.h - USES DDG4 + USES DD4hep::DDG4 ) add_library(DDG4IO SHARED DDEve/IO.cpp G__DDG4IO.cxx) - target_link_libraries(DDG4IO DDG4 DDEve_Interface) + target_link_libraries(DDG4IO DD4hep::DDG4 DD4hep::DDEve_Interface) set_target_properties(DDG4IO PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) install(TARGETS DDG4IO EXPORT DD4hep LIBRARY DESTINATION lib) endif() diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index 5107b1b9a1a129589e2b7954a65ee037502dd3a4..9a600d9f9dcad8be20a8aa41fa6ea6b30acc9e95 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -12,17 +12,18 @@ SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME DDG4) # configure Geant4 IF(NOT DD4HEP_USE_GEANT4) - dd4hep_print("Not Using geant4, not building DDG4") + dd4hep_print("|++> Not Using geant4, not building DDG4") RETURN() ENDIF() #---Add Library--------------------------------------------------------------------- file(GLOB DDG4_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) add_library(DDG4 SHARED ${DDG4_SOURCES}) +add_library(DD4hep::DDG4 ALIAS DDG4) target_link_libraries(DDG4 PUBLIC - DDCore + DD4hep::DDCore Geant4::Interface ) @@ -38,13 +39,13 @@ dd4hep_add_plugin(DDG4Legacy SOURCES legacy/*.cpp USES DDG4) #----------------------------------------------------------------------------------- dd4hep_add_dictionary( G__DDG4 SOURCES python/DDG4Dict.C - USES DDCore DDParsers DDG4 Geant4::Interface + USES DD4hep::DDCore DD4hep::DDParsers DD4hep::DDG4 Geant4::Interface ) #--------------------------- Plugin library for the simulation framework --------- dd4hep_add_plugin(DDG4Plugins SOURCES plugins/*.cpp GENERATED G__DDG4.cxx - USES ROOT::Core ${CLHEP} DDG4 ${XML_LIBRARIES} DDParsers + USES DD4hep::DDG4 DD4hep::DDParsers ${XML_LIBRARIES} ROOT::Core ${CLHEP} ) #--------------------------- Plugin library for the simulation framework --------- @@ -54,7 +55,7 @@ if(TARGET Python2::Python) dd4hep_print("|++> Python found, creating DDG4Python Dictionary") dd4hep_add_dictionary(G__DDG4Python SOURCES src/python/DDG4Python.C - USES DDCore DDParsers DDG4 ROOT::Core Geant4::Interface + USES DD4hep::DDCore DD4hep::DDParsers DD4hep::DDG4 ROOT::Core Geant4::Interface ) dd4hep_add_dictionary(G__DDPython SOURCES tpython/DDPython.C @@ -64,7 +65,8 @@ if(TARGET Python2::Python) #--------------------------- Specialized python plugins -------------------------- dd4hep_print("|++> ROOT Has Python, creating DDPython library and plugins") add_library(DDPython SHARED G__DDPython.cxx tpython/DDPython.cpp) - target_link_libraries(DDPython DDG4 ROOT::Core Python2::Python ROOT::PyROOT) + add_library(DD4hep::DDPython ALIAS DDPython) + target_link_libraries(DDPython DD4hep::DDG4 ROOT::Core Python2::Python ROOT::PyROOT) IF(${CMAKE_CXX_STANDARD} GREATER 16) # python header not cxx17 compatible, gives error in clang target_compile_options(DDPython PUBLIC -Wno-register) @@ -72,11 +74,11 @@ if(TARGET Python2::Python) dd4hep_add_plugin(DDG4Python SOURCES src/python/*.cpp GENERATED G__DDG4Python.cxx - USES DDG4 DDPython + USES DD4hep::DDG4 DD4hep::DDPython ) #---Helper to overcome deficiency of the python executable concerning multi-threading add_executable(pyddg4 pyddg4.cpp) - target_link_libraries(pyddg4 PUBLIC DDPython ROOT::Core ROOT::PyROOT) + target_link_libraries(pyddg4 PUBLIC DD4hep::DDPython ROOT::Core ROOT::PyROOT) # install these libraries set_target_properties(DDPython DDG4Python PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) @@ -93,7 +95,7 @@ endif() IF(TARGET LCIO::LCIO) dd4hep_add_plugin(DDG4LCIO SOURCES lcio/*.cpp - USES DDG4 LCIO::LCIO + USES DD4hep::DDG4 LCIO::LCIO ) install(TARGETS DDG4LCIO EXPORT DD4hep LIBRARY DESTINATION lib) set_target_properties(DDG4LCIO PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) diff --git a/DDParsers/CMakeLists.txt b/DDParsers/CMakeLists.txt index a12abc941c5c9e77465a8c58a5c163940b3fad22..ac1be0f3aaa0805756be3cfaad8ec5c161b58fda 100644 --- a/DDParsers/CMakeLists.txt +++ b/DDParsers/CMakeLists.txt @@ -16,6 +16,7 @@ file(GLOB DDParsers_SOURCES src/Parsers/*.cpp src/Evaluator/*.cpp) file(GLOB DDParsers_SPIRIT_SOURCES src/Spirit/*.cpp) add_library(DDParsers SHARED ${DDParsers_SOURCES} ${DDParsers_SPIRIT_SOURCES}) +add_library(DD4hep::DDParsers ALIAS DDParsers) target_compile_definitions(DDParsers INTERFACE BOOST_SPIRIT_USE_PHOENIX_V3) diff --git a/DDRec/CMakeLists.txt b/DDRec/CMakeLists.txt index ea9a3a31f69d4ba732ed69bf5011f60e3c5b03f6..fe0f4fb4c484e9f4b6fb5ce31379da645df0922c 100644 --- a/DDRec/CMakeLists.txt +++ b/DDRec/CMakeLists.txt @@ -32,6 +32,7 @@ ADD_LIBRARY(DDRec SHARED ${GEAR_SOURCE_FILE} G__DDRec.cxx ) +ADD_LIBRARY(DD4hep::DDRec ALIAS DDRec) TARGET_INCLUDE_DIRECTORIES(DDRec PUBLIC diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt index 70e555101aa741238be8b7a1aceacb16876fccf2..c96f873c8b2b8832905d980fab8d6e03a84ba07f 100644 --- a/DDTest/CMakeLists.txt +++ b/DDTest/CMakeLists.txt @@ -10,6 +10,8 @@ #================================================================================= add_library(DDTest INTERFACE) +add_library(DD4hep::DDTest ALIAS DDTest) + target_include_directories(DDTest INTERFACE include) foreach(TEST_NAME @@ -23,7 +25,7 @@ foreach(TEST_NAME test_segmentationHandles ) add_executable(${TEST_NAME} src/${TEST_NAME}.cc) - target_link_libraries(${TEST_NAME} DDCore DDRec DDTest) + target_link_libraries(${TEST_NAME} DD4hep::DDCore DD4hep::DDRec DD4hep::DDTest) install(TARGETS ${TEST_NAME} RUNTIME DESTINATION bin) set(cmd ${CMAKE_INSTALL_PREFIX}/bin/run_test.sh ${TEST_NAME}) @@ -36,7 +38,7 @@ foreach(TEST_NAME test_surface ) add_executable(${TEST_NAME} src/${TEST_NAME}.cc) - target_link_libraries(${TEST_NAME} DDCore DDRec DDTest) + target_link_libraries(${TEST_NAME} DD4hep::DDCore DD4hep::DDRec DD4hep::DDTest) install(TARGETS ${TEST_NAME} RUNTIME DESTINATION bin) add_test(NAME t_${TEST_NAME} COMMAND ${CMAKE_INSTALL_PREFIX}/bin/run_test.sh ${TEST_NAME} file:${CMAKE_CURRENT_SOURCE_DIR}/units.xml) @@ -48,7 +50,7 @@ if (DD4HEP_USE_GEANT4) test_EventReaders ) add_executable(${TEST_NAME} src/${TEST_NAME}.cc) - target_link_libraries(${TEST_NAME} DDCore DDRec DDG4) + target_link_libraries(${TEST_NAME} DD4hep::DDCore DD4hep::DDRec DD4hep::DDG4) target_include_directories(${TEST_NAME} PRIVATE ./include) install(TARGETS ${TEST_NAME} DESTINATION bin) diff --git a/GaudiPluginService/CMakeLists.txt b/GaudiPluginService/CMakeLists.txt index 8b2e25090f7735907bcb57b487b2699cae5d18d4..f8aaa6aeed610f23456bb61b4f7fdb5ed9fd9954 100644 --- a/GaudiPluginService/CMakeLists.txt +++ b/GaudiPluginService/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) project(GaudiPluginService) add_library(DD4hepGaudiPluginMgr SHARED src/PluginServiceV1.cpp src/PluginServiceV2.cpp interface/DD4hepV1.cpp interface/DD4hepV2.cpp) +add_library(DD4hep::DD4hepGaudiPluginMgr ALIAS DD4hepGaudiPluginMgr) + target_compile_definitions(DD4hepGaudiPluginMgr PUBLIC Gaudi=DD4hep_Flavor) target_include_directories(DD4hepGaudiPluginMgr PUBLIC diff --git a/UtilityApps/CMakeLists.txt b/UtilityApps/CMakeLists.txt index 04c5092d53b0075137a8b707c0304fc12d6c2d49..b01c90e6405946b9e7c1e5cddfc2ee589ac4deb7 100644 --- a/UtilityApps/CMakeLists.txt +++ b/UtilityApps/CMakeLists.txt @@ -11,33 +11,33 @@ SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME UtilityApps) add_executable(geoDisplay src/display.cpp) -target_link_libraries(geoDisplay DDCore) +target_link_libraries(geoDisplay DD4hep::DDCore) #----------------------------------------------------------------------------------- add_executable(geoConverter src/converter.cpp) -target_link_libraries(geoConverter DDCore) +target_link_libraries(geoConverter DD4hep::DDCore) #----------------------------------------------------------------------------------- add_executable(geoPluginRun src/plugin_runner.cpp) -target_link_libraries(geoPluginRun DDCore) +target_link_libraries(geoPluginRun DD4hep::DDCore) #----------------------------------------------------------------------------------- add_executable(dumpBfield src/dumpBfield.cpp) -target_link_libraries(dumpBfield DDCore) +target_link_libraries(dumpBfield DD4hep::DDCore) #----------------------------------------------------------------------------------- add_executable(print_materials src/print_materials.cpp) -target_link_libraries(print_materials DDCore DDRec) +target_link_libraries(print_materials DD4hep::DDCore DD4hep::DDRec) #----------------------------------------------------------------------------------- add_executable(materialScan src/materialScan.cpp) -target_link_libraries(materialScan ROOT::Core ROOT::Geom DDRec) +target_link_libraries(materialScan DD4hep::DDRec ROOT::Core ROOT::Geom) #----------------------------------------------------------------------------------- add_executable(materialBudget src/materialBudget.cpp) -target_link_libraries(materialBudget ROOT::Core ROOT::Geom DDRec ROOT::Hist) +target_link_libraries(materialBudget DD4hep::DDRec ROOT::Core ROOT::Geom ROOT::Hist) #----------------------------------------------------------------------------------- add_executable(graphicalScan src/graphicalScan.cpp) -target_link_libraries(graphicalScan ROOT::Core ROOT::Geom DDRec ROOT::Hist) +target_link_libraries(graphicalScan DD4hep::DDRec ROOT::Core ROOT::Geom ROOT::Hist) #----------------------------------------------------------------------------------- if(TARGET Geant4::Interface) add_executable(dumpdetector src/dumpdetector.cpp) - target_link_libraries(dumpdetector Geant4::Interface DDCore DDRec) + target_link_libraries(dumpdetector DD4hep::DDCore DD4hep::DDRec Geant4::Interface) LIST(APPEND OPTIONAL_EXECUTABLES dumpdetector) endif() @@ -45,10 +45,10 @@ endif() if(BUILD_TESTING) if(DD4HEP_USE_LCIO) add_executable(test_surfaces src/test_surfaces.cpp) - target_link_libraries(test_surfaces DDRec DDTest LCIO::LCIO) + target_link_libraries(test_surfaces DD4hep::DDRec DD4hep::DDTest LCIO::LCIO) add_executable(test_cellid_position_converter src/test_cellid_position_converter.cpp) - target_link_libraries(test_cellid_position_converter DDRec DDTest LCIO::LCIO) + target_link_libraries(test_cellid_position_converter DD4hep::DDRec DD4hep::DDTest LCIO::LCIO) LIST(APPEND OPTIONAL_EXECUTABLES test_surfaces) LIST(APPEND OPTIONAL_EXECUTABLES test_cellid_position_converter) @@ -58,7 +58,7 @@ endif() dd4hep_add_dictionary( G__eve SOURCES src/EvNavHandler.h LINKDEF src/LinkDef.h - USES DDCore ROOT::Geom + USES DD4hep::DDCore ROOT::Geom ) # #----------------------------------------------------------------------------------- @@ -66,16 +66,16 @@ if (DD4HEP_USE_LCIO) dd4hep_add_dictionary( G__eve1 SOURCES src/EvNavHandler.h LINKDEF src/LinkDef.h - USES DDCore ROOT::Geom + USES DD4hep::DDCore ROOT::Geom ) add_executable(teveLCIO G__eve1.cxx src/teve_display.cpp src/next_event_lcio.cpp) - target_link_libraries(teveLCIO DDRec LCIO::LCIO ROOT::Core ROOT::Eve ROOT::Gui ROOT::Graf3d ROOT::RGL) + target_link_libraries(teveLCIO DD4hep::DDRec LCIO::LCIO ROOT::Core ROOT::Eve ROOT::Gui ROOT::Graf3d ROOT::RGL) LIST(APPEND OPTIONAL_EXECUTABLES teveLCIO) endif() # #----------------------------------------------------------------------------------- add_executable(teveDisplay src/teve_display.cpp src/next_event_dummy.cpp G__eve.cxx) -target_link_libraries(teveDisplay DDRec ROOT::Core ROOT::Eve ROOT::Gui ROOT::Graf3d ROOT::RGL ) +target_link_libraries(teveDisplay DD4hep::DDRec ROOT::Core ROOT::Eve ROOT::Gui ROOT::Graf3d ROOT::RGL ) INSTALL(TARGETS geoDisplay geoConverter diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake index 4c45218edad8f36f55279c466d356d94bf62b735..9cc236721a9a885713e0dfa6b88d19403ec87fc5 100644 --- a/cmake/DD4hep.cmake +++ b/cmake/DD4hep.cmake @@ -20,7 +20,7 @@ endif() #--------------------------------------------------------------------------------------------------- # Main functional include file -if ( "${DD4hepBuild_included}" STREQUAL "" ) +if (NOT DD4hepBuild_included) include ( DD4hepBuild ) include ( DD4hep_XML_setup ) endif() @@ -91,7 +91,6 @@ function(dd4hep_generate_rootmap_notapple library) set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.components) set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_LIBRARY_SUFFIX}) - #message(STATUS "DD4hep_DIR = ${DD4hep_DIR}" ) add_custom_command(OUTPUT ${rootmapfile} DEPENDS ${library} diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index 7863f6c268bd4c9eec2e827564790c5a0326b85c..c1b2e9d3d94ad257189a0905b1c8bd68a2803112 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -10,9 +10,13 @@ # #================================================================================= -##set(DD4HEP_DEBUG_CMAKE 1) -message ( STATUS "INCLUDING DD4hepBuild.cmake" ) + include ( CMakeParseArguments ) + +if(DD4hepBuild_included) + RETURN() +endif() +message(STATUS "Including DD4hepBuild.cmake") set ( DD4hepBuild_included ON ) #--------------------------------------------------------------------------------------------------- @@ -48,10 +52,10 @@ macro(dd4hep_set_compiler_flags) CHECK_CXX_COMPILER_FLAG( "${FLAG}" CXX_FLAG_WORKS_${FLAG_WORD} ) IF( ${CXX_FLAG_WORKS_${FLAG_WORD}} ) - MESSAGE ( STATUS "Adding ${FLAG} to CXX_FLAGS" ) + dd4hep_debug("|DDD> Adding ${FLAG} to CXX_FLAGS" ) SET ( CMAKE_CXX_FLAGS "${FLAG} ${CMAKE_CXX_FLAGS} ") ELSE() - MESSAGE ( STATUS "NOT Adding ${FLAG} to CXX_FLAGS" ) + dd4hep_debug("|DDD> NOT Adding ${FLAG} to CXX_FLAGS" ) ENDIF() ENDFOREACH() diff --git a/examples/CLICSiD/CMakeLists.txt b/examples/CLICSiD/CMakeLists.txt index fa04537161fc3278a56080cd6f3b0387d1ba31d0..4e0ff6b2f46a4ee9b2aeca0f91a43cf276a31133 100644 --- a/examples/CLICSiD/CMakeLists.txt +++ b/examples/CLICSiD/CMakeLists.txt @@ -14,8 +14,10 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) #----------------------------------------------------------------------------------- dd4hep_configure_output () -find_package(DD4hep) -find_package(ROOT REQUIRED COMPONENTS Geom) +IF(NOT TARGET DD4hep::DDCore) + find_package(DD4hep) + find_package(ROOT REQUIRED COMPONENTS Geom) +ENDIF() set(CLICSiDEx_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/CLICSiD) dd4hep_install_dir( scripts sim DESTINATION ${CLICSiDEx_INSTALL} ) @@ -26,11 +28,10 @@ if (DD4HEP_USE_GEANT4) add_executable(CLICSiDAClick scripts/CLICSiDAClick.C) target_link_libraries(CLICSiDAClick DD4hep::DDCore DD4hep::DDG4) + install(TARGETS CLICSiDXML CLICSiDAClick DESTINATION bin) endif() # -install(TARGETS CLICSiDXML CLICSiDAClick DESTINATION bin) - dd4hep_configure_scripts ( CLICSiD DEFAULT_SETUP WITH_TESTS ) enable_testing () diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7d66b0f2b452b488cdd63a2b8dee7a5c515c6797..8a3be21ebdc6bb95cd150cbe6ab882ebbe16a9bb 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -30,14 +30,16 @@ option(BUILD_TESTING "Enable and build tests" ON) option(CMAKE_MACOSX_RPATH "Build with rpath on macos" ON) # -find_package ( DD4hep REQUIRED ) -include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) -include ( ${DD4hep_DIR}/cmake/DD4hepBuild.cmake ) +IF(NOT TARGET DD4hep::DDCore) + find_package ( DD4hep REQUIRED ) + include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) + include ( ${DD4hep_DIR}/cmake/DD4hepBuild.cmake ) + find_package ( ROOT REQUIRED COMPONENTS Geom GenVector ) + dd4hep_set_compiler_flags() +ENDIF() # -find_package ( ROOT REQUIRED COMPONENTS Geom GenVector ) #include(${ROOT_USE_FILE}) # -dd4hep_set_compiler_flags() SET( ENV{DD4hepExamplesINSTALL} ${CMAKE_INSTALL_PREFIX} ) # dd4hep_configure_output()