Qmake directives to help using Templight to analyse our template usage.

This commit is contained in:
Mathew Sutcliffe
2017-02-20 21:03:03 +00:00
parent c268581954
commit db692461ef
5 changed files with 57 additions and 2 deletions

View File

@@ -52,6 +52,12 @@ macx:staticlib:isEmpty(SOURCES) {
# not supported by clang_cl
clang_cl: CONFIG -= precompile_header
################################
# Templight (template analysis tool)
################################
include(templight.pri)
################################
# Black libs
################################

View File

@@ -9,12 +9,10 @@ defineReplace(fileCopyDestination) {
win32:isEmpty(MINGW_IN_SHELL) {
copy_files.commands = copy /y ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
TOUCH = copy /y nul
}
else {
copy_files.commands = mkdir -p `dirname ${QMAKE_FILE_OUT}` && \
cp ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
TOUCH = touch
}
QMAKE_EXTRA_COMPILERS += copy_files
@@ -25,6 +23,7 @@ QMAKE_EXTRA_COMPILERS += copy_files
# with PRE_TARGETDEPS instead.
#copy_files.CONFIG += target_predeps
load(touch)
copy_files_cookie.depends = compiler_copy_files_make_all
copy_files_cookie.target = copy_files.cookie
win32:!mingw: copy_files_cookie.commands = $$TOUCH $** && $$TOUCH $@

View File

@@ -0,0 +1,30 @@
contains(BLACK_CONFIG, Templight) {
QMAKE_CXXFLAGS += -Xtemplight -profiler -Xtemplight -ignore-system
QMAKE_CXXFLAGS += -Xtemplight -blacklist -Xtemplight $$PWD/templight_blacklist
clang_cl {
QMAKE_CC = clang-cl
QMAKE_CXX = templight-cl
moc_predefs.commands = clang-cl -Bx$$shell_quote($$shell_path($$QMAKE_QMAKE)) $$QMAKE_CXXFLAGS \
-E -Za ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} $$escape_expand(\n)$$LITERAL_HASH
}
else:clang {
QMAKE_CC = clang
QMAKE_CXX = templight++
moc_predefs.commands = clang++ $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
}
else:error(Templight requires a clang mkspec)
templight-convert.commands = templight-convert -f callgrind -i ${QMAKE_FILE_IN}.trace.pbf -o ${QMAKE_FILE_OUT}
templight-convert.CONFIG = no_link
templight-convert.input = OBJECTS
templight-convert.output = ${QMAKE_FILE_IN_PATH}/callgrind.${QMAKE_FILE_IN_BASE}
QMAKE_EXTRA_COMPILERS += templight-convert
load(touch)
win32:!mingw: templight-convert-cookie.commands = $$TOUCH $** && $$TOUCH $@
else: templight-convert-cookie.commands = $$TOUCH $< && $$TOUCH $@
templight-convert-cookie.depends = compiler_templight-convert_make_all
templight-convert-cookie.target = templight-convert.cookie
QMAKE_EXTRA_TARGETS += templight-convert-cookie
!isEmpty(SOURCES): PRE_TARGETDEPS += templight-convert.cookie
}

View File

@@ -0,0 +1,14 @@
#
# Identifiers matching the regular expressions below
# will be omitted from templight traces.
#
# standard library templates
identifier ^std(::|$)
# standard library implementation templates
identifier __
identifier ^_[A-Z]
# assume templates starting with 'Q' are Qt templates
identifier ^[qQ]

View File

@@ -0,0 +1,6 @@
win32:isEmpty(MINGW_IN_SHELL) {
TOUCH = copy /y nul
}
else {
TOUCH = touch
}