Skip to content

Commit

Permalink
Convert the old feature system
Browse files Browse the repository at this point in the history
... to the new qmake based configuration system.

This removes the old qfeatures.txt (distributed over configure.json
files) and qfeatures.h (distributed over qconfig-<module>.h files).

qfeatures.prf is gone without replacement, as attempts to use it would
lead to followup errors anyway.

Change-Id: I1598de19db937082283a905b9592d3849d2199d0
Reviewed-by: Oswald Buddenhagen <[email protected]>
  • Loading branch information
laknoll committed Sep 15, 2016
1 parent b22471e commit a668c6a
Show file tree
Hide file tree
Showing 33 changed files with 981 additions and 182 deletions.
16 changes: 0 additions & 16 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -753,21 +753,6 @@ while [ "$#" -gt 0 ]; do
opensource)
COMMERCIAL_USER="no"
;;
feature-*)
FEATURE=`echo $VAR | sed 's,^[^-]*-\([^-]*\),\1,' | tr 'abcdefghijklmnopqrstuvwxyz-' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
if grep "^Feature: *${FEATURE} *\$" "$relpath"/src/corelib/global/qfeatures.txt >/dev/null 2>&1; then
F=`echo $VAR | sed 's,^[^-]*-\([^-]*\),\1,'`
if [ "$VAL" = "no" ]; then
F="no-$F"
elif [ "$VAL" != "yes" ] && [ "$VAL" != "unknown" ]; then
UNKNOWN_OPT=yes
fi
CFG_FEATURES="$CFG_FEATURES $F"
else
echo "ERROR: Unknown feature $FEATURE"
UNKNOWN_OPT=yes
fi
;;
confirm-license)
if [ "$VAL" = "yes" ]; then
OPT_CONFIRM_LICENSE="$VAL"
Expand Down Expand Up @@ -1894,7 +1879,6 @@ fi

cat > "$outpath/config.tests/configure.cfg" <<EOF
# Feature defaults set by configure command line
config.input.extra_features = $CFG_FEATURES
config.input.qt_edition = $Edition
config.input.qt_licheck = $Licheck
config.input.qt_release_date = $ReleaseDate
Expand Down
7 changes: 3 additions & 4 deletions configure.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"src/network",
"src/sql",
"src/gui",
"src/xml",
"src/widgets",
"src/printsupport"
],
Expand Down Expand Up @@ -933,6 +934,8 @@
},
"concurrent": {
"label": "Qt Concurrent",
"purpose": "Provides a high-level multi-threading API.",
"section": "Kernel",
"output": [ "publicFeature", "feature" ]
},
"dbus": {
Expand Down Expand Up @@ -1032,10 +1035,6 @@
"autoDetect": false,
"condition": "tests.wmf",
"output": [ "publicQtConfig" ]
},
"extra_features": {
"comment": "### remove, once qfeatures.txt is ported to the new system",
"output": [ "extraFeatures" ]
}
},

Expand Down
37 changes: 0 additions & 37 deletions configure.pri
Original file line number Diff line number Diff line change
Expand Up @@ -379,43 +379,6 @@ defineTest(qtConfOutput_compilerVersion) {
export($${currentConfig}.output.publicPro)
}

# should go away when qfeatures.txt is ported
defineTest(qtConfOutput_extraFeatures) {
isEmpty(config.input.extra_features): return()

# write to qconfig.pri
$${currentConfig}.output.publicPro += "$${LITERAL_HASH}ifndef QT_BOOTSTRAPPED"
for (f, config.input.extra_features) {
feature = $$replace(f, "^no-", "")
FEATURE = $$upper($$replace(feature, -, _))
contains(f, "^no-.*") {
$${currentConfig}.output.publicPro += \
"$${LITERAL_HASH}ifndef QT_NO_$$FEATURE" \
"$${LITERAL_HASH}define QT_NO_$$FEATURE" \
"$${LITERAL_HASH}endif"
} else {
$${currentConfig}.output.publicPro += \
"$${LITERAL_HASH}if defined(QT_$$FEATURE) && defined(QT_NO_$$FEATURE)" \
"$${LITERAL_HASH}undef QT_$$FEATURE" \
"$${LITERAL_HASH}elif !defined(QT_$$FEATURE) && !defined(QT_NO_$$FEATURE)" \
"$${LITERAL_HASH}define QT_$$FEATURE" \
"$${LITERAL_HASH}endif"
}
}
$${currentConfig}.output.publicPro += "$${LITERAL_HASH}endif"
export($${currentConfig}.output.publicPro)

# write to qmodule.pri
disabled_features =
for (f, config.input.extra_features) {
feature = $$replace(f, "^no-", "")
FEATURE = $$upper($$replace(feature, -, _))
contains(f, "^no-.*"): disabled_features += $$FEATURE
}
!isEmpty(disabled_features): qtConfOutputVar(assign, "privatePro", QT_NO_DEFINES, $$disabled_features)
}


defineTest(qtConfOutput_compilerFlags) {
# this output also exports the variables locally, so that subsequent compiler tests can use them

Expand Down
3 changes: 1 addition & 2 deletions examples/network/network.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ qtHaveModule(widgets) {
multicastreceiver \
multicastsender

load(qfeatures)
!contains(QT_DISABLED_FEATURES, bearermanagement) {
qtConfig(bearermanagement) {
# no QProcess
!vxworks:!qnx:!winrt:!integrity:!uikit: SUBDIRS += network-chat

Expand Down
3 changes: 1 addition & 2 deletions examples/widgets/tools/tools.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ SUBDIRS = \

contains(DEFINES, QT_NO_TRANSLATION): SUBDIRS -= i18n

load(qfeatures)
contains(QT_DISABLED_FEATURES, library) {
!qtConfig(library) {
SUBDIRS -= \
echoplugin \
plugandpaint
Expand Down
1 change: 0 additions & 1 deletion mkspecs/common/linux-android.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ QMAKE_PLATFORM += android
include(linux.conf)
include(gcc-base-unix.conf)

DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG
QT_QPA_DEFAULT_PLATFORM = minimal

NDK_ROOT = $$(ANDROID_NDK_ROOT)
Expand Down
2 changes: 1 addition & 1 deletion mkspecs/common/uikit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ QMAKE_PLATFORM += uikit
CONFIG += bitcode reduce_exports

INCLUDEPATH += $$PWD/uikit
DEFINES += DARWIN_NO_CARBON QT_NO_PRINTER QT_NO_PRINTDIALOG
DEFINES += DARWIN_NO_CARBON

include(mac.conf)
3 changes: 1 addition & 2 deletions mkspecs/common/winrt_winphone/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ MAKEFILE_GENERATOR = MSBUILD
QMAKE_COMPILER = msvc
QMAKE_PLATFORM = winrt win32
CONFIG = package_manifest $$CONFIG incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target rtti
DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN \
QT_NO_PRINTER QT_NO_PRINTDIALOG # TODO: Remove when printing is re-enabled
DEFINES += UNICODE WIN32 QT_LARGEFILE_SUPPORT Q_BYTE_ORDER=Q_LITTLE_ENDIAN

DEPLOYMENT_PLUGIN += qwinrt

Expand Down
4 changes: 0 additions & 4 deletions mkspecs/features/qfeatures.prf

This file was deleted.

16 changes: 14 additions & 2 deletions mkspecs/features/qt_configure.prf
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,20 @@ defineTest(qtConfParseCommandLine) {
}
# handle builtin [-no]-feature-xxx
isEmpty(type):contains(opt, "feature-(.*)") {
# simply skip for now
next()
opt ~= s,^feature-,,
found = false
for (cc, allConfigs) {
contains($${cc}.features._KEYS_, $$opt) {
found = true
break()
}
}
!$$found {
qtConfAddError("Enabling/Disabling unknown feature '$$opt'.")
return()
}
# this is a boolean enabling/disabling the corresponding feature
type = boolean
}

isEmpty(type) {
Expand Down
1 change: 0 additions & 1 deletion mkspecs/integrity-armv7-imx6/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

include(../common/ghs-integrity-armv7.conf)

DEFINES += QT_NO_CLIPBOARD
DEFINES += QT_STATICPLUGIN

QTPLUGIN.platforms += qeglfs qeglfs-viv-integration
Expand Down
1 change: 0 additions & 1 deletion mkspecs/integrity-armv7/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

include(../common/ghs-integrity-armv7.conf)

DEFINES += QT_NO_CLIPBOARD
DEFINES += QT_STATICPLUGIN

QTPLUGIN.platforms += integrityfb
1 change: 0 additions & 1 deletion mkspecs/integrity-x86/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
include(../common/ghs-integrity-x86.conf)

QMAKE_CFLAGS += -cpu=Corei
DEFINES += QT_NO_CLIPBOARD
DEFINES += QT_STATICPLUGIN

QTPLUGIN.platforms += integrityfb
2 changes: 1 addition & 1 deletion mkspecs/qnx-aarch64le-qcc/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# qmake configuration for qnx aarch64le systems
#

DEFINES += QT_NO_CLIPBOARD _FORTIFY_SOURCE=2
DEFINES += _FORTIFY_SOURCE=2

QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now

Expand Down
2 changes: 0 additions & 2 deletions mkspecs/qnx-armle-v7-qcc/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
#

include(../common/qcc-base-qnx-armle-v7.conf)

DEFINES += QT_NO_CLIPBOARD
2 changes: 0 additions & 2 deletions mkspecs/qnx-x86-64-qcc/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# qmake configuration for qnx x86-64 systems
#

DEFINES += QT_NO_CLIPBOARD

QMAKE_LFLAGS_SHLIB += -Wl,-z,relro -Wl,-z,now

include(../common/qcc-base-qnx-x86-64.conf)
Expand Down
2 changes: 0 additions & 2 deletions mkspecs/qnx-x86-qcc/qmake.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
#

include(../common/qcc-base-qnx-x86.conf)

DEFINES += QT_NO_CLIPBOARD
82 changes: 1 addition & 81 deletions qtbase.pro
Original file line number Diff line number Diff line change
Expand Up @@ -75,90 +75,10 @@ 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 feature dependencies." \
" *" \
" * 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()
# 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()

no_features =
lines = $$cat($$OUT_PWD/src/corelib/global/qconfig.h, lines)
for (line, lines) {
# We ignore all defines that don't follow the #ifndef + indent pattern.
# This makes it possible to have unchecked defines which are no features.
t = $$replace(line, "^$${LITERAL_HASH} define QT_NO_(\\S+)\\s*$", "\\1")
!isEqual(t, $$line) {
isEmpty(features.$${t}.name): \
error("qconfig.h disables unknown feature $$t")
no_features += $$t
}
}
for (def, QT_NO_DEFINES) {
!isEmpty(features.$${def}.name): \
no_features += $$def
}
no_features = $$unique(no_features)

# Don't simply add these to QT_CONFIG, as then one might expect them to be there without load(qfeatures).
# And we don't want to do that automatically, as the dynamic dependency resolution is somewhat expensive.
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 \
"QT_DISABLED_FEATURES = \$\$unique(QT_DISABLED_FEATURES)"
write_file($$OUT_PWD/mkspecs/qfeatures.pri, FEATURES_PRI)|error()

# Files created by us
QMAKE_DISTCLEAN += \
src/corelib/global/qfeatures.h \
include/QtCore/qfeatures.h \
mkspecs/qfeatures.pri

#mkspecs
mkspecs.path = $$[QT_HOST_DATA]/mkspecs
mkspecs.files = \
$$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri $$OUT_PWD/mkspecs/qfeatures.pri \
$$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri \
$$OUT_PWD/mkspecs/qdevice.pri $$OUT_PWD/mkspecs/qhost.pri \
$$files($$PWD/mkspecs/*)
mkspecs.files -= $$PWD/mkspecs/modules $$PWD/mkspecs/modules-inst
Expand Down
Loading

0 comments on commit a668c6a

Please sign in to comment.