diff --git a/CMakeLists.txt b/CMakeLists.txt index 58e8ef1a82ebfe6b8abe9f88536c3682ff79e29c..91a5c196efe856bbbe2ba5340ffb7d7d54ac8c44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,18 +97,17 @@ find_package (ROOT 6.08 REQUIRED) DD4HEP_SETUP_ROOT_TARGETS() # Configure BOOST -find_package(Boost 1.49 REQUIRED COMPONENTS filesystem system) -SET_TARGET_PROPERTIES(Boost::boost - PROPERTIES - INTERFACE_COMPILE_DEFINITIONS BOOST_SPIRIT_USE_PHOENIX_V3 - ) -GET_TARGET_PROPERTY(BOOST_FILESYSTEM_LOC Boost::filesystem IMPORTED_LOCATION) -GET_FILENAME_COMPONENT(BOOST_DIR ${BOOST_FILESYSTEM_LOC} DIRECTORY) +find_package(Boost 1.49 REQUIRED) +DD4HEP_SETUP_BOOST_TARGETS() # Configure Geant4 if(DD4HEP_USE_GEANT4) find_package( Geant4 10.2.2 REQUIRED gdml ui_all vis_all ) DD4HEP_SETUP_GEANT4_TARGETS() + # Geant4 sets the CLHEP include directory to include_directories, we undo this here + # we don't do this inside DD4hep_SETUP_GEANT4_TARGETS, because that is also used in + # DD4hepConfig by users of DD4hep + SET_DIRECTORY_PROPERTIES(PROPERTIES INCLUDE_DIRECTORIES "") endif() if(DD4HEP_USE_LCIO) diff --git a/GaudiPluginService/CMakeLists.txt b/GaudiPluginService/CMakeLists.txt index b02354c25f7eafc065b90ba4a625dd70845cbb0b..8b2e25090f7735907bcb57b487b2699cae5d18d4 100644 --- a/GaudiPluginService/CMakeLists.txt +++ b/GaudiPluginService/CMakeLists.txt @@ -2,7 +2,7 @@ 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) -target_compile_definitions(DD4hepGaudiPluginMgr PUBLIC Gaudi=DD4hep_Flavor USE_BOOST_FILESYSTEM) +target_compile_definitions(DD4hepGaudiPluginMgr PUBLIC Gaudi=DD4hep_Flavor) target_include_directories(DD4hepGaudiPluginMgr PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> @@ -11,24 +11,20 @@ target_include_directories(DD4hepGaudiPluginMgr PUBLIC if( APPLE ) target_compile_definitions(DD4hepGaudiPluginMgr PUBLIC APPLE) endif() -target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-shadow) -target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-unused) -target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-unused-parameter) -target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-deprecated) -target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-keyword-macro) -target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-return-type-c-linkage) +target_compile_options(DD4hepGaudiPluginMgr PRIVATE -Wno-shadow + -Wno-unused + -Wno-unused-parameter + -Wno-deprecated + -Wno-keyword-macro + -Wno-return-type-c-linkage + ) -target_link_libraries(DD4hepGaudiPluginMgr PUBLIC Boost::filesystem Boost::system ${CMAKE_DL_LIBS}) +target_link_libraries(DD4hepGaudiPluginMgr PUBLIC ${FS_LIBRARIES} ${CMAKE_DL_LIBS}) SET_TARGET_PROPERTIES(DD4hepGaudiPluginMgr PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) -if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) - SET ( GaudiPluginService_LIBRARIES DD4hepGaudiPluginMgr PARENT_SCOPE ) - SET ( GaudiPluginService_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE ) -endif() - add_executable(listcomponents src/listcomponents.cpp ) add_executable(DD4hep::listcomponents ALIAS listcomponents) -target_link_libraries(listcomponents PUBLIC DD4hepGaudiPluginMgr ${CMAKE_DL_LIBS}) +target_link_libraries(listcomponents PUBLIC DD4hepGaudiPluginMgr ${FS_LIBRARIES} ${CMAKE_DL_LIBS}) target_compile_options(listcomponents PRIVATE -Wno-deprecated) INSTALL(TARGETS listcomponents DD4hepGaudiPluginMgr EXPORT DD4hep diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake index 1b3426bbd2cfb727f9389b374d604c07c6e5d7e9..d0d70e20597699e51035eb0bd6d2d35384df95a8 100644 --- a/cmake/DD4hep.cmake +++ b/cmake/DD4hep.cmake @@ -97,9 +97,6 @@ function(dd4hep_generate_rootmap_notapple library) set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_LIBRARY_SUFFIX}) #message(STATUS "DD4hep_DIR = ${DD4hep_DIR}" ) - GET_TARGET_PROPERTY(boost_filesystem_loc Boost::filesystem IMPORTED_LOCATION) - GET_FILENAME_COMPONENT(boost_dir ${boost_filesystem_loc} DIRECTORY) - add_custom_command(OUTPUT ${rootmapfile} DEPENDS ${library} POST_BUILD @@ -107,7 +104,6 @@ function(dd4hep_generate_rootmap_notapple library) -Dgenmap_install_dir=${LIBRARY_OUTPUT_PATH} -DROOT_VERSION=${ROOT_VERSION} -DDD4hep_DIR=${DD4hep_DIR} - -DLD_PATH=${boost_dir} -P ${DD4hep_DIR}/cmake/MakeGaudiMap.cmake) add_custom_target(Components_${library} ALL DEPENDS ${rootmapfile}) SET( install_destination "lib" ) diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index 2dbfce0c034d83401a098744ace9cbf8aaeb749d..0057ed4d7f8b1104d4bc08a6ff368c20f33b69dd 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -1294,6 +1294,36 @@ macro(DD4HEP_SETUP_ROOT_TARGETS) dd4hep_debug("ROOT INCL DIRS ${ROOT_INCLUDE_DIRS}") dd4hep_debug("ROOT_VERSION: ${ROOT_VERSION}" ) +ENDMACRO() + +# +# Do some processing of the imported Boost Targets +# Some libraries are only needed for cxx std 14 +# we also have to make sure the boost library location is known in that case +# +# + +MACRO(DD4HEP_SETUP_BOOST_TARGETS) + + SET_TARGET_PROPERTIES(Boost::boost + PROPERTIES + INTERFACE_COMPILE_DEFINITIONS BOOST_SPIRIT_USE_PHOENIX_V3 + ) + +IF(${CMAKE_CXX_STANDARD} EQUAL 14) + find_package(Boost 1.49 REQUIRED COMPONENTS filesystem system) + SET(FS_LIBRARIES Boost::filesystem Boost::system) +SET_TARGET_PROPERTIES(Boost::filesystem + PROPERTIES + INTERFACE_COMPILE_DEFINITIONS USE_BOOST_FILESYSTEM + ) + GET_TARGET_PROPERTY(BOOST_FILESYSTEM_LOC Boost::filesystem IMPORTED_LOCATION) + GET_FILENAME_COMPONENT(BOOST_DIR ${BOOST_FILESYSTEM_LOC} DIRECTORY) +ELSE() + SET(FS_LIBRARIES stdc++fs) +ENDIF() + + ENDMACRO() # diff --git a/cmake/MakeGaudiMap.cmake b/cmake/MakeGaudiMap.cmake index fd5c7d13b04d15e33da5a3d16f7e7dfefc4d83c5..1c753d3b5139a25596554e9c457f849361d4eedc 100644 --- a/cmake/MakeGaudiMap.cmake +++ b/cmake/MakeGaudiMap.cmake @@ -1,6 +1,6 @@ message(STATUS " *** Gaudi listcomponents: Generate map for ${libname} ..." ) # - # Running listcomponents from Gaudi + # Running listcomponents from DD4hep # FIND_PROGRAM( Gaudi_listcomponents_CMD listcomponents PATHS ${genmap_install_dir}/../bin ${DD4hep_DIR}/bin NO_DEFAULT_PATH NO_CMAKE_PATH) @@ -9,7 +9,7 @@ message(STATUS " *** Gaudi listcomponents: Generate map for ${libname} ..." ) WORKING_DIRECTORY ${genmap_install_dir} " ) if(APPLE) - SET ( ENV{DYLD_LIBRARY_PATH} ${genmap_install_dir}:${LD_PATH}:$ENV{DYLD_LIBRARY_PATH}:$ENV{DD4HEP_LIBRARY_PATH} ) + SET ( ENV{DYLD_LIBRARY_PATH} ${genmap_install_dir}:$ENV{DYLD_LIBRARY_PATH}:$ENV{DD4HEP_LIBRARY_PATH} ) ##EXECUTE_PROCESS( COMMAND echo DYLD_LIBRARY_PATH = $ENV{DYLD_LIBRARY_PATH} ) else() SET ( ENV{LD_LIBRARY_PATH} ${genmap_install_dir}:$ENV{LD_LIBRARY_PATH} )