Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#---------------------------------------------------------------------------------------------------
# add_dd4hep_plugin ( libraryName )
#
# generates the rootmap and installs the library
# all other arguments ( SHARED, ${sources} ) are collected in ${ARGN}
#---------------------------------------------------------------------------------------------------
function( add_dd4hep_plugin libraryName )
ADD_LIBRARY ( ${libraryName} ${ARGN} )
if(APPLE)
dd4hep_generate_rootmap_apple( ${libraryName} )
else()
dd4hep_generate_rootmap( ${libraryName} )
endif()
install( TARGETS ${libraryName}
LIBRARY DESTINATION lib
)
endfunction()
#---------------------------------------------------------------------------------------------------
# dd4hep_instantiate_package
# calls all the function/includes/configurations that are needed to be done to create dd4hep plugins
#---------------------------------------------------------------------------------------------------
function ( dd4hep_instantiate_package PackageName )
MESSAGE (STATUS "instantiating the dd4hep package ${PackageName}" )
IF ( NOT ${DD4hep_FOUND} )
MESSAGE ( FATAL "DD4HEP was not found" )
ENDIF()
INCLUDE( DD4hepMacros )
#---- configure run environment ---------------
configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/this${PackageName}.sh
DESTINATION bin
)
endfunction()
#---------------------------------------------------------------------------------------------------
# dd4hep_generate_rootmap(library)
#
# Create the .rootmap file needed by the plug-in system.
#---------------------------------------------------------------------------------------------------
function(dd4hep_generate_rootmap library)
Andre Sailer
committed
if ( NOT DD4hep_ROOT )
SET ( DD4hep_ROOT ${CMAKE_SOURCE_DIR} )
endif()
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}
Andre Sailer
committed
-P ${DD4hep_ROOT}/cmake/MakeRootMap.cmake
DEPENDS ${library})
add_custom_target(${library}Rootmap ALL DEPENDS ${rootmapfile})
install(FILES ${LIBRARY_OUTPUT_PATH}/${rootmapfile}
DESTINATION lib
)
endfunction()
#
#
function(dd4hep_generate_rootmap_apple library)
# for now do the same for apple that is done for the rest
dd4hep_generate_rootmap( ${library} )
#FG: the following function works nicely on MacOS - for dd4hep and examples
# but not on SL or Ubuntu ...
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# find_package(ROOT QUIET)
# find_package(DD4hep QUIET)
#
# set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.rootmap)
#
# set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_LIBRARY_SUFFIX})
#
#
##---------------------------------------------------------------------------------------
#if( DD4hep_FOUND )
# # we are building an external tool and need to source ${DD4hep_ROOT}/bin/thisdd4hep.sh
#
# add_custom_command(OUTPUT ${rootmapfile}
# COMMAND cd ${LIBRARY_OUTPUT_PATH} &&
# . ${DD4hep_ROOT}/bin/thisdd4hep.sh &&
# genmap ${ROOT_genmap_CMD} -i ${libname} -o ${rootmapfile}
# DEPENDS ${library})
#
#else() # we are building DD4hep itself - only need thisroot.sh
#
# add_custom_command(OUTPUT ${rootmapfile}
# COMMAND cd ${LIBRARY_OUTPUT_PATH} &&
# . ${ROOT_ROOT}/bin/thisroot.sh &&
# genmap ${ROOT_genmap_CMD} -i ${libname} -o ${rootmapfile}
# DEPENDS ${library})
#endif()
#
#
#add_custom_target(${library}Rootmap ALL DEPENDS ${rootmapfile})
#
#install(FILES ${LIBRARY_OUTPUT_PATH}/${rootmapfile}
# DESTINATION lib
# )
##--------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
# dd4hep_install_library(library)
#
# Install library
#---------------------------------------------------------------------------------------------------
function(dd4hep_install_library library)
set(installfile ${library}.install)
set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.rootmap)
Markus Frank
committed
set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_MODULE_SUFFIX})
Markus Frank
committed
SET ( ENV{LD_LIBRARY_PATH} ./:$ENV{LD_LIBRARY_PATH} )
COMMAND echo
${library} ${LIBRARY_OUTPUT_DIR}
DEPENDS ${library})
add_custom_target(${library}Install ALL DEPENDS ${installfile})
endfunction()