Warning, /DD4hep/cmake/DD4hep.cmake 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
0013 #---------------------------------------------------------------------------------------------------
0014 if ( DD4hep_DIR )
0015 set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_DIR}/cmake )
0016 endif()
0017 if(CMAKE_INSTALL_PREFIX)
0018 set ( CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} )
0019 endif()
0020
0021 #---------------------------------------------------------------------------------------------------
0022 # Main functional include file
0023 if (NOT DD4hepBuild_included)
0024 include ( DD4hepBuild )
0025 endif()
0026
0027 ##---------------------------------------------------------------------------------------------------
0028 ##
0029 ## OLDER STUFF: To be kept for backwards compatibility ....
0030 ##
0031 #---------------------------------------------------------------------------------------------------
0032 # add_dd4hep_plugin ( libraryName )
0033 #
0034 # generates the rootmap and installs the library
0035 # all other arguments ( SHARED, ${sources} ) are collected in ${ARGN}
0036 #---------------------------------------------------------------------------------------------------
0037
0038 function( add_dd4hep_plugin libraryName )
0039 ADD_LIBRARY ( ${libraryName} ${ARGN} )
0040 dd4hep_generate_rootmap( ${libraryName} )
0041 install( TARGETS ${libraryName} LIBRARY DESTINATION lib )
0042 endfunction()
0043
0044 #---------------------------------------------------------------------------------------------------
0045 # dd4hep_instantiate_package
0046 # calls all the function/includes/configurations that are needed to be done to create dd4hep plugins
0047 #---------------------------------------------------------------------------------------------------
0048 function ( dd4hep_instantiate_package PackageName )
0049 MESSAGE (STATUS "Instantiating the DD4hep package ${PackageName}" )
0050
0051 IF ( NOT ${DD4hep_FOUND} )
0052 MESSAGE ( FATAL "DD4HEP was not found" )
0053 ENDIF()
0054
0055 INCLUDE( DD4hepMacros )
0056
0057 #---- configure run environment ---------------
0058 configure_file( ${DD4hep_DIR}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY)
0059
0060 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/this${PackageName}.sh
0061 DESTINATION bin
0062 )
0063
0064
0065 endfunction()
0066 #---------------------------------------------------------------------------------------------------
0067 # dd4hep_generate_rootmap(library)
0068 #
0069 # Create the .components file needed by the plug-in system.
0070 #---------------------------------------------------------------------------------------------------
0071 function(dd4hep_generate_rootmap library)
0072
0073 if(APPLE)
0074 set(ENV_VAR DYLD_LIBRARY_PATH)
0075 else()
0076 set(ENV_VAR LD_LIBRARY_PATH)
0077 endif()
0078 set(${ENV_VAR}_VALUE $<TARGET_FILE_DIR:${library}>:$<TARGET_FILE_DIR:DD4hep::DD4hepGaudiPluginMgr>:$ENV{${ENV_VAR}})
0079
0080 set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.components)
0081
0082 add_custom_command(OUTPUT ${rootmapfile}
0083 DEPENDS ${library}
0084 COMMAND ${ENV_VAR}=${${ENV_VAR}_VALUE} $<TARGET_FILE:DD4hep::listcomponents> -o ${rootmapfile} $<TARGET_FILE_NAME:${library}>
0085 WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH}
0086 )
0087
0088 add_custom_target(Components_${library} ALL DEPENDS ${rootmapfile})
0089 SET( install_destination "lib" )
0090 if( CMAKE_INSTALL_LIBDIR )
0091 SET( install_destination ${CMAKE_INSTALL_LIBDIR} )
0092 endif()
0093 install(FILES $<TARGET_FILE_DIR:${library}>/${rootmapfile}
0094 DESTINATION ${install_destination}
0095 )
0096 endfunction()