-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.sh
executable file
·79 lines (70 loc) · 1.61 KB
/
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
#!/bin/bash
# this little script will make life easier
# 2018 Tong Zhang<[email protected]>
# 2020-2021 Tong Zhang<[email protected]>
function build
{
echo "NOTE: specify your own LLVM_DIR and LLVM_ROOT"
JOBS=`getconf _NPROCESSORS_ONLN`
#specify non default compiler here
# -DCMAKE_C_COMPILER=clang-10 \
# -DCMAKE_CXX_COMPILER=clang++-10
mkdir build
pushd build
cmake ../ \
-DLLVM_CMAKE_PATH=/usr/lib/llvm-11/lib/cmake \
-DCMAKE_BUILD_TYPE=Debug \
make -j${JOBS}
popd
}
codedir=(
gatlin
include
#pex
)
formatdir=(
gatlin
include
#pex
)
scope_file=".scopefile"
tag_file="tags"
function gen_scope
{
> ${scope_file}
for d in ${codedir[@]}; do
find $d -type f \
-a \( -name "*.h" -o -name "*.hpp" -o -name "*.cpp" -o -name "*.c" \
-o -name "*.cc" \) >> ${scope_file}
done
rm -f scope.* ${tag_file}
ctags -I "__THROW __nonnull __attribute_pure__ __attribute__ G_GNUC_PRINTF+" \
--file-scope=yes --c++-kinds=+px --c-kinds=+px --fields=+iaS -Ra --extra=+fq \
--langmap=c:.c.h.pc.ec --languages=c,c++ --links=yes \
-f ${tag_file} -L ${scope_file}
cscope -Rb -i ${scope_file}
}
function indent
{
for d in ${formatdir[@]}; do
clang-format -i -style=llvm `find $d -name '*.cpp' -or -name "*.h"`
done
}
case $1 in
"tag")
gen_scope
;;
"build")
build
;;
"clean")
rm -rf build
rm -f ${tag_file} ${scope_file} cscope.out
;;
"indent")
indent
;;
*)
echo ./build.sh tag build clean indent
;;
esac