diff --git a/app/include/MainWindow.h b/app/include/MainWindow.h index d418326..c2f3cc7 100644 --- a/app/include/MainWindow.h +++ b/app/include/MainWindow.h @@ -70,12 +70,7 @@ private: inline void init_resources() { -#ifdef QT_STATICPLUGIN -#ifndef SQP_NO_PLUGINS - Q_IMPORT_PLUGIN(PythonProviders) - Q_INIT_RESOURCE(python_providers); -#endif -#endif + Q_IMPORT_PLUGIN(DemoPlugin); Q_INIT_RESOURCE(sqpguiresources); SqpApplication::setOrganizationName("LPP"); SqpApplication::setOrganizationDomain("lpp.fr"); diff --git a/app/meson.build b/app/meson.build index 3c6bbb3..dc9da82 100644 --- a/app/meson.build +++ b/app/meson.build @@ -29,32 +29,16 @@ else rc = [] endif -app_libs = [] -cpp_args = [] -if 'static' == get_option('default_library') - app_libs = [sciqlop_python_providers] - cpp_args += ['-DQT_STATICPLUGIN'] -endif +cpp_args = ['-DQT_STATICPLUGIN'] -#sciqlop_app = executable('sciqlop', -# app_sources, -# app_moc_files, -# rc, -# include_directories : [ app_inc], -# link_with: app_libs, -# cpp_args: cpp_args, -# dependencies : [sciqlop_gui, sciqlop_core], -# install : true -# ) sciqlop_app_lib = library('sciqlop', app_sources, app_moc_files, rc, include_directories : [ app_inc], - link_with: app_libs, cpp_args: cpp_args, - dependencies : [sciqlop_gui, sciqlop_core], + dependencies : [sciqlop_gui, sciqlop_core, demo_plugin_dep], install : true ) diff --git a/plugins/demo_plugin/DemoPlugin.cpp b/plugins/demo_plugin/DemoPlugin.cpp new file mode 100644 index 0000000..76e73e3 --- /dev/null +++ b/plugins/demo_plugin/DemoPlugin.cpp @@ -0,0 +1,7 @@ +#include "DemoPlugin.hpp" +#include + +void DemoPlugin::initialize() +{ + std::cout << "Loading DemoPlugin \\o/" << std::endl; +} diff --git a/plugins/demo_plugin/DemoPlugin.hpp b/plugins/demo_plugin/DemoPlugin.hpp new file mode 100644 index 0000000..3957021 --- /dev/null +++ b/plugins/demo_plugin/DemoPlugin.hpp @@ -0,0 +1,19 @@ +#ifndef SCIQLOP_DEMOPLUGIN_H +#define SCIQLOP_DEMOPLUGIN_H + +#include +#include + +#define PLUGIN_JSON_FILE_PATH "DemoPlugin.json" + + +class DemoPlugin : public QObject, public IPlugin { + Q_OBJECT + Q_INTERFACES(IPlugin) + Q_PLUGIN_METADATA(IID "sciqlop.plugin.IPlugin" FILE PLUGIN_JSON_FILE_PATH) +public: + /// @sa IPlugin::initialize() + void initialize() final; +}; + +#endif // SCIQLOP_DEMOPLUGIN_H diff --git a/plugins/demo_plugin/DemoPlugin.json b/plugins/demo_plugin/DemoPlugin.json new file mode 100644 index 0000000..824bca4 --- /dev/null +++ b/plugins/demo_plugin/DemoPlugin.json @@ -0,0 +1,3 @@ +{ + "name" : "DemoPlugin" +} diff --git a/plugins/demo_plugin/meson.build b/plugins/demo_plugin/meson.build new file mode 100644 index 0000000..d200414 --- /dev/null +++ b/plugins/demo_plugin/meson.build @@ -0,0 +1,25 @@ +demoplugin_moc_headers = [ + 'DemoPlugin.hpp' +] + +demoplugin_sources = [ + 'DemoPlugin.cpp' +] + + +demoplugin_moc_files = qt5.preprocess( + moc_headers: demoplugin_moc_headers, + dependencies: sciqlop_core, + include_directories: core_inc, + moc_extra_arguments : ['-DQT_PLUGIN', '-DQT_STATICPLUGIN'] + ) + +demo_plugin = static_library('demo_plugin', + 'DemoPlugin.cpp', + demoplugin_moc_files, + extra_files: 'DemoPlugin.hpp', + dependencies : [sciqlop_core], + cpp_args : ['-DQT_PLUGIN', '-DQT_STATICPLUGIN'] + ) + +demo_plugin_dep = declare_dependency(link_with: demo_plugin, include_directories: '.') diff --git a/plugins/meson.build b/plugins/meson.build index e69de29..52db1c2 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -0,0 +1,2 @@ + +subdir('demo_plugin')