# CustomExtensionSystem **Repository Path**: kingofloong/custom-extension-system ## Basic Information - **Project Name**: CustomExtensionSystem - **Description**: 基于QT插件机制的可扩展插件框架 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-03-11 - **Last Updated**: 2024-08-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CustomExtensionSystem(CES) This is a extensible plug-in system based on QT. ## Supported Platforms :white_check_mark::Win10 (MSVC-16.0) :white_large_square::Linux ## Summary 1.基于单例的PluginManager进行插件的扫描和插件实例化; 2.根据扫描后的插件元信息进行依赖解析; 3.根据解析队列进行已知插件的实例化; 4.对解析队列中的插件依次调用`初始化`和`开始` 5.在析构的时候调用`结束`和`反初始化` ## classDiagram ```mermaid classDiagram IPluginManager --> IPlugin IPluginManager --> IContext IContext --> IService IPlugin ..* IContext PluginA ..|> IPlugin PluginB ..|> IPlugin ServiceA ..|> IService ServiceB ..|> IService class IService{ + ServiceId() } class IContext{ + Registry() + UnRegistry() } class IPluginManager { + static GetInstance() + LoadPlugins() } class IPlugin { + InitPlugin(IContextSPtr) + StartPlugin() + StopPlugin() + DeInitPlugin() } ``` ## Project Directory structure ``` CES |-- bin_debug | |-- Example[d].dll/so //模块动态库输出文件 | |-- log //日志输出 | `-- plugin //插件动态库目录 | `-- Gui[d].dll/so //插件动态库输出文件 |-- config |-- include |-- src | |-- app //主程序入口 main | | |-- CMakeLists.txt | | `-- server.cc | |-- module //模块--提供基础接口(无实现)的标准模块和提供基础功能内置模块 | | |-- CMakeLists.txt //包含模块的创建调用 | | |-- Example //标准模块 | | | |-- CMakeLists.txt | | | |-- include //对外共有接口(.h/.hpp) | | | | `-- interface.h | | | `-- src //内部实现(.h/.cc/.cpp) | | | |-- foo.h | | | `-- foo.cc | | `-- Util //接口模块 | | |-- CMakeLists.txt | | `-- include //共有接口(.h/.hpp) | | `-- foo.h | `-- plugins //插件--基于同种接口的可替换或定制化的功能 | |-- CMakeLists.txt //包含插件的创建调用 | `-- Gui //Gui可根基不同项目单独定制,暂时无独立接口,基于QMainWindow | |-- CMakeLists.txt | |-- include //对外共有接口(.h/.hpp) | | `-- interface.h | `-- src //内部实现(.h/.cc/.cpp) | |-- foo.h | `-- foo.cc |-- template //工程模板 | |-- ModuleTemplate //模块模板 | | |-- CommonCMakeLists.txt.in | | |-- InterfaceCMakeLists.txt.in | | |-- include | | | `-- Global.h.in | | `-- src | |-- PluginTemplate //插件模板 | | |-- CMakeLists.txt.in | | |-- include | | | |-- Global.h.in | | | `-- PluginTemplate.json.in | | `-- src | | |-- PluginTemplate.cc.in | | `-- PluginTemplate.h.in | `-- ReadMe.md //模板ReadMe `-- third_party //第三方库依赖 `-- golog //git submodule ``` ## Dependencies - Qt 5.15.2 - MSVC-16.0(VS2019) - glog (V0.7.0-rc1) - ## Build ``` # Clone the repository git clone https://gitee.com/kingofloong/custom-extension-system.git cd custom-extension-system # initialize submodules git submodule update --init --recursive # make a build directory mkdir build && cd build # run CMake (additional options like -DCMAKE_PREFIX_PATH=F:\Qt\5.15.2\msvc2019_64 -DCMAKE_CXX_FLAGS='/utf-8' are possible) cmake .. # alternatively: cmake --build . make -j 12 ```