plugin-cmake: 增加对不同平台构建扩展时添加尾巴

This commit is contained in:
zinface 2023-02-12 23:06:48 +08:00
parent 2b9774a171
commit 44b879f7ce
1 changed files with 61 additions and 1 deletions

View File

@ -108,8 +108,68 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
endif(CMAKE_HOST_WIN32)
if(CMAKE_HOST_UNIX)
target_compile_definitions(${PLUGIN_VAR} PUBLIC NDD_EXPORT=export)
target_compile_definitions(${PLUGIN_VAR} PUBLIC NDD_EXPORT=)
endif(CMAKE_HOST_UNIX)
# ------------ 为在不同平台构建的插件定义输出名称(尾巴) ------------- #
# <OS> Windows/MacOS/Linux
# <ARCH> X86_64AMD64ARM64....
# <COMPILER> MinGWCygwinMSVCGNUClangIntel....
# <QT> Qt:
set(${PLUGIN_VAR}_OUTPUT_NAME ${PLUGIN_VAR})
# <OS> ------- Apple/Linux/Windows ------------------- #
if(APPLE)
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_MacOS")
elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID)
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Linux")
elseif(WIN32)
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Win32")
endif()
# <ARCH> ------- X86_64/AMD64/ARM64/... -------------- #
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${CMAKE_HOST_SYSTEM_PROCESSOR}")
# if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
# if(CMAKE_APPLE_SILICON_PROCESSOR)
# string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Silicon")
# endif(CMAKE_APPLE_SILICON_PROCESSOR)
# endif(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
# <COMPILER> -----
# string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_MinGW")
if(WIN32)
if(MINGW)
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_MinGW")
elseif(CYGWIN)
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Cygwin")
elseif(MSVC)
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_MSVC")
else() # MinGW Cygwin MSVC
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "")
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Unknow")
else() # CMAKE_CXX_COMPILER_ID
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${CMAKE_CXX_COMPILER_ID}")
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "")
endif()
else()
# MINGW MINGW GNU
string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${CMAKE_CXX_COMPILER_ID}")
endif()
# : GNU Compiler
# if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
# string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_GCC")
# endif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
# <Qt >
# if(NOT "${Qt5_}" STREQUAL "")
# string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${QT_VERSION}")
# endif(NOT "${QT_VERSION}" STREQUAL "")
set_property(TARGET ${PLUGIN_VAR}
PROPERTY
OUTPUT_NAME "${${PLUGIN_VAR}_OUTPUT_NAME}")
# ------------ ------------- #
# Notepad-- 使
target_include_directories(${PLUGIN_VAR} PUBLIC