diff --git a/src/plugin/CMakeLists.txt b/src/plugin/CMakeLists.txt index 6203de1..06953e2 100644 --- a/src/plugin/CMakeLists.txt +++ b/src/plugin/CMakeLists.txt @@ -5,6 +5,9 @@ option(USE_NOTEPAD_PLUGIN_BASE "构建 Notepad-- 内部的插件基础模板" OF if(USE_NOTEPAD_PLUGIN) + # 可扩展插件接口 + include(interfaces/interfaces.cmake) + if(USE_NOTEPAD_PLUGIN_BASE) # 默认的测试插件 add_subdirectory(test) diff --git a/src/plugin/interfaces/README.md b/src/plugin/interfaces/README.md new file mode 100644 index 0000000..c968167 --- /dev/null +++ b/src/plugin/interfaces/README.md @@ -0,0 +1,4 @@ + +Symbolically linked file from template-plugins/base-plugin-interface + +NOTE: This file should not be changed. \ No newline at end of file diff --git a/src/plugin/interfaces/interfaces.cmake b/src/plugin/interfaces/interfaces.cmake new file mode 100644 index 0000000..54fa047 --- /dev/null +++ b/src/plugin/interfaces/interfaces.cmake @@ -0,0 +1,36 @@ +# interfaces.cmake + # 仅作为在上层进行引入的方案 + +# 构建可扩展插件能力的接口 + # 从 base-plugin-interface 中进行设计并构建为 plugin_interface + + +if(TRUE) + set(interfaces + ${CMAKE_CURRENT_LIST_DIR}/ndd-base + ${CMAKE_CURRENT_LIST_DIR}/ndd-menu + ${CMAKE_CURRENT_LIST_DIR}/ndd-dock + ) + message("interfaces:" "${interfaces}") + + spark_add_library_file_glob(plugin_interface STATIC + interfaces/ndd-base/*.h interfaces/ndd-base/*.cpp + interfaces/ndd-menu/*.h interfaces/ndd-menu/*.cpp + interfaces/ndd-dock/*.h interfaces/ndd-dock/*.cpp + ) + target_include_directories(plugin_interface + PUBLIC + ${interfaces}) + # target_link_qt5(plugin_interface) + if(USE_QT6) + target_link_qt6(plugin_interface) + else() + target_link_qt5(plugin_interface) + endif(USE_QT6) +endif(TRUE) + +# 使用 spark 风格链接的 plugin_interface +macro(target_link_plugin_interface _target) + target_link_libraries(${_target} + plugin_interface) +endmacro(target_link_plugin_interface _target) \ No newline at end of file diff --git a/src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-base/ndd_plugin_base_interface.cpp b/src/plugin/interfaces/ndd-base/ndd_plugin_base_interface.cpp similarity index 100% rename from src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-base/ndd_plugin_base_interface.cpp rename to src/plugin/interfaces/ndd-base/ndd_plugin_base_interface.cpp diff --git a/src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-base/ndd_plugin_base_interface.h b/src/plugin/interfaces/ndd-base/ndd_plugin_base_interface.h similarity index 100% rename from src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-base/ndd_plugin_base_interface.h rename to src/plugin/interfaces/ndd-base/ndd_plugin_base_interface.h diff --git a/src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-dock/ndd_plugin_dock_interface.cpp b/src/plugin/interfaces/ndd-dock/ndd_plugin_dock_interface.cpp similarity index 100% rename from src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-dock/ndd_plugin_dock_interface.cpp rename to src/plugin/interfaces/ndd-dock/ndd_plugin_dock_interface.cpp diff --git a/src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-dock/ndd_plugin_dock_interface.h b/src/plugin/interfaces/ndd-dock/ndd_plugin_dock_interface.h similarity index 100% rename from src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-dock/ndd_plugin_dock_interface.h rename to src/plugin/interfaces/ndd-dock/ndd_plugin_dock_interface.h diff --git a/src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-menu/ndd_plugin_menu_interface.cpp b/src/plugin/interfaces/ndd-menu/ndd_plugin_menu_interface.cpp similarity index 100% rename from src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-menu/ndd_plugin_menu_interface.cpp rename to src/plugin/interfaces/ndd-menu/ndd_plugin_menu_interface.cpp diff --git a/src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-menu/ndd_plugin_menu_interface.h b/src/plugin/interfaces/ndd-menu/ndd_plugin_menu_interface.h similarity index 100% rename from src/plugin/template-plugins/base-plugin-interface/interfaces/ndd-menu/ndd_plugin_menu_interface.h rename to src/plugin/interfaces/ndd-menu/ndd_plugin_menu_interface.h diff --git a/src/plugin/template-plugins/base-plugin-interface/CMakeLists.txt b/src/plugin/template-plugins/base-plugin-interface/CMakeLists.txt index 56a03b5..541771f 100644 --- a/src/plugin/template-plugins/base-plugin-interface/CMakeLists.txt +++ b/src/plugin/template-plugins/base-plugin-interface/CMakeLists.txt @@ -92,24 +92,32 @@ endif(UNIX) # ----------------- base-plugin-interface 构建接口化插件支持相关 ----------------- # -macro(target_link_plugin_interface _target) +# 构建可扩展插件能力的接口 ndd_plugin_interface (仅在此处使用) +macro(target_link_ndd_plugin_interface _target) set(interfaces interfaces/ndd-base interfaces/ndd-menu - interfaces/ndd-dock) + interfaces/ndd-dock + ) - spark_add_library_file_glob(plugin_interface STATIC + spark_add_library_file_glob(ndd_plugin_interface STATIC interfaces/ndd-base/*.h interfaces/ndd-base/*.cpp interfaces/ndd-menu/*.h interfaces/ndd-menu/*.cpp interfaces/ndd-dock/*.h interfaces/ndd-dock/*.cpp ) - target_include_directories(plugin_interface + target_include_directories(ndd_plugin_interface PUBLIC ${interfaces}) - target_link_qt5(plugin_interface) - - target_link_libraries(${_target} - plugin_interface) -endmacro(target_link_plugin_interface _target) + if(USE_QT6) + target_link_qt6(ndd_plugin_interface) + else() + target_link_qt5(ndd_plugin_interface) + endif(USE_QT6) + + target_link_libraries(${_target} + ndd_plugin_interface) +endmacro(target_link_ndd_plugin_interface _target) + +# 构建可扩展插件能力的接口 ndd_plugin_interface (仅在此处使用) +target_link_ndd_plugin_interface(${LOCAL_PLUGIN_NAME}) -target_link_plugin_interface(${LOCAL_PLUGIN_NAME}) diff --git a/src/plugin/template-plugins/base-plugin-interface/interfaces b/src/plugin/template-plugins/base-plugin-interface/interfaces new file mode 120000 index 0000000..035d154 --- /dev/null +++ b/src/plugin/template-plugins/base-plugin-interface/interfaces @@ -0,0 +1 @@ +../../interfaces/ \ No newline at end of file