mirror of https://gitee.com/cxasm/notepad--.git
spark: 将 message 转为 spark_debug_message 来确保不打印大量消息
This commit is contained in:
parent
08ded5d7ed
commit
bb5af11a50
|
@ -5,4 +5,12 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
# set(CMAKE_BUILD_TYPE "Debug")
|
||||
# set(CMAKE_BUILD_TYPE "Debug")
|
||||
|
||||
option(SPARK_DEBUG_MESSAGE "CMake Spark Module Debug Message." OFF)
|
||||
|
||||
macro(spark_debug_message)
|
||||
if(SPARK_DEBUG_MESSAGE)
|
||||
message(${ARGN})
|
||||
endif(SPARK_DEBUG_MESSAGE)
|
||||
endmacro(spark_debug_message)
|
||||
|
|
|
@ -46,7 +46,7 @@ macro(spark_add_links_qt5)
|
|||
|
||||
string(TOLOWER "${qt5_item}" qt5_lower_item)
|
||||
spark_add_link_qt5(${qt5_lower_item} Qt5::${qt5_item})
|
||||
message("add_target_link_qt5_${qt5_item} or add_target_link_qt5_${qt5_lower_item}")
|
||||
spark_debug_message("add_target_link_qt5_${qt5_item} or add_target_link_qt5_${qt5_lower_item}")
|
||||
endforeach(qt5_item IN LISTS qt5_items)
|
||||
endmacro(spark_add_links_qt5)
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ macro(spark_add_links_qt6)
|
|||
|
||||
string(TOLOWER "${qt6_item}" qt6_lower_item)
|
||||
spark_add_link_qt6(${qt6_lower_item} Qt6::${qt6_item})
|
||||
message("add_target_link_qt6_${qt6_item} or add_target_link_qt6_${qt6_lower_item}")
|
||||
spark_debug_message("add_target_link_qt6_${qt6_item} or add_target_link_qt6_${qt6_lower_item}")
|
||||
endforeach(qt6_item IN LISTS qt6_items)
|
||||
endmacro(spark_add_links_qt6)
|
||||
|
||||
|
|
|
@ -6,16 +6,16 @@ cmake_minimum_required(VERSION 3.5.1)
|
|||
# 构建一个库,基于指定的源文件
|
||||
# 并根据库名生成 target_link_<lib_name> 函数
|
||||
macro(spark_add_library _lib_name)
|
||||
message("================ ${_lib_name} Library ================")
|
||||
spark_debug_message("================ ${_lib_name} Library ================")
|
||||
add_library(${_lib_name} ${ARGN})
|
||||
|
||||
set(SRCS ${ARGN})
|
||||
foreach(item IN LISTS SRCS)
|
||||
message(" -> ${item}")
|
||||
spark_debug_message(" -> ${item}")
|
||||
endforeach(item IN LISTS SRCS)
|
||||
|
||||
function(target_link_${_lib_name} TARGET)
|
||||
message("${_lib_name}")
|
||||
spark_debug_message("${_lib_name}")
|
||||
target_link_libraries(${TARGET} ${_lib_name})
|
||||
endfunction(target_link_${_lib_name} TARGET)
|
||||
|
||||
|
@ -32,7 +32,7 @@ macro(spark_add_library_path _lib_name _lib_path)
|
|||
if(${${_lib_name}_SOURCE_PATH} STREQUAL SHARED OR ${${_lib_name}_SOURCE_PATH} STREQUAL STATIC)
|
||||
set(${_lib_name}_SOURCE_PATH ${ARGV2})
|
||||
set(${_lib_name}_TYPE ${_lib_path})
|
||||
message("_lib_path: ${${_lib_name}_SOURCE_PATH}(${ARGV2})[${${_lib_name}_TYPE}]")
|
||||
spark_debug_message("_lib_path: ${${_lib_name}_SOURCE_PATH}(${ARGV2})[${${_lib_name}_TYPE}]")
|
||||
|
||||
if(${ARGC} LESS 3)
|
||||
message(FATAL_ERROR "Missing parameter, library path not specified.")
|
||||
|
@ -41,24 +41,24 @@ macro(spark_add_library_path _lib_name _lib_path)
|
|||
|
||||
aux_source_directory(${${_lib_name}_SOURCE_PATH} ${_lib_name}_SOURCES)
|
||||
|
||||
message("================ spark_add_library_path: ${_lib_name} ================")
|
||||
# message("================ spark_add_library_path: ${_lib_name} ================")
|
||||
file(GLOB UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${${_lib_name}_SOURCE_PATH}/*.ui)
|
||||
add_library(${_lib_name} ${${_lib_name}_TYPE} ${${_lib_name}_SOURCES} ${UI_LIST})
|
||||
message("${_lib_name}_SOURCES: ${${_lib_name}_SOURCES}, ${${_lib_name}_SOURCE_PATH}")
|
||||
spark_debug_message("${_lib_name}_SOURCES: ${${_lib_name}_SOURCES}, ${${_lib_name}_SOURCE_PATH}")
|
||||
foreach(item IN LISTS ${_lib_name}_SOURCES)
|
||||
message(" -> ${item}")
|
||||
spark_debug_message(" -> ${item}")
|
||||
endforeach(item IN LISTS ${_lib_name}_SOURCES)
|
||||
|
||||
function(target_link_${_lib_name} TARGET)
|
||||
# message("target_link_${_lib_name}")
|
||||
message(" -> (include): ${${_lib_name}_SOURCE_PATH}")
|
||||
# spark_debug_message("target_link_${_lib_name}")
|
||||
spark_debug_message(" -> (include): ${${_lib_name}_SOURCE_PATH}")
|
||||
target_include_directories(${TARGET} PUBLIC "${${_lib_name}_SOURCE_PATH}")
|
||||
target_link_libraries(${TARGET} ${_lib_name})
|
||||
endfunction(target_link_${_lib_name} TARGET)
|
||||
|
||||
function(target_include_${_lib_name} TARGET)
|
||||
# message("target_link_${_lib_name}")
|
||||
message(" -> (include): ${${_lib_name}_SOURCE_PATH}")
|
||||
# spark_debug_message("target_link_${_lib_name}")
|
||||
spark_debug_message(" -> (include): ${${_lib_name}_SOURCE_PATH}")
|
||||
target_include_directories(${TARGET} PUBLIC "${${_lib_name}_SOURCE_PATH}")
|
||||
# target_link_libraries(${TARGET} ${_lib_name})
|
||||
endfunction(target_include_${_lib_name} TARGET)
|
||||
|
@ -74,8 +74,8 @@ macro(spark_add_library_path _lib_name _lib_path)
|
|||
# 手动操作将必须使用绝对路径,这是不好的地方
|
||||
# get_target_property(_lib_include_directories ${_lib_name} INCLUDE_DIRECTORIES)
|
||||
# list(APPEND _lib_include_directories "${CMAKE_CURRENT_LIST_DIR}/${${_lib_name}_SOURCE_PATH}")
|
||||
# message("----> ${CMAKE_CURRENT_LIST_DIR}/${${_lib_name}_SOURCE_PATH}")
|
||||
# message("----> ${_lib_include_directories}")
|
||||
# spark_debug_message("----> ${CMAKE_CURRENT_LIST_DIR}/${${_lib_name}_SOURCE_PATH}")
|
||||
# spark_debug_message("----> ${_lib_include_directories}")
|
||||
# set_target_properties(${_lib_name} PROPERTIES
|
||||
# INCLUDE_DIRECTORIES "${_lib_include_directories}"
|
||||
# INTERFACE_INCLUDE_DIRECTORIES "${_lib_include_directories}"
|
||||
|
@ -88,7 +88,7 @@ endmacro(spark_add_library_path _lib_name _lib_path)
|
|||
# Qt编译时源文件包括很多类型,需要指定 *.h/*.cpp/*.qrc/*.qm/... 等
|
||||
macro(spark_add_executable _exec_name)
|
||||
|
||||
message("================ ${_exec_name} Executable ================")
|
||||
spark_debug_message("================ ${_exec_name} Executable ================")
|
||||
add_executable(${_exec_name} ${ARGN})
|
||||
|
||||
endmacro(spark_add_executable _exec_name)
|
||||
|
@ -96,16 +96,16 @@ endmacro(spark_add_executable _exec_name)
|
|||
macro(spark_add_executable_path _exec_name _exec_path)
|
||||
aux_source_directory(${_exec_path} ${_exec_name}_SOURCES)
|
||||
|
||||
message("================ ${_exec_name} Executable ================")
|
||||
spark_debug_message("================ ${_exec_name} Executable ================")
|
||||
file(GLOB UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_exec_path}/*.ui)
|
||||
add_executable(${_exec_name} ${${_exec_name}_SOURCES} ${ARGN} ${UI_LIST})
|
||||
foreach(item IN LISTS ${_exec_name}_SOURCES)
|
||||
message(" -> ${item}")
|
||||
spark_debug_message(" -> ${item}")
|
||||
endforeach(item IN LISTS ${_exec_name}_SOURCES)
|
||||
|
||||
# function(target_link_${_exec_name} TARGET)
|
||||
# message("target_link_${_lib_name}")
|
||||
message(" -> (include): ${_exec_path}")
|
||||
# spark_debug_message("target_link_${_lib_name}")
|
||||
spark_debug_message(" -> (include): ${_exec_path}")
|
||||
target_include_directories(${_exec_name} PUBLIC "${_exec_path}")
|
||||
# target_link_libraries(${TARGET} ${_lib_name})
|
||||
# endfunction(target_link_${_exec_name} TARGET)
|
||||
|
@ -140,7 +140,7 @@ macro(spark_add_executable_paths _prefix_path)
|
|||
set(PATHS ${ARGN})
|
||||
foreach(item IN LISTS PATHS)
|
||||
file(GLOB QRCS "${item}/*.qrc")
|
||||
message(">>> add_executable: " "${_prefix_path}-${item} ${item} + ${QRCS}")
|
||||
spark_debug_message(">>> add_executable: " "${_prefix_path}-${item} ${item} + ${QRCS}")
|
||||
spark_add_executable_path(${_prefix_path}-${item} ${item} ${QRCS})
|
||||
target_link_qt5(${_prefix_path}-${item})
|
||||
endforeach(item IN LISTS PATHS)
|
||||
|
@ -154,7 +154,7 @@ endmacro(spark_add_executable_paths _prefix_path)
|
|||
# _NAME: 用于此 fucntion 中的要求参数: <_NAME>目标将要连接此库
|
||||
macro(spark_add_link _IN_NAME)
|
||||
function(target_link_${_IN_NAME} _NAME)
|
||||
message("LINK ${_NAME} ${ARGN}")
|
||||
spark_debug_message("LINK ${_NAME} ${ARGN}")
|
||||
target_link_libraries(${_NAME}
|
||||
${ARGN})
|
||||
endfunction(target_link_${_IN_NAME} _NAME)
|
||||
|
|
|
@ -46,32 +46,32 @@ function(plus_list INVAL OUTVAL OUTVALLEN)
|
|||
find_plus(${INVAL} RIGHT_PLUS)
|
||||
|
||||
string(LENGTH "${INVAL}" INVALLEN)
|
||||
message("--> 传入的 INVAL: --> 内容: ${INVAL}")
|
||||
message("--> 传入的 INVAL: --> 长度: ${INVALLEN}")
|
||||
message("--> 传入的 INVAL: --> +位置: ${RIGHT_PLUS}")
|
||||
spark_debug_message("--> 传入的 INVAL: --> 内容: ${INVAL}")
|
||||
spark_debug_message("--> 传入的 INVAL: --> 长度: ${INVALLEN}")
|
||||
spark_debug_message("--> 传入的 INVAL: --> +位置: ${RIGHT_PLUS}")
|
||||
|
||||
# 判断是否有右侧 + 号
|
||||
if(RIGHT_PLUS LESS 0)
|
||||
message("--> 传入的 INVAL: --> 无需计算新的+位置")
|
||||
# message("--> 计算新的 + 位置: ${_PLUSINDEX}")
|
||||
spark_debug_message("--> 传入的 INVAL: --> 无需计算新的+位置")
|
||||
# spark_debug_message("--> 计算新的 + 位置: ${_PLUSINDEX}")
|
||||
list(APPEND _tmps ${INVAL})
|
||||
else()
|
||||
math(EXPR _PLUSINDEX "${RIGHT_PLUS}+1")
|
||||
message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX}")
|
||||
spark_debug_message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX}")
|
||||
|
||||
string(SUBSTRING "${INVAL}" ${_PLUSINDEX} ${INVALLEN} NewVal)
|
||||
message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX} -> 内容: ${NewVal}")
|
||||
spark_debug_message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX} -> 内容: ${NewVal}")
|
||||
# string(REPLACE "+" ";" _tmps "${NewVal}")
|
||||
# list(LENGTH FFFFL FFFFLEN)
|
||||
|
||||
# message("--> 计算新的 + 位置: ${_PLUSINDEX} --> 后面的 NewVal: ${NewVal}")
|
||||
# spark_debug_message("--> 计算新的 + 位置: ${_PLUSINDEX} --> 后面的 NewVal: ${NewVal}")
|
||||
|
||||
# find_plus(${NewVal} _NextPlus)
|
||||
# if(_NextPlus LESS 0)
|
||||
# list(APPEND _tmps ${NewVal})
|
||||
# message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的")
|
||||
# spark_debug_message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的")
|
||||
# else()
|
||||
# message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的")
|
||||
# spark_debug_message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的")
|
||||
# # 重新
|
||||
# # plus_list(${NewVal} NewValS )
|
||||
# # foreach(item)
|
||||
|
@ -87,29 +87,29 @@ function(plus_list INVAL OUTVAL OUTVALLEN)
|
|||
endfunction(plus_list INVAL OUTVAL OUTVALLEN)
|
||||
|
||||
# plus_list("+AAA+BBB+CCC+DDD" FFF FFLEN)
|
||||
# message("--------> ${FFF}: -> ${FFLEN}")
|
||||
# spark_debug_message("--------> ${FFF}: -> ${FFLEN}")
|
||||
|
||||
# spark_add_library_realpaths
|
||||
# 基于传入的项进行构建
|
||||
# 可接受的值为: 路径列表
|
||||
# 可接受的值为: 路径列表+依赖库A+依赖库B
|
||||
macro(spark_add_library_realpaths)
|
||||
message("---> 基于传入的项进行构建 <---")
|
||||
# message("--> src/unclassified/ItemDelegates/NdStyledItemDelegate")
|
||||
spark_debug_message("---> 基于传入的项进行构建 <---")
|
||||
# spark_debug_message("--> src/unclassified/ItemDelegates/NdStyledItemDelegate")
|
||||
# string(FIND <string> <substring> <output_variable> [REVERSE])
|
||||
# string(SUBSTRING <string> <begin> <length> <output_variable>)
|
||||
# math(EXPR value "100 * 0xA" OUTPUT_FORMAT DECIMAL) # value is set to "1000"
|
||||
|
||||
set(REALPATHS ${ARGN})
|
||||
foreach(REALPATH IN LISTS REALPATHS)
|
||||
message("---> 传入路径: ${REALPATH} <--- ")
|
||||
spark_debug_message("---> 传入路径: ${REALPATH} <--- ")
|
||||
string(LENGTH "${REALPATH}" REALPATH_LENGTH)
|
||||
message("---> 计算传入路径长度: --> 长度: ${REALPATH_LENGTH}")
|
||||
spark_debug_message("---> 计算传入路径长度: --> 长度: ${REALPATH_LENGTH}")
|
||||
|
||||
string(FIND "${REALPATH}" "/" LASTINDEX REVERSE)
|
||||
message("---> 计算传入路径末尾/位置: --> 长度: ${LASTINDEX}")
|
||||
spark_debug_message("---> 计算传入路径末尾/位置: --> 长度: ${LASTINDEX}")
|
||||
math(EXPR LASTINDEX "${LASTINDEX}+1")
|
||||
message("---> 计算传入路径末尾/右移: --> 长度: ${LASTINDEX}")
|
||||
spark_debug_message("---> 计算传入路径末尾/右移: --> 长度: ${LASTINDEX}")
|
||||
string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALPATH_LENGTH} REALNAME_Dependency)
|
||||
|
||||
# 找 + 号下标,这是找+号的函数
|
||||
|
@ -118,9 +118,9 @@ macro(spark_add_library_realpaths)
|
|||
# 判断是否有找到 + 号下标,值为 -1 或 正整数
|
||||
if(RIGHT_PLUS LESS 0) # 小于0: 不存在 + 号
|
||||
set(REALNAME "${REALNAME_Dependency}")
|
||||
message("---> 传入路径末尾/右移部分: --> ${REALNAME} <-- 无依赖+")
|
||||
spark_debug_message("---> 传入路径末尾/右移部分: --> ${REALNAME} <-- 无依赖+")
|
||||
|
||||
message("---> 构建 ${REALNAME} -> ${REALNAME} ${REALPATH} ")
|
||||
spark_debug_message("---> 构建 ${REALNAME} -> ${REALNAME} ${REALPATH} ")
|
||||
|
||||
spark_add_library_path(${REALNAME} ${REALPATH})
|
||||
|
||||
|
@ -133,7 +133,7 @@ macro(spark_add_library_realpaths)
|
|||
endif(SPARK_FIND_QT6)
|
||||
|
||||
else()
|
||||
message("---> 传入路径末尾/右移部分: --> ${REALNAME_Dependency} <-- 依赖+")
|
||||
spark_debug_message("---> 传入路径末尾/右移部分: --> ${REALNAME_Dependency} <-- 依赖+")
|
||||
|
||||
# 存在+号,将截取从 / 到 + 号之间的内容作为目标名称
|
||||
# 例如 src/unclassified/widgets/DocTypeListView+JsonDeploy
|
||||
|
@ -141,8 +141,8 @@ macro(spark_add_library_realpaths)
|
|||
# 将 RIGHT_PLUS - LASTINDEX 计算出 DocTypeListView 字符长度
|
||||
math(EXPR REALNAME_LENGTH "${RIGHT_PLUS}-${LASTINDEX}")
|
||||
|
||||
message("---> 计算传入路径末尾/右移部分: --> 位置: ${RIGHT_PLUS}")
|
||||
# message("---> 计算传入路径末尾/右移部分: --> 长度: ${REALNAME_Dependency}")
|
||||
spark_debug_message("---> 计算传入路径末尾/右移部分: --> 位置: ${RIGHT_PLUS}")
|
||||
# spark_debug_message("---> 计算传入路径末尾/右移部分: --> 长度: ${REALNAME_Dependency}")
|
||||
|
||||
# 目标名称为 DocTypeListView
|
||||
# 依赖为 JsonDeploy
|
||||
|
@ -150,17 +150,17 @@ macro(spark_add_library_realpaths)
|
|||
string(SUBSTRING "${REALPATH}" 0 ${RIGHT_PLUS} _REALPATH_DIR)
|
||||
string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALNAME_LENGTH} REALNAME)
|
||||
|
||||
message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME}")
|
||||
spark_debug_message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME}")
|
||||
|
||||
string(SUBSTRING "${REALPATH}" ${RIGHT_PLUS} ${REALPATH_LENGTH} Dependency)
|
||||
message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency}")
|
||||
spark_debug_message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency}")
|
||||
|
||||
# plus_list(${Dependency} dependencies dependencies_len)
|
||||
string(REPLACE "+" ";" dependencies "${Dependency}")
|
||||
message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency} --> 列表: ${dependencies} <-- ")
|
||||
spark_debug_message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency} --> 列表: ${dependencies} <-- ")
|
||||
|
||||
|
||||
message("---> 构建 ${REALNAME} -> ${REALNAME} ${_REALPATH_DIR}")
|
||||
spark_debug_message("---> 构建 ${REALNAME} -> ${REALNAME} ${_REALPATH_DIR}")
|
||||
|
||||
spark_add_library_path(${REALNAME} ${_REALPATH_DIR})
|
||||
# target_link_qt5(${REALNAME}) # 使用依赖的依赖或许也不错
|
||||
|
@ -181,7 +181,7 @@ macro(spark_aux_source_paths AUX_VAR)
|
|||
set(${AUX_VAR}_PATHS ${ARGN})
|
||||
|
||||
foreach(aux_path IN LISTS ${AUX_VAR}_PATHS)
|
||||
# message("aux_path: ${aux_path}")
|
||||
# spark_debug_message("aux_path: ${aux_path}")
|
||||
aux_source_directory(${aux_path} ${AUX_VAR})
|
||||
endforeach(aux_path IN LISTS ${AUX_VAR}_PATHS)
|
||||
|
||||
|
@ -197,7 +197,7 @@ macro(spark_file_glob FGLOB_VAR)
|
|||
|
||||
file(GLOB FGLOB_PATH_SRCS ${fglob_path})
|
||||
foreach(fglob_path_src IN LISTS FGLOB_PATH_SRCS)
|
||||
# message(" -> ${item}")
|
||||
# spark_debug_message(" -> ${item}")
|
||||
list(APPEND ${FGLOB_VAR} ${fglob_path_src})
|
||||
endforeach(fglob_path_src IN LISTS FGLOB_PATH_SRCS)
|
||||
|
||||
|
@ -218,19 +218,19 @@ macro(spark_add_source_paths SOURCE_VAR)
|
|||
# list(APPEND ${SOURCE_VAR}_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_PATH})
|
||||
# aux_source_directory(${SOURCE_PATH} _SOURCES)
|
||||
# foreach(item IN LISTS _SOURCES)
|
||||
# # message(" -> ${item}")
|
||||
# # spark_debug_message(" -> ${item}")
|
||||
# list(APPEND ${SOURCE_VAR} ${item})
|
||||
# endforeach(item IN LISTS _SOURCES)
|
||||
|
||||
# file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SOURCE_PATH}/*.h)
|
||||
# foreach(item IN LISTS HEADER_LIST)
|
||||
# # message(" -> ${item}")
|
||||
# # spark_debug_message(" -> ${item}")
|
||||
# list(APPEND ${SOURCE_VAR} ${item})
|
||||
# endforeach(item IN LISTS HEADER_LIST)
|
||||
|
||||
file(GLOB UI_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${source_path}/*.ui)
|
||||
foreach(ui_src IN LISTS UI_SRCS)
|
||||
# message(" -> ${item}")
|
||||
# spark_debug_message(" -> ${item}")
|
||||
list(APPEND ${SOURCE_VAR} ${ui_src})
|
||||
endforeach(ui_src IN LISTS UI_SRCS)
|
||||
endforeach(source_path IN LISTS ${SOURCE_VAR}_PATHS)
|
||||
|
|
Loading…
Reference in New Issue