-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
59 lines (51 loc) · 901 Bytes
/
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
#!/bin/sh
while [[ $# -ge 1 ]]
do
key="$1"
case $key in
-c|--compiler)
COMPILER="$2"
shift
;;
-r|--run-test)
RUN="$2"
shift
;;
-h|--help)
exit 0
;;
*)
;;
esac
shift
done
root_dir="$( pwd )"
Build () {
mkdir _build
cd _build
echo $root_dir
cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_CXX_COMPILER=${COMPILER} $root_dir
make -j2
}
Clear() {
if [ -d _build ]
then
rm -rf ./_build
fi
}
RunTest() {
for filename in `find $root_dir/_build/labs/*/ -type f -name "*.exe"`
do
cd `dirname $filename`
echo "Run `basename $filename`"
./`basename $filename`
echo "Output: "
cat "output.txt"
echo
done
}
Clear
Build
if [ "${RUN}" == "tests" ]; then
RunTest
fi