diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index d3aa9f2f934f88bf53258df5ae128eb9f568a326..a650e15cb1cea8d741e1330ddcdb24aa1d0f9566 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -31,8 +31,11 @@ target_link_libraries(DD4hepPlugins ${ROOT_LIBRARIES} ${XML_LIBRARIES} DD4hepCor SET_TARGET_PROPERTIES( DD4hepCore DD4hepPlugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) #---Rootmap generation-------------------------------------------------------------- -dd4hep_generate_rootmap(DD4hepPlugins) -#dd4hep_install_library(DD4hepPlugins) +if(APPLE) + dd4hep_generate_rootmap_apple(DD4hepPlugins) +else() + dd4hep_generate_rootmap(DD4hepPlugins) +endif() #--- install target------------------------------------- diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index e8a71875046d38637b315ec47289799235abc70a..c5b87029589a90c3c9ef9f4ab2f491fc3490fef2 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -29,7 +29,11 @@ target_link_libraries(DD4hepG4 DD4hepCore ${ROOT_LIBRARIES} Reflex ${Geant4_LIBR SET_TARGET_PROPERTIES( DD4hepG4 PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) -dd4hep_generate_rootmap(DD4hepG4) +if(APPLE) + dd4hep_generate_rootmap_apple(DD4hepG4) +else() + dd4hep_generate_rootmap(DD4hepG4) +endif() #----------------------------------------------------------------------------------- add_executable(g4gdmlDisplay g4gdmlDisplay.cpp) diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake index 540a305dd11d6738c062821bec4056c380ca6762..5fe467b18eafb002ea6a4622d2adbd059337d538 100644 --- a/cmake/DD4hep.cmake +++ b/cmake/DD4hep.cmake @@ -4,6 +4,32 @@ # Create the .rootmap file needed by the plug-in system. #--------------------------------------------------------------------------------------------------- function(dd4hep_generate_rootmap library) + + find_package(ROOT QUIET) + set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.rootmap) + + set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_LIBRARY_SUFFIX}) + + add_custom_command(OUTPUT ${rootmapfile} + COMMAND ${CMAKE_COMMAND} -Dlibname=${libname} -Drootmapfile=${rootmapfile} + -Dgenmap_install_dir=${LIBRARY_OUTPUT_PATH} + -P ${CMAKE_SOURCE_DIR}/cmake/MakeRootMap.cmake + DEPENDS ${library}) + + add_custom_target(${library}Rootmap ALL DEPENDS ${rootmapfile}) + + install(FILES ${LIBRARY_OUTPUT_PATH}/${rootmapfile} + DESTINATION lib + ) +endfunction() + + + +# +#FG: the following function works nicely on MacOS - for dd4hep and examples +# but not on SL or Ubuntu ... +# +function(dd4hep_generate_rootmap_apple library) find_package(ROOT QUIET) find_package(DD4hep QUIET) @@ -38,11 +64,10 @@ install(FILES ${LIBRARY_OUTPUT_PATH}/${rootmapfile} DESTINATION lib ) #-------------------------------------------------------------------------------------- +endfunction() + - # Notify the project level target - #gaudi_merge_files_append(Rootmap ${library}Rootmap ${CMAKE_CURRENT_BINARY_DIR}/${library}.rootmap) -endfunction() #--------------------------------------------------------------------------------------------------- diff --git a/cmake/MakeRootMap.cmake b/cmake/MakeRootMap.cmake index dd01e7d2211f35960770209e0be2c96477754d1f..51007eb66e7f387464e6b713783087de3e6982d7 100644 --- a/cmake/MakeRootMap.cmake +++ b/cmake/MakeRootMap.cmake @@ -1,4 +1,11 @@ -SET ( ENV{LD_LIBRARY_PATH} ./:$ENV{LD_LIBRARY_PATH} ) + +if(APPLE) + #MESSAGE( STATUS " set DYLD_LIBRARY_PATH to ./:$ENV{DYLD_LIBRARY_PATH} " ) + SET ( ENV{DYLD_LIBRARY_PATH} ./:$ENV{DYLD_LIBRARY_PATH} ) +else() + SET ( ENV{LD_LIBRARY_PATH} ./:$ENV{LD_LIBRARY_PATH} ) +endif() + EXECUTE_PROCESS( COMMAND genmap -i ${libname} -o ${rootmapfile} WORKING_DIRECTORY ${genmap_install_dir} diff --git a/examples/ILDExDet/CMakeLists.txt b/examples/ILDExDet/CMakeLists.txt index 4ac7caa3b0b6eb62c9c1cf8c1ef422d2e93ca338..517e01ae94beb0f0198b21750b468c09e737d79c 100644 --- a/examples/ILDExDet/CMakeLists.txt +++ b/examples/ILDExDet/CMakeLists.txt @@ -67,7 +67,11 @@ target_link_libraries(${PackageName} ${DD4hep_LIBRARIES} ${ROOT_LIBRARIES} ${RO #---Rootmap generation-------------------------------------------------------------- -dd4hep_generate_rootmap(${PackageName} ) +if(APPLE) + dd4hep_generate_rootmap_apple(${PackageName} ) +else() + dd4hep_generate_rootmap(${PackageName} ) +endif() #---- configure run environment --------------- diff --git a/examples/ILDExSimu/CMakeLists.txt b/examples/ILDExSimu/CMakeLists.txt index f67bb30d4488aca5b2a7d2c221b694913a349559..5cc6fe8012e6508bbc54062e1b8a7880707faca6 100644 --- a/examples/ILDExSimu/CMakeLists.txt +++ b/examples/ILDExSimu/CMakeLists.txt @@ -90,8 +90,13 @@ target_link_libraries(${PackageName} ${DD4hep_LIBRARIES} #---Rootmap generation-------------------------------------------------------------- -# fg: not needed here -#dd4hep_generate_rootmap(${PackageName} ) +# fg: not needed here (?) +#if(APPLE) +# dd4hep_generate_rootmap_apple(${PackageName} ) +#else() +# dd4hep_generate_rootmap(${PackageName} ) +#endif() + #---- configure run environment --------------- configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY)