forked from hlrs-vis/covise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.covise.sh
142 lines (123 loc) · 3.45 KB
/
.covise.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
130
131
132
133
134
135
136
137
138
139
140
141
142
##############################################
#
# COVISE Basic Settings: DO NOT CHANGE
#
################################################
function cmake_version() {
${COVISE_CMAKE} --version|head -n 1|sed -e 's/^.*version[^0-9]//'
}
function is_cmake3() {
case $(cmake_version) in
3.*)
return 0
;;
*)
return 1
;;
esac
}
function find_cmake3() {
if [ -z "$COVISE_CMAKE" ]; then
COVISE_CMAKE=cmake
which cmake3 >/dev/null 2>&1 && COVISE_CMAKE=cmake3
if ! is_cmake3; then
COVISE_CMAKE=cmake
fi
fi
if ! is_cmake3; then
echo "Did not find CMake3: try setting COVISE_CMAKE"
return 1
fi
export COVISE_CMAKE
return 0
}
#
# COVISE Installation Directory
#
# If the default (~/covise) is not used, and your cwd is not the covise
# home (i. e. a directory which contains a .covise.sh file), you must set it
# to your covise directory
#
if [ -z "$COVISEDIR" ]; then
if [ -f .covise.sh ]; then
export COVISEDIR="`/bin/pwd`"
elif [ -f "${HOME}"/covise/.covise.sh ]; then
export COVISEDIR="`sh -f -c 'cd ~/covise ; unset PWD; /bin/pwd'`"
elif [ -f "${HOME}"/covise_snap/.covise.sh ]; then
export COVISEDIR="`sh -f -c 'cd ~/covise_snap ; unset PWD; /bin/pwd'`"
else
echo "Cannot determine COVISEDIR, set manually to directory where bin and config directories reside"
return 1
fi
fi
export COVISEDIR="`sh -f -c 'cd "$COVISEDIR" ; unset PWD; /bin/pwd'`"
if [ ! -z "$COVISEDIR" ]; then
if [ -z "$COVISEDESTDIR" ]; then
export COVISEDESTDIR=$COVISEDIR
fi
fi
if [ -r "$COVISEDIR"/scripts/covise-functions.sh ]; then
. "$COVISEDIR"/scripts/covise-functions.sh
else
echo "$COVISEDIR/scripts/covise-functions.sh not readable"
return 1
fi
#
# System Architecture
#
guess_archsuffix
if ! find_cmake3 ; then
return 1
fi
# PATH
#
if [ "$COVISE_GLOBALINSTDIR" = "" ]; then
export PATH="$COVISEDIR"/bin:"$PATH"
if [ "$COVISE_PATH" = "" ]; then
export COVISE_PATH="${COVISEDIR}"
if [ "$COVISEDESTDIR" != "$COVISEDIR" ]; then
export COVISE_PATH="${COVISEDESTDIR}:${COVISE_PATH}"
fi
fi
else
export PATH="$COVISE_GLOBALINSTDIR"/covise/bin:"$PATH"
if [ "$COVISE_PATH" = "" ]; then
export COVISE_PATH="$COVISEDIR":"$COVISE_GLOBALINSTDIR/covise"
fi
fi
#
# COVISE environment path (colon separated list)
#
BASEARCH=`echo $ARCHSUFFIX | sed -e 's/opt$//' -e 's/mpi$//' -e 's/xenomai$//' `
if [ -z "$EXTERNLIBS" ]; then
extlibs="${COVISEDIR}/extern_libs/${ARCHSUFFIX}"
if [ ! -d "$extlibs" ]; then
extlibs="${COVISEDIR}/extern_libs/${BASEARCH}"
fi
if [ ! -d "$extlibs" ]; then
extlibs="/data/extern_libs/$ARCHSUFFIX"
if [ ! -d "$extlibs" ]; then
extlibs="/data/extern_libs/$BASEARCH"
fi
fi
if [ -d "$extlibs" ]; then
export EXTERNLIBS="$extlibs"
fi
fi
if [ -d "${COVISEDIR}/.git" ]; then
GITDATE=$(GIT_DIR=${COVISEDIR}/.git git log -n1 '--format=%ci')
if [ $? ]; then
export COVISE_VERSION=$(echo $GITDATE | sed -e 's/-/./' -e 's/-.*//' -e 's/\.0/./')
fi
fi
if [ -z "${PYTHON_HOME}" ]; then
if [ -d "${EXTERNLIBS}/python" ]; then
export PYTHON_HOME="${EXTERNLIBS}/python"
elif [ -n "$(which python3)" 2> /dev/null ]; then
python_bin="$(which python3)"
export PYTHON_HOME="${python_bin%/*bin/python3}"
fi
fi
if [ -r "${HOME}"/.covise.local.sh ]; then
. "${HOME}"/.covise.local.sh
fi