diff options
author | Antti Määttä <antti.maatta@qt.io> | 2023-10-05 14:48:14 +0300 |
---|---|---|
committer | Antti Määttä <antti.maatta@qt.io> | 2023-10-30 18:59:21 +0300 |
commit | 0f2558470d4a4b7983e31748f3916a057fae1f50 (patch) | |
tree | 961f2197fe48626af4c757b8814b4d3798bdcb89 /src/corelib/tracing/qctf.cpp | |
parent | 457566c96f420c452c4709e1e1942933c1ea2c5d (diff) |
Fix CTF with static build
- Do not require feature library
- Load static plugin
Change-Id: I6c3ec72e20b9f2800c1d350dac795fccbb8c381e
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'src/corelib/tracing/qctf.cpp')
-rw-r--r-- | src/corelib/tracing/qctf.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/corelib/tracing/qctf.cpp b/src/corelib/tracing/qctf.cpp index 6601398beb..ff81d0a678 100644 --- a/src/corelib/tracing/qctf.cpp +++ b/src/corelib/tracing/qctf.cpp @@ -7,6 +7,7 @@ #include <qpluginloader.h> #include <qfileinfo.h> #include <qdir.h> +#include <qjsonarray.h> #include "qctf_p.h" @@ -18,6 +19,8 @@ static bool s_prevent_recursion = false; static bool s_shutdown = false; static QCtfLib* s_plugin = nullptr; +#if QT_CONFIG(library) && defined(QT_SHARED) + #if defined(Q_OS_ANDROID) static QString findPlugin(const QString &plugin) { @@ -64,6 +67,30 @@ static bool loadPlugin(bool &retry) return true; } +#else + +#define QCtfPluginIID QStringLiteral("org.qt-project.Qt.QCtfLib") + +static bool loadPlugin(bool &retry) +{ + retry = false; + const auto &plugins = QPluginLoader::staticPlugins(); + for (const auto &plugin : plugins) { + const auto json = plugin.metaData(); + const auto IID = json[QStringLiteral("IID")]; + if (IID.toString() == QCtfPluginIID) { + s_plugin = qobject_cast<QCtfLib *>(plugin.instance()); + if (!s_plugin) + return false; + s_plugin->shutdown(&s_shutdown); + return true; + } + } + return false; +} + +#endif + static bool initialize() { if (s_shutdown || s_prevent_recursion) |