cmake-plugin: 调整 external-plugin 插件适配可扩展宏方案

This commit is contained in:
zinface 2023-04-25 23:50:37 +08:00
parent cbd8d0e97b
commit 505bb25c0e
2 changed files with 24 additions and 2 deletions

View File

@ -7,6 +7,9 @@
# external-plugin -> your plugin name
set(LOCAL_PLUGIN_NAME "external-plugin")
set(LOCAL_PLUGIN_VERSION "0.1")
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/config.h.in plugin-config.h @ONLY)
# external-plugin
# external-plugin
@ -55,6 +58,11 @@ endif(TRUE)
# ----------------- external-plugin ----------------- #
target_compile_definitions(${LOCAL_PLUGIN_NAME}
#
PRIVATE
NOTEPAD_PLUGIN_DECLARE_PLUGIN_CONFIG)
if(WIN32 AND NOTEPAD_BUILD_BY_SHARED)
# Windows QScintilla
target_compile_definitions(${LOCAL_PLUGIN_NAME}

View File

@ -6,6 +6,20 @@
#include "ndd_plugin_implement.h"
NOTEPAD_PLUGIN_METADATA_IDENTIFY_V1(u8"外部插件扩展测试", "0.1", "zinface", u8"基于 QMainWindow Ui 的插件", "");
NOTEPAD_PLUGIN_METADATA_IDENTIFY_1 {
USE_IDENTIFY_VARIABLES
NOTEPAD_PLUGIN_METADATA_IMPLEMENT_V1(NddPluginImplement, false);
NOTEPAD_PLUGIN_METADATA(u8"外部插件扩展测试", PLUGIN_VERSION, "zinface", u8"基于 QMainWindow Ui 的插件", "")
return true;
}
NOTEPAD_PLUGIN_METADATA_IMPLEMENT_1 {
USE_IMPLEMENT_VARIABLES
auto imp = new NddPluginImplement(s_pNotepad, s_getCurEdit());
imp->setCurrentEditFunc(s_getCurEdit);
imp->setMenuActions(s_pProcData.m_rootMenu);
return 0;
}