From 7f404250c09a8ebe1ccd4a6fa6b664facd5b4b00 Mon Sep 17 00:00:00 2001 From: David Blyth <dblyth@anl.gov> Date: Fri, 16 Jun 2017 15:01:58 +0000 Subject: [PATCH] Added environment helper scripts that only set up variables for DD4hep and not for dependencies. --- cmake/thisdd4hep_only.csh | 39 +++++++++++++++++ cmake/thisdd4hep_only.sh | 91 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 cmake/thisdd4hep_only.csh create mode 100644 cmake/thisdd4hep_only.sh diff --git a/cmake/thisdd4hep_only.csh b/cmake/thisdd4hep_only.csh new file mode 100644 index 000000000..38807a4de --- /dev/null +++ b/cmake/thisdd4hep_only.csh @@ -0,0 +1,39 @@ +# Source this script to set up the DD4Hep installation that this script is part of. +# This version of the script has been modified to set up environment variables for +# only DD4hep. +# +# This script if for the csh like shells, see thisdd4hep.sh for bash like shells. +# +# Author: Pere Mato + +set ARGS=($_) +set THIS="`dirname ${ARGS[2]}`" + + +#----PATH---------------------------------------------------------------------------- +if ($?PATH) then + setenv PATH @CMAKE_INSTALL_PREFIX@/bin:$PATH # Linux, ELF HP-UX +else + setenv PATH @CMAKE_INSTALL_PREFIX@/bin +endif + +#----LD_LIBRARY_PATH----------------------------------------------------------------- +if ($?LD_LIBRARY_PATH) then + setenv LD_LIBRARY_PATH @CMAKE_INSTALL_PREFIX@/lib:$LD_LIBRARY_PATH # Linux, ELF HP-UX +else + setenv LD_LIBRARY_PATH @CMAKE_INSTALL_PREFIX@/lib +endif + +#----DYLD_LIBRARY_PATH--------------------------------------------------------------- +if ($?DYLD_LIBRARY_PATH) then + setenv DYLD_LIBRARY_PATH @CMAKE_INSTALL_PREFIX@/lib:$DYLD_LIBRARY_PATH # Mac OS X +else + setenv DYLD_LIBRARY_PATH @CMAKE_INSTALL_PREFIX@/lib +endif + +#----PYTHONPATH--------------------------------------------------------------- +if ($?PYTHONPATH) then + setenv PYTHONPATH @CMAKE_SOURCE_DIR@/DDCore/python:$PYTHONPATH +else + setenv PYTHONPATH @CMAKE_SOURCE_DIR@/DDCore/python +endif diff --git a/cmake/thisdd4hep_only.sh b/cmake/thisdd4hep_only.sh new file mode 100644 index 000000000..5b9ce5f95 --- /dev/null +++ b/cmake/thisdd4hep_only.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# Source this script to set up the DD4Hep installation that this script is part of. +# This version of the script has been modified to set up environment variables for +# only DD4hep. +# +# This script if for the csh like shells, see thisdd4hep.csh for csh like shells. +# +# Author: Pere Mato. F. Gaede, M.Frank +#------------------------------------------------------------------------------- +# +#echo " ### thisdd4hep.sh: initialize the environment for DD4hep ! " +# +#----------------------------------------------------------------------------- +dd4hep_parse_this() { + package=${2}; + if [ "x${1}" = "x" ]; then + if [ ! -f bin/this${package}.sh ]; then + echo ERROR: must "cd where/${package}/is" before calling ". bin/this${package}.sh" for this version of bash!; + return 1; + fi + THIS="${PWD}"; + else + # get param to "." + THIS=$(dirname $(dirname ${1})); + #if [ ! -f ${THIS}/bin/this${package}.sh ]; then + # THIS=$(dirname ${package}); + #fi; + fi; + THIS=$(cd ${THIS} > /dev/null; pwd); +} +#----------------------------------------------------------------------------- +dd4hep_add_path() { + path_name=${1}; + path_prefix=${2}; + eval path_value=\$$path_name; + if [ ${path_value} ]; then + path_value=${path_prefix}:${path_value}; + else + path_value=${path_prefix}; + fi; + eval export ${path_name}=${path_value}; + ## echo "dd4hep_add_path: ${path_name}=${path_value}"; +} +#----------------------------------------------------------------------------- +dd4hep_add_library_path() { + path_prefix=${1}; + if [ @USE_DYLD@ ]; + then + if [ ${DYLD_LIBRARY_PATH} ]; then + export DYLD_LIBRARY_PATH=${path_prefix}:$DYLD_LIBRARY_PATH; + export DD4HEP_LIBRARY_PATH=${path_prefix}:$DD4HEP_LIBRARY_PATH; + else + export DYLD_LIBRARY_PATH=${path_prefix}; + export DD4HEP_LIBRARY_PATH=${path_prefix}; + fi; + else + if [ ${LD_LIBRARY_PATH} ]; then + export LD_LIBRARY_PATH=${path_prefix}:$LD_LIBRARY_PATH; + else + export LD_LIBRARY_PATH=${path_prefix}; + fi; + fi; +} +#----------------------------------------------------------------------------- +# +dd4hep_parse_this ${BASH_ARGV[0]} DD4hep; +# +#----DD4hep installation directory-------------------------------------------- +export DD4hepINSTALL=${THIS}; +export DD4hep_DIR=${THIS}; +export DD4hep_ROOT=${THIS}; +# +#----PATH--------------------------------------------------------------------- +dd4hep_add_path PATH ${THIS}/bin; +#----LIBRARY_PATH------------------------------------------------------------- +dd4hep_add_library_path ${THIS}/lib; +#----PYTHONPATH--------------------------------------------------------------- +dd4hep_add_path PYTHONPATH ${THIS}/python; +#----ROOT_INCLUDE_PATH-------------------------------------------------------- +dd4hep_add_path ROOT_INCLUDE_PATH ${THIS}/include; +#----------------------------------------------------------------------------- +if [ @USE_DYLD@ ]; +then + export DD4HEP_LIBRARY_PATH=${DYLD_LIBRARY_PATH}; +else + export DD4HEP_LIBRARY_PATH=${LD_LIBRARY_PATH}; +fi; +#----------------------------------------------------------------------------- +# +unset THIS; +#----------------------------------------------------------------------------- -- GitLab