From 1c9364698027822516a0b9e28264b5c652b7fd8f Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 6 Mar 2017 15:05:33 +0100 Subject: Fix build with -no-feature-library Disable code that directly interacts with QPluginLoader or relies on QCoreApplication::libraryPaths(). For loading plugins from inside Qt code you can use QFactoryLoader. If QPluginLoader is necessary, please consider staticPlugins() and staticInstances(). Change-Id: I14e2e2b5437ddd74109a94cc47dd53f4459ea2f5 Reviewed-by: Alex Blasche --- src/feedback/qfeedbackplugin.cpp | 12 +++++++++++- src/feedback/qfeedbackpluginsearch.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/feedback/qfeedbackplugin.cpp b/src/feedback/qfeedbackplugin.cpp index 0c32b86..2616f35 100644 --- a/src/feedback/qfeedbackplugin.cpp +++ b/src/feedback/qfeedbackplugin.cpp @@ -120,13 +120,18 @@ class BackendLoader { public: BackendLoader() : inst(0) { } - ~BackendLoader() { pl.unload(); } + ~BackendLoader() { +#if QT_CONFIG(library) + pl.unload(); +#endif + } void setInstance(T *newInst) { inst = newInst; } T * instance() { return inst; } void tryLoad(QPluginLoader &loader) { +#if QT_CONFIG(library) if (T *newInst = qobject_cast(loader.instance())) { if (!inst || inst->pluginPriority() < newInst->pluginPriority()) { inst = newInst; @@ -135,6 +140,9 @@ public: pl.load(); //Adds a ref to the library } } +#else + Q_UNUSED(loader) +#endif } @@ -252,6 +260,7 @@ class BackendManager public: BackendManager() { +#if QT_CONFIG(library) QStringList pluginPaths = getPluginPaths(QLatin1String("feedback")); foreach (const QString& pluginPath, pluginPaths) { @@ -266,6 +275,7 @@ public: loader.unload(); } } +#endif if (!hapticsBackend.instance()) hapticsBackend.setInstance(new QDummyBackend); diff --git a/src/feedback/qfeedbackpluginsearch.h b/src/feedback/qfeedbackpluginsearch.h index c2699e2..2b946d0 100644 --- a/src/feedback/qfeedbackpluginsearch.h +++ b/src/feedback/qfeedbackpluginsearch.h @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE inline QStringList getPluginPaths(const QString& plugintype) { +#if QT_CONFIG(library) #if !defined QT_NO_DEBUG const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0; #endif @@ -106,6 +107,10 @@ inline QStringList getPluginPaths(const QString& plugintype) } return plugins; +#else + Q_UNUSED(plugintype) + return QStringList(); +#endif } QT_END_NAMESPACE -- cgit v1.2.3