-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfigure.sh
159 lines (133 loc) · 4.53 KB
/
configure.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash
# Use this to not build supera (can cause conflicts when building supera in larsoft)
#export LARCV_NOSUPERA=1
# Use this to not build w/ opencv
#export LARCV_NOOPENCV=1
# DETECT PYTHON VERSION
let PYTHON_VERSION=`python -V 2>&1 | awk '{ print $2 }' | sed 's/\./\ /g' | awk '{ print $1 }'`
#echo Using Python $PYTHON_VERSION
export LARCV_PYTHON=$PYTHON_VERSION
# clean up previously set env
if [[ -z $FORCE_LARCV_BASEDIR ]]; then
__larcv_configure_where__="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export LARCV_BASEDIR=${__larcv_configure_where__}
else
export LARCV_BASEDIR=$FORCE_LARCV_BASEDIR
fi
# Abort if ROOT not installed. Let's check rootcint for this.
if [ `command -v rootcling` ]; then
export LARCV_ROOT6=1
else
if [[ -z `command -v rootcint` ]]; then
echo
echo Looks like you do not have ROOT installed.
echo You cannot use LArCV w/o ROOT!
echo Aborting.
echo
return 1;
fi
fi
# check for either clang or gcc
export LARCV_CXX=clang++
if [ -z `command -v $LARCV_CXX` ]; then
export LARCV_CXX=g++
if [ -z `command -v $LARCV_CXX` ]; then
echo
echo Looks like you do not have neither clang or g++!
echo You need one of those to compile LArCaffe... Abort config...
echo
return 1;
fi
fi
# set the build dir
unset LARCV_BUILDDIR
if [[ -z $LARCV_BUILDDIR ]]; then
export LARCV_BUILDDIR=$LARCV_BASEDIR/build
fi
# set important directories
export LARCV_COREDIR=$LARCV_BASEDIR/larcv/core
export LARCV_APPDIR=$LARCV_BASEDIR/larcv/app
export LARCV_LIBDIR=$LARCV_BUILDDIR/installed/lib
export LARCV_INCDIR=$LARCV_BUILDDIR/installed/include
export LARCV_BINDIR=$LARCV_BUILDDIR/installed/bin
# set the version
export LARCV_VERSION=1
# Check OpenCV
export LARCV_OPENCV=1
if [[ -z $OPENCV_INCDIR ]]; then
export LARCV_OPENCV=0
fi
if [[ -z $OPENCV_LIBDIR ]]; then
export LARCV_OPENCV=0
fi
# Check Numpy
if [[ ${LARCV_PYTHON} -eq 2 ]]; then
export LARCV_NUMPY=`$LARCV_BASEDIR/bin/check_numpy_py2`
else
export LARCV_NUMPY=`$LARCV_BASEDIR/bin/check_numpy`
fi
# Check for libtorch
export LARCV_LIBTORCH=1
if [[ -z $LIBTORCH_INCDIR ]]; then
export LARCV_LIBTORCH=0
fi
if [[ -z $LIBTORCH_LIBDIR ]]; then
export LARCV_LIBTORCH=0
fi
# Set ANN directories
if [[ -z $LARCV_ANN ]]; then
export LARCV_ANN=1
fi
if [ $LARCV_ANN -eq 1 ]; then
export ANN_INCDIR=$LARCV_BASEDIR/app/ann_1.1.2/include
export ANN_LIBDIR=$LARCV_BASEDIR/app/ann_1.1.2/lib
printf "\033[93mANN: approximate nearest neighboor\033[00m\n"
echo " Found ANN package"
fi
# warning for missing support
missing=""
if [ $LARCV_OPENCV -eq 0 ]; then
missing+=" OpenCV"
fi
if [ $LARCV_NUMPY -eq 0 ]; then
missing+=" Numpy"
fi
if [ $LARCV_ANN -eq 0 ]; then
missing+=" ANN"
fi
if [ $LARCV_LIBTORCH -eq 0 ]; then
missing+=" libTorch"
else
printf "\033[93mlibTorch\033[00m Building with libtorch (PyTorch C++ API) support \n"
fi
if [[ $missing ]]; then
printf "\033[93mWarning\033[00m ... missing$missing support. Build without them.\n";
fi
echo
printf "\033[93mLArCV\033[00m FYI shell env. may useful for external packages:\n"
printf " \033[95mLARCV_INCDIR\033[00m = $LARCV_INCDIR\n"
printf " \033[95mLARCV_LIBDIR\033[00m = $LARCV_LIBDIR\n"
printf " \033[95mLARCV_BUILDDIR\033[00m = $LARCV_BUILDDIR\n"
printf " \033[95mLARCV_PYTHON\033[00m = $LARCV_PYTHON\n"
printf " \033[95mLARCV_NUMPY\033[00m = $LARCV_NUMPY\n"
# modify paths
[[ ":$PATH:" != *":${LARCV_BASEDIR}/bin:"* ]] && export PATH="${LARCV_BASEDIR}/bin:${PATH}"
[[ ":$LD_LIBRARY_PATH:" != *":${LARCV_LIBDIR}/bin:"* ]] && export LD_LIBRARY_PATH="${LARCV_LIBDIR}:${LD_LIBRARY_PATH}"
[[ ":$DYLD_LIBRARY_PATH:" != *":${LARCV_LIBDIR}/bin:"* ]] && export DYLD_LIBRARY_PATH="${LARCV_LIBDIR}:${DYLD_LIBRARY_PATH}"
# put the rgb viewer into the path
[[ ":$PATH:" != *":${LARCV_BASEDIR}/mac:"* ]] && export PATH="${LARCV_BASEDIR}/mac:${PATH}"
# paths if using OPENCV (NO_OPENCV to explicitly disallow)
if [[ -z $LARCV_NOOPENCV ]]; then
[[ ":$LD_LIBRARY_PATH:" != *":${OPENCV_LIBDIR}/bin:"* ]] && export LD_LIBRARY_PATH="${OPENCV_LIBDIR}:${LD_LIBRARY_PATH}"
[[ ":$DYLD_LIBRARY_PATH:" != *":${OPENCV_LIBDIR}/bin:"* ]] && export DYLD_LIBRARY_PATH="${OPENCV_LIBDIR}:${DYLD_LIBRARY_PATH}"
fi
mkdir -p $LARCV_BUILDDIR;
mkdir -p $LARCV_LIBDIR;
mkdir -p $LARCV_BINDIR;
# add to python path
[[ ":$PYTHONPATH:" != *":${LARCV_BASEDIR}/python:"* ]] && export PYTHONPATH="${LARCV_BASEDIR}/python:${PYTHONPATH}"
echo
echo "Finish configuration. To build, type:"
echo "> cd \$LARCV_BUILDDIR"
echo "> make "
echo