diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2013-08-20 09:02:17 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-13 11:48:08 +0200 |
commit | 31b4461097bd4bd0c128647bab896c2612ef82b0 (patch) | |
tree | 53710dab5d5f89650de71649b84589c212d1856f /src/tools/moc/generator.cpp | |
parent | 209a5f1e8dc3e2275f225823ad9edfee09ba756c (diff) |
moc: add -M<key=value> to ease static qml plugin linking
A module plugin in qml belongs to a URI/namespace. This
uri is resolved run-time by QtDeclarative by knowing the
path of the qmldir that references the plugin.
For static plugins this becomes a problem, since we lost
the information regarding which plugin belongs to which
qmldir, since a static plugin has no file path.
To avoid pushing the responsibility of clarifying this
onto the application developer, it is better to embed this
information into the meta data of the plugins themselves.
Since this information can be resolved by the
build system, a new option to moc has been added:
-M<key=value>
that will let you add meta tags to the meta data from
the command line to each class that has an IID specified.
For the URI case, we can then e.g do:
-Muri=QtQuick.Controls -Muri=QtQuick.Controls.Private
Change-Id: I81a156660148fc94db6f3cac0473e9e1c8458c58
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/tools/moc/generator.cpp')
-rw-r--r-- | src/tools/moc/generator.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 50da6d2e54..cb18c2c4a5 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -1462,6 +1462,10 @@ void Generator::generatePluginMetaData() data.insert(debugKey, QJsonValue(false)); data.insert(QStringLiteral("MetaData"), cdef->pluginData.metaData.object()); + // Add -M args from the command line: + foreach (const QString &key, cdef->pluginData.metaArgs.keys()) + data.insert(key, cdef->pluginData.metaArgs.value(key)); + fputs("\nQT_PLUGIN_METADATA_SECTION const uint qt_section_alignment_dummy = 42;\n\n" "#ifdef QT_NO_DEBUG\n", out); writePluginMetaData(out, data); |