-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·49 lines (40 loc) · 1.25 KB
/
configure
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
export REPO_ROOT=`pwd`
export CMAKE_ROOT=${REPO_ROOT}
export BUILD_ROOT=${CMAKE_ROOT}/build
export COV_ROOT=${CMAKE_ROOT}/coverage
export MAKEFLAGS="-j32"
unconfigure() {
rm -rf ${BUILD_ROOT}
rm -rf ${COV_ROOT};
cd ${REPO_ROOT}
}
reconfigure() {
cd ${CMAKE_ROOT} && rm -rf ${BUILD_ROOT} &&
mkdir -p ${BUILD_ROOT} && cd ${BUILD_ROOT} &&
cmake $@ ..
}
reconfigure_guard() {
if [[ ! -d ${BUILD_ROOT} ]]; then reconfigure; fi;
}
build() {
reconfigure_guard && pushd ${BUILD_ROOT}; make ${MAKEFLAGS}
}
fbuild() {
build; popd
}
gencov() {
if [[ ! -d ${BUILD_ROOT} ]]; then
reconfigure -DPROFILE=1;
fi;
mkdir -p ${COV_ROOT}
build
lcov --no-external --capture --initial --directory `realpath ${REPO_ROOT}` --output-file ${COV_ROOT}/initial.info
make test
lcov --no-external --capture --directory `realpath ${REPO_ROOT}` --output-file ${COV_ROOT}/test.info
lcov --add-tracefile ${COV_ROOT}/initial.info --add-tracefile ${COV_ROOT}/test.info --output-file ${COV_ROOT}/complete.info
genhtml --prefix ${REPO_ROOT} --ignore-errors source ${COV_ROOT}/complete.info \
--legend --title `git rev-parse HEAD` --output-directory=${COV_ROOT}/html
}
gencovr() {
unconfigure && gencov;
}