Skip to content
Snippets Groups Projects
Commit 06f74fc6 authored by Frank Gaede's avatar Frank Gaede
Browse files

- improved creation and usage of environment scripts:

    - ./bin/thisdd4hep.sh now initializes also ROOT
      and optionally geant4
    - cmake/thisdd4hep_package.sh.in is used in 
      examples to create thisILDExDet.sh and thisILDExSimu.sh
  
  - the thisdd4hep.sh script is now also used in the build process
    for generating the rootmap files

parent 2ca9f8dc
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,11 @@ add_subdirectory(DDCore)
if(DD4HEP_WITH_GEANT4)
add_subdirectory(DDG4)
add_subdirectory(DDSense)
#--- create a geant4 variables for the thisdd4hep.sh script
find_package( Geant4 )
get_filename_component(Geant4_ROOT "${Geant4_INCLUDE_DIR}/../../" ABSOLUTE)
endif()
add_subdirectory(UtilityApps)
......
......@@ -68,6 +68,9 @@ To build and run the simulation examples Geant4 will be required.
source /data/ilcsoft/root/5.34.03/bin/thisroot.sh
( minimum is: export ROOTSYS=/data/ilcsoft/root/5.34.03 )
- configure and build:
cd DD4hep
......@@ -101,30 +104,15 @@ To build and run the simulation examples Geant4 will be required.
-DDD4HEP_USE_PYROOT=ON
- Setup the running environment
. thisdd4hep.sh
- Setup the environment for running
. ./bin/thisdd4hep.sh
or
source thisdd4hep.csh
source ./bin/thisdd4hep.csh
### now call make ###########
make -j4
- Run ILDEx display
DDExamples/ILDExDisplay/ILDExDisplay file:../DD4hep/DDExamples/ILDExDet/compact/ILDEx.xml
- Run CLICSiD display
DDExamples/CLICSiD/CLICSiDtest file:../DD4hep/DDExamples/CLICSiD/compact/compact.xml
3) Extending
------------
......@@ -143,11 +131,8 @@ DDExamples/CLICSiD/CLICSiDtest file:../DD4hep/DDExamples/CLICSiD/compact/compact
Before any of the (new) examples in the ./examples directory can be build,
one needs to set the environment:
source __path_where_ROOT_is_installed___/bin/thisroot.sh
source __path_where_DD4hep_is_installed_/bin/thisdd4hep.sh
[note: possible other scripts need to be called, e.g. when using geant4 - see above ]
- then building the examples should be very straight forward. e.g:
(check for additional instructions in example subdirectory)
......@@ -157,8 +142,9 @@ one needs to set the environment:
cmake ..
make -j install
- before running the example, again the (DY)LD_LIBRARY_PATH has to be updated:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$PWD/../lib
- before running the example, initialize the environment:
. ./bin/thisILDExDet.sh
- then you can for example display the ILD detector (toy model):
......@@ -172,8 +158,6 @@ one needs to set the environment:
6) run SLIC simulation on lccd file created with DD4Hep:
# create lcdd file from compact:
./bin/geoConverter -compact2lcdd -input file:../DD4hep/DDExamples/ILDExDet/compact/ILDEx.xml -output ILD_toy.lcdd
# make sure slic is in the path and then:
slic -g ./ILD_toy.lcdd -o ILD_toy.slcio -x -m ../DD4hep/DDExamples/ILDExSimu/run1.mac
......@@ -5,19 +5,40 @@
#---------------------------------------------------------------------------------------------------
function(dd4hep_generate_rootmap library)
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 ${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
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
)
#--------------------------------------------------------------------------------------
# Notify the project level target
#gaudi_merge_files_append(Rootmap ${library}Rootmap ${CMAKE_CURRENT_BINARY_DIR}/${library}.rootmap)
......
......@@ -2,6 +2,7 @@
# This module sets up ROOT information
# It defines:
# ROOT_FOUND If the ROOT is found
# ROOT_ROOT the root directory ($ROOTSYS)
# ROOT_INCLUDE_DIR PATH to the include directory
# ROOT_LIBRARIES Most common libraries
# ROOT_LIBRARY_DIR PATH to the library directory
......@@ -33,6 +34,8 @@ if(ROOT_CONFIG_EXECUTABLE)
set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
set(ROOT_ROOT ${ROOTSYS})
# Make variables changeble to the advanced user
mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
......
......@@ -16,6 +16,19 @@ else
THIS=$(dirname ${BASH_ARGV[0]})
fi
#----------- source the ROOT environment first
source @ROOT_ROOT@/bin/thisroot.sh
if [ @DD4hep_WITH_GEANT4@ ]
then
export G4INSTALL=@Geant4_ROOT@/../../
export G4ENV_INIT=@Geant4_ROOT@/../../bin/geant4.sh
# export G4SYSTEM="Darwin-g++"
test -r ${G4ENV_INIT} && { cd $(dirname ${G4ENV_INIT}) ; . ./$(basename ${G4ENV_INIT}) ; cd $OLDPWD ; }
fi
#----PATH-----------------------------------------------------------------
if [ -z "${PATH}" ]; then
PATH=@CMAKE_INSTALL_PREFIX@/bin; export PATH # Linux, ELF HP-UX
......@@ -25,16 +38,16 @@ fi
#----LD_LIBRARY_PATH-----------------------------------------------------------------
if [ -z "${LD_LIBRARY_PATH}" ]; then
LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@XERCESC_ROOT_DIR@/lib:@ROOT_LIBRARY_DIR@:@Geant4_DIR@/..; export LD_LIBRARY_PATH # Linux, ELF HP-UX
LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@XERCESC_ROOT_DIR@/lib:@Geant4_DIR@/..; export LD_LIBRARY_PATH # Linux, ELF HP-UX
else
LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@XERCESC_ROOT_DIR@/lib:@ROOT_LIBRARY_DIR@:@Geant4_DIR@/..:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@XERCESC_ROOT_DIR@/lib:@Geant4_DIR@/..:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
fi
#----DYLD_LIBRARY_PATH---------------------------------------------------------------
if [ -z "${DYLD_LIBRARY_PATH}" ]; then
DYLD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@XERCESC_ROOT_DIR@/lib:@ROOT_LIBRARY_DIR@; export DYLD_LIBRARY_PATH # Mac OS X
DYLD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@XERCESC_ROOT_DIR@/lib; export DYLD_LIBRARY_PATH # Mac OS X
else
DYLD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@XERCESC_ROOT_DIR@/lib:@ROOT_LIBRARY_DIR@:$DYLD_LIBRARY_PATH; export DYLD_LIBRARY_PATH
DYLD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib:@XERCESC_ROOT_DIR@/lib:$DYLD_LIBRARY_PATH; export DYLD_LIBRARY_PATH
fi
#----PYTHONPATH---------------------------------------------------------------
......
#################################################################################
#
# environment script for DD4hep examples - initializes DD4hep (and ROOT) as well
#
# @author F.Gaede, DESY, 2013
#
#################################################################################
source @DD4hep_ROOT@/bin/thisDD4hep.sh
export PATH=$PATH:@CMAKE_INSTALL_PREFIX@/bin
if [ @APPLE@ ]
then
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:@CMAKE_INSTALL_PREFIX@/lib
else
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:@CMAKE_INSTALL_PREFIX@/lib
fi
\ No newline at end of file
......@@ -69,6 +69,15 @@ target_link_libraries(${PackageName} ${DD4hep_LIBRARIES} ${ROOT_LIBRARIES} ${RO
dd4hep_generate_rootmap(${PackageName} )
#---- configure run environment ---------------
configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/this${PackageName}.sh
DESTINATION bin
)
#--- install target-------------------------------------
install(TARGETS ${PackageName}
......
......@@ -93,6 +93,14 @@ target_link_libraries(${PackageName} ${DD4hep_LIBRARIES}
# fg: not needed here
#dd4hep_generate_rootmap(${PackageName} )
#---- configure run environment ---------------
configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/this${PackageName}.sh
DESTINATION bin
)
#--- install target-------------------------------------
install(TARGETS ${PackageName}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment