cmake-plugin: 抽离 base-plugin-interface/interfaces

This commit is contained in:
zinface 2023-04-28 13:54:53 +08:00
parent 372378f5e4
commit 0d64dc621f
11 changed files with 62 additions and 10 deletions

View File

@ -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)

View File

@ -0,0 +1,4 @@
Symbolically linked file from template-plugins/base-plugin-interface
NOTE: This file should not be changed.

View File

@ -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)

View File

@ -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})

View File

@ -0,0 +1 @@
../../interfaces/