blob: 89817122d2b671f49b207f2e4e160096e0e05212 (
plain)
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
|
#! /bin/bash
VERBOSE=${VERBOSE:-0}
CMAKE_OPTIONS=""
MAKE_OPTIONS=""
BUILD_DIR=./build
[ -f cmake_opts ] && source cmake_opts
function cmake_init() {
echo -e " * cmake init\n"
if [ ! -d $BUILD_DIR ]; then
mkdir $BUILD_DIR || exit 1
fi
cd $BUILD_DIR || exit 1
if [ ! -e CMakeCache.txt ]; then
cmake ${CMAKE_OPTIONS} .. || exit 1
fi
cd .. || exit 1
}
function cmake_clean() {
echo -e " * clean cmake files\n" && rm $BUILD_DIR/CMakeCache.txt 2>/dev/null
}
function cmake_rm() {
echo -e " * rm cmake files\n" && rm -fr $BUILD_DIR 2>/dev/null
}
function cmake_make() {
cmake_init
echo -e " * cmake make\n" && cd $BUILD_DIR || exit 1
if [ $VERBOSE -eq 1 ]; then
VERBOSE=1 make $MAKE_OPTIONS || exit 1
else
make $MAKE_OPTIONS || exit 1
fi
cd ..
}
function cmake_tests() {
cmake_init
echo -e " * execute tests\n" && time ./libk8055/test
}
if [ $# -eq 0 ]; then
echo "usage $0 [cmds list]"
echo "cmds may be"
echo " r[m] => all built, temp and cache files"
echo " c[lean] => remove cache files"
echo " m[ake] => launch the build process"
echo " t[ests] => execute tests"
echo "ex: $0 r m pkg x"
exit 1
fi
for arg in $@; do
case $arg in
c|clean)
cmd="cmake_clean";;
r|rm)
cmd="cmake_rm";;
m|make)
cmd="cmake_make";;
t|test)
cmd="cmake_tests";;
*)
echo "unknown command ${arg}" && exit 1
esac
$cmd
done
|