-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_build.sh
executable file
·106 lines (88 loc) · 2.55 KB
/
run_build.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
#chmod +x run_build.sh
#!/bin/bash
CACHE_FILE="$PWD/build/.directory_cache.txt"
BUILD_DIR="$PWD/build"
SOURCE_DIR="$PWD"
BUILD=0
RUN_TEST=0
RUN_GEN=0
RUN_RAD=0
while getopts ":btgr" opt; do
case ${opt} in
b )
BUILD=1
;;
t )
RUN_TEST=1
;;
g )
RUN_GEN=1
;;
r )
RUN_RAD=1
;;
\? )
echo "-- Failed to parse arguments" 1>&2
;;
esac
done
if [ -z "$GEANT4_DIR" ] || [ -z "$ROOT_DIR" ] || [ -z "$MARLEY_DIR" ]; then
if [ -f "$CACHE_FILE" ]; then
source "$CACHE_FILE"
if [ $BUILD -eq 1 ]; then
echo "-- Building..."
cmake -S "$SOURCE_DIR" -B "$BUILD_DIR"
cmake --build "$BUILD_DIR"
echo "-- Build complete"
fi
else
read -p "*** Enter path to your GEANT4 directory: " GEANT4_DIR
read -p "*** Enter path to your ROOT directory: " ROOT_DIR
read -p "*** Enter path to your Marley directory: " MARLEY_DIR
if [ ! -d "$GEANT4_DIR" ]; then
echo "-- Failed to find GEANT4 directory"
fi
if [ ! -d "$ROOT_DIR" ]; then
echo "-- Failed to find ROOT directory"
fi
if [ ! -d "$MARLEY_DIR" ]; then
echo "-- Failed to find Marley directory"
fi
if [ -d "$GEANT4_DIR" ] && [ -d "$ROOT_DIR" ] && [ -d "$MARLEY_DIR" ]; then
echo "export GEANT4_DIR=$GEANT4_DIR" > "$CACHE_FILE"
echo "export ROOT_DIR=$ROOT_DIR/root_install/cmake" >> "$CACHE_FILE"
echo "export MARLEY_DIR=$MARLEY_DIR" >> "$CACHE_FILE"
source "$CACHE_FILE"
echo "-- Set environment variables"
if [ $BUILD -eq 1 ]; then
echo "-- Building..."
cmake -S "$SOURCE_DIR" -B "$BUILD_DIR"
cmake --build "$BUILD_DIR"
echo "-- Build complete"
fi
fi
fi
else
if [ $BUILD -eq 1 ]; then
echo "-- Building..."
cmake -S "$SOURCE_DIR" -B "$BUILD_DIR"
cmake --build "$BUILD_DIR"
echo "-- Build complete"
fi
fi
cd "$MARLEY_DIR"
source ./setup_marley.sh
if [ $RUN_TEST -eq 1 ]; then
cd "$SOURCE_DIR/system"
./lumilar -g generator/gun_electron_mono.mac -d detector/debug_tpc.mac
fi
if [ $RUN_GEN -eq 1 ]; then
cd "$SOURCE_DIR/system"
./lumilar -g generator/marley_solar.mac -d detector/debug_tpc.mac
fi
if [ $RUN_RAD -eq 1 ]; then
cd "$SOURCE_DIR/system"
./lumilar -g generator/bxdecay0_debug.mac -d detector/debug_tpc.mac
fi
cd "$SOURCE_DIR"
# ./run_build.sh -b -t -g -r