##// END OF EJS Templates
Adds basic demo plugin to explain how to write custom plugins in C++...
jeandet -
r1509:3eb0350f563b
parent child
Show More
@@ -0,0 +1,7
1 #include "DemoPlugin.hpp"
2 #include <iostream>
3
4 void DemoPlugin::initialize()
5 {
6 std::cout << "Loading DemoPlugin \\o/" << std::endl;
7 }
@@ -0,0 +1,19
1 #ifndef SCIQLOP_DEMOPLUGIN_H
2 #define SCIQLOP_DEMOPLUGIN_H
3
4 #include <IPlugin.h>
5 #include <QtPlugin>
6
7 #define PLUGIN_JSON_FILE_PATH "DemoPlugin.json"
8
9
10 class DemoPlugin : public QObject, public IPlugin {
11 Q_OBJECT
12 Q_INTERFACES(IPlugin)
13 Q_PLUGIN_METADATA(IID "sciqlop.plugin.IPlugin" FILE PLUGIN_JSON_FILE_PATH)
14 public:
15 /// @sa IPlugin::initialize()
16 void initialize() final;
17 };
18
19 #endif // SCIQLOP_DEMOPLUGIN_H
@@ -0,0 +1,3
1 {
2 "name" : "DemoPlugin"
3 }
@@ -0,0 +1,25
1 demoplugin_moc_headers = [
2 'DemoPlugin.hpp'
3 ]
4
5 demoplugin_sources = [
6 'DemoPlugin.cpp'
7 ]
8
9
10 demoplugin_moc_files = qt5.preprocess(
11 moc_headers: demoplugin_moc_headers,
12 dependencies: sciqlop_core,
13 include_directories: core_inc,
14 moc_extra_arguments : ['-DQT_PLUGIN', '-DQT_STATICPLUGIN']
15 )
16
17 demo_plugin = static_library('demo_plugin',
18 'DemoPlugin.cpp',
19 demoplugin_moc_files,
20 extra_files: 'DemoPlugin.hpp',
21 dependencies : [sciqlop_core],
22 cpp_args : ['-DQT_PLUGIN', '-DQT_STATICPLUGIN']
23 )
24
25 demo_plugin_dep = declare_dependency(link_with: demo_plugin, include_directories: '.')
@@ -70,12 +70,7 private:
70
70
71 inline void init_resources()
71 inline void init_resources()
72 {
72 {
73 #ifdef QT_STATICPLUGIN
73 Q_IMPORT_PLUGIN(DemoPlugin);
74 #ifndef SQP_NO_PLUGINS
75 Q_IMPORT_PLUGIN(PythonProviders)
76 Q_INIT_RESOURCE(python_providers);
77 #endif
78 #endif
79 Q_INIT_RESOURCE(sqpguiresources);
74 Q_INIT_RESOURCE(sqpguiresources);
80 SqpApplication::setOrganizationName("LPP");
75 SqpApplication::setOrganizationName("LPP");
81 SqpApplication::setOrganizationDomain("lpp.fr");
76 SqpApplication::setOrganizationDomain("lpp.fr");
@@ -29,32 +29,16 else
29 rc = []
29 rc = []
30 endif
30 endif
31
31
32 app_libs = []
32 cpp_args = ['-DQT_STATICPLUGIN']
33 cpp_args = []
34 if 'static' == get_option('default_library')
35 app_libs = [sciqlop_python_providers]
36 cpp_args += ['-DQT_STATICPLUGIN']
37 endif
38
33
39 #sciqlop_app = executable('sciqlop',
40 # app_sources,
41 # app_moc_files,
42 # rc,
43 # include_directories : [ app_inc],
44 # link_with: app_libs,
45 # cpp_args: cpp_args,
46 # dependencies : [sciqlop_gui, sciqlop_core],
47 # install : true
48 # )
49
34
50 sciqlop_app_lib = library('sciqlop',
35 sciqlop_app_lib = library('sciqlop',
51 app_sources,
36 app_sources,
52 app_moc_files,
37 app_moc_files,
53 rc,
38 rc,
54 include_directories : [ app_inc],
39 include_directories : [ app_inc],
55 link_with: app_libs,
56 cpp_args: cpp_args,
40 cpp_args: cpp_args,
57 dependencies : [sciqlop_gui, sciqlop_core],
41 dependencies : [sciqlop_gui, sciqlop_core, demo_plugin_dep],
58 install : true
42 install : true
59 )
43 )
60
44
@@ -0,0 +1,2
1
2 subdir('demo_plugin')
General Comments 0
You need to be logged in to leave comments. Login now