forked from HEP-FCC/fcc-spi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_fcc_stack.sh
129 lines (118 loc) · 4.71 KB
/
init_fcc_stack.sh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
122
123
124
125
126
127
128
129
#!/bin/sh -u
# This script sets up the commonly used software for FCC software projects:
# - Linux machines at CERN:
# The software is taken from cvmfs or afs depending on command (source init_fcc_stack.sh cvmfs/afs).
# - MacOS / Linux elsewhere: We assume the software is installed locally and their environment is set.
# Add the passed value only to path if it's not already in there.
function add_to_path {
if [ -z "$1" ] || [[ "$1" == "/lib" ]]; then
return
fi
path_name=${1}
eval path_value=\$$path_name
path_prefix=${2}
case ":$path_value:" in
*":$path_prefix:"*) :;; # already there
*) path_value=${path_prefix}:${path_value};; # or prepend path
esac
eval export ${path_name}=${path_value}
}
platform='unknown'
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
fs=$1
if [ -z "$fs" ] || [[ ! -d "/$fs" ]]; then
fs="afs"
echo "INFO - Defaulting to afs as file system."
fi
if [[ $fs = 'afs' ]]; then
LHCBPATH=/afs/cern.ch/lhcb/software/releases
LCGPREFIX=/afs/cern.ch/sw/lcg
export FCCSWPATH=/afs/cern.ch/exp/fcc/sw/0.7
else
LHCBPATH=/cvmfs/lhcb.cern.ch/lib/lhcb
LCGPREFIX=/cvmfs/sft.cern.ch/lcg
export FCCSWPATH=/cvmfs/fcc.cern.ch/sw/0.7
fi
platform='Linux'
echo "Platform detected: $platform"
if [[ -d "$LCGPREFIX" ]] ; then
# Check if build type is set, if not default to release build
if [ -z "$BUILDTYPE" ] || [[ "$BUILDTYPE" == "Release" ]]; then
export BINARY_TAG=x86_64-slc6-gcc49-opt
export CMAKE_BUILD_TYPE="Release"
else
export BINARY_TAG=x86_64-slc6-gcc49-dbg
export CMAKE_BUILD_TYPE="Debug"
fi
# Set up Gaudi + Dependencies
source $LHCBPATH/LBSCRIPTS/LBSCRIPTS_v8r5p3/InstallArea/scripts/LbLogin.sh --cmtconfig $BINARY_TAG
export LCGPATH=$LCGPREFIX/views/LCG_83/$BINARY_TAG
# The LbLogin sets VERBOSE to 1 which increases the compilation output. If you want details set this to 1 by hand.
unset VERBOSE
# Only source the lcg setup script if paths are not already set
# (necessary because of incompatible python install in view)
case ":$LD_LIBRARY_PATH:" in
*":$LCGPATH/lib64:"*) :;; # Path is present do nothing
*) source $LCGPATH/setup.sh;; # otherwise setup
esac
# This path is used below to select software versions
echo "Software taken from $FCCSWPATH and LCG_83"
# If podio or EDM not set locally already, take them from afs
if [ -z "$PODIO" ]; then
export PODIO=$FCCSWPATH/podio/0.4/$BINARY_TAG
else
echo "Take podio: $PODIO"
fi
if [ -z "$FCCEDM" ]; then
export FCCEDM=$FCCSWPATH/fcc-edm/0.4/$BINARY_TAG
else
echo "Take fcc-edm: $FCCEDM"
fi
if [ -z "$FCCPHYSICS" ]; then
export FCCPHYSICS=$FCCSWPATH/fcc-physics/0.1/$BINARY_TAG
fi
export DELPHES_DIR=$FCCSWPATH/Delphes/3.3.2/$BINARY_TAG
export PYTHIA8_DIR=$LCGPREFIX/releases/LCG_80/MCGenerators/pythia8/212/$BINARY_TAG
export PYTHIA8_XML=$PYTHIA8_DIR/share/Pythia8/xmldoc
export PYTHIA8DATA=$PYTHIA8_XML
export HEPMC_PREFIX=$LCGPATH
# add DD4hep
export inithere=$PWD
cd $FCCSWPATH/DD4hep/20161003/$BINARY_TAG
source bin/thisdd4hep.sh
cd $inithere
# add Geant4 data files
if [[ $fs = 'afs' ]]; then
source /afs/cern.ch/sw/lcg/external/geant4/10.2/setup_g4datasets.sh
else
source /cvmfs/geant4.cern.ch/geant4/10.2/setup_g4datasets.sh
fi
else
# cannot find afs / cvmfs: so get rid of this to avoid confusion
unset FCCSWPATH
fi
add_to_path LD_LIBRARY_PATH $FCCEDM/lib
add_to_path LD_LIBRARY_PATH $PODIO/lib
add_to_path LD_LIBRARY_PATH $PYTHIA8_DIR/lib
add_to_path LD_LIBRARY_PATH $FCCPHYSICS/lib
elif [[ "$unamestr" == 'Darwin' ]]; then
platform='Darwin'
echo "Platform detected: $platform"
add_to_path DYLD_LIBRARY_PATH $FCCEDM/lib
add_to_path DYLD_LIBRARY_PATH $PODIO/lib
add_to_path DYLD_LIBRARY_PATH $PYTHIA8_DIR/lib
add_to_path DYLD_LIBRARY_PATH $FCCPHYSICS/lib
fi
# let ROOT know where the fcc-edm and -physics headers live.
add_to_path ROOT_INCLUDE_PATH $PODIO/include
add_to_path ROOT_INCLUDE_PATH $FCCEDM/include/datamodel
add_to_path ROOT_INCLUDE_PATH $FCCPHYSICS/include
add_to_path PYTHONPATH $PODIO/python
add_to_path PATH $FCCPHYSICS/bin
add_to_path CMAKE_PREFIX_PATH $FCCEDM
add_to_path CMAKE_PREFIX_PATH $PODIO
add_to_path CMAKE_PREFIX_PATH $PYTHIA8_DIR
if [ "$DELPHES_DIR" ]; then
add_to_path CMAKE_PREFIX_PATH $DELPHES_DIR
fi