summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-10-28 21:59:17 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-31 19:49:15 +0100
commit3b6b615334713cbfeb43409ff104244b55f4ce1f (patch)
tree30857727afdc9325b93ce590789c1afaf8d6552a
parent418e06f78f8b6cbc33b42f9b300c9c46c1ea2a32 (diff)
export QT_NO_<foo> equivalents to the build system
this makes it possible to properly exclude entire subprojects based on the availability of features, rather than stuffing every single source file with #ifdefs. the defines are aggregated from the -qconfig <profile>, -no-feature-<foo> and some other configure flags. usage: load(qfeatures) !contains(QT_DISABLED_FEATURES, textarea): SUBDIRS += textstuff Task-number: QTBUG-28102 Change-Id: I83400632d64312fa4b907e1318dddfe27c432387 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Peter Hartmann <phartmann@blackberry.com> Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
-rwxr-xr-xconfigure10
-rw-r--r--mkspecs/features/qfeatures.prf4
-rw-r--r--qtbase.pro19
3 files changed, 33 insertions, 0 deletions
diff --git a/configure b/configure
index 3a8665d1c2..b5e375baed 100755
--- a/configure
+++ b/configure
@@ -6682,6 +6682,16 @@ echo "QT_BUILD_PARTS += $CFG_BUILD_PARTS" >> "$QTMODULE.tmp"
if [ -n "$CFG_SKIP_MODULES" ]; then
echo "QT_SKIP_MODULES += $CFG_SKIP_MODULES" >> "$QTMODULE.tmp"
fi
+DISABLED_FEATURES=
+for cfg in $QCONFIG_FLAGS; do
+ ncfg=${cfg#QT_NO_}
+ if [ x$ncfg != x$cfg ]; then
+ DISABLED_FEATURES="$DISABLED_FEATURES $ncfg"
+ fi
+done
+if [ -n "$DISABLED_FEATURES" ]; then
+ echo "QT_NO_DEFINES = $DISABLED_FEATURES" >> "$QTMODULE.tmp"
+fi
echo "QT_QCONFIG_PATH = ${CFG_QCONFIG_PATH#$relpath/src/corelib/global/}" >> "$QTMODULE.tmp"
cat >>"$QTMODULE.tmp" <<EOF
diff --git a/mkspecs/features/qfeatures.prf b/mkspecs/features/qfeatures.prf
new file mode 100644
index 0000000000..15ef5c5be0
--- /dev/null
+++ b/mkspecs/features/qfeatures.prf
@@ -0,0 +1,4 @@
+# This file needs to be loaded explicitly, as the evaluation is relatively
+# expensive, and not many projects will actually need it.
+QMAKE_QT_FEATURES = $$[QT_HOST_DATA/get]/mkspecs/qfeatures.pri
+include($$QMAKE_QT_FEATURES) | error("Failed to load $$QMAKE_QT_FEATURES")
diff --git a/qtbase.pro b/qtbase.pro
index d608695970..37a20738fd 100644
--- a/qtbase.pro
+++ b/qtbase.pro
@@ -131,12 +131,16 @@ FEATURES_H = \
" *" \
" * This list is generated by qmake from <qtbase>/src/corelib/global/qfeatures.txt" \
" */"
+FEATURES_PRI =
for (ft, features) {
!isEmpty(features.$${ft}.depends) {
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"
+ FEATURES_PRI += \
+ "contains(QT_DISABLED_FEATURES, "^($$lower($$join($$list($$replace(features.$${ft}.depends, _, -)), "|")))$"): \\" \
+ " QT_DISABLED_FEATURES += $$lower($$replace(ft, _, -))"
}
}
write_file($$OUT_PWD/src/corelib/global/qfeatures.h, FEATURES_H)|error("Aborting.")
@@ -145,6 +149,7 @@ FWD_FEATURES_H = \
'$${LITERAL_HASH}include "../../src/corelib/global/qfeatures.h"'
write_file($$OUT_PWD/include/QtCore/qfeatures.h, FWD_FEATURES_H)|error("Aborting.")
+no_features =
lines = $$cat($$absolute_path($$QT_QCONFIG_PATH, $$PWD/src/corelib/global), lines)
for (line, lines) {
# We ignore all defines that don't follow the #ifndef + indent pattern.
@@ -153,8 +158,22 @@ for (line, lines) {
!isEqual(t, $$line) {
isEmpty(features.$${t}.name): \
error("$$QT_QCONFIG_PATH disables unknown feature $$t")
+ no_features += $$t
}
}
+for (def, QT_NO_DEFINES) {
+ !isEmpty(features.$${def}.name): \
+ no_features += $$def
+}
+no_features = $$unique(no_features)
+
+# Can't simply add these to QT_CONFIG, as e.g., contains(QT_CONFIG, accessibility) matches no-accessibililty.
+FEATURES_PRI = \
+ "$${LITERAL_HASH} Features disabled by configure:" \
+ "QT_DISABLED_FEATURES =$$lower($$join($$list($$replace(no_features, _, -)), " ", " "))" \
+ "$$escape_expand(\\n)$${LITERAL_HASH} Dependencies derived from <qtbase>/src/corelib/global/qfeatures.txt:" \
+ $$FEATURES_PRI
+write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error("Aborting.")
#mkspecs
mkspecs.path = $$[QT_HOST_DATA]/mkspecs