From 02549b5739eaef3fd40a9409a8c083390013ddd3 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 8 Feb 2023 03:12:03 +0800 Subject: [PATCH] =?UTF-8?q?plugin-cmake:=20=E5=AF=B9=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=97=B6=E5=90=AF=E7=94=A8=20NOTEPAD=5FPLUGI?= =?UTF-8?q?N=5FMANAGER=20=E5=AE=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index 37ad692..77a4278 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -56,6 +56,7 @@ set_target_properties(${${NOTEPAD_PLUGIN}} PROPERTIES macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) # aux_source_directory(${PLUGIN_VAR}_SOURCES ${ARGN}) add_library(${PLUGIN_VAR} SHARED ${PLUGIN_SRC} ${ARGN}) + if(CMAKE_HOST_WIN32) # Win32 已提供宏判断 # target_compile_definitions(${PLUGIN_VAR} PUBLIC NDD_EXPORT=export) @@ -64,8 +65,12 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) if(CMAKE_HOST_UNIX) target_compile_definitions(${PLUGIN_VAR} PUBLIC NDD_EXPORT=export) endif(CMAKE_HOST_UNIX) - target_include_directories(${PLUGIN_VAR} PUBLIC ${NOTEPAD_PLUGIN_INCLUDEDIR} ${NOTEPAD_PLUGIN_EXTERNAL_INCLUDES}) - target_link_directories(${PLUGIN_VAR} PUBLIC ${NOTEPAD_PLUGIN_LIBDIR}) + + # Notepad-- 插件开发时应该使用的 头文件安装目录、库文件安装目录 + target_include_directories(${PLUGIN_VAR} PUBLIC + ${NOTEPAD_PLUGIN_INCLUDEDIR} ${NOTEPAD_PLUGIN_EXTERNAL_INCLUDES}) + target_link_directories(${PLUGIN_VAR} PUBLIC + ${NOTEPAD_PLUGIN_LIBDIR}) target_link_libraries(${PLUGIN_VAR} ${NOTEPAD_PLUGIN_CORELIB}) if(NOTEPAD_BUILD_BY_QT5) target_link_libraries(${PLUGIN_VAR} Qt5::Core Qt5::Widgets) @@ -74,6 +79,10 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) if(NOTEPAD_BUILD_BY_QT6) target_link_libraries(${PLUGIN_VAR} Qt6::Core Qt6::Widgets) endif(NOTEPAD_BUILD_BY_QT6) + + # 这是插件实现接口中增加的 NOTEPAD_PLUGIN_MANAGER 宏开关 + # 来处理减少 Notepad-- 在编译时不需要,但在插件编译时所需要的模板内容 + target_compile_definitions(${PLUGIN_VAR} PUBLIC NOTEPAD_PLUGIN_MANAGER=) endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)