This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanage.sh
executable file
·164 lines (123 loc) · 3.37 KB
/
manage.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/bash
# -------------------------------------------------------------------------------------------------
# Management script
# -------------------------------------------------------------------------------------------------
if [ $# -eq 0 ]
then
echo "No arguments supplied"
exit
fi
# -------------------------------------------------------------------------------------------------
# Building
# -------------------------------------------------------------------------------------------------
function build {
unset CC
unset CXX
mkdir -p docs/images &&
ln -sf $(pwd)/data/screenshots $(pwd)/docs/images/ &&
mkdir -p build &&
cd build && \
CMAKE_CXX_COMPILER_LAUNCHER=ccache cmake .. -GNinja && \
ninja && \
cd ..
}
function rmbuild {
rm -rf ./build/
}
function clang {
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
build
}
# -------------------------------------------------------------------------------------------------
# Cython
# -------------------------------------------------------------------------------------------------
function parse_headers {
python tools/parse_headers.py
}
function build_cython {
rm -rf datoviz/*.c datoviz/*.so datoviz/__pycache__ && \
python tools/generate_cython.py && \
python setup.py build_ext -i && \
python setup.py develop --user
}
# -------------------------------------------------------------------------------------------------
# Code quality
# -------------------------------------------------------------------------------------------------
function format {
find examples/ tests/ src/ include/ -iname *.h -o -iname *.c | xargs clang-format -i
}
function valgrind {
# NOTE: need to remove -pg compiler option before running valgrind
valgrind \
--leak-check=full \
--show-leak-kinds=all \
--keep-debuginfo=yes \
--track-origins=yes \
--verbose \
--suppressions=.valgrind.exceptions.txt \
--log-file=.valgrind.out.txt \
${@:2}
}
function cppcheck {
cppcheck --enable=all --inconclusive src/ include/ cli/ tests/ -i external -I include/datoviz
# 2> .cppcheck.out.txt && \
# echo ".cppcheck.out.txt saved"
}
function prof {
gprof build/datoviz gmon.out
}
# -------------------------------------------------------------------------------------------------
# Tests
# -------------------------------------------------------------------------------------------------
function test {
./build/datoviz test $1
}
function pytest {
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(pwd)/build pytest datoviz/tests/ -vv
}
# -------------------------------------------------------------------------------------------------
# Entry-point
# -------------------------------------------------------------------------------------------------
# Building
if [ $1 == "build" ]
then
build
elif [ $1 == "clean" ]
then
rmbuild
elif [ $1 == "rebuild" ]
then
rmbuild
build
elif [ $1 == "clang" ]
then
clang
# Cython
elif [ $1 == "parseheaders" ]
then
parse_headers
elif [ $1 == "cython" ]
then
build_cython
# Code quality
elif [ $1 == "format" ]
then
format
elif [ $1 == "valgrind" ]
then
valgrind
elif [ $1 == "cppcheck" ]
then
cppcheck
elif [ $1 == "prof" ]
then
prof
# Test
elif [ $1 == "test" ]
then
test $2
elif [ $1 == "pytest" ]
then
pytest
fi