Warning, /acts/cmake/setup_withdeps.sh.in is written in an unsupported language. File is not indexed.
0001 # This file is part of the ACTS project.
0002 #
0003 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008
0009 # This script sets up the ACTS environment with dependencies in a somewhat robust way.
0010
0011 IS_INSTALLED_VERSION="@IS_INSTALLED_VERSION@"
0012 ROOT_DIR="@ROOT_DIR@"
0013 ROOT_BINDIR="@ROOT_BINDIR@"
0014 GEANT4_DIR="@GEANT4_DIR@"
0015 GEANT4_INCLUDE_DIR="@GEANT4_INCLUDE_DIR@"
0016 DD4hep_DIR="@DD4hep_DIR@"
0017 DD4hep_INCLUDE_DIRS="@DD4hep_INCLUDE_DIRS@"
0018 podio_DIR="@podio_DIR@"
0019 podio_LIBRARY_DIR="@podio_LIBRARY_DIR@"
0020 podio_INCLUDE_DIR="@podio_INCLUDE_DIR@"
0021 podio_PYTHON_DIR="@podio_PYTHON_DIR@"
0022 EDM4HEP_DIR="@EDM4HEP_DIR@"
0023 EDM4HEP_LIBRARY_DIR="@EDM4HEP_LIBRARY_DIR@"
0024 EDM4HEP_INCLUDE_DIR="@EDM4HEP_INCLUDE_DIR@"
0025
0026 if [ -n "${ZSH_VERSION:-}" ]; then
0027 script_dir=${0:a:h}
0028 elif [ -n "${BASH_VERSION:-}" ]; then
0029 script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
0030 else
0031 # If the current shell is not ZSH or Bash, we can't guarantee that the
0032 # script will work, so we throw an error.
0033 echo "ERROR: neither ZSH nor Bash was detected, other shells are not supported. The environment has not been modified."
0034 exit 1
0035 fi
0036
0037 # remember which path we used for python
0038 python_path=$(which python3)
0039 python_path=$(dirname "${python_path}")
0040
0041 # source the basic ACTS environment
0042 source "${script_dir}/this_acts.sh"
0043
0044 # activate dependencies if present
0045 if [[ -n "${ROOT_SETUP_SCRIPT:-}" ]]; then
0046 # Dependency setup script has already given us this location!
0047 source "$ROOT_SETUP_SCRIPT"
0048 else
0049 # Try to recover the build-time configuration
0050 if [[ -d "${ROOT_DIR}" ]]; then
0051 source "${ROOT_BINDIR}/thisroot.sh"
0052 fi
0053 fi
0054 if [[ -d "${GEANT4_DIR}" ]]; then
0055 source "${GEANT4_INCLUDE_DIR}/../../bin/geant4.sh"
0056 fi
0057 if [[ -d "${DD4hep_DIR}" ]]; then
0058 prevstate=$-
0059
0060 set +e
0061 source "${DD4hep_INCLUDE_DIRS}/../bin/thisdd4hep.sh"
0062 # Without this, DD4hep's Xerces-C XML parsing fails with:
0063 # > Could not load a transcoding service
0064 export LC_ALL=C
0065
0066 if [[ "$prevstate" == *e* ]]; then
0067 # -e was set before, re-enabling
0068 set -e
0069 fi
0070 fi
0071 if [[ -d "${podio_DIR}" ]]; then
0072 export LD_LIBRARY_PATH="${podio_LIBRARY_DIR}:${LD_LIBRARY_PATH}"
0073 export DYLD_LIBRARY_PATH="${podio_LIBRARY_DIR}:${DYLD_LIBRARY_PATH}"
0074 export ROOT_INCLUDE_PATH="${podio_INCLUDE_DIR}:${ROOT_INCLUDE_PATH}"
0075 export PYTHONPATH="${podio_PYTHON_DIR}:${PYTHONPATH}"
0076 fi
0077 if [[ -d "${EDM4HEP_DIR}" ]]; then
0078 export LD_LIBRARY_PATH="${EDM4HEP_LIBRARY_DIR}/lib:${LD_LIBRARY_PATH}"
0079 export DYLD_LIBRARY_PATH="${EDM4HEP_LIBRARY_DIR}/lib:${DYLD_LIBRARY_PATH}"
0080 export ROOT_INCLUDE_PATH="${EDM4HEP_INCLUDE_DIR}:${ROOT_INCLUDE_PATH}"
0081 fi
0082
0083 # ensure that we end up with the same python as before sourcing this script
0084 # this was observed to be a problem as other activation scripts like ROOT modify PATH
0085 export PATH="${python_path}:${PATH}"