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 target_link_directories(${PLUGIN_VAR} PUBLIC
${NOTEPAD_PLUGIN_LIBDIR}) ${NOTEPAD_PLUGIN_LIBDIR})
target_link_libraries(${PLUGIN_VAR} ${NOTEPAD_PLUGIN_CORELIB}) target_link_libraries(${PLUGIN_VAR} ${NOTEPAD_PLUGIN_CORELIB})
if(NOTEPAD_BUILD_BY_QT5) if(NOTEPAD_BUILD_BY_QT5)
target_link_libraries(${PLUGIN_VAR} Qt5::Core Qt5::Widgets) target_link_libraries(${PLUGIN_VAR} Qt5::Core Qt5::Widgets)
endif(NOTEPAD_BUILD_BY_QT5) endif(NOTEPAD_BUILD_BY_QT5)
@ -195,7 +196,17 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
# NOTEPAD_PLUGIN_MANAGER # NOTEPAD_PLUGIN_MANAGER
# Notepad-- # 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) endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)

View File

@ -32,10 +32,31 @@ endif(TRUE)
# ----------------- Notepad-- ----------------- # # ----------------- Notepad-- ----------------- #
if(TRUE) if(TRUE)
# # -
target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN=0) # target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN)
# ... # ...
endif(TRUE) 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

@ -20,7 +20,6 @@ if(TRUE)
# FAIL: only *.ui will spark_file_glob(MOC_HEADER ...) # FAIL: only *.ui will spark_file_glob(MOC_HEADER ...)
) )
spark_add_library(QSci STATIC ${QSciSources} ${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)
target_include_directories(QSci PRIVATE target_include_directories(QSci PRIVATE
src/qscint/scintilla/boostregex src/qscint/scintilla/boostregex
src/qscint/scintilla/lexlib) src/qscint/scintilla/lexlib)
@ -36,4 +35,30 @@ endif(TRUE)
# QSci PrintSupportConcurrent # 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)