Back to home page

EIC code displayed by LXR

 
 

    


Warning, /DD4hep/DDCore/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 #=================================================================================
0002 #
0003 #  AIDA Detector description implementation 
0004 #---------------------------------------------------------------------------------
0005 # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0006 # All rights reserved.
0007 #
0008 # For the licensing terms see $DD4hepINSTALL/LICENSE.
0009 # For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0010 #
0011 #=================================================================================
0012 #---Generate ROOT dictionary------------------------------------------------------
0013 SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME DDCore)
0014 dd4hep_print("|++> Will be Building DDCore")
0015 
0016 file(GLOB DDCore_SOURCES src/*.cpp src/segmentations/*.cpp src/XML/*.cpp)
0017 
0018 if(${CMAKE_CXX_STANDARD} LESS 17)
0019   list(APPEND EXCLUDE_HEADER include/DD4hep/SpecParRegistry.h)
0020   list(APPEND EXCLUDE_HEADER include/DD4hep/Filter.h)
0021   list(FILTER DDCore_SOURCES EXCLUDE REGEX Filter\.cpp|SpecParRegistry\.cpp )
0022 endif()
0023 
0024 # Build the generic DD4hep dictionary
0025 dd4hep_add_dictionary( G__DD4hep
0026   SOURCES include/ROOT/Warnings.h
0027   include/DD4hep/*.h
0028   include/DD4hep/detail/*.h
0029   include/XML/*.h
0030   src/RootDictionary.h
0031   EXCLUDE include/DD4hep/DetFactoryHelper.h
0032   include/DD4hep/Any.h
0033   include/DD4hep/Factories.h
0034   include/DD4hep/Plugins.h
0035   include/DD4hep/IoStreams.h
0036   include/DD4hep/SurfaceInstaller.h
0037   include/DD4hep/GrammarParsed.h
0038   include/DD4hep/GrammarUnparsed.h
0039   include/XML/UnicodeValues.h
0040   include/XML/tinyxml.h
0041   include/XML/tinystring.h
0042   ${EXCLUDE_HEADER}
0043   LINKDEF include/ROOT/LinkDef.h
0044   USES DDCore DDParsers ${XML_LIBRARIES} ${TBB_IMPORTED_TARGETS}
0045   DEFINITIONS DD4HEP_MUST_USE_DETECTORIMP_H
0046   )
0047 
0048 # Build the DD4hep dictionary for all geometry instantiations
0049 dd4hep_add_dictionary( G__DD4hepGeo
0050   SOURCES include/ROOT/Warnings.h src/GeoDictionary.h
0051   LINKDEF include/ROOT/LinkDef.h
0052   USES DDCore DDParsers ${XML_LIBRARIES}
0053   )
0054 
0055 # Build the DD4hep dictionary for property type instantiations
0056 dd4hep_add_dictionary( G__DD4hepProperties
0057   SOURCES include/ROOT/Warnings.h src/PropertyDictionary.h
0058   LINKDEF include/ROOT/LinkDef.h
0059   USES DDCore DDParsers ${XML_LIBRARIES}
0060   )
0061 
0062 # Build the DD4hep dictionary for the segmentation instantiations
0063 dd4hep_add_dictionary( G__DD4hepSegmentations
0064   SOURCES include/ROOT/Warnings.h src/SegmentationDictionary.h
0065   LINKDEF include/ROOT/LinkDef.h
0066   USES DDCore DDParsers ${XML_LIBRARIES}
0067   )
0068 
0069 if(TARGET Boost::boost)
0070   dd4hep_print("|++> Boost available, building Json Parsers")
0071   file(GLOB DDCore_BOOST_SOURCES src/JSON/*.cpp)
0072 endif()
0073 
0074 add_library(DDCore ${DDCore_SOURCES} ${DDCore_BOOST_SOURCES}
0075   G__DD4hep.cxx
0076   G__DD4hepSegmentations.cxx
0077   G__DD4hepProperties.cxx
0078   G__DD4hepGeo.cxx
0079   )
0080 add_library(DD4hep::DDCore ALIAS DDCore)
0081 
0082 if(DD4HEP_USE_TBB AND ${CMAKE_CXX_STANDARD} GREATER_EQUAL 17)
0083   target_compile_definitions(DDCore PUBLIC DD4HEP_USE_TBB)
0084   target_link_libraries(DDCore PUBLIC TBB::tbb)
0085 endif()
0086 
0087 target_include_directories(DDCore
0088   PUBLIC
0089   $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
0090   $<INSTALL_INTERFACE:include>
0091   )
0092 
0093 target_link_libraries(DDCore
0094   PUBLIC
0095   DD4hep::DDParsers
0096   ROOT::Core ROOT::Rint ROOT::Tree ROOT::Physics ROOT::Geom ROOT::GenVector
0097   ${XML_LIBRARIES} ${CMAKE_DL_LIBS}
0098   )
0099 
0100 if(${CMAKE_VERSION} VERSION_GREATER 3.7.99)
0101   target_compile_features(DDCore
0102     PUBLIC
0103     cxx_std_${CMAKE_CXX_STANDARD} # Needs cmake 3.8
0104     )
0105 endif()
0106 
0107 # Generate DDCore plugins---------------------------------------------------------
0108 dd4hep_add_plugin(DDCorePlugins SOURCES src/plugins/*.cpp USES DDCore)
0109 
0110 # Graphics DDCore plugins---------------------------------------------------------
0111 dd4hep_add_plugin(DDCoreGraphics
0112   SOURCES src/graphics/*.cpp
0113   USES DDCore ROOT::Core ROOT::Rint ROOT::Gui ROOT::Hist ROOT::HistPainter ROOT::ROOTHistDraw)
0114 
0115 # This plugins depends on the ROOT GDML readers. Hence, extra library
0116 IF(TARGET ROOT::Gdml)
0117   dd4hep_print("|++> Found Root::GDML: Creating DDGDMLPlugins")
0118   dd4hep_add_plugin(DDGDMLPlugins
0119     SOURCES src/gdml/*.cpp
0120     USES DD4hep::DDCore ROOT::Core ROOT::Gdml
0121     )
0122   set_target_properties(DDGDMLPlugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
0123   LIST(APPEND OPTIONAL_TARGETS DDGDMLPlugins)
0124 ELSE()
0125   dd4hep_print("ROOT does not include GDML, not building DDCore GDML Plugins")
0126 ENDIF()
0127 
0128 #---------------------------  Specialized PYTHON plugin ----------------------------
0129 IF(TARGET ROOT::ROOTTPython)
0130   dd4hep_add_plugin(DDPythonPlugins
0131     SOURCES src/python/*.cpp
0132     USES DDCore ROOT::Core ROOT::ROOTTPython
0133     )
0134   set_target_properties(DDPythonPlugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
0135   LIST(APPEND OPTIONAL_TARGETS DDPythonPlugins)
0136 ELSE()
0137   dd4hep_print("ROOT does not include Python support, not building DDCore DDPython Plugins")
0138 ENDIF()
0139 
0140 # install python files
0141 file(GLOB DDCore_Python python/*.py)
0142 install(FILES ${DDCore_Python} DESTINATION ${DD4HEP_PYTHON_INSTALL_DIR})
0143 
0144 install(PROGRAMS python/bin/checkOverlaps.py DESTINATION bin RENAME checkOverlaps)
0145 install(PROGRAMS python/bin/checkGeometry.py DESTINATION bin RENAME checkGeometry)
0146 
0147 # install header files
0148 install(DIRECTORY
0149   include/DDSegmentation
0150   include/DD4hep
0151   include/XML
0152   include/JSON
0153   include/Parsers
0154   include/ROOT
0155   DESTINATION include
0156   )
0157 
0158 set_target_properties(DDCore DDCorePlugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION})
0159 install(TARGETS DDCore DDCorePlugins ${OPTIONAL_TARGETS} EXPORT DD4hep
0160   ARCHIVE DESTINATION lib
0161   LIBRARY DESTINATION lib
0162   )