qt5base-lts/mkspecs/features/win32/dumpcpp.prf
Andy Shaw faf742b05d dumpcpp: Run dumpcpp if the generated files do not exist at qmake time
By running dumpcpp if the files do not exist at qmake time we enable
the dependency finder to find these files and set up the dependencies
as appropriate. Since other changes ensure that dumpcpp will be called
at the right time when building if the typelib changes, we no longer
need to have the generated files dependent on the objects. As a
result, we are able to prevent it from unnecessarily rebuilding
everything if certain files are updated.

Change-Id: I334f48c7a980aa8b893c14cb2a4687d3b2b7a4b9
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-07-03 22:15:44 +01:00

37 lines
1.2 KiB
Plaintext

qtPrepareTool(QMAKE_DUMPCPP, dumpcpp)
dumpcpp_decl.depends += $$QMAKE_DUMPCPP_EXE
dumpcpp_decl.commands = $$QMAKE_DUMPCPP ${QMAKE_FILE_IN} -o ${QMAKE_FILE_BASE}
qaxcontainer_compat: dumpcpp_decl.commands += -compat
dumpcpp_decl.output = ${QMAKE_FILE_BASE}.h
dumpcpp_decl.input = TYPELIBS
dumpcpp_decl.variable_out = HEADERS
dumpcpp_decl.name = DUMP
dumpcpp_decl.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += dumpcpp_decl
dumpcpp_impl.commands = $$escape_expand(\\n) # dummy command
dumpcpp_impl.output = ${QMAKE_FILE_BASE}.cpp
dumpcpp_impl.input = TYPELIBS
dumpcpp_impl.variable_out = SOURCES
dumpcpp_impl.name = CPP
dumpcpp_impl.depends += ${QMAKE_FILE_BASE}.h
QMAKE_EXTRA_COMPILERS += dumpcpp_impl
# Call dumpcpp the first time if the files do not exist to help find dependencies
!build_pass:have_target:!contains(TEMPLATE, vc.*) {
for(tlb, TYPELIBS) {
tlbCopy = $$replace(tlb, \", )
hdr = $$basename(tlb)
hdr = $$section(hdr, ., 0, -2)
tmp_command = $$QMAKE_DUMPCPP $$system_quote($$absolute_path($$tlb, $$_PRO_FILE_PWD_)) \
-o $$system_quote($$OUT_PWD/$$hdr)
qaxcontainer_compat: tmp_command += -compat
!exists($$OUT_PWD/$${hdr}.h): system($$tmp_command)
}
}