diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-10-23 15:24:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-29 15:37:58 +0100 |
commit | 08a737def9145a53615871bb5900f9794bf699f5 (patch) | |
tree | 79344c4688bdce13acaeb422673dfb7876e8d9f8 /qtbase.pro | |
parent | 569ec1ab346e786e98a8e6884ed40a063a740832 (diff) | |
download | qtbase-08a737def9145a53615871bb5900f9794bf699f5.tar.gz |
generate qfeatures.h at build time
much more elegant than the checked in file. and less chance to get it
wrong, as people often enough do.
Change-Id: I975a62dfd83ce4f15947ce54f3c40931b1badae0
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'qtbase.pro')
-rw-r--r-- | qtbase.pro | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/qtbase.pro b/qtbase.pro index d3b03d1fba..afdeed853c 100644 --- a/qtbase.pro +++ b/qtbase.pro @@ -103,6 +103,53 @@ prefix_build|!equals(PWD, $$OUT_PWD) { } +# Generate qfeatures.h +features = +lines = $$cat("src/corelib/global/qfeatures.txt", lines) +for (line, lines) { + t = $$replace(line, "^Feature: (\\S+)\\s*$", "\\1") + !isEqual(t, $$line) { + feature = $$t + features += $$t + } else { + t = $$replace(line, "^Requires: (.*)$", "\\1") + !isEqual(t, $$line) { + features.$${feature}.depends = $$replace(t, \\s+$, ) + } else { + t = $$replace(line, "^Name: (.*)$", "\\1") + !isEqual(t, $$line) { + features.$${feature}.name = $$replace(t, \\s+$, ) + } + } + } +} +features = $$sort_depends(features, features.) +features = $$reverse(features) +FEATURES_H = \ + "/*" \ + " * All features and their dependencies." \ + " *" \ + " * This list is generated by qmake from <qtbase>/src/corelib/global/qfeatures.txt" \ + " */" +for (ft, features) { + FEATURES_H += \ + "$$escape_expand(\\n)// $$eval(features.$${ft}.name)" + isEmpty(features.$${ft}.depends) { + FEATURES_H += \ + "//$${LITERAL_HASH}define QT_NO_$$ft" + } else { + FEATURES_H += \ + "$${LITERAL_HASH}if !defined(QT_NO_$$ft) && ($$join($$list($$split(features.$${ft}.depends)), ") || defined(QT_NO_", "defined(QT_NO_", ")"))" \ + "$${LITERAL_HASH} define QT_NO_$$ft" \ + "$${LITERAL_HASH}endif" + } +} +write_file($$OUT_PWD/src/corelib/global/qfeatures.h, FEATURES_H)|error("Aborting.") +# Create forwarding header +FWD_FEATURES_H = \ + '$${LITERAL_HASH}include "../../src/corelib/global/qfeatures.h"' +write_file($$OUT_PWD/include/QtCore/qfeatures.h, FWD_FEATURES_H)|error("Aborting.") + #mkspecs mkspecs.path = $$[QT_HOST_DATA]/mkspecs mkspecs.files = \ |