cmake/modules: 重新设计 QScintilla 库构建的宏控制形式

This commit is contained in:
zinface 2023-02-22 11:33:46 +08:00
parent 661a165f8e
commit 4a463afbb1
3 changed files with 65 additions and 8 deletions

View File

@ -185,6 +185,7 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
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)
endif(NOTEPAD_BUILD_BY_QT5)
@ -195,7 +196,17 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
# NOTEPAD_PLUGIN_MANAGER
# Notepad--
target_compile_definitions(${PLUGIN_VAR} PUBLIC NOTEPAD_PLUGIN_MANAGER=)
if(WIN32)
target_compile_definitions(${PLUGIN_VAR}
PUBLIC
NOTEPAD_PLUGIN_MANAGER
QSCINTILLA_DLL # Windows 使 QSci Q_DECL_IMPORT
# QSCINTILLA_EXPORT Q_DECL_IMPORT
)
else()
target_compile_definitions(${PLUGIN_VAR}
PUBLIC NOTEPAD_PLUGIN_MANAGER)
endif(WIN32)
endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
@ -215,4 +226,4 @@ message(" - ${NOTEPAD_PLUGIN_INCLUDEDIR}")
message(" - ${NOTEPAD_PLUGIN_LIBDIR}")
message(" - ${NOTEPAD_PLUGIN_CORELIB}")
message(" - ${NOTEPAD_IMPORTED_CORELIB_PATH}")
message("- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<")
message("- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<")

View File

@ -32,10 +32,31 @@ endif(TRUE)
# ----------------- Notepad-- ----------------- #
if(TRUE)
#
target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN=0)
# -
# target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN)
# ...
endif(TRUE)
# Notepad-- QSci Qt5::XmlPatterns
# Notepad-- QSci Qt5::XmlPatterns
# Notepad-- ...
# ----------------- Notepad-- ----------------- #
if(WIN32)
# Windows QScintilla
target_compile_definitions(${PROJECT_NAME}
PRIVATE
NO_PLUGIN #
QSCINTILLA_DLL # Windows 使 QSci Q_DECL_IMPORT
# QSCINTILLA_EXPORT Q_DECL_IMPORT
)
endif(WIN32)
if(UNIX)
# Windows QScintilla
target_compile_definitions(${PROJECT_NAME}
PRIVATE
NO_PLUGIN #
)
endif(UNIX)

View File

@ -19,8 +19,7 @@ if(TRUE)
# src/qscint/src/Qsci
# FAIL: only *.ui will spark_file_glob(MOC_HEADER ...)
)
spark_add_library(QSci STATIC ${QSciSources} ${MOC_HEADER})
target_compile_definitions(QSci PRIVATE SCINTILLA_QT SCI_LEXER INCLUDE_DEPRECATED_FEATURES QSCINTILLA_MAKE_DLL)
spark_add_library(QSci STATIC ${QSciSources} ${MOC_HEADER})
target_include_directories(QSci PRIVATE
src/qscint/scintilla/boostregex
src/qscint/scintilla/lexlib)
@ -36,4 +35,30 @@ endif(TRUE)
# QSci PrintSupportConcurrent
# QSci ...
# QSci ...
if(WIN32)
# Windows QScintilla
target_compile_definitions(QSci
PRIVATE
SCINTILLA_QT #
SCI_LEXER #
INCLUDE_DEPRECATED_FEATURES #
QSCINTILLA_MAKE_DLL # Windows Q_DECL_EXPORT
# Windows 使 Q_DECL_IMPORT
# QSCINTILLA_EXPORT
# 构建时(导出)由外部使用时(导入)
)
endif(WIN32)
if(UNIX)
# Linux QScintilla
target_compile_definitions(QSci
PRIVATE
SCINTILLA_QT #
SCI_LEXER #
INCLUDE_DEPRECATED_FEATURES #
# QSCINTILLA_MAKE_DLL # Linux 使 Q_DECL_EXPORT Q_DECL_IMPORT
# QSCINTILLA_EXPORT
)
endif(UNIX)