diff options
author | Alexis Jeandet <alexis.jeandet@member.fsf.org> | 2017-10-01 16:18:31 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-10-01 20:12:25 +0300 |
commit | a9258923fac2ab145a94f7c72cc5c0127d50bfe2 (patch) | |
tree | 9acf5b06d93ae58e52bf956a62981c4a0f3f0aa6 /test cases | |
parent | ae532c807c61afa51c17222d284475c1984e0ec8 (diff) | |
download | meson-a9258923fac2ab145a94f7c72cc5c0127d50bfe2.zip meson-a9258923fac2ab145a94f7c72cc5c0127d50bfe2.tar.gz meson-a9258923fac2ab145a94f7c72cc5c0127d50bfe2.tar.bz2 |
Added include directory argument for Qt's Moc which is needed to build plugins.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/frameworks/4 qt/meson.build | 10 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/plugin/plugin.cpp | 7 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/plugin/plugin.h | 11 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/plugin/plugin.json | 3 | ||||
-rw-r--r-- | test cases/frameworks/4 qt/pluginInterface/plugin_if.h | 21 |
5 files changed, 52 insertions, 0 deletions
diff --git a/test cases/frameworks/4 qt/meson.build b/test cases/frameworks/4 qt/meson.build index d9cab6f..c6f108b 100644 --- a/test cases/frameworks/4 qt/meson.build +++ b/test cases/frameworks/4 qt/meson.build @@ -70,5 +70,15 @@ foreach qt : ['qt4', 'qt5'] dependencies : qtcore) test(qt + 'maninclude', qtmaninclude) + + # building Qt plugins implies to give include path to moc + plugin_includes = include_directories('pluginInterface', 'plugin') + pluginpreprocess = qtmodule.preprocess( + moc_headers : 'plugin/plugin.h', + include_directories : plugin_includes + ) + plugin = library('plugin', 'plugin/plugin.cpp', pluginpreprocess, + include_directories : plugin_includes, + dependencies : qtcore) endif endforeach diff --git a/test cases/frameworks/4 qt/plugin/plugin.cpp b/test cases/frameworks/4 qt/plugin/plugin.cpp new file mode 100644 index 0000000..eeae98d --- /dev/null +++ b/test cases/frameworks/4 qt/plugin/plugin.cpp @@ -0,0 +1,7 @@ +#include "plugin.h" +#include <QFile> + +QString plugin1::getResource() +{ + return "hello world"; +} diff --git a/test cases/frameworks/4 qt/plugin/plugin.h b/test cases/frameworks/4 qt/plugin/plugin.h new file mode 100644 index 0000000..1138f41 --- /dev/null +++ b/test cases/frameworks/4 qt/plugin/plugin.h @@ -0,0 +1,11 @@ +#pragma once +#include <plugin_if.h> + +class plugin1:public QObject,public PluginInterface +{ + Q_OBJECT + Q_INTERFACES(PluginInterface) + Q_PLUGIN_METADATA(IID "demo.PluginInterface" FILE "plugin.json") +public: + QString getResource() override; +}; diff --git a/test cases/frameworks/4 qt/plugin/plugin.json b/test cases/frameworks/4 qt/plugin/plugin.json new file mode 100644 index 0000000..6c6a011 --- /dev/null +++ b/test cases/frameworks/4 qt/plugin/plugin.json @@ -0,0 +1,3 @@ +{ + "name" : "Plugin1" +} diff --git a/test cases/frameworks/4 qt/pluginInterface/plugin_if.h b/test cases/frameworks/4 qt/pluginInterface/plugin_if.h new file mode 100644 index 0000000..97d2800 --- /dev/null +++ b/test cases/frameworks/4 qt/pluginInterface/plugin_if.h @@ -0,0 +1,21 @@ +#ifndef PLUGIN_IF_H +#define PLUGIN_IF_H + +#include <QString> +#include <QtPlugin> + +/** + * @brief Interface for a plugin + */ +class PluginInterface +{ +public: + virtual ~PluginInterface() = default; + + /// Initializes the plugin + virtual QString getResource() = 0; +}; + +Q_DECLARE_INTERFACE(PluginInterface, "demo.PluginInterface") + +#endif |