diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2019-05-06 11:08:25 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2019-05-07 13:51:54 +0000 |
commit | 3f80c821e939cd908651d20940fb41b2522dc199 (patch) | |
tree | e360fd470fad4a400721d369a60a6c31579769fe | |
parent | 694568d01a1d2480bd57a27ed2f500506f488fcb (diff) |
Qt: Do not link static plugins into static libraries
Plugins should only be linked into applications and shared libraries.
Change-Id: I95adc3f1f1ec8ea512e4166e78be1d9c5abb6745
Fixes: QBS-1441
Reviewed-by: Ola Røer Thorsen <ola@silentwings.no>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
4 files changed, 16 insertions, 3 deletions
diff --git a/doc/reference/modules/qt-plugin_support-module.qdoc b/doc/reference/modules/qt-plugin_support-module.qdoc index fe28ee907..9bd27c3f7 100644 --- a/doc/reference/modules/qt-plugin_support-module.qdoc +++ b/doc/reference/modules/qt-plugin_support-module.qdoc @@ -75,3 +75,11 @@ \readonly */ +/*! + \qmlproperty bool Qt.plugin_support::linkPlugins + + Controls whether plugins of a statically built Qt should be linked into the product. + + \default \true if the product is an application or shared library, \c false otherwise. + +*/ diff --git a/share/qbs/module-providers/Qt/templates/QtPlugin.qbs b/share/qbs/module-providers/Qt/templates/QtPlugin.qbs index 23a6795f3..88bfa5a65 100644 --- a/share/qbs/module-providers/Qt/templates/QtPlugin.qbs +++ b/share/qbs/module-providers/Qt/templates/QtPlugin.qbs @@ -12,6 +12,8 @@ QtModule { return false; if (!isStaticLibrary) return false; + if (!Qt.plugin_support.linkPlugins) + return false; if (!(Qt.plugin_support.enabledPlugins || []).contains(qtModuleName)) return false; if (!extendsModules || extendsModules.length === 0) diff --git a/share/qbs/module-providers/Qt/templates/plugin_support.qbs b/share/qbs/module-providers/Qt/templates/plugin_support.qbs index 13d95c383..1de923f17 100644 --- a/share/qbs/module-providers/Qt/templates/plugin_support.qbs +++ b/share/qbs/module-providers/Qt/templates/plugin_support.qbs @@ -1,6 +1,8 @@ Module { // Set by user. property varList pluginsByType + property bool linkPlugins: product.type + && (product.type.contains("application") || product.type.contains("sharedlibrary")) // Set by Qt modules. property stringList pluginTypes diff --git a/share/qbs/module-providers/Qt/templates/qml.qbs b/share/qbs/module-providers/Qt/templates/qml.qbs index 2b11abbd5..c95c0f367 100644 --- a/share/qbs/module-providers/Qt/templates/qml.qbs +++ b/share/qbs/module-providers/Qt/templates/qml.qbs @@ -24,12 +24,13 @@ QtModule { readonly property string pluginListFilePathDebug: product.buildDirectory + "/plugins.list.d" readonly property string pluginListFilePathRelease: product.buildDirectory + "/plugins.list" + property bool linkPlugins: isStaticLibrary && Qt.plugin_support.linkPlugins hasLibrary: @has_library@ architectures: @archs@ targetPlatform: @targetPlatform@ - staticLibsDebug: (isStaticLibrary ? ['@' + pluginListFilePathDebug] : []).concat(@staticLibsDebug@) - staticLibsRelease: (isStaticLibrary ? ['@' + pluginListFilePathRelease] : []).concat(@staticLibsRelease@) + staticLibsDebug: (linkPlugins ? ['@' + pluginListFilePathDebug] : []).concat(@staticLibsDebug@) + staticLibsRelease: (linkPlugins ? ['@' + pluginListFilePathRelease] : []).concat(@staticLibsRelease@) dynamicLibsDebug: @dynamicLibsDebug@ dynamicLibsRelease: @dynamicLibsRelease@ linkerFlagsDebug: @linkerFlagsDebug@ @@ -60,7 +61,7 @@ QtModule { } Rule { - condition: isStaticLibrary + condition: linkPlugins multiplex: true requiresInputs: false inputs: ["qt.qml.qml"] |