-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.sh
executable file
·90 lines (73 loc) · 1.62 KB
/
meson.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
#!/bin/bash
COMMAND="$0"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
usage() {
echo "Usage: ${COMMAND} [valgrind] <build|test|coverage|setup> [options]"
exit 1
}
reconfig=0
setup=0
valg=0
build=0
testing=0
coverage=0
if [[ ! -d "${DIR}/build" ]]; then
reconfig=1
fi
while [ "$1" != "" ]; do
case $1 in
valgrind ) valg=1;;
setup ) reconfig=1
setup=1
shift
break;;
build ) build=1
shift
break;;
test ) testing=1
shift
break;;
coverage ) coverage=1
shift
break;;
* ) usage;;
esac
shift
done
if [ "$setup" = "0" ] && [ "$build" = "0" ] && [ "$testing" = "0" ] && [ "$coverage" = "0" ]; then
usage
fi
if [ "$reconfig" = "1" ]; then
if [[ -d "${DIR}/build" ]]; then
rm -r "${DIR}/build"
fi
args="-Db_coverage=true"
if [ "$valg" = "1" ] && [ "$testing" = "0" ]; then
args="${args} -Dalways_valgrind=true"
fi
if [ "$setup" = "1" ]; then
args="${args} $@"
fi
eval "meson setup ${args} ${DIR}/build"
if [ "$setup" = "1" ]; then
exit 0
fi
fi
if [ "$testing" = "1" ]; then
args="-C ${DIR}/build $@"
if [ "$valg" = "1" ]; then
args="${args} --setup valgrind"
fi
eval "meson test ${args}"
exit 0
fi
if [ "$build" = "1" ]; then
args="-C ${DIR}/build $@"
eval "ninja ${args}"
exit 0
fi
if [ "$coverage" = "1" ]; then
args="-C ${DIR}/build $@"
eval "ninja ${args} coverage"
exit 0
fi