-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·54 lines (45 loc) · 850 Bytes
/
build.sh
File metadata and controls
executable file
·54 lines (45 loc) · 850 Bytes
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
#!/usr/bin/env bash
cd "$(dirname "$0")"
# Check if MPI environment is loaded
if ! [ -x "$(command -v mpirun)" ]; then
source ./setup/setup-mpi.sh
fi
# Parse command line arguments
# Source: https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-f|--force)
FORCE=true
shift # past argument
;;
-c|--clean)
CLEAN=true
shift # past argument
;;
-d|--debug)
DEBUG=true
shift # past argument
;;
*)
echo "Unrecognized option $key"
exit 2
esac
done
(#set -x;
mkdir -p ../build
cd ../build
if [ $FORCE ]; then
rm -rf *
if [ $DEBUG ]; then
cmake -DCMAKE_BUILD_TYPE=Debug ../src
else
cmake -DCMAKE_BUILD_TYPE=Release ../src
fi
fi
if [ $CLEAN ]; then
make clean
fi
make
)