Skip to content

Commit e83c698

Browse files
committed
Add 'coverage' make target
Assignment to OBJECTS_DIR, MOC_DIR and similar qmake variables must be removed for coverage analysis to work. Please consider using shadow build to keep your source tree clean of build artifacts: cd build && qmake .. && make
1 parent 13326c0 commit e83c698

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

build/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

coverage.pri

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
COVERAGE_EXCLUDES = \
2+
/usr/* \
3+
*/moc_*.cpp \
4+
*/*.moc \
5+
*/qrc_*.cpp \
6+
/build/* \
7+
/json/* \
8+
/tests/* \
9+
mnotificationmanagerproxy.h \
10+
mnotificationmanagerproxy.cpp \
11+
12+
coverage.CONFIG = phony
13+
coverage.commands = '\
14+
@echo "--- coverage: extracting info"$$escape_expand(\\n\\t) \
15+
lcov -c -o lcov.info -d .$$escape_expand(\\n\\t) \
16+
@echo "--- coverage: excluding $$join(COVERAGE_EXCLUDES, ", ")"$$escape_expand(\\n\\t) \
17+
lcov -r lcov.info $$join(COVERAGE_EXCLUDES, "' '", "'", "'") -o lcov.info$$escape_expand(\\n\\t) \
18+
@echo "--- coverage: generating html"$$escape_expand(\\n\\t) \
19+
genhtml -o coverage lcov.info --demangle-cpp$$escape_expand(\\n\\t) \
20+
@echo -e "--- coverage: done\\n\\n\\tfile://$${OUT_PWD}/coverage/index.html\\n" \
21+
'
22+
23+
QMAKE_EXTRA_TARGETS += coverage

mlite.pro

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ CONFIG += ordered
33
SUBDIRS = \
44
src \
55
tests \
6+
7+
# Adds 'coverage' make target
8+
include(coverage.pri)

src/src.pro

-3
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ HEADERS += $$INSTALL_HEADERS
7575

7676
DEFINES += MLITE_LIBRARY
7777

78-
OBJECTS_DIR = .obj
79-
MOC_DIR = .moc
80-
8178
PCFILE=mlite$${NODASH_QT_VERSION}.pc
8279
configure($${PWD}/$${PCFILE}.in)
8380
pcfiles.files = $$PCFILE

0 commit comments

Comments
 (0)