summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Kreuzkamp <anton.kreuzkamp@kdab.com>2019-02-13 19:31:49 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2019-02-22 12:04:45 +0000
commita48635f21fa68c5033ebe0d6832d405acfcca937 (patch)
tree39e16fe02b4e6580c1583f7ae261d2efe9234866
parentcb836badcd8e0b2b2fcb6467cd3b9f7a5b8370b7 (diff)
Load static plugins when QT_NO_LIBRARY is set
When QT_NO_LIBRARY was set, QRenderPluginFactory::create and QSceneImportFactory::create would simply do nothing, causing no plugins to ever be loaded. On static builds with QT_NO_LIBRARY plugins can still be used by using static plugins. The plugin factories omit them, even though QFactoryLoader, which they both rely on, supports loading static plugins when QT_NO_LIBRARY is set. Commit d964eab8 did a similar thing for QSceneImportFactory and QInputDeviceIntegration. Task-number: QTBUG-72378 Change-Id: I97912a34940e821bda6c0ae830baff4d773451f3 Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/frontend/qrenderpluginfactory.cpp12
-rw-r--r--src/render/io/qsceneexportfactory.cpp12
2 files changed, 10 insertions, 14 deletions
diff --git a/src/render/frontend/qrenderpluginfactory.cpp b/src/render/frontend/qrenderpluginfactory.cpp
index 51fa068c6..548fa90e0 100644
--- a/src/render/frontend/qrenderpluginfactory.cpp
+++ b/src/render/frontend/qrenderpluginfactory.cpp
@@ -48,14 +48,14 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-#ifndef QT_NO_LIBRARY
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QRenderPluginFactoryInterface_iid, QLatin1String("/renderplugins"), Qt::CaseInsensitive))
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QRenderPluginFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
QStringList QRenderPluginFactory::keys(const QString &pluginPath)
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
QStringList list;
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
@@ -72,14 +72,14 @@ QStringList QRenderPluginFactory::keys(const QString &pluginPath)
list.append(loader()->keyMap().values());
return list;
#else
- return QStringList();
+ return loader()->keyMap().values();
#endif
}
QRenderPlugin *QRenderPluginFactory::create(const QString &name, const QStringList &args,
const QString &pluginPath)
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
if (QRenderPlugin *ret
@@ -87,10 +87,8 @@ QRenderPlugin *QRenderPluginFactory::create(const QString &name, const QStringLi
return ret;
}
}
- if (QRenderPlugin *ret = qLoadPlugin<QRenderPlugin, QRenderPluginFactoryIf>(loader(), name, args))
- return ret;
#endif
- return nullptr;
+ return qLoadPlugin<QRenderPlugin, QRenderPluginFactoryIf>(loader(), name, args);
}
} // namespace Render
diff --git a/src/render/io/qsceneexportfactory.cpp b/src/render/io/qsceneexportfactory.cpp
index 6e1126da8..10db614f4 100644
--- a/src/render/io/qsceneexportfactory.cpp
+++ b/src/render/io/qsceneexportfactory.cpp
@@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-#ifndef QT_NO_LIBRARY
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QSceneExportFactoryInterface_iid, QLatin1String("/sceneparsers"), Qt::CaseInsensitive))
+#if QT_CONFIG(library)
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QSceneExportFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
QStringList QSceneExportFactory::keys(const QString &pluginPath)
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
QStringList list;
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
@@ -74,14 +74,14 @@ QStringList QSceneExportFactory::keys(const QString &pluginPath)
list.append(loader()->keyMap().values());
return list;
#else
- return QStringList();
+ return loader()->keyMap().values();
#endif
}
QSceneExporter *QSceneExportFactory::create(const QString &name, const QStringList &args,
const QString &pluginPath)
{
-#ifndef QT_NO_LIBRARY
+#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
if (QSceneExporter *ret = qLoadPlugin<QSceneExporter,
@@ -89,10 +89,8 @@ QSceneExporter *QSceneExportFactory::create(const QString &name, const QStringLi
return ret;
}
}
- if (QSceneExporter *ret = qLoadPlugin<QSceneExporter, QSceneExportPlugin>(loader(), name, args))
- return ret;
#endif
- return nullptr;
+ return qLoadPlugin<QSceneExporter, QSceneExportPlugin>(loader(), name, args);
}
} // namespace Qt3DRender