CMake: Add handling of PLUGIN_EXTENDS for generic plugins

Modify pro2cmake converter to add extra argument to
qt_internal_add_plugin. DEFINE_IF FALSE is added to generic plugins
those had "PLUGIN_EXTENDS = - " specified in .pro files.

Fixes: QTBUG-87861
Change-Id: I9269df19a32a088f5261f50e7ffff6d29c3d605f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2020-11-06 17:18:18 +01:00
parent 632da28e9c
commit 76230d9879
16 changed files with 20 additions and 3 deletions

View File

@ -133,11 +133,10 @@ function(qt_internal_add_plugin target)
_qt_plugin_install_package_suffix "${plugin_install_package_suffix}")
endif()
# TODO: This is a bit too coarse for generic plugins.
# The generic plugins should also be enabled by default, once QTBUG-87861 is fixed.
# The generic plugins should be enabled by default.
# But platform plugins should always be disabled by default, and only one is enabled
# based on the platform (condition specified in arg_DEFAULT_IF).
if(plugin_type_escaped STREQUAL "generic" OR plugin_type_escaped STREQUAL "platforms")
if(plugin_type_escaped STREQUAL "platforms")
set(_default_plugin 0)
else()
set(_default_plugin 1)

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QEvdevKeyboardPlugin
OUTPUT_NAME qevdevkeyboardplugin
TYPE generic
DEFAULT_IF FALSE
SOURCES
main.cpp
PUBLIC_LIBRARIES

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QEvdevMousePlugin
OUTPUT_NAME qevdevmouseplugin
TYPE generic
DEFAULT_IF FALSE
SOURCES
main.cpp
PUBLIC_LIBRARIES

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QEvdevTabletPlugin
OUTPUT_NAME qevdevtabletplugin
TYPE generic
DEFAULT_IF FALSE
SOURCES
main.cpp
PUBLIC_LIBRARIES

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QEvdevTouchScreenPlugin
OUTPUT_NAME qevdevtouchplugin
TYPE generic
DEFAULT_IF FALSE
SOURCES
main.cpp
PUBLIC_LIBRARIES

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QLibInputPlugin
OUTPUT_NAME qlibinputplugin
TYPE generic
DEFAULT_IF FALSE
SOURCES
main.cpp
PUBLIC_LIBRARIES

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QTsLibPlugin
OUTPUT_NAME qtslibplugin
TYPE generic
DEFAULT_IF FALSE
SOURCES
main.cpp
PUBLIC_LIBRARIES

View File

@ -9,6 +9,7 @@ qt_find_package(Tslib) # special case
qt_internal_add_plugin(QTsLibPlugin
OUTPUT_NAME qtslibplugin
TYPE generic
DEFAULT_IF FALSE
SOURCES
main.cpp
PUBLIC_LIBRARIES

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QTuioTouchPlugin
OUTPUT_NAME qtuiotouchplugin
TYPE generic
DEFAULT_IF FALSE
SOURCES
main.cpp
qoscbundle.cpp qoscbundle_p.h

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QComposePlatformInputContextPlugin
OUTPUT_NAME composeplatforminputcontextplugin
TYPE platforminputcontexts
DEFAULT_IF FALSE
SOURCES
qcomposeplatforminputcontext.cpp qcomposeplatforminputcontext.h
qcomposeplatforminputcontextmain.cpp

View File

@ -10,6 +10,7 @@ pkg_get_variable(PKG_X11_PREFIX x11 prefix) # special case
qt_internal_add_plugin(QComposePlatformInputContextPlugin
OUTPUT_NAME composeplatforminputcontextplugin
TYPE platforminputcontexts
DEFAULT_IF FALSE
SOURCES
qcomposeplatforminputcontext.cpp qcomposeplatforminputcontext.h
qcomposeplatforminputcontextmain.cpp

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QIbusPlatformInputContextPlugin
OUTPUT_NAME ibusplatforminputcontextplugin
TYPE platforminputcontexts
DEFAULT_IF FALSE
SOURCES
main.cpp
qibusinputcontextproxy.cpp qibusinputcontextproxy.h

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QGtk3ThemePlugin
OUTPUT_NAME qgtk3
TYPE platformthemes
DEFAULT_IF FALSE
SOURCES
main.cpp
qgtk3dialoghelpers.cpp qgtk3dialoghelpers.h

View File

@ -10,6 +10,7 @@ qt_find_package(X11) # special case
qt_internal_add_plugin(QGtk3ThemePlugin
OUTPUT_NAME qgtk3
TYPE platformthemes
DEFAULT_IF FALSE
SOURCES
main.cpp
qgtk3dialoghelpers.cpp qgtk3dialoghelpers.h

View File

@ -7,6 +7,7 @@
qt_internal_add_plugin(QXdgDesktopPortalThemePlugin
OUTPUT_NAME qxdgdesktopportal
TYPE platformthemes
DEFAULT_IF FALSE
SOURCES
main.cpp
qxdgdesktopportalfiledialog.cpp qxdgdesktopportalfiledialog_p.h

View File

@ -3913,6 +3913,10 @@ def write_plugin(cm_fh, scope, *, indent: int = 0) -> str:
if "static" in scope.get("CONFIG"):
extra.append("STATIC")
plugin_extends = scope.get_string("PLUGIN_EXTENDS")
if plugin_type != "platform" and plugin_extends == "-":
extra.append("DEFAULT_IF FALSE")
forward_target_info(scope, extra)
write_main_part(