diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2012-12-10 15:56:29 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-10 15:33:45 +0100 |
commit | f166fcd3d0931ecc08087b12fdac5940e5ccbdf7 (patch) | |
tree | 9eaa421ef64ea9e956dbdef8ef11ee9d23aee994 /mkspecs/features/qt.prf | |
parent | c9d40ef2c1ff9e701cd052dadfc0e515ff6b523f (diff) |
Pro-file level support for importing plugins for static Qt builds
Platform plugin is needed always when gui is linked to an application.
This is tedious to do manually for static builds, so provide support
for generating a source file that imports static plugins for
application projects.
"CONFIG += import_plugins" statement in application .pro file will
generate required import statements for all plugins specified with
QTPLUGIN variable.
The plugin class names are found from plugin's module pri generated
automatically when plugin is built, as long as the plugin specifies
the PLUGIN_CLASS_NAME in the plugin .pro file before loading
qt_plugin.prf.
Task-number: QTBUG-28131
Change-Id: I19f8ea48a3c1e9b5c81f4399c4b5d439a6d4bea1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'mkspecs/features/qt.prf')
-rw-r--r-- | mkspecs/features/qt.prf | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 443914e011..6b2833b09e 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -36,7 +36,30 @@ plugin { #Qt plugins } QT_PLUGIN_VERIFY = DEPLOYMENT_PLUGIN -contains(QT_CONFIG, static): QT_PLUGIN_VERIFY += QTPLUGIN + +contains(QT_CONFIG, static) { + QT_PLUGIN_VERIFY += QTPLUGIN + contains(TEMPLATE, .*app) { + import_plugins:!isEmpty(QTPLUGIN) { + IMPORT_FILE_CONT = \ + "// This file is autogenerated by qmake. It imports static plugin classes for" \ + "// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables." \ + "$${LITERAL_HASH}include <QtPlugin>" + for(IMPORT_PLUG, $$list($$unique(QTPLUGIN))) { + PLUG_CLASS = $$eval(QT_PLUGIN.$${IMPORT_PLUG}.CLASS_NAME) + !isEmpty(PLUG_CLASS): \ + IMPORT_FILE_CONT += "Q_IMPORT_PLUGIN($$PLUG_CLASS)" + else: \ + warning("Plugin class name could not be determined for $$IMPORT_PLUG plugin.") + } + IMPORT_CPP = $$OUT_PWD/$$lower($$basename(TARGET))_plugin_import.cpp + write_file($$IMPORT_CPP, IMPORT_FILE_CONT)|error("Aborting.") + SOURCES += $$IMPORT_CPP + QMAKE_DISTCLEAN += $$IMPORT_CPP + } + } +} + for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) { for(QTPLUG, $$list($$lower($$unique($$QT_CURRENT_VERIFY)))) { # Check if the plugin is known to Qt. We can use this to determine |