diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-02-15 22:14:42 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-02-21 21:30:10 +0000 |
commit | c9398266d804d570f305590df9481028c9880175 (patch) | |
tree | a3346850881f789f274f277ff046161e267a361e /src/qml/qml.pro | |
parent | e4bea7805a229d3625f110f844d908e2abe790b5 (diff) |
Move the QML_COMPILE_HASH macro definition from the command-line
If it's in the command-line, it is added to the precompiled header,
which won't be regenerated if the macro changed. Instead, let's create a
header that can be #included only in the file it needs to.
Since qmldevtools compiles the file that has this new #include, we need
to ensure it was created before the module is compiled.
Change-Id: I940917d6763842499b18fffd1513b9c64cd98387
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml.pro')
-rw-r--r-- | src/qml/qml.pro | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/qml/qml.pro b/src/qml/qml.pro index acaff08a29..f75bfa0313 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -16,17 +16,28 @@ gcc:isEqual(QT_ARCH, "mips"): QMAKE_CXXFLAGS += -fno-reorder-blocks DEFINES += QT_NO_FOREACH -tagFile=$$PWD/../../.tag -tag= -exists($$tagFile) { - tag=$$cat($$tagFile, singleline) - QMAKE_INTERNAL_INCLUDED_FILES += $$tagFile -} -!equals(tag, "$${LITERAL_DOLLAR}Format:%H$${LITERAL_DOLLAR}") { - DEFINES += QML_COMPILE_HASH="$$tag" -} else:exists($$PWD/../../.git) { - commit=$$system(git describe --tags --always --long --dirty) - DEFINES += QML_COMPILE_HASH="$$commit" +!build_pass { + # Create a header containing a hash that describes this library. For a + # released version of Qt, we'll use the .tag file that is updated by git + # archive with the commit hash. For unreleased versions, we'll ask git + # describe. Note that it won't update unless qmake is run again, even if + # the commit change also changed something in this library. + tagFile = $$PWD/../../.tag + tag = + exists($$tagFile) { + tag = $$cat($$tagFile, singleline) + QMAKE_INTERNAL_INCLUDED_FILES += $$tagFile + } + !equals(tag, "$${LITERAL_DOLLAR}Format:%H$${LITERAL_DOLLAR}") { + QML_COMPILE_HASH = $$tag + } else:exists($$PWD/../../.git) { + commit = $$system(git describe --tags --always --long --dirty) + QML_COMPILE_HASH = $$commit + } + compile_hash_contents = \ + "// Generated file, DO NOT EDIT" \ + "$${LITERAL_HASH}define QML_COMPILE_HASH \"$$QML_COMPILE_HASH\"" + write_file("$$OUT_PWD/qml_compile_hash_p.h", compile_hash_contents)|error() } exists("qqml_enable_gcov") { |