notepad--/patchs/coconil-cmake-spark-deb-app...

2760 lines
108 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From cc06baf3b21851b8addc0f691a31541ca436d395 Mon Sep 17 00:00:00 2001
From: coconil <coconil@foxmail.com>
Date: Tue, 31 Jan 2023 22:17:32 +0800
Subject: [PATCH 01/13] add cmake support
---
CMakeLists.txt | 2 ++
src/qscint/CMakeLists.txt | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1d6eea..f1c6d25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,3 +53,5 @@ install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/linux/usr
include(${PROJECT_SOURCE_DIR}/cmake/package_config.cmake)
include(CPack)
+
+target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
\ No newline at end of file
diff --git a/src/qscint/CMakeLists.txt b/src/qscint/CMakeLists.txt
index b114614..f132dc6 100644
--- a/src/qscint/CMakeLists.txt
+++ b/src/qscint/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required(VERSION 3.16)
-project(qscintilla2_qt5 CXX)
+cmake_minimum_required(VERSION 3.24)
+project(qscint CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
@@ -28,7 +28,7 @@ ${PROJECT_SOURCE_DIR}/scintilla/boostregex
target_include_directories(${PROJECT_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/src
-${PROJECT_SOURCE_DIR}/src/Qsci
+${PROJECT_SOURCE_DIR}/src/Qsci
${PROJECT_SOURCE_DIR}/scintilla/src
${PROJECT_SOURCE_DIR}/scintilla/include)
--
2.20.1
From 7466475538da85ba7eb24024e34b5fde8babe5f9 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Wed, 1 Feb 2023 20:04:05 +0800
Subject: [PATCH 02/13] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?=
=?UTF-8?q?=E6=9E=84=E5=BB=BA=EF=BC=8C=E6=94=AF=E6=8C=81=E6=9E=84=E5=BB=BA?=
=?UTF-8?q?=20deb?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 54 ++++-
CMakeLists.txt | 36 ++-
Makefile | 61 +++++
assets/spark.png | Bin 0 -> 4959 bytes
cmake/DebPackageConfig.cmake | 323 +++++++++++++++++++++++++++
cmake/SparkDesktopMacros.cmake | 35 +++
cmake/SparkInstallMacrosConfig.cmake | 131 +++++++++++
cmake/package-deb.descript | 45 ++++
cmake/spark-desktop.desktop.in | 12 +
9 files changed, 682 insertions(+), 15 deletions(-)
create mode 100644 Makefile
create mode 100644 assets/spark.png
create mode 100644 cmake/DebPackageConfig.cmake
create mode 100644 cmake/SparkDesktopMacros.cmake
create mode 100644 cmake/SparkInstallMacrosConfig.cmake
create mode 100644 cmake/package-deb.descript
create mode 100644 cmake/spark-desktop.desktop.in
diff --git a/.gitignore b/.gitignore
index 8d723bc..72fb977 100644
--- a/.gitignore
+++ b/.gitignore
@@ -384,15 +384,45 @@ FodyWeavers.xsd
!.vscode/extensions.json
*.code-workspace
-# Local History for Visual Studio Code
-.history/
-
-# Windows Installer files from build outputs
-*.cab
-*.msi
-*.msix
-*.msm
-*.msp
-
-# JetBrains Rider
-*.sln.iml
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
+
+
+
+# Ignore the build directory generated by the vsocde cmake extension
+build/
+# Ignore the build directory generated by the vsocde clangd extension
+.cache
+
+# Created by https://www.toptal.com/developers/gitignore/api/cmake
+# Edit at https://www.toptal.com/developers/gitignore?templates=cmake
+
+### CMake ###
+CMakeLists.txt.user
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Testing
+Makefile
+cmake_install.cmake
+install_manifest.txt
+compile_commands.json
+CTestTestfile.cmake
+_deps
+
+### CMake Patch ###
+# External projects
+*-prefix/
+
+# End of https://www.toptal.com/developers/gitignore/api/cmake
+!/Makefile
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f1c6d25..666fbdb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required(VERSION 3.16)
-project(notepad--)
+cmake_minimum_required(VERSION 3.24)
+project(notepad-- VERSION 1.22.0)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
@@ -54,4 +54,34 @@ install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/linux/usr
include(${PROJECT_SOURCE_DIR}/cmake/package_config.cmake)
include(CPack)
-target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
\ No newline at end of file
+target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
+
+if(CMAKE_HOST_UNIX)
+ include(cmake/SparkInstallMacrosConfig.cmake)
+ include(cmake/SparkDesktopMacros.cmake)
+ # 内容默认应用名称: Name= 应与项目名称相同
+ spark_desktop_macros(
+ # 应用名称: Name=
+ ${PROJECT_NAME}
+ # 应用名称: Name[zh_CN]=
+ "Notepad--"
+ # 应用说明: Comment=
+ "Notepad-- 是一个国产跨平台、简单的文本编辑器。"
+ # 应用类型: Type=
+ "Application"
+ # 执行程序: Exec=
+ "notepad--"
+ # 图标路径: Icon=
+ "/usr/share/notepad--/icons/spark.png"
+ # 应用分类: Category=
+ "Development"
+ )
+ spark_install_file(/usr/share/applications/ ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.desktop)
+ spark_install_file(/usr/share/notepad--/icons/ assets/spark.png)
+ spark_install_target(/usr/bin/ ${PROJECT_NAME})
+
+ # 注释行(使用方式)
+ find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR})
+ add_package_descript(cmake/package-deb.descript)
+
+endif(CMAKE_HOST_UNIX)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..43e849f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,61 @@
+CPUS=$(shell nproc)
+CALENDAR=$(shell date '+%Y%m%d')
+OSID=$(shell lsb_release -si)
+OSRELEASE=$(shell lsb_release -sr)
+SUFFIX=
+ifneq ("$(OSID)", "")
+SUFFIX=_$(OSID)$(OSRELEASE)
+endif
+
+PROJECT_NAME=notepad--
+PACKAGE_NAME=com.hmja.notepad
+
+all:
+ mkdir -p build
+ cd build && cmake ..
+ cd build && make -j$(CPUS)
+
+run: all
+ exec $(shell find build/ -maxdepth 1 -type f -executable | grep $(PROJECT_NAME))
+
+debug:
+ mkdir -p build
+ cd build && cmake -DCMAKE_BUILD_TYPE=Debug ..
+ cd build && make -j$(CPUS)
+
+release:
+ mkdir -p build
+ cd build && cmake -DCMAKE_BUILD_TYPE=Release -DPACKAGE_SUFFIX="$(SUFFIX)" ..
+ cd build && make -j$(CPUS)
+
+package: release
+ cd build && make package
+ tree build/_CPack_Packages/Linux/DEB/$(PROJECT_NAME)-*
+ dpkg-deb --contents build/$(PACKAGE_NAME)_*$(CALENDAR)*$(SUFFIX).deb
+ # cd build/_CPack_Packages/Linux/DEB/$(PROJECT_NAME)_*$(CALENDAR)*$(SUFFIX).deb && find .
+
+builddeps:
+ cd build && make builddeps
+
+cpus:
+ @echo "CPU数量: $(CPUS)"
+
+copytosource:package
+ cp build/$(PACKAGE_NAME)_*$(CALENDAR)*.deb .
+
+# 进入 qdebug 模式,在 deepin 中默认被禁用,可 env | grep QT 查看,并在 /etc/X11/Xsession.d/00deepin-dde-env 配置中已定义
+# 1. 禁止 qt 的 debug 打印: qt.*.debug=false
+# qt.qpa.input.events
+# qt.qpa.events
+# 2. 禁止 dtk 的 debug 打印: dtk.*.debug=false
+# dtk.dpluginloader
+# 3. 禁止 qtcreator 本身的 debug 打印
+# qtc.autotest.testcodeparser
+# qtc.clangbackend.server
+# ...
+# 4. 关闭其它的太麻烦了,直接只启用本地 debug
+# .debug=true
+enter-qdebug-mode:
+ # 进入新的 bash 环境
+ @# export QT_LOGGING_RULES=".debug=true; qt.*.debug=false; dtk.*.debug=false; dde.*.debug=false; qtc*=false; " && bash
+ export QT_LOGGING_RULES=".debug=true" && bash
diff --git a/assets/spark.png b/assets/spark.png
new file mode 100644
index 0000000000000000000000000000000000000000..544e2c7cff5f70894e27a7a717d4a62120630b7a
GIT binary patch
literal 4959
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
literal 0
HcmV?d00001
diff --git a/cmake/DebPackageConfig.cmake b/cmake/DebPackageConfig.cmake
new file mode 100644
index 0000000..cfba051
--- /dev/null
+++ b/cmake/DebPackageConfig.cmake
@@ -0,0 +1,323 @@
+cmake_minimum_required(VERSION 3.0.0)
+
+# function(add_deb_package PACKAGE_NAME PACKAGE_VERSION PACKAGE_MAINTAINER PACKAGE_EMAIL PACKAGE_SHORT_DESCRIPTION PACKAGE_LONG_DESCRIPTION)
+
+# endfunction(add_deb_package PACKAGE_NAME PACKAGE_VERSION PACKAGE_MAINTAINER PACKAGE_EMAIL PACKAGE_SHORT_DESCRIPTION PACKAGE_LONG_DESCRIPTION)
+
+# if(add_deb_package VALUE) set(Package ${VALUE} PARENT_SCOPE) endif(add_deb_package VALUE)
+# if(add_deb_version VALUE) set(Version ${VALUE} PARENT_SCOPE) endif(add_deb_version VALUE)
+# if(add_deb_maintainer VALUE) set(Maintainer ${VALUE} PARENT_SCOPE) endif(add_deb_maintainer VALUE)
+# if(add_deb_email VALUE) set(Email ${VALUE} PARENT_SCOPE) endif(add_deb_email VALUE)
+# if(add_deb_descrition VALUE) set(Descrition ${VALUE} PARENT_SCOPE) endif(add_deb_descrition VALUE)
+# if(add_deb_detail VALUE) set(Detail ${VALUE} PARENT_SCOPE) endif(add_deb_detail VALUE)
+
+
+# set(Package "")
+# set(Version "")
+# set(Architecture "")
+# set(Maintainer "")
+# set(Email "")
+# set(Descrition "")
+
+function(find_str _IN _SEP _OUT)
+ string(FIND "${_IN}" "${_SEP}" _TMP)
+ set(${_OUT} ${_TMP} PARENT_SCOPE)
+endfunction(find_str _IN _SEP _OUT)
+
+
+function(find_next _IN _OUT)
+ find_str("${_IN}" "\n" _TMP)
+ set(${_OUT} ${_TMP} PARENT_SCOPE)
+endfunction(find_next _IN _OUT)
+
+function(sub_next _IN _INDEX _OUT __OUT)
+ find_next(${_IN} _NEXTINDEX)
+ string(SUBSTRING "${_IN}" ${_INDEX} ${_NEXTINDEX} _TMP)
+ math(EXPR _NEXTINDEX ${_NEXTINDEX}+1)
+ string(SUBSTRING "${_IN}" ${_NEXTINDEX} -1 __TMP)
+ set(${_OUT} ${_TMP} PARENT_SCOPE)
+ set(${__OUT} ${__TMP} PARENT_SCOPE)
+endfunction(sub_next _IN _INDEX _OUT)
+
+function(trim_str _IN _OUT)
+ string(STRIP "${_IN}" _TMP)
+ set(${_OUT} ${_TMP} PARENT_SCOPE)
+endfunction(trim_str _IN _OUT)
+
+function(split_str _IN _SEP _OUT)
+ string(FIND "${_IN}" "${_SEP}" _TMP_INDEX)
+ if(NOT _TMP_INDEX EQUAL -1)
+ string(SUBSTRING "${_IN}" 0 ${_TMP_INDEX} _TMP)
+ math(EXPR _TMP_INDEX ${_TMP_INDEX}+1)
+ string(SUBSTRING "${_IN}" ${_TMP_INDEX} -1 __TMP)
+ set(${_OUT} "${_TMP};${__TMP}" PARENT_SCOPE)
+ else()
+ set(${_OUT} ${_IN} PARENT_SCOPE)
+ endif(NOT _TMP_INDEX EQUAL -1)
+endfunction(split_str _IN _SEP _OUT)
+
+function(split_str_p _IN _SEP _OUT __OUT)
+ split_str("${_IN}" "${_SEP}" _TMP)
+ list(GET _TMP 0 __TMP)
+ list(GET _TMP 1 ___TMP)
+ set(${_OUT} ${__TMP} PARENT_SCOPE)
+ set(${__OUT} ${___TMP} PARENT_SCOPE)
+endfunction(split_str_p _IN _SEP _OUT __OUT)
+
+function(split_str_n _IN _SEP _OUT _N)
+ if(_N GREATER 1)
+ set(_C ${_N})
+ set(_RET "")
+ set(_NEXT ${_IN})
+ while(NOT _C EQUAL 0)
+ split_str("${_NEXT}" "${_SEP}" _TMP)
+ list(LENGTH _TMP _TMP_LEN)
+ if(_TMP_LEN EQUAL 2)
+ list(GET _TMP 0 __TMP)
+ list(GET _TMP 1 _NEXT)
+ list(APPEND _RET ${__TMP})
+ else()
+ break()
+ endif(_TMP_LEN EQUAL 2)
+ math(EXPR _C "${_C}-1")
+ endwhile(NOT _C EQUAL 0)
+ list(APPEND _RET ${_NEXT})
+ set(${_OUT} ${_RET} PARENT_SCOPE)
+ else()
+ split_str("${_IN}" "${_SEP}" _TMP)
+ set(${_OUT} ${_TMP} PARENT_SCOPE)
+ endif(_N GREATER 1)
+endfunction(split_str_n _IN _SEP _OUT _N)
+
+
+function(set_package_vars _IN_KEY _IN_VAL)
+
+ # trim_str("${_IN_KEY}" _IN_KEY)
+
+ find_str("${_IN_KEY}" "Type" _Type)
+ if(_Type EQUAL "0")
+ string(TOUPPER "${_IN_VAL}" _IN_VAL_UPPER)
+ string(TOLOWER "${_IN_VAL}" _IN_VAL_LOWER)
+ set(CPACK_GENERATOR "${_IN_VAL_UPPER}" PARENT_SCOPE)
+ message("--> 软件包类型: ${_IN_VAL_LOWER}")
+ endif(_Type EQUAL "0")
+
+ find_str("${_IN_KEY}" "Package" _Package)
+ if(_Package EQUAL "0")
+ if(_IN_VAL STREQUAL "auto")
+ set(CPACK_DEBIAN_PACKAGE_NAME "${PROJECT_NAME}" PARENT_SCOPE)
+ else()
+ set(CPACK_DEBIAN_PACKAGE_NAME "${_IN_VAL}" PARENT_SCOPE)
+ endif(_IN_VAL STREQUAL "auto")
+ message("--> 软件包名: ${_IN_VAL}")
+ endif(_Package EQUAL "0")
+
+ find_str("${_IN_KEY}" "Version" _Version)
+ if(_Version EQUAL "0")
+ if(_IN_VAL STREQUAL "auto")
+ set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}" PARENT_SCOPE)
+ else()
+ set(CPACK_DEBIAN_PACKAGE_VERSION "${_IN_VAL}" PARENT_SCOPE)
+ endif(_IN_VAL STREQUAL "auto")
+
+ message("--> 软件版本: ${_IN_VAL}")
+ endif(_Version EQUAL "0")
+
+ find_str("${_IN_KEY}" "CalVer" _CalVer)
+ if(_CalVer EQUAL "0")
+ set(CalVer "${_IN_VAL}" PARENT_SCOPE)
+ message("--> 日历化版本: ${_IN_VAL}")
+ endif(_CalVer EQUAL "0")
+
+ find_str("${_IN_KEY}" "Architecture" _Architecture)
+ if(_Architecture EQUAL "0")
+ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE)
+ if(_IN_VAL STREQUAL "auto")
+ execute_process(
+ COMMAND dpkg --print-architecture
+ OUTPUT_VARIABLE _RETV
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_RETV}" PARENT_SCOPE)
+ endif(_IN_VAL STREQUAL "auto")
+ message("--> 软件架构: ${_IN_VAL}")
+ endif(_Architecture EQUAL "0")
+
+ find_str("${_IN_KEY}" "Priority" _Priority)
+ if(_Priority EQUAL "0")
+ set(CPACK_DEBIAN_PACKAGE_PRIORITY "${_IN_VAL}" PARENT_SCOPE)
+ message("--> 优先级: ${_IN_VAL}")
+ endif(_Priority EQUAL "0")
+
+ find_str("${_IN_KEY}" "Depends" _Depends)
+ if(_Depends EQUAL "0")
+ set(CPACK_DEBIAN_PACKAGE_DEPENDS "${_IN_VAL}" PARENT_SCOPE)
+ message("--> 软件依赖: ${_IN_VAL}")
+ endif(_Depends EQUAL "0")
+
+ find_str("${_IN_KEY}" "Maintainer" _Maintainer)
+ if(_Maintainer EQUAL "0")
+ set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${_IN_VAL}" PARENT_SCOPE)
+ message("--> 软件维护者: ${_IN_VAL}")
+ endif(_Maintainer EQUAL "0")
+
+ find_str("${_IN_KEY}" "Homepage" _Homepage)
+ if(_Homepage EQUAL "0")
+ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${_IN_VAL}" PARENT_SCOPE)
+ message("--> 软件主页: ${_IN_VAL}")
+ endif(_Homepage EQUAL "0")
+
+ find_str("${_IN_KEY}" "Recommends" _Recommends)
+ if(_Recommends EQUAL "0")
+ set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "${_IN_VAL}" PARENT_SCOPE)
+ message("--> 软件建议: ${_IN_VAL}")
+ endif(_Recommends EQUAL "0")
+
+endfunction(set_package_vars _IN_KEY _IN_VAL)
+
+# 定义一个自定义(add_package_descript)函数
+# 用于按特定配置约定自动化构建软件包配置
+function(add_package_descript IN_DES)
+ set(PACKAGE_DES_PATH "${IN_DES}")
+
+ if(EXISTS ${IN_DES})
+
+ elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${IN_DES}")
+ set(PACKAGE_DES_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${IN_DES}")
+ else()
+ message(FATAL_ERROR "!! Not Found Path: ${PACKAGE_DES_PATH}")
+ return()
+ endif(EXISTS ${IN_DES})
+
+ file(READ ${PACKAGE_DES_PATH} DES_CONTENT)
+ trim_str("${DES_CONTENT}" DES_CONTENT)
+
+ ################## 解析 ##################
+
+ sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT)
+ set(PREV_DES "")
+ while(NOT DES_LINE STREQUAL "${PREV_DES}")
+ # 检查该描述行是否是 # 注释开头,是的话将跳过该行
+ find_str("${DES_LINE}" "#" _COMMENT)
+ if(_COMMENT EQUAL "0")
+ message("--> !!!!!!! ${DES_LINE}")
+ sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT)
+ continue()
+ endif(_COMMENT EQUAL "0")
+
+ # 检查该描述行是否是 Descrition 开头,是的话说明描述结尾了
+ find_str("${DES_LINE}" "Descrition" _DESCRIPTION)
+ if(_DESCRIPTION EQUAL "0")
+ break()
+ endif(_DESCRIPTION EQUAL "0")
+
+ split_str_n("${DES_LINE}" ":" _TMP 1)
+ list(LENGTH _TMP _TMP_LEN)
+
+ if(_TMP_LEN EQUAL 2)
+ split_str_p("${DES_LINE}" ":" _TMP __TMP)
+ trim_str("${__TMP}" __TMP)
+ string(LENGTH "${__TMP}" __TMP_LENGTH)
+ if(NOT __TMP_LENGTH EQUAL "0")
+ set_package_vars("${_TMP}" "${__TMP}")
+ endif(NOT __TMP_LENGTH EQUAL "0")
+ endif(_TMP_LEN EQUAL 2)
+
+ # 记录当前行,获取下一行,可能是已经结尾了(将保持重复行)
+ set(PREV_DES "${DES_LINE}")
+ sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT)
+ endwhile(NOT DES_LINE STREQUAL "${PREV_DES}")
+
+
+ # 再一次检查该描述行是否是 Descrition 开头,是的话将进行分析描述行
+ find_str("${DES_LINE}" "Descrition" _DESCRIPTION)
+ if(_DESCRIPTION EQUAL "0")
+ split_str_p("${DES_LINE}" ":" _TMP __TMP)
+ trim_str("${__TMP}" __TMP)
+ set(Descrition ${__TMP})
+ set(PREV_DES_LINE "")
+ while(NOT PREV_DES_LINE STREQUAL DES_LINE)
+ if(NOT PREV_DES_LINE STREQUAL "")
+ set(Descrition "${Descrition}\n${DES_LINE}")
+ endif(NOT PREV_DES_LINE STREQUAL "")
+ set(PREV_DES_LINE "${DES_LINE}")
+ sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT)
+ endwhile(NOT PREV_DES_LINE STREQUAL DES_LINE)
+ # set(Descrition "${Descrition}")
+ message("--> 软件说明: ${Descrition}")
+
+ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${Descrition})
+ endif(_DESCRIPTION EQUAL "0")
+
+ ##################### deb #####################
+ # ARCHITECTURE
+ if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+ set(ARCHITECTURE "amd64")
+ elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "aarch64")
+ set(ARCHITECTURE "arm64")
+ endif()
+
+ #################### Calendar Version ###################
+ if("${CalVer}" STREQUAL "true")
+ string(TIMESTAMP BUILD_TIME "%Y%m%d")
+ set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_DEBIAN_PACKAGE_VERSION}-${BUILD_TIME}")
+ endif("${CalVer}" STREQUAL "true")
+
+
+
+ ##################### deb file name #####################
+ set(_Package "${CPACK_DEBIAN_PACKAGE_NAME}")
+ set(_Version "${CPACK_DEBIAN_PACKAGE_VERSION}")
+ set(_Architecture "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
+
+ set(_DebFileName
+ "${_Package}_${_Version}_${_Architecture}${PACKAGE_SUFFIX}.deb"
+ )
+ set(CPACK_DEBIAN_FILE_NAME ${_DebFileName})
+
+
+ # set(CPACK_DEBIAN_PACKAGE_NAME "${Package}")
+ # set(CPACK_DEBIAN_PACKAGE_VERSION "${Version}")
+ # set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${Architecture}")
+ # set(CPACK_DEBIAN_PACKAGE_DEPENDS "${Depends}")
+ # set(CPACK_DEBIAN_PACKAGE_PRIORITY "${Priority}")
+ # set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${Maintainer}")
+ # set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${Descrition}")
+
+ # 设置即将使用的标准脚本
+ # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
+ # "${CMAKE_SOURCE_DIR}/config/DEBIAN/preinst"
+ # "${CMAKE_SOURCE_DIR}/config/DEBIAN/postinst"
+ # "${CMAKE_SOURCE_DIR}/config/DEBIAN/prerm"
+ # "${CMAKE_SOURCE_DIR}/config/DEBIAN/postrm"
+ # )
+
+ # 设置为ON以便使用 dpkg-shlibdeps 生成更好的包依赖列表。
+ # set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+ # set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
+ # set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY "=")
+
+ include(CPack)
+
+endfunction(add_package_descript IN_DES)
+
+
+# TODO:
+# CPACK_GENERATOR
+# CPACK_DEBIAN_FILE_NAME - n
+# CPACK_DEBIAN_PACKAGE_NAME - y
+# CPACK_DEBIAN_PACKAGE_VERSION - y
+# CPACK_DEBIAN_PACKAGE_ARCHITECTURE - y(auto)
+# CPACK_DEBIAN_PACKAGE_DEPENDS - y
+# CPACK_DEBIAN_PACKAGE_PRIORITY - y
+# CPACK_DEBIAN_PACKAGE_MAINTAINER - y
+# CPACK_DEBIAN_PACKAGE_DESCRIPTION - y
+
+# ARCHITECTURE
+# if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+# set(ARCHITECTURE "amd64")
+# elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "aarch64")
+# set(ARCHITECTURE "arm64")
+# endif()
+
+# string(TIMESTAMP BUILD_TIME "%Y%m%d")
diff --git a/cmake/SparkDesktopMacros.cmake b/cmake/SparkDesktopMacros.cmake
new file mode 100644
index 0000000..223ac6b
--- /dev/null
+++ b/cmake/SparkDesktopMacros.cmake
@@ -0,0 +1,35 @@
+
+macro(spark_desktop_macros _APP_NAME _APP_NAME_ZH_CN _APP_COMMENT _APP_TYPE _APP_EXECUTE_PATH _APP_EXECUTE_ICON_PATH _APP_CATEGORIES)
+ set(APP_NAME ${_APP_NAME})
+ set(APP_NAME_ZH_CN ${_APP_NAME_ZH_CN})
+ set(APP_COMMENT ${_APP_COMMENT})
+ set(APP_TYPE ${_APP_TYPE})
+ set(APP_EXECUTE_PATH ${_APP_EXECUTE_PATH})
+ set(APP_EXECUTE_ICON_PATH ${_APP_EXECUTE_ICON_PATH})
+ set(APP_CATEGORIES ${_APP_CATEGORIES})
+ configure_file(cmake/spark-desktop.desktop.in
+ ${CMAKE_BINARY_DIR}/${_APP_NAME}.desktop
+ )
+endmacro(spark_desktop_macros _APP_NAME _APP_NAME_ZH_CN _APP_COMMENT _APP_TYPE _APP_EXECUTE_PATH _APP_EXECUTE_ICON_PATH _APP_CATEGORIES)
+
+# include(cmake/SparkDesktopMacros.cmake)
+# 内容默认应用名称: Name= 应与项目名称相同
+# spark_desktop_macros(
+ # 应用名称: Name=
+ # 应用名称: Name[zh_CN]=
+ # 应用说明: Comment=
+ # 应用类型: Type=
+ # 执行程序: Exec=
+ # 图标路径: Icon=
+ # 应用分类: Category=
+# )
+
+# configure_file(<input> <output>
+# [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS |
+# FILE_PERMISSIONS <permissions>...]
+# [COPYONLY] [ESCAPE_QUOTES] [@ONLY]
+# [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
+
+# install(FILES ${APP_NAME}.desktop
+# DESTINATION /usr/share/applications
+# )
\ No newline at end of file
diff --git a/cmake/SparkInstallMacrosConfig.cmake b/cmake/SparkInstallMacrosConfig.cmake
new file mode 100644
index 0000000..1f8939b
--- /dev/null
+++ b/cmake/SparkInstallMacrosConfig.cmake
@@ -0,0 +1,131 @@
+
+# spark_install_target
+# 基于传入的路径/目标进行安装
+# 可接受的值为: 安装路径 目标A
+# 可接受的值为: 安装路径 目标A 目标B 目标C...
+macro(spark_install_target INSTALL_TARGET_DIR INSTALL_TARGETS)
+ install(TARGETS
+ ${INSTALL_TARGETS} ${ARGN}
+ DESTINATION ${INSTALL_TARGET_DIR})
+endmacro(spark_install_target INSTALL_TARGET_DIR INSTALL_TARGETS)
+
+# spark_install_file
+# 基于传入的路径/文件进行安装
+# 可接受的值为: 安装路径 文件A
+# 可接受的值为: 安装路径 文件A 文件B 文件C...
+macro(spark_install_file INSTALL_FILE_DIR INSTALL_FILE)
+ install(FILES
+ ${INSTALL_FILE} ${ARGN}
+ DESTINATION ${INSTALL_FILE_DIR})
+endmacro(spark_install_file INSTALL_FILE_DIR INSTALL_FILE)
+
+# spark_install_program
+# 基于传入的路径/文件进行安装,并自动为其添加可执行权限
+# 可接受的值为: 安装路径 文件A
+# 可接受的值为: 安装路径 文件A 文件B 文件C...
+macro(spark_install_program INSTALL_PROGRAM_DIR INSTALL_PROGRAM)
+ install(PROGRAMS
+ ${INSTALL_PROGRAM} ${ARGN}
+ DESTINATION ${INSTALL_PROGRAM_DIR})
+endmacro(spark_install_program INSTALL_PROGRAM_DIR INSTALL_PROGRAM)
+
+
+# spark_install_directory
+# 基于传入的路径/目录进行安装
+# 可接受的值为: 安装路径 路径A
+# 可接受的值为: 安装路径 路径A/* 为安装路径A下所有内容
+macro(spark_install_directory INSTALL_DIRECTORY_DIR INSTALL_DIRECOTRY)
+ # INSTALL_DIRECOTRY 可能包含 *
+ # 1. 找到 '*', 截取,列出目录下所有文件,安装
+ # 2. 是文件的直接使用 spark_install_file 安装
+ # 2. 是目录的直接使用 spark_install_directory 安装
+ # message(FATAL_ERROR "${INSTALL_DIRECTORY_DIR}")
+ # string(FIND <string> <substring> <output_variable> [REVERSE])
+ string(FIND "${INSTALL_DIRECOTRY}" "*" INSTALL_DIRECTORY_FIND_INDEX)
+ # message(FATAL_ERROR "${INSTALL_DIRECTORY_FIND_INDEX}: ${INSTALL_DIRECTORY_DIR}")
+
+ # file(GLOB <variable>
+ # [LIST_DIRECTORIES true|false] [RELATIVE <path>] [CONFIGURE_DEPENDS]
+ # [<globbing-expressions>...])
+
+ if (NOT INSTALL_DIRECTORY_FIND_INDEX EQUAL -1)
+ # string(SUBSTRING <string> <begin> <length> <output_variable>)
+ string(SUBSTRING "${INSTALL_DIRECOTRY}" 0 ${INSTALL_DIRECTORY_FIND_INDEX} INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING)
+ # message(FATAL_ERROR "directory: ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING}")
+
+ # file(GLOB <variable>
+ # [LIST_DIRECTORIES true|false] [RELATIVE <path>] [CONFIGURE_DEPENDS]
+ # [<globbing-expressions>...])
+
+ file(GLOB INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING}/*)
+ list(LENGTH INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST_LENGTH)
+ foreach(item IN LISTS INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST)
+ # message("-> ${item}")
+ if(IS_DIRECTORY ${item})
+ message("-> ${item} IS_DIRECTORY")
+ # spark_install_directory(${INSTALL_DIRECTORY_DIR} ${item})
+ install(DIRECTORY
+ ${item}
+ DESTINATION ${INSTALL_DIRECTORY_DIR}
+ USE_SOURCE_PERMISSIONS)
+ else()
+ message("-> ${item} NOT IS_DIRECTORY")
+ spark_install_program(${INSTALL_DIRECTORY_DIR} ${item})
+ # spark_install_file(${INSTALL_DIRECTORY_DIR} ${item})
+ endif(IS_DIRECTORY ${item})
+ endforeach(item IN LISTS INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST)
+
+ # message(FATAL_ERROR " directory: ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST}")
+ # message(FATAL_ERROR " directory: ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST_LENGTH}")
+
+ else()
+ message(FATAL_ERROR "install ${INSTALL_DIRECTORY_DIR}")
+
+ install(DIRECTORY
+ ${INSTALL_DIRECOTRY} ${ARGN}
+ DESTINATION ${INSTALL_DIRECTORY_DIR})
+ endif(NOT INSTALL_DIRECTORY_FIND_INDEX EQUAL -1)
+
+endmacro(spark_install_directory INSTALL_DIRECTORY_DIR INSTALL_DIRECOTRY)
+
+
+
+macro(spark_install_changelog CHANGE_LOG_FILE)
+ set(SOURCE_CHANGE_LOG_FILE ${CHANGE_LOG_FILE})
+ if (EXISTS ${SOURCE_CHANGE_LOG_FILE})
+
+ execute_process(COMMAND test -f ${SOURCE_CHANGE_LOG_FILE}
+ RESULT_VARIABLE changelog_test
+ )
+ execute_process(COMMAND which gzip
+ RESULT_VARIABLE gzip_test
+ )
+ if (NOT changelog_test EQUAL 0)
+ message(FATAL_ERROR "NOTE: 不是常规文件: ${SOURCE_CHANGE_LOG_FILE}")
+ endif(NOT changelog_test EQUAL 0)
+
+ if (NOT gzip_test EQUAL 0)
+ message(FATAL_ERROR "NOTE: 未安装 gzip, 无法压缩 changelog")
+ endif(NOT gzip_test EQUAL 0)
+
+ # 压缩与安装日志文件
+ add_custom_command(
+ OUTPUT "${CMAKE_BINARY_DIR}/changelog.gz"
+ COMMAND gzip -cn9 "${SOURCE_CHANGE_LOG_FILE}" > "${CMAKE_BINARY_DIR}/changelog.gz"
+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+ COMMENT "Compressing changelog"
+ )
+ add_custom_target(changelog ALL DEPENDS "${CMAKE_BINARY_DIR}/changelog.gz")
+
+ # include(GNUInstallDirs)
+ set(SPARK_INSTALL_CHANGE_LOG_DIR "/usr/share/doc/${PROJECT_NAME}/")
+ install(FILES
+ ${CMAKE_BINARY_DIR}/changelog.gz
+ debian/copyright
+
+ DESTINATION ${SPARK_INSTALL_CHANGE_LOG_DIR}
+ )
+ else()
+ message(FATAL_ERROR "未找到: ${SOURCE_CHANGE_LOG_FILE}")
+ endif(EXISTS ${SOURCE_CHANGE_LOG_FILE})
+endmacro(spark_install_changelog CHANGE_LOG_FILE)
diff --git a/cmake/package-deb.descript b/cmake/package-deb.descript
new file mode 100644
index 0000000..be0fa83
--- /dev/null
+++ b/cmake/package-deb.descript
@@ -0,0 +1,45 @@
+# 注释行(使用方式)
+# find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR})
+# add_package_descript(cmake/package-deb.descript)
+
+# 打包后的文件名称
+# FileName: 待定
+# 配置 PACKAGE_SUFFIX 变量可添加尾巴名称
+# 如在 Makefile 中硬编码方式
+# OSID=$(shell lsb_release -si)
+# OSRELEASE=$(shell lsb_release -sr)
+# -DPACKAGE_SUFFIX="_$(OSID)$(OSRELEASE)"
+
+# deb 安装包的安装时脚本
+# 1.安装[前|后]执行脚本(preinst,postinst),
+# 2.卸载[前|后]执行脚本(prerm,postrm)
+# ControlExtra: 未定义(暂不支持)
+# 如需指定请修改 DebPackageConfig.cmake 模板(第252行)
+# CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA 变量
+
+# 打包类型,暂支持 deb, 未来支持 tgz(tar.gz)
+Type: deb
+# 软件包名称(自动, 使用 PROJECT_NAME 变量值)
+Package: com.hmja.notepad
+# 软件包版本(自动, 使用 PROJECT_VERSION 变量值)
+Version: auto
+# 日历化尾部版本
+CalVer: true
+# 软件包架构(自动)
+Architecture: auto
+# 软件包属于的系统部分[admin|cli-mono|comm|database|debug|devel|doc|editors|education|electronics|embedded|fonts|games|gnome|gnu-r|gnustep|graphics|hamradio|haskell|httpd|interpreters|introspection|java|javascript|kde|kernel|libdevel|libs|lisp|localization|mail|math|metapackages|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|rust|science|shells|sound|tasks|tex|text|utils|vcs|video|web|x11|xfce|zope]
+Section: editors
+# 软件包优先级[required|important|stantard|optional|extra]
+Priority: optional
+# 软件包依赖
+Depends:
+# 软件包维护者(组织或个人)
+Maintainer: 尹作为 <757210198@qq.com>
+# 软件包主页
+Homepage: https://gitee.com/cxasm/notepad--
+# 软件包建议
+Recommends:
+# 软件包描述信息
+Descrition: Notepad--是一个国产跨平台、简单的文本编辑器。
+ Notepad--是一个国产跨平台、简单的文本编辑器是替换notepad++的一种选择。
+ 其内置强大的代码对比功能让你丢掉付费的beyond compare。
diff --git a/cmake/spark-desktop.desktop.in b/cmake/spark-desktop.desktop.in
new file mode 100644
index 0000000..e7c3b18
--- /dev/null
+++ b/cmake/spark-desktop.desktop.in
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Version=1.0
+Name=@APP_NAME@
+Name[zh_CN]=@APP_NAME_ZH_CN@
+Comment=@APP_COMMENT@
+Type=@APP_TYPE@
+Exec=@APP_EXECUTE_PATH@
+Icon=@APP_EXECUTE_ICON_PATH@
+Categories=@APP_CATEGORIES@
+MimeType=text/plain
+
+# Generated from the DesktopGenerater component of the z-Tools toolkit
\ No newline at end of file
--
2.20.1
From 684ced155e1c749b06e76449177c95db9392c0fc Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Wed, 1 Feb 2023 20:09:49 +0800
Subject: [PATCH 03/13] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?=
=?UTF-8?q?=E6=9E=84=E5=BB=BA=EF=BC=8C=E6=94=AF=E6=8C=81=E6=9E=84=E5=BB=BA?=
=?UTF-8?q?=20Appimage?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CMakeLists.txt | 8 ++
Makefile | 23 ++++++
cmake/SparkAppimageConfig.cmake | 139 ++++++++++++++++++++++++++++++++
cmake/spark-appimage.desktop.in | 10 +++
4 files changed, 180 insertions(+)
create mode 100644 cmake/SparkAppimageConfig.cmake
create mode 100644 cmake/spark-appimage.desktop.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 666fbdb..a8f27aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,6 +80,14 @@ if(CMAKE_HOST_UNIX)
spark_install_file(/usr/share/notepad--/icons/ assets/spark.png)
spark_install_target(/usr/bin/ ${PROJECT_NAME})
+
+ # 1. 在顶层构建中导入 Appimage 的构建
+ include(cmake/SparkAppimageConfig.cmake) # 导入来自 Spark 构建的 Appimage 构建
+ add_appimage_icon(assets/spark.png) # 添加到 Appimage 中的默认的图标
+ add_appimage_desktop() # 添加到 Appimage 中的默认desktop(使用来自 Spark 构建的 Desktop 构建中配置的信息(必须要求 spark-desktop))
+ add_appimage() # 应用对 Appimage 的构建
+
+
# 注释行(使用方式)
find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR})
add_package_descript(cmake/package-deb.descript)
diff --git a/Makefile b/Makefile
index 43e849f..b71b27f 100644
--- a/Makefile
+++ b/Makefile
@@ -59,3 +59,26 @@ enter-qdebug-mode:
# 进入新的 bash 环境
@# export QT_LOGGING_RULES=".debug=true; qt.*.debug=false; dtk.*.debug=false; dde.*.debug=false; qtc*=false; " && bash
export QT_LOGGING_RULES=".debug=true" && bash
+
+# Appimage 的构建流 --
+# 在 Makefile 进行构建目标构建 Appimage (要求提供工具的绝对路径然后可依次进行linuxdeployqt, genrate-appimage)
+# 来自于 https://github.com/probonopd/linuxdeployqt 的 linuxdeployqt
+# 来自于 https://github.com/AppImage/AppImageKit 的 appimagetool
+# 来自于 https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git 托管存储的工具
+
+# 或指定你所想存放克隆项目的位置
+BUNDLE_LINUXDEPLOYQT := $(shell pwd)/build/bundle-linuxdeployqt
+
+download-bundle-linuxdeploytools:
+ -git clone https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git $(BUNDLE_LINUXDEPLOYQT)
+
+LINUXDEPLOYQT := "$(BUNDLE_LINUXDEPLOYQT)/linuxdeployqt-continuous-x86_64.AppImage"
+APPIMAGETOOL := "$(BUNDLE_LINUXDEPLOYQT)/appimagetool-x86_64.AppImage"
+
+linuxdeploy: release download-bundle-linuxdeploytools
+ cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL)
+ cd build && make linuxdeploy
+
+genrate-appimage:
+ cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL)
+ cd build && make appimage
diff --git a/cmake/SparkAppimageConfig.cmake b/cmake/SparkAppimageConfig.cmake
new file mode 100644
index 0000000..7463a48
--- /dev/null
+++ b/cmake/SparkAppimageConfig.cmake
@@ -0,0 +1,139 @@
+# export PATH=/usr/lib/x86_64-linux-gnu/qt5/bin:$PATH
+# export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
+# export QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins:$QT_PLUGIN_PATH
+# export QML2_IMPORT_PATH=/usr/lib/x86_64-linux-gnu/qt5/qml:$QML2_IMPORT_PATH
+
+# export PATH=/usr/lib/x86_64-linux-gnu/qt5/bin:$PATH
+# ~/linuxdeployqt-continuous-x86_64.AppImage spark-store-submitter -appimage
+# cd ..
+# ~/appimagetool-x86_64.AppImage appimage/
+
+# LINUXDEPLOYQT=/home/zinface/linuxdeployqt-continuous-x86_64.AppImage
+# APPIMAGETOOL=/home/zinface/appimagetool-x86_64.AppImage
+
+# if ()
+set(APPIMAGE_OUTPUT "${CMAKE_BINARY_DIR}/appimage")
+set(APPIMAGE_ICON "${APPIMAGE_OUTPUT}/default.png")
+set(APPIMAGE_DESTKOP "${APPIMAGE_OUTPUT}/default.desktop")
+# set(LINUXDEPLOYQT)
+# set(APPIMAGETOOL)
+
+function(execute_linuxdeploy _PATH)
+ execute_process(COMMAND ${LINUXDEPLOYQT}
+ WORKING_DIRECTORY "${APPIMAGE_OUTPUT}"
+ )
+endfunction(execute_linuxdeploy _PATH)
+
+function(target_linuxdeploy)
+ add_custom_target(linuxdeploy pwd
+ BYPRODUCTS appimage
+ COMMAND cp ../${PROJECT_NAME} .
+ COMMAND "${LINUXDEPLOYQT}" ${PROJECT_NAME} -appimage -unsupported-allow-new-glibc -verbose=3 -no-strip|| true
+ COMMAND cp ../spark-appimage.desktop default.desktop
+ COMMAND cp ../spark-appimage.png default.png
+ WORKING_DIRECTORY "${APPIMAGE_OUTPUT}")
+endfunction(target_linuxdeploy)
+
+function(target_appimage)
+ add_custom_target(copy-desktop-appimage
+ COMMAND cp ../spark-appimage.desktop default.desktop
+ COMMAND cp ../spark-appimage.png default.png
+ WORKING_DIRECTORY "${APPIMAGE_OUTPUT}")
+ add_custom_target(appimage pwd
+ COMMAND ${APPIMAGETOOL} ${APPIMAGE_OUTPUT}
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ DEPENDS copy-desktop-appimage)
+endfunction(target_appimage)
+
+function(add_appimage)
+ # check linuxdeploy
+ if(NOT DEFINED LINUXDEPLOYQT)
+ message("AppImage> Not Found LINUXDEPLOYQT Variable!")
+ return()
+ endif(NOT DEFINED LINUXDEPLOYQT)
+ if(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT})
+ message("> cmake version is less than 3.19")
+ message(WARNING "!Relative paths are not supported!")
+ else()
+ file(REAL_PATH ${LINUXDEPLOYQT} LINUXDEPLOYQT_REAL_PATH)
+ endif(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT})
+ message("AppImage> Found LINUXDEPLOYQT Variable: ${LINUXDEPLOYQT_REAL_PATH}")
+
+ # check appimagetool
+ if(NOT DEFINED APPIMAGETOOL)
+ message("AppImage> Not Found APPIMAGETOOL Variable!")
+ return()
+ endif(NOT DEFINED APPIMAGETOOL)
+ if(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT})
+ # execute_process(COMMAND realpath ${APPIMAGETOOL} OUTPUT_VARIABLE APPIMAGETOOL_REAL_PATH)
+ message("> cmake version is less than 3.19")
+ message(WARNING "!Relative paths are not supported!")
+ else()
+ file(REAL_PATH ${APPIMAGETOOL} APPIMAGETOOL_REAL_PATH)
+ endif(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT})
+ message("AppImage> Found APPIMAGETOOL Variable: ${LINUXDEPLOYQT_REAL_PATH}")
+
+ # do add_custome_target
+ make_directory(${APPIMAGE_OUTPUT})
+ target_linuxdeploy()
+ target_appimage()
+endfunction(add_appimage)
+
+function(add_appimage_desktop)
+ configure_file(cmake/spark-appimage.desktop.in
+ ${CMAKE_BINARY_DIR}/spark-appimage.desktop @ONLY)
+endfunction(add_appimage_desktop)
+
+function(add_appimage_icon _ICON_PATH)
+ if(CMAKE_VERSION VERSION_LESS 3.21)
+ message("> cmake version is less than 3.21")
+ configure_file(${_ICON_PATH} ${CMAKE_BINARY_DIR}/spark-appimage.png COPYONLY)
+ else()
+ file(COPY_FILE ${_ICON_PATH} ${CMAKE_BINARY_DIR}/spark-appimage.png)
+ endif(CMAKE_VERSION VERSION_LESS 3.21)
+endfunction(add_appimage_icon _ICON_PATH)
+
+
+
+# 如果glic>=2.27,你就需要加上参数 -unsupported-allow-new-glibc (意思就是不再低版本发行版使用了)
+# 或 -unsupported-bundle-everything大概的意思是尝试兼容实际测试到其他发行版直接用不了了有可能是发行版的原因还是建议用前者虽然放弃了低版本
+
+# -unsupported-bundle-everything
+ # 捆绑所有依赖库,包括 ld-linux.so 加载器和 glibc。这将允许构建在较新系统上的应用程序在较旧的目标系统上运行但不建议这样做因为它会导致捆绑包超出所需的大小并且可能到其他发行版无法使用
+# -unsupported-allow-new-glibc
+ # 允许 linuxdeployqt 在比仍受支持的最旧 Ubuntu LTS 版本更新的发行版上运行。这将导致 AppImage无法在所有仍受支持的发行版上运行既不推荐也不测试或支持
+
+# ./linuxdeployqt-7-x86_64.AppImage 程序目录/程序 -appimage -unsupported-allow-new-glibc
+# ./linuxdeployqt-7-x86_64.AppImage 程序目录/程序 -appimage -unsupported-bundle-everything
+
+
+
+
+# 1. 在顶层构建中导入 Appimage 的构建
+# include(cmake/SparkAppimageConfig.cmake) # 导入来自 Spark 构建的 Appimage 构建
+# add_appimage_icon(assets/spark.png) # 添加到 Appimage 中的默认的图标
+# add_appimage_desktop() # 添加到 Appimage 中的默认desktop(使用来自 Spark 构建的 Desktop 构建中配置的信息(必须要求 spark-desktop))
+# add_appimage() # 应用对 Appimage 的构建
+
+# 2. 在 Makefile 进行构建目标构建 Appimage 的构建流 --
+# 在 Makefile 进行构建目标构建 Appimage (要求提供工具的绝对路径然后可依次进行linuxdeployqt, genrate-appimage)
+# 来自于 https://github.com/probonopd/linuxdeployqt 的 linuxdeployqt
+# 来自于 https://github.com/AppImage/AppImageKit 的 appimagetool
+# 来自于 https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git 托管存储的工具
+
+# 或指定你所想存放克隆项目的位置
+# BUNDLE_LINUXDEPLOYQT := $(shell pwd)/build/bundle-linuxdeployqt
+
+# download-bundle-linuxdeploytools:
+# -git clone https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git $(BUNDLE_LINUXDEPLOYQT)
+
+# LINUXDEPLOYQT := "$(BUNDLE_LINUXDEPLOYQT)/linuxdeployqt-continuous-x86_64.AppImage"
+# APPIMAGETOOL := "$(BUNDLE_LINUXDEPLOYQT)/appimagetool-x86_64.AppImage"
+
+# linuxdeploy: release download-bundle-linuxdeploytools
+# cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL)
+# cd build && make linuxdeploy
+
+# genrate-appimage:
+# cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL)
+# cd build && make appimage
diff --git a/cmake/spark-appimage.desktop.in b/cmake/spark-appimage.desktop.in
new file mode 100644
index 0000000..0ca2577
--- /dev/null
+++ b/cmake/spark-appimage.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=@APP_NAME@
+Name[zh_CN]=@APP_NAME_ZH_CN@
+Exec=AppRun %F
+Icon=default
+Comment=@APP_COMMENT@
+Terminal=true
+Type=Application
+Categories=@APP_CATEGORIES@
+MimeType=text/plain
--
2.20.1
From c241f19bbcec29d7a1ed8fe8e1f0d6e36a957b69 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Thu, 2 Feb 2023 13:58:29 +0800
Subject: [PATCH 04/13] =?UTF-8?q?desktop:=20=E4=B8=BA=20desktop=20?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E6=9C=AC=E6=96=87=E4=BB=B6=E7=9A=84?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=20MimeType?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cmake/spark-appimage.desktop.in | 2 +-
cmake/spark-desktop.desktop.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/spark-appimage.desktop.in b/cmake/spark-appimage.desktop.in
index 0ca2577..70fc6b9 100644
--- a/cmake/spark-appimage.desktop.in
+++ b/cmake/spark-appimage.desktop.in
@@ -7,4 +7,4 @@ Comment=@APP_COMMENT@
Terminal=true
Type=Application
Categories=@APP_CATEGORIES@
-MimeType=text/plain
+MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-patch;text/x-adasrc;text/x-chdr;text/x-csrc;text/css;application/x-desktop;text/x-patch;text/x-fortran;text/html;text/x-java;text/x-tex;text/x-makefile;text/x-objcsrc;text/x-pascal;application/x-perl;application/x-perl;application/x-php;text/vnd.wap.wml;text/x-python;application/x-ruby;text/sgml;application/xml;model/vrml;image/svg+xml;application/json;
diff --git a/cmake/spark-desktop.desktop.in b/cmake/spark-desktop.desktop.in
index e7c3b18..e33c74e 100644
--- a/cmake/spark-desktop.desktop.in
+++ b/cmake/spark-desktop.desktop.in
@@ -7,6 +7,6 @@ Type=@APP_TYPE@
Exec=@APP_EXECUTE_PATH@
Icon=@APP_EXECUTE_ICON_PATH@
Categories=@APP_CATEGORIES@
-MimeType=text/plain
+MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-patch;text/x-adasrc;text/x-chdr;text/x-csrc;text/css;application/x-desktop;text/x-patch;text/x-fortran;text/html;text/x-java;text/x-tex;text/x-makefile;text/x-objcsrc;text/x-pascal;application/x-perl;application/x-perl;application/x-php;text/vnd.wap.wml;text/x-python;application/x-ruby;text/sgml;application/xml;model/vrml;image/svg+xml;application/json;
# Generated from the DesktopGenerater component of the z-Tools toolkit
\ No newline at end of file
--
2.20.1
From 4a74a60af053dfa4680918ceac8a78974d481d53 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Thu, 2 Feb 2023 14:00:54 +0800
Subject: [PATCH 05/13] =?UTF-8?q?repo:=20=E5=AF=B9=20desktop=20=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E6=B7=BB=E5=8A=A0=20%F=20=E5=8F=82=E6=95=B0=EF=BC=8C?=
=?UTF-8?q?=E4=BB=A5=E4=BF=9D=E8=AF=81=E5=8F=AF=E6=AD=A3=E7=A1=AE=E4=BC=A0?=
=?UTF-8?q?=E5=85=A5=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CMakeLists.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8f27aa..63e878c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,7 +70,8 @@ if(CMAKE_HOST_UNIX)
# 应用类型: Type=
"Application"
# 执行程序: Exec=
- "notepad--"
+ # 有关此 %F 参数可查看: https://gitee.com/zinface/z-tools/blob/desktop-dev/src/DesktopGenerater/desktopexecparamdialog.cpp
+ "notepad-- %F"
# 图标路径: Icon=
"/usr/share/notepad--/icons/spark.png"
# 应用分类: Category=
--
2.20.1
From b7f8abc6c6631ea598216c3606d0f61a9b653474 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Thu, 2 Feb 2023 14:47:56 +0800
Subject: [PATCH 06/13] =?UTF-8?q?cmake-version:=20=E5=B0=86=E7=89=88?=
=?UTF-8?q?=E6=9C=AC=E9=99=8D=E5=88=B0=203.22=20=E4=BB=A5=E9=80=82?=
=?UTF-8?q?=E7=94=A8=E4=BA=8E=20cmake=20=E6=9E=84=E5=BB=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CMakeLists.txt | 2 +-
src/qscint/CMakeLists.txt | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 63e878c..60e9171 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.24)
+cmake_minimum_required(VERSION 3.22)
project(notepad-- VERSION 1.22.0)
set(CMAKE_AUTOMOC ON)
diff --git a/src/qscint/CMakeLists.txt b/src/qscint/CMakeLists.txt
index f132dc6..77f02f2 100644
--- a/src/qscint/CMakeLists.txt
+++ b/src/qscint/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.24)
+cmake_minimum_required(VERSION 3.22)
project(qscint CXX)
set(CMAKE_AUTOMOC ON)
--
2.20.1
From 8661b20c61ad6f70f645e69e89da46e2b945bf7d Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Sun, 5 Feb 2023 12:55:38 +0800
Subject: [PATCH 07/13] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?=
=?UTF-8?q?=E7=8E=B0=E6=9C=89=E5=AE=8C=E6=95=B4=E6=9E=84=E5=BB=BA=E6=A8=A1?=
=?UTF-8?q?=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cmake/SparkEnvConfig.cmake | 8 +
cmake/SparkFindQt5Config.cmake | 153 ++++++++++++++++++
cmake/SparkFindQt6Config.cmake | 130 +++++++++++++++
cmake/SparkMacrosConfig.cmake | 161 +++++++++++++++++++
cmake/SparkMacrosExtendConfig.cmake | 237 ++++++++++++++++++++++++++++
5 files changed, 689 insertions(+)
create mode 100644 cmake/SparkEnvConfig.cmake
create mode 100644 cmake/SparkFindQt5Config.cmake
create mode 100644 cmake/SparkFindQt6Config.cmake
create mode 100644 cmake/SparkMacrosConfig.cmake
create mode 100644 cmake/SparkMacrosExtendConfig.cmake
diff --git a/cmake/SparkEnvConfig.cmake b/cmake/SparkEnvConfig.cmake
new file mode 100644
index 0000000..3690f1a
--- /dev/null
+++ b/cmake/SparkEnvConfig.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.5.1)
+
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+# set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_AUTORCC ON)
+# set(CMAKE_BUILD_TYPE "Debug")
\ No newline at end of file
diff --git a/cmake/SparkFindQt5Config.cmake b/cmake/SparkFindQt5Config.cmake
new file mode 100644
index 0000000..ad2db4c
--- /dev/null
+++ b/cmake/SparkFindQt5Config.cmake
@@ -0,0 +1,153 @@
+cmake_minimum_required(VERSION 3.5.1)
+
+set(SPARK_FIND_QT5 TRUE)
+
+find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED)
+
+# function(target_link_qt5 NAME)
+# target_link_libraries(${NAME}
+# Qt5::Core
+# Qt5::Widgets
+# Qt5::Network)
+# endfunction(target_link_qt5 NAME)
+
+# 使用 spark_add_link 生成 target_link_qt5 以替代上面内容
+spark_add_link(qt5 Qt5::Core Qt5::Widgets Qt5::Network)
+
+
+# spark_add_link_qt5
+# 自定义宏 spark_add_link_qt5 以扩展 target_link_qt5_<name> 结构
+ # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 <name> 名称
+ # 同等于 spark_add_link(qt_<name> ${ARGN})
+macro(spark_add_link_qt5 _IN_NAME)
+ spark_add_link(qt5_${_IN_NAME} ${ARGN})
+endmacro(spark_add_link_qt5 _IN_NAME)
+
+# 使用 spark_add_link_qt5 生成 target_link_qt5_<name> 的宏
+# spark_add_link_qt5(Concurrent Qt5::Concurrent)
+
+# 高级自定义
+# spark_add_links_qt5
+# 自定义宏 spark_add_links_qt5 以扩展 spark_add_link_qt5 宏配置组
+ # 特点: 任意长度参数
+ # qt5_item: 为进行遍历后的单项,类似于 python3 中的 (for item in items:)
+ # 例如: qt5_item 为 Core
+ # spark_add_link_qt5(${qt5_item} Qt5::${qt5_item})
+ # 展开为 spark_add_link_qt5(Core Qt5::Core)
+ # 展开为 spark_add_link(qt5_Core Qt5::Core)
+ # 展开为 spark_add_link(qt5_Core Qt5::Core)
+ # 特性: 增加 qt5_Core 转 qt5_core
+ # string(TOLOWER <string> <output_variable>)
+macro(spark_add_links_qt5)
+ set(qt5_items ${ARGN})
+ foreach(qt5_item IN LISTS qt5_items)
+ find_package(Qt5${qt5_item})
+ spark_add_link_qt5(${qt5_item} Qt5::${qt5_item})
+
+ 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}")
+ endforeach(qt5_item IN LISTS qt5_items)
+endmacro(spark_add_links_qt5)
+
+
+# Core 用于其它模块的核心非图形类。
+# GUI 图形用户界面 GUI 组件基类。包括 OpenGL。
+# Multimedia 音频 视频 无线电 摄像头功能类。
+# Multimedia Widgets 用于实现多媒体功能,基于 Widget 的类。
+# Network 使网络编程更容易和更可移植的类。
+
+# QML QML 和 JavaScript 语言类。
+# Quick 以自定义用户界面 UI 构建高动态应用程序的声明性框架。
+# Quick Controls 为桌面、嵌入式及移动设备创建高性能用户界面提供轻量 QML 类型。这些类型运用简单样式化体系结构且非常高效。
+# Quick Dialogs 用于从 Qt Quick 应用程序创建系统对话框,并与之交互的类型。
+# Quick Layouts 布局是用于在用户界面中排列基于 Qt Quick 2 项的项。
+# Quick Test 用于 QML 应用程序的单元测试框架,其测试案例被编写成 JavaScript 函数。
+ # 注意: 二进制保证不兼容 Qt Quick Test但源代码仍兼容。
+
+# Qt SQL 集成使用 SQL 数据库的类。
+# Qt Test 单元测试 Qt 应用程序和库的类。
+ # 注意: 二进制保证不兼容 Qt Test但源代码仍兼容。
+# Qt Widgets 以 C++ 小部件扩展 Qt GUI 的类。
+
+
+
+# 找出所有 Qt5 模板
+# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5
+
+# 掐头去尾,洗一次
+# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 | sed 's@^Qt5@@; s@Config.cmake$@@; /^\s*$/d'
+
+# 排序
+# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 | sed 's@^Qt5@@; s@Config.cmake$@@; /^\s*$/d' | sort | pr -t -3
+
+spark_add_links_qt5(
+ # AccessibilitySupport
+ # AttributionsScannerTools
+ Concurrent
+ # Core
+ # DBus
+ # Designer
+ # DesignerComponents
+ # DeviceDiscoverySupport
+ # DocTools
+ # EdidSupport
+ # EglFSDeviceIntegration
+ # EglFsKmsSupport
+ # EglSupport
+ # EventDispatcherSupport
+ # FbSupport
+ # FontDatabaseSupport
+ # GlxSupport
+ Gui
+ # Help
+ # InputSupport
+ # KmsSupport
+ # LinguistTools
+ # LinuxAccessibilitySupport
+ # Network
+ # OpenGL
+ # OpenGLExtensions
+ # PacketProtocol
+ # PlatformCompositorSupport
+ # Positioning
+ # PositioningQuick
+ PrintSupport
+ # Qml
+ # QmlDebug
+ # QmlDevTools
+ # QmlImportScanner
+ # QmlModels
+ # QmlWorkerScript
+ # Quick
+ # QuickCompiler
+ # QuickControls2
+ # QuickParticles
+ # QuickShapes
+ # QuickTemplates2
+ # QuickTest
+ # QuickWidgets
+ # SerialBus
+ # SerialPort
+ # ServiceSupport
+ # Sql
+ # Svg
+ # Test
+ # ThemeSupport
+ # UiPlugin
+ # UiTools
+ # VulkanSupport
+ # WebChannel
+ # WebEngine
+ # WebEngineCore
+ # WebEngineWidgets
+ # WebKit
+ # WebKitWidgets
+ # WebSockets
+ # Widgets
+ # X11Extras
+ # XcbQpa
+ # XkbCommonSupport
+ # Xml
+ XmlPatterns
+)
\ No newline at end of file
diff --git a/cmake/SparkFindQt6Config.cmake b/cmake/SparkFindQt6Config.cmake
new file mode 100644
index 0000000..fb2d741
--- /dev/null
+++ b/cmake/SparkFindQt6Config.cmake
@@ -0,0 +1,130 @@
+cmake_minimum_required(VERSION 3.5.1)
+
+set(SPARK_FIND_QT6 TRUE)
+
+find_package(Qt6 COMPONENTS Core Widgets Network REQUIRED)
+
+# function(target_link_qt6 NAME)
+# target_link_libraries(${NAME}
+# Qt6::Core
+# Qt6::Widgets
+# Qt6::Network)
+# endfunction(target_link_qt6 NAME)
+
+# 使用 spark_add_link 生成 target_link_qt6 以替代上面内容
+spark_add_link(qt6 Qt6::Core Qt6::Widgets Qt6::Network)
+
+
+# spark_add_link_qt6
+# 自定义宏 spark_add_link_qt6 以扩展 target_link_qt6_<name> 结构
+ # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 <name> 名称
+ # 同等于 spark_add_link(qt_<name> ${ARGN})
+macro(spark_add_link_qt6 _IN_NAME)
+ spark_add_link(qt6_${_IN_NAME} ${ARGN})
+endmacro(spark_add_link_qt6 _IN_NAME)
+
+# 使用 spark_add_link_qt6 生成 target_link_qt6_<name> 的宏
+# spark_add_link_qt5(Concurrent Qt6::Concurrent)
+
+# 高级自定义
+# spark_add_links_qt6
+# 自定义宏 spark_add_links_qt6 以扩展 spark_add_link_qt6 宏配置组
+ # 特点: 任意长度参数
+ # qt6_item: 为进行遍历后的单项,类似于 python3 中的 (for item in items:)
+ # 例如: qt6_item 为 Core
+ # spark_add_link_qt6(${qt6_item} Qt6::${qt6_item})
+ # 展开为 spark_add_link_qt6(Core Qt6::Core)
+ # 展开为 spark_add_link(qt6_Core Qt6::Core)
+ # 展开为 spark_add_link(qt6_Core Qt6::Core)
+ # 特性: 增加 qt6_Core 转 qt6_core
+ # string(TOLOWER <string> <output_variable>)
+macro(spark_add_links_qt6)
+ set(qt6_items ${ARGN})
+ foreach(qt6_item IN LISTS qt6_items)
+ find_package(Qt6${qt6_item})
+ spark_add_link_qt6(${qt6_item} Qt6::${qt6_item})
+
+ 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}")
+ endforeach(qt6_item IN LISTS qt6_items)
+endmacro(spark_add_links_qt6)
+
+# 找出所有 Qt6 模板
+# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt6@Qt6@;' | grep ^Qt6
+
+# 掐头去尾,洗一次
+# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 | sed 's@^Qt5@@; s@Config.cmake$@@; /^\s*$/d'
+
+# 排序
+# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt5@Qt5@;' | grep ^Qt5 | sed 's@^Qt5@@; s@Config.cmake$@@; /^\s*$/d' | sort | pr -t -3
+# find /usr/lib/x86_64-linux-gnu/cmake/ -name "*Config.cmake" | sed 's@^.*/Qt6@Qt6@;' | grep ^Qt6 | sed 's@^Qt6@@; s@Config.cmake$@@; /^\s*$/d' | sort | pr -t -3
+
+spark_add_links_qt6(
+ # BuildInternals
+ # BuildInternals/StandaloneTests/Qt5CompatTests
+ # BuildInternals/StandaloneTests/QtBaseTests
+ Concurrent
+ # Core
+ Core5Compat
+ # CoreTools
+ # DBus
+ # DBusTools
+ # DeviceDiscoverySupportPrivate
+ # EglFSDeviceIntegrationPrivate
+ # EglFsKmsGbmSupportPrivate
+ # EglFsKmsSupportPrivate
+ # FbSupportPrivate
+ # Gui
+ # GuiTools
+ # HostInfo
+ # InputSupportPrivate
+ # KmsSupportPrivate
+ # Network
+ # OpenGL
+ # OpenGLWidgets
+ PrintSupport
+ # QComposePlatformInputContextPlugin
+ # QCupsPrinterSupportPlugin
+ # QEglFSEmulatorIntegrationPlugin
+ # QEglFSIntegrationPlugin
+ # QEglFSKmsEglDeviceIntegrationPlugin
+ # QEglFSKmsGbmIntegrationPlugin
+ # QEglFSX11IntegrationPlugin
+ # QEvdevKeyboardPlugin
+ # QEvdevMousePlugin
+ # QEvdevTabletPlugin
+ # QEvdevTouchScreenPlugin
+ # QGifPlugin
+ # QGtk3ThemePlugin
+ # QIBaseDriverPlugin
+ # QIbusPlatformInputContextPlugin
+ # QICOPlugin
+ # QJpegPlugin
+ # QLibInputPlugin
+ # QLinuxFbIntegrationPlugin
+ # QMinimalEglIntegrationPlugin
+ # QMinimalIntegrationPlugin
+ # QMYSQLDriverPlugin
+ # QNetworkManagerNetworkInformationPlugin
+ # QODBCDriverPlugin
+ # QOffscreenIntegrationPlugin
+ # QPSQLDriverPlugin
+ # QSQLiteDriverPlugin
+ # QTlsBackendCertOnlyPlugin
+ # QTlsBackendOpenSSLPlugin
+ # QTsLibPlugin
+ # QTuioTouchPlugin
+ # QVkKhrDisplayIntegrationPlugin
+ # QVncIntegrationPlugin
+ # QXcbEglIntegrationPlugin
+ # QXcbGlxIntegrationPlugin
+ # QXcbIntegrationPlugin
+ # QXdgDesktopPortalThemePlugin
+ # Sql
+ # Test
+ # Widgets
+ # WidgetsTools
+ # XcbQpaPrivate
+ # Xml
+)
\ No newline at end of file
diff --git a/cmake/SparkMacrosConfig.cmake b/cmake/SparkMacrosConfig.cmake
new file mode 100644
index 0000000..4f68ce1
--- /dev/null
+++ b/cmake/SparkMacrosConfig.cmake
@@ -0,0 +1,161 @@
+cmake_minimum_required(VERSION 3.5.1)
+
+# 定义一些 macro 用于自动生成构建结构
+
+# spark_add_library <lib_name> [files]...
+# 构建一个库,基于指定的源文件
+ # 并根据库名生成 target_link_<lib_name> 函数
+macro(spark_add_library _lib_name)
+ message("================ ${_lib_name} Library ================")
+ add_library(${_lib_name} ${ARGN})
+
+ set(SRCS ${ARGN})
+ foreach(item IN LISTS SRCS)
+ message(" -> ${item}")
+ endforeach(item IN LISTS SRCS)
+
+ function(target_link_${_lib_name} TARGET)
+ message("${_lib_name}")
+ target_link_libraries(${TARGET} ${_lib_name})
+ endfunction(target_link_${_lib_name} TARGET)
+
+endmacro(spark_add_library _lib_name)
+
+# spark_add_library_path <lib_name> <lib_path>
+# 构建一个库,基于指定的路径
+ # 并根据库名生成 target_link_<lib_name> 函数
+ # 函数内增加以 <lib_path> 头文件搜索路径
+macro(spark_add_library_path _lib_name _lib_path)
+
+ set(${_lib_name}_SOURCE_PATH ${_lib_path})
+ set(${_lib_name}_TYPE)
+ 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}]")
+
+ if(${ARGC} LESS 3)
+ message(FATAL_ERROR "Missing parameter, library path not specified.")
+ endif(${ARGC} LESS 3)
+ endif(${${_lib_name}_SOURCE_PATH} STREQUAL SHARED OR ${${_lib_name}_SOURCE_PATH} STREQUAL STATIC)
+
+ aux_source_directory(${${_lib_name}_SOURCE_PATH} ${_lib_name}_SOURCES)
+
+ 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}")
+ foreach(item IN LISTS ${_lib_name}_SOURCES)
+ 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}")
+ 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}")
+ target_include_directories(${TARGET} PUBLIC "${${_lib_name}_SOURCE_PATH}")
+ # target_link_libraries(${TARGET} ${_lib_name})
+ endfunction(target_include_${_lib_name} TARGET)
+
+ # file(GLOB HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${${_lib_name}_SOURCE_PATH}/*.h)
+ target_include_directories(${_lib_name} PUBLIC "${${_lib_name}_SOURCE_PATH}")
+
+ # 如果想用以下操作手动实现 target_link_include_directories
+ # 请注意对 LIST 类型使用 "" 进行包围
+ # target_link_include_directories 的 PUBLIC 将会填充(追加)目标的 INCLUDE_DIRECTORIES 属性
+ # target_link_include_directories 支持 cmake 生成大表达式,更容易操作,手动将无法实现此类能力
+ # target_link_include_directories 支持相对路径和绝对路径参数
+ # 手动操作将必须使用绝对路径,这是不好的地方
+ # 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}")
+ # set_target_properties(${_lib_name} PROPERTIES
+ # INCLUDE_DIRECTORIES "${_lib_include_directories}"
+ # INTERFACE_INCLUDE_DIRECTORIES "${_lib_include_directories}"
+ # )
+
+endmacro(spark_add_library_path _lib_name _lib_path)
+
+# spark_add_executable <exec_name> [files]...
+# 构建一个可执行文件,基于指定的源文件
+ # Qt编译时源文件包括很多类型需要指定 *.h/*.cpp/*.qrc/*.qm/... 等
+macro(spark_add_executable _exec_name)
+
+ message("================ ${_exec_name} Executable ================")
+ add_executable(${_exec_name} ${ARGN})
+
+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 ================")
+ 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}")
+ endforeach(item IN LISTS ${_exec_name}_SOURCES)
+
+ # function(target_link_${_exec_name} TARGET)
+ # message("target_link_${_lib_name}")
+ message(" -> (include): ${_exec_path}")
+ target_include_directories(${_exec_name} PUBLIC "${_exec_path}")
+ # target_link_libraries(${TARGET} ${_lib_name})
+ # endfunction(target_link_${_exec_name} TARGET)
+ # target_link_${_exec_name}(${_exec_name})
+
+endmacro(spark_add_executable_path _exec_name _exec_path)
+
+# spark_find_library
+# 搜索一个库,基于指定的库名,调用 pkg-config 搜索库
+ # 并根据库名生成一个 target_link_<prefix> 函数
+macro(spark_find_library _prefix)
+ find_package(PkgConfig REQUIRED)
+
+ # libnotify
+ pkg_check_modules(${_prefix} ${ARGN})
+ function(target_link_${_prefix} TARGET)
+ target_include_directories(${TARGET} PUBLIC
+ ${${_prefix}_INCLUDE_DIRS})
+ target_link_libraries(${TARGET}
+ ${${_prefix}_LIBRARIES})
+ endfunction(target_link_${_prefix} TARGET)
+
+endmacro(spark_find_library _prefix)
+
+
+# spark_add_executable_paths
+# 自定义构建宏,基于指定的前缀名称,处理后续参数为子目录
+ # item: 为进行遍历后的单项,类似于 python3 中的 (for item in items:)
+ # file: 为在目录中不以递归(GLOB_RECURSE)方式寻找 qrc 文件,需要将其参与编译才能被 rcc
+ # 并根据 prefix-<item> 生成构建目标,
+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_add_executable_path(${_prefix_path}-${item} ${item} ${QRCS})
+ target_link_qt5(${_prefix_path}-${item})
+ endforeach(item IN LISTS PATHS)
+endmacro(spark_add_executable_paths _prefix_path)
+
+# spark_add_link
+# 自定义宏以代替当前使用 fucntion 定义 target_link_<name> 结构
+ # _IN_NAME: 此宏生成 target_link_<name> 的要求参数
+ # ARGN: 此宏剩余的参数列表
+ # 在使用 target_link_<name> 时
+ # _NAME: 用于此 fucntion 中的要求参数: <_NAME>目标将要连接此库
+macro(spark_add_link _IN_NAME)
+ function(target_link_${_IN_NAME} _NAME)
+ message("LINK ${_NAME} ${ARGN}")
+ target_link_libraries(${_NAME}
+ ${ARGN})
+ endfunction(target_link_${_IN_NAME} _NAME)
+endmacro(spark_add_link _IN_NAME)
diff --git a/cmake/SparkMacrosExtendConfig.cmake b/cmake/SparkMacrosExtendConfig.cmake
new file mode 100644
index 0000000..bd15f0d
--- /dev/null
+++ b/cmake/SparkMacrosExtendConfig.cmake
@@ -0,0 +1,237 @@
+
+# find_plus
+# 寻找 INVAl 传入的字符串,如果存在 + 字符将写入位置到 OUTVAL
+function(find_plus INVAL OUTVAL)
+ string(FIND "${INVAL}" "+" plus_index)
+ set(${OUTVAL} ${plus_index} PARENT_SCOPE)
+ # if(plus_index LESS 0)
+ # set(${OUTVAL} -1 PARENT_SCOPE)
+ # else()
+ # set(${OUTVAL} ${plus_index} PARENT_SCOPE)
+ # endif(plus_index LESS 0)
+endfunction(find_plus INVAL OUTVAL)
+
+# find_plus("FF" FFFF)
+# message("--> FFFF ${FFFF}") # --> FFFF -1
+# find_plus("F+F" FFFF)
+# message("--> FFFF ${FFFF}") # --> FFFF 1
+# find_plus("+F+F" FFFF)
+# message("--> FFFF ${FFFF}") # --> FFFF 0
+
+# set(FFF)
+# list(APPEND FFFF )
+# list(APPEND FFFF "F")
+# list(APPEND FFFF "FA")
+# message("--> FFFF: ${FFFF}") # --> FFFF: F;FA
+
+# set(FFFFS "")
+# list(APPEND FFFFS ${FFFF})
+# message("--> FFFFS: ${FFFFS}") # --> FFFFS: F;FA
+
+# set(FFFF "+AA+BB+CC+DD")
+# string(REPLACE "+" ";" FFFFL "${FFFF}")
+# list(LENGTH FFFFL FFFFLEN)
+# message("--> FFFFL: ${FFFFL} --> ${FFFFLEN}") # --> FFFFL: F;
+
+# plus_list
+# 将传入的 "+AAA+BBB+CCC" 类型数据变成一个 列表(list)
+# 适用于不使用 string 进行替换 + 为 ";" 的情况下使用直接变成 list
+function(plus_list INVAL OUTVAL OUTVALLEN)
+ # set(${OUTVAL} "..." PARENT_SCOPE)
+ # set(${OUTVALLEN} 0 PARENT_SCOPE)
+
+ set(_tmps "") # 设置为空的
+
+ # 寻找下一个 + 位置
+ find_plus(${INVAL} RIGHT_PLUS)
+
+ string(LENGTH "${INVAL}" INVALLEN)
+ message("--> 传入的 INVAL: --> 内容: ${INVAL}")
+ message("--> 传入的 INVAL: --> 长度: ${INVALLEN}")
+ message("--> 传入的 INVAL: --> +位置: ${RIGHT_PLUS}")
+
+ # 判断是否有右侧 + 号
+ if(RIGHT_PLUS LESS 0)
+ message("--> 传入的 INVAL: --> 无需计算新的+位置")
+ # message("--> 计算新的 + 位置: ${_PLUSINDEX}")
+ list(APPEND _tmps ${INVAL})
+ else()
+ math(EXPR _PLUSINDEX "${RIGHT_PLUS}+1")
+ message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX}")
+
+ string(SUBSTRING "${INVAL}" ${_PLUSINDEX} ${INVALLEN} NewVal)
+ message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX} -> 内容: ${NewVal}")
+ # string(REPLACE "+" ";" _tmps "${NewVal}")
+ # list(LENGTH FFFFL FFFFLEN)
+
+ # message("--> 计算新的 + 位置: ${_PLUSINDEX} --> 后面的 NewVal: ${NewVal}")
+
+ # find_plus(${NewVal} _NextPlus)
+ # if(_NextPlus LESS 0)
+ # list(APPEND _tmps ${NewVal})
+ # message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的")
+ # else()
+ # message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的")
+ # # 重新
+ # # plus_list(${NewVal} NewValS )
+ # # foreach(item)
+ # # list(APPEND _tmps ${item})
+ # # endforeach(item)
+ # endif(_NextPlus LESS 0)
+ endif(RIGHT_PLUS LESS 0)
+
+ set(${OUTVAL} ${_tmps} PARENT_SCOPE)
+ list(LENGTH _tmps _tmps_len)
+ set(${OUTVALLEN} ${_tmps_len} PARENT_SCOPE)
+
+endfunction(plus_list INVAL OUTVAL OUTVALLEN)
+
+# plus_list("+AAA+BBB+CCC+DDD" FFF FFLEN)
+# message("--------> ${FFF}: -> ${FFLEN}")
+
+# spark_add_library_realpaths
+# 基于传入的项进行构建
+# 可接受的值为: 路径列表
+# 可接受的值为: 路径列表+依赖库A+依赖库B
+macro(spark_add_library_realpaths)
+ message("---> 基于传入的项进行构建 <---")
+ # 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} <--- ")
+ string(LENGTH "${REALPATH}" REALPATH_LENGTH)
+ message("---> 计算传入路径长度: --> 长度: ${REALPATH_LENGTH}")
+
+ string(FIND "${REALPATH}" "/" LASTINDEX REVERSE)
+ message("---> 计算传入路径末尾/位置: --> 长度: ${LASTINDEX}")
+ math(EXPR LASTINDEX "${LASTINDEX}+1")
+ message("---> 计算传入路径末尾/右移: --> 长度: ${LASTINDEX}")
+ string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALPATH_LENGTH} REALNAME_Dependency)
+
+ # 找 + 号下标,这是找+号的函数
+ find_plus(${REALPATH} RIGHT_PLUS)
+
+ # 判断是否有找到 + 号下标,值为 -1 或 正整数
+ if(RIGHT_PLUS LESS 0) # 小于0: 不存在 + 号
+ set(REALNAME "${REALNAME_Dependency}")
+ message("---> 传入路径末尾/右移部分: --> ${REALNAME} <-- 无依赖+")
+
+ message("---> 构建 ${REALNAME} -> ${REALNAME} ${REALPATH} ")
+
+ spark_add_library_path(${REALNAME} ${REALPATH})
+
+ if(SPARK_FIND_QT5)
+ target_link_qt5(${REALNAME})
+ endif(SPARK_FIND_QT5)
+
+ if(SPARK_FIND_QT6)
+ target_link_qt6(${REALNAME})
+ endif(SPARK_FIND_QT6)
+
+ else()
+ message("---> 传入路径末尾/右移部分: --> ${REALNAME_Dependency} <-- 依赖+")
+
+ # 存在+号,将截取从 / 到 + 号之间的内容作为目标名称
+ # 例如 src/unclassified/widgets/DocTypeListView+JsonDeploy
+ # ^(LASTINDEX) ^(RIGHT_PLUS)
+ # 将 RIGHT_PLUS - LASTINDEX 计算出 DocTypeListView 字符长度
+ math(EXPR REALNAME_LENGTH "${RIGHT_PLUS}-${LASTINDEX}")
+
+ message("---> 计算传入路径末尾/右移部分: --> 位置: ${RIGHT_PLUS}")
+ # message("---> 计算传入路径末尾/右移部分: --> 长度: ${REALNAME_Dependency}")
+
+ # 目标名称为 DocTypeListView
+ # 依赖为 JsonDeploy
+ # set(REALNAME "")
+ string(SUBSTRING "${REALPATH}" 0 ${RIGHT_PLUS} _REALPATH_DIR)
+ string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALNAME_LENGTH} REALNAME)
+
+ message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME}")
+
+ string(SUBSTRING "${REALPATH}" ${RIGHT_PLUS} ${REALPATH_LENGTH} Dependency)
+ message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency}")
+
+ # plus_list(${Dependency} dependencies dependencies_len)
+ string(REPLACE "+" ";" dependencies "${Dependency}")
+ message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency} --> 列表: ${dependencies} <-- ")
+
+
+ message("---> 构建 ${REALNAME} -> ${REALNAME} ${_REALPATH_DIR}")
+
+ spark_add_library_path(${REALNAME} ${_REALPATH_DIR})
+ # target_link_qt5(${REALNAME}) # 使用依赖的依赖或许也不错
+
+ target_include_directories(${REALNAME} PUBLIC ${_REALPATH_DIR})
+ target_link_libraries(${REALNAME} ${dependencies})
+
+ endif(RIGHT_PLUS LESS 0)
+ endforeach(REALPATH IN LISTS REALPATHS)
+
+endmacro(spark_add_library_realpaths)
+
+
+# spark_aux_source_paths
+# 将指定路径中的文件变成可用的AUX源文件列表
+macro(spark_aux_source_paths AUX_VAR)
+ set(${AUX_VAR} "")
+ set(${AUX_VAR}_PATHS ${ARGN})
+
+ foreach(aux_path IN LISTS ${AUX_VAR}_PATHS)
+ # message("aux_path: ${aux_path}")
+ aux_source_directory(${aux_path} ${AUX_VAR})
+ endforeach(aux_path IN LISTS ${AUX_VAR}_PATHS)
+
+endmacro(spark_aux_source_paths AUX_VAR)
+
+# spark_file_glob
+#
+macro(spark_file_glob FGLOB_VAR)
+ set(${FGLOB_VAR} "")
+ set(${FGLOB_VAR}_PATHS ${ARGN})
+
+ foreach(fglob_path IN LISTS ${FGLOB_VAR}_PATHS)
+
+ file(GLOB FGLOB_PATH_SRCS ${fglob_path})
+ foreach(fglob_path_src IN LISTS FGLOB_PATH_SRCS)
+ # message(" -> ${item}")
+ list(APPEND ${FGLOB_VAR} ${fglob_path_src})
+ endforeach(fglob_path_src IN LISTS FGLOB_PATH_SRCS)
+
+ endforeach(fglob_path IN LISTS ${FGLOB_VAR}_PATHS)
+
+endmacro(spark_file_glob FGLOB_VAR)
+
+
+# spark_add_source_paths
+# 将指定路径中的文件变成可用的源文件列表
+#
+macro(spark_add_source_paths SOURCE_VAR)
+ set(${SOURCE_VAR} "")
+ set(${SOURCE_VAR}_PATHS ${ARGN})
+
+ spark_aux_source_paths(${SOURCE_VAR} ${ARGN})
+ foreach(source_path IN LISTS ${SOURCE_VAR}_PATHS)
+ # list(APPEND ${SOURCE_VAR}_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_PATH})
+ # aux_source_directory(${SOURCE_PATH} _SOURCES)
+ # foreach(item IN LISTS _SOURCES)
+ # # 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}")
+ # 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}")
+ list(APPEND ${SOURCE_VAR} ${ui_src})
+ endforeach(ui_src IN LISTS UI_SRCS)
+ endforeach(source_path IN LISTS ${SOURCE_VAR}_PATHS)
+endmacro(spark_add_source_paths SOURCE_VAR)
--
2.20.1
From ba6310f45bd803ed6ac60b9851cecc14445cc942 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Sun, 5 Feb 2023 13:00:22 +0800
Subject: [PATCH 08/13] =?UTF-8?q?repo:=20=E5=B0=86=E7=8E=B0=E6=9C=89?=
=?UTF-8?q?=E6=9E=84=E5=BB=BA=E8=BD=AC=E4=B8=BA=20spark=20=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CMakeLists.txt | 120 +++++++++++++++++++++++++++----------------------
1 file changed, 66 insertions(+), 54 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 60e9171..d990b1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,60 +1,72 @@
cmake_minimum_required(VERSION 3.22)
+
project(notepad-- VERSION 1.22.0)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-set(CMAKE_AUTORCC ON)
-
-find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns)
-
-# TODO: use system provided libraries to build
-# current status: some header can not be found,for example: Scintilla.h
-find_library(QSCINTILLA_LIB_PATH qscintilla2_qt5)
-find_path(QSCINTILLA_INC_PATH qsciscintilla.h PATHS /usr/include/)
-find_path(SCINTILLA_INC_PATH Scintilla.h PATHS /usr/include/)
-if((${QSCINTILLA_LIB_PATH} STREQUAL "QSCINTILLA_LIB_PATH-NOTFOUND") OR
- (${QSCINTILLA_INC_PATH} STREQUAL "QSCINTILLA_INC_PATH-NOTFOUND") OR
- (${SCINTILLA_INC_PATH} STREQUAL "SCINTILLA_INC_PATH-NOTFOUND") )
-set(NOTEPAD_USE_SYS_LIB OFF)
-message("system libraries or header not found,build from local")
-add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint)
-else()
-set(NOTEPAD_USE_SYS_LIB ON)
-message("use system libraries")
-message("QSCINTILLA_LIB_PATH:" ${QSCINTILLA_LIB_PATH})
-message("QSCINTILLA_INC_PATH:" ${QSCINTILLA_INC_PATH})
-message("SCINTILLA_INC_PATH:" ${SCINTILLA_INC_PATH})
-endif()
-
-file(GLOB UI_SRC ${PROJECT_SOURCE_DIR}/src/*.ui)
-set(UI_SRC ${UI_SRC} ${PROJECT_SOURCE_DIR}/src/cceditor/ccnotepad.ui)
-aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC)
-aux_source_directory(${PROJECT_SOURCE_DIR}/src/cceditor SRC)
-
-add_executable(${PROJECT_NAME} ${SRC} ${UI_SRC} ${PROJECT_SOURCE_DIR}/src/RealCompare.qrc)
-target_include_directories(${PROJECT_NAME} PRIVATE
-${PROJECT_SOURCE_DIR}/src
-${PROJECT_SOURCE_DIR}/src/cceditor
-)
-
-if(NOTEPAD_USE_SYS_LIB)
-target_include_directories(${PROJECT_NAME} PRIVATE ${QSCINTILLA_INC_PATH} ${SCINTILLA_INC_PATH})
-endif()
-
-target_link_libraries(${PROJECT_NAME} qscintilla2_qt5 Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
-
-install(
- TARGETS ${PROJECT_NAME}
- DESTINATION "bin"
-)
-
-install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/linux/usr
- DESTINATION "/")
-
-include(${PROJECT_SOURCE_DIR}/cmake/package_config.cmake)
-include(CPack)
-
-target_link_libraries(${PROJECT_NAME} qscint Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport Qt5::XmlPatterns)
+include(cmake/SparkEnvConfig.cmake)
+include(cmake/SparkMacrosConfig.cmake)
+include(cmake/SparkFindQt5Config.cmake)
+# include(cmake/SparkFindQt6Config.cmake)
+include(cmake/SparkMacrosExtendConfig.cmake)
+
+# ----------------- Build QScint ----------------- #
+if(TRUE)
+ # add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint)
+ # file(GLOB MOC_HEADER src/qscint/src/Qsci/*.h)
+ spark_file_glob(MOC_HEADER "src/qscint/src/Qsci/*.h")
+
+ spark_add_source_paths(QSciSources
+ src/qscint/src
+ src/qscint/scintilla/lexers
+ src/qscint/scintilla/lexlib
+ src/qscint/scintilla/src
+ src/qscint/scintilla/boostregex
+
+ # 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)
+ target_include_directories(QSci PRIVATE
+ src/qscint/scintilla/boostregex
+ src/qscint/scintilla/lexlib)
+ target_include_directories(QSci PUBLIC
+ src/qscint/src
+ src/qscint/src/Qsci
+ src/qscint/scintilla/src
+ src/qscint/scintilla/include)
+ target_link_qt5(QSci)
+ target_link_qt5_PrintSupport(QSci)
+ target_link_qt5_Concurrent(QSci)
+endif(TRUE)
+
+
+# ----------------- Build CCEditor ----------------- #
+if(TRUE)
+
+ # 准备构建 CCEditor
+ set(QRC_SOURCES src/RealCompare.qrc)
+ spark_aux_source_paths(CCEditorSources
+ src
+ src/cceditor
+ )
+ spark_add_executable(${PROJECT_NAME} ${CCEditorSources} ${QRC_SOURCES})
+ target_include_directories(${PROJECT_NAME} PRIVATE
+ ${PROJECT_SOURCE_DIR}/src
+ ${PROJECT_SOURCE_DIR}/src/cceditor
+
+ ${PROJECT_SOURCE_DIR}/src/qscint/src
+ ${PROJECT_SOURCE_DIR}/src/qscint/src/Qsci
+ ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/src
+ ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/include
+ ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/lexlib
+ ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/boostregex
+ )
+ # target_link_libraries(${PROJECT_NAME} QSci)
+ target_link_QSci(${PROJECT_NAME})
+ target_link_qt5_XmlPatterns(${PROJECT_NAME})
+
+endif(TRUE)
+
if(CMAKE_HOST_UNIX)
include(cmake/SparkInstallMacrosConfig.cmake)
--
2.20.1
From 28e63cf37d6e4b41b4a0720ee7a321d484487eb5 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Sun, 5 Feb 2023 16:58:53 +0800
Subject: [PATCH 09/13] =?UTF-8?q?repo:=20=E9=A2=84=E7=95=99=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=E4=B8=BA=E6=8F=92=E4=BB=B6=E7=9B=B8=E5=85=B3=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E9=83=A8=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CMakeLists.txt | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d990b1d..c18417f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,6 +67,16 @@ if(TRUE)
endif(TRUE)
+# ----------------- CCEditor Plugin Support or Other ----------------- #
+if(TRUE)
+
+ # 开启插件支持
+ # target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN=0)
+
+ # 其它有关插件的部分处理...
+
+endif(TRUE)
+
if(CMAKE_HOST_UNIX)
include(cmake/SparkInstallMacrosConfig.cmake)
--
2.20.1
From 481a7f7b39fe4b67bec6a3cab24e59a4e06b39f0 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Mon, 6 Feb 2023 01:10:42 +0800
Subject: [PATCH 10/13] =?UTF-8?q?linux/plugin-support:=20=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=20Notepad--=20=E6=8F=92=E4=BB=B6=E6=9E=84=E5=BB=BA?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=94=AF=E6=8C=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CMakeLists.txt | 71 +++++++++++++++++++-
cmake/NotepadPluginConfig.cmake.in | 96 ++++++++++++++++++++++++++++
cmake/SparkInstallMacrosConfig.cmake | 3 +-
3 files changed, 167 insertions(+), 3 deletions(-)
create mode 100644 cmake/NotepadPluginConfig.cmake.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c18417f..28b3007 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,13 +71,14 @@ endif(TRUE)
if(TRUE)
# 开启插件支持
- # target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN=0)
+ target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN=0)
# 其它有关插件的部分处理...
endif(TRUE)
-
+# 可能需要变更为 CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" ??
+# 并使用 Linux.cmake 维护?
if(CMAKE_HOST_UNIX)
include(cmake/SparkInstallMacrosConfig.cmake)
include(cmake/SparkDesktopMacros.cmake)
@@ -103,6 +104,72 @@ if(CMAKE_HOST_UNIX)
spark_install_file(/usr/share/notepad--/icons/ assets/spark.png)
spark_install_target(/usr/bin/ ${PROJECT_NAME})
+ # TODO如果主线已经将 linux/destkop 的PR合入即可移除此部分以上部分而使用以下部分
+ # spark_install_directory(/usr src/linux/usr/*) # 完整的 Linux 资源文件
+
+ # ------------------ INSTALL PLUGIN CONFIG ------------------ #
+ # ------------------ INSTALL PLUGIN CONFIG ------------------ #
+ # ------------------ INSTALL PLUGIN CONFIG ------------------ #
+ include(CMakePackageConfigHelpers)
+ include(GNUInstallDirs)
+
+ # 定义插件配置安装位置
+ set(CMAKE_INSTALL_PREFIX "/usr")
+ set(NOTEPAD_PLUGIN NotepadPlugin)
+
+ # 定义开发插件时的配置目录与 CMake 模块文件名称
+ set(NOTEPAD_PLUGIN_CONFIG ${NOTEPAD_PLUGIN}Config.cmake)
+ set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN})
+ set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN})
+
+ # 定义一些扩展内容,主要是提供给 CMake 模块文件填充
+ set(NOTEPAD_PLUGIN_CORELIB QSci)
+ set(NOTEPAD_PLUGIN_EXTERNAL_INCLUDES
+ ${NOTEPAD_PLUGIN_INCLUDEDIR}/Qsci)
+
+ # 定义在插件开发的 CMake 模块中Notepad-- 是否是基于 QT5 实现
+ # 并自动为插件开发层自动开启相关 Qt 依赖组件
+ # 此部分逻辑将自动提供给 add_notepad_plugin 自行处理
+ set(NOTEPAD_BUILD_BY_QT5 TRUE)
+ set(NOTEPAD_BUILD_BY_QT6 FALSE)
+
+ # 定义在插件开发的 CMake 模块中Notepad-- 是否将提供 "插件安装目录(位置)"
+ set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY "")
+
+ # 将 NOTEPAD_PLUGIN_INCLUDEDIR NOTEPAD_PLUGIN_LIBDIR 填充到 cmake 文件
+ configure_package_config_file(cmake/NotepadPluginConfig.cmake.in
+ ${CMAKE_BINARY_DIR}/${NOTEPAD_PLUGIN_CONFIG}
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${NOTEPAD_PLUGIN})
+ # 安装 cmake 文件
+ spark_install_file(${CMAKE_INSTALL_LIBDIR}/cmake/${NOTEPAD_PLUGIN}
+ ${CMAKE_BINARY_DIR}/${NOTEPAD_PLUGIN_CONFIG})
+ # 安装头插件接口文件
+ spark_install_file(${NOTEPAD_PLUGIN_INCLUDEDIR}
+ src/include/pluginGl.h)
+ # 安装插件所需要的Qsci文件
+ spark_install_directory(${NOTEPAD_PLUGIN_INCLUDEDIR}
+ src/qscint/src/Qsci)
+
+ # 导出 QSci 的头文件(从插件实现层面来看,目前是使用*.h 与 pluginGl.h
+ # 但从 Qsci 层面来看,*.h 使用的是 #include <Qsci/*.h> ,所以此部分不被使用)
+ # spark_file_glob(QSci_HEADERS src/qscint/src/Qsci/*.h src/include/pluginGl.h)
+ # set_target_properties(QSci PROPERTIES PUBLIC_HEADER "${QSci_HEADERS}")
+
+ # 导出 Notepad-- 的接口文件(从逻辑层面来看,目前已经在前面安装了接口文件,所以此部分不被使用)
+ # spark_file_glob(Notepad_HEADERS src/include/pluginGl.h)
+ # set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${QSci_HEADERS}")
+
+ # 安装项目文件与 QSci 文件
+ install(TARGETS ${PROJECT_NAME} QSci
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION ${NOTEPAD_PLUGIN_LIBDIR}
+ ARCHIVE DESTINATION ${NOTEPAD_PLUGIN_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${NOTEPAD_PLUGIN_INCLUDEDIR}
+ )
+ # ------------------ INSTALL PLUGIN CONFIG ------------------ #
+ # ------------------ INSTALL PLUGIN CONFIG ------------------ #
+ # ------------------ INSTALL PLUGIN CONFIG ------------------ #
+
# 1. 在顶层构建中导入 Appimage 的构建
include(cmake/SparkAppimageConfig.cmake) # 导入来自 Spark 构建的 Appimage 构建
diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in
new file mode 100644
index 0000000..58e0bd7
--- /dev/null
+++ b/cmake/NotepadPluginConfig.cmake.in
@@ -0,0 +1,96 @@
+# NotepadPluginConfig.cmake
+# 用于 Notepad-- 插件实现的 CMake 模块初级定义
+
+# 在 Linux 中,它的布局应该如下:
+# /usr/lib/x86_64-linux-gnu/cmake/NotepadPlugin/NotepadPluginConfig.cmake
+
+# 在 插件开发层中,它的使用如下:
+ # 1. 查找 NotepadPlugin 模块
+ # find_package(NotepadPlugin)
+ # 2. 使用 add_notepad_plugin(<模块名称> <源代码、资源文件> [...])
+ # add_notepad_plugin(<plugin_name> <plugin_srcs> ...)
+
+# 一些无关紧要的部分,如果需要实现插件安装操作时,即可进行使用
+# include(CMakePackageConfigHelpers)
+# include(GNUInstallDirs)
+
+#
+set(NOTEPAD_PLUGIN @NOTEPAD_PLUGIN@)
+set(NOTEPAD_PLUGIN_INCLUDEDIR @NOTEPAD_PLUGIN_INCLUDEDIR@)
+set(NOTEPAD_PLUGIN_LIBDIR @NOTEPAD_PLUGIN_LIBDIR@)
+set(NOTEPAD_PLUGIN_CORELIB @NOTEPAD_PLUGIN_CORELIB@)
+
+# 一些扩展内容,主要是 CMake 模块文件的填充
+set(NOTEPAD_PLUGIN_EXTERNAL_INCLUDES
+ @NOTEPAD_PLUGIN_EXTERNAL_INCLUDES@)
+
+# 由插件开发者进行参考的 "Notepad 提供的插件安装目录(位置)"
+set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY @NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_DIRECTORY@)
+
+set(NOTEPAD_BUILD_BY_QT5 @NOTEPAD_BUILD_BY_QT5@)
+set(NOTEPAD_BUILD_BY_QT6 @NOTEPAD_BUILD_BY_QT6@)
+
+if(NOTEPAD_PLUGIN_BY_QT5)
+ set(CMAKE_AUTOMOC ON)
+ set(CMAKE_AUTOUIC ON)
+ find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
+endif(NOTEPAD_PLUGIN_BY_QT5)
+
+if(NOTEPAD_BUILD_BY_QT6)
+ set(CMAKE_AUTOMOC ON)
+ set(CMAKE_AUTOUIC ON)
+ find_package(Qt6 COMPONENTS Core Widgets REQUIRED)
+endif(NOTEPAD_BUILD_BY_QT6)
+
+
+
+add_library(${NOTEPAD_PLUGIN} SHARED IMPORTED)
+set_target_properties(${${NOTEPAD_PLUGIN}} PROPERTIES
+ IMPORTED_LOCATION
+ ${NOTEPAD_PLUGIN_LIBDIR}/lib${NOTEPAD_PLUGIN_CORELIB}.so
+
+ INCLUDE_DIRECTORIES
+ "${NOTEPAD_PLUGIN_INCLUDEDIR};${NOTEPAD_PLUGIN_EXTERNAL_INCLUDES}"
+)
+
+# add_notepad_plugin(<PLUGIN_VAR> <PLUGIN_SRC> [...])
+#
+macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
+ # aux_source_directory(${PLUGIN_VAR}_SOURCES ${ARGN})
+ add_library(${PLUGIN_VAR} SHARED ${PLUGIN_SRC} ${ARGN})
+ if(CMAKE_HOST_WIN32)
+ # Win32 已提供宏判断
+ # target_compile_definitions(${PLUGIN_VAR} PUBLIC NDD_EXPORT=export)
+ endif(CMAKE_HOST_WIN32)
+
+ if(CMAKE_HOST_UNIX)
+ target_compile_definitions(${PLUGIN_VAR} PUBLIC NDD_EXPORT=export)
+ endif(CMAKE_HOST_UNIX)
+ target_include_directories(${PLUGIN_VAR} PUBLIC ${NOTEPAD_PLUGIN_INCLUDEDIR} ${NOTEPAD_PLUGIN_EXTERNAL_INCLUDES})
+ target_link_directories(${PLUGIN_VAR} PUBLIC ${NOTEPAD_PLUGIN_LIBDIR})
+ target_link_libraries(${PLUGIN_VAR} ${NOTEPAD_PLUGIN_CORELIB})
+ if(NOTEPAD_PLUGIN_QT5)
+ target_link_libraries(${PLUGIN_VAR} Qt5::Core Qt5::Widgets)
+ endif(NOTEPAD_PLUGIN_QT5)
+
+ if(NOTEPAD_PLUGIN_QT5)
+ target_link_libraries(${PLUGIN_VAR} Qt6::Core Qt6::Widgets)
+ endif(NOTEPAD_PLUGIN_QT5)
+
+endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
+
+# support git plugin
+macro(add_notepad_plugin_with_git PLUGIN_VAR GIT_REPO_URL GIT_REPO_PLUGIN_PATH)
+ execute_process(COMMAND git clone ${GIT_REPO_URL} ${PLUGIN_VAR}_git
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ ERROR_QUIET)
+ aux_source_directory(${CMAKE_BINARY_DIR}/$${PLUGIN_VAR}_git/${GIT_REPO_PLUGIN_PATH} ${PLUGIN_VAR}_RESOURCES)
+ add_notepad_plugin(${PLUGIN_VAR} ${${PLUGIN_VAR}_RESOURCES})
+endmacro(add_notepad_plugin_with_git PLUGIN_VAR GIT_REPO_URL GIT_REPO_PLUGIN_PATH)
+
+message("- >>>>>>>>>>>>>>>>>> NotepadPlugin: <<<<<<<<<<<<<<<<<<")
+message(" - ${CMAKE_CURRENT_LIST_FILE}")
+message(" - ${NOTEPAD_PLUGIN_INCLUDEDIR}")
+message(" - ${NOTEPAD_PLUGIN_LIBDIR}")
+message(" - ${NOTEPAD_PLUGIN_CORELIB}")
+message("- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<")
\ No newline at end of file
diff --git a/cmake/SparkInstallMacrosConfig.cmake b/cmake/SparkInstallMacrosConfig.cmake
index 1f8939b..204d16a 100644
--- a/cmake/SparkInstallMacrosConfig.cmake
+++ b/cmake/SparkInstallMacrosConfig.cmake
@@ -79,7 +79,8 @@ macro(spark_install_directory INSTALL_DIRECTORY_DIR INSTALL_DIRECOTRY)
# message(FATAL_ERROR " directory: ${INSTALL_DIRECTORY_FIND_INDEX_SUBSTRING_FILE_GLOB_LIST_LENGTH}")
else()
- message(FATAL_ERROR "install ${INSTALL_DIRECTORY_DIR}")
+ # ISSUES You Must check here
+ # message(FATAL_ERROR "install ${INSTALL_DIRECTORY_DIR}")
install(DIRECTORY
${INSTALL_DIRECOTRY} ${ARGN}
--
2.20.1
From 7e215f5fe65a9962bf29588a0e566d239b734d25 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Mon, 6 Feb 2023 01:11:26 +0800
Subject: [PATCH 11/13] =?UTF-8?q?linux/plugin-doc:=20=E6=B7=BB=E5=8A=A0=20?=
=?UTF-8?q?Notepad--=20=E6=8F=92=E4=BB=B6=E6=9E=84=E5=BB=BA=E6=8F=8F?=
=?UTF-8?q?=E8=BF=B0=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cmake/NoteadPlugin-Linux-Development.md | 164 ++++++++++++++++++++++++
1 file changed, 164 insertions(+)
create mode 100644 cmake/NoteadPlugin-Linux-Development.md
diff --git a/cmake/NoteadPlugin-Linux-Development.md b/cmake/NoteadPlugin-Linux-Development.md
new file mode 100644
index 0000000..c642fc7
--- /dev/null
+++ b/cmake/NoteadPlugin-Linux-Development.md
@@ -0,0 +1,164 @@
+# NotepadPlugin 开发说明
+
+> 当前插件实现的提供 Linux 层开发说明
+
+- 引用 NotepadPluginConfig.cmake 中的说明
+
+ ```cmake
+ # NotepadPluginConfig.cmake
+ # 用于 Notepad-- 插件实现的 CMake 模块初级定义
+
+ # 在 Linux 中,它的布局应该如下:
+ # /usr/lib/x86_64-linux-gnu/cmake/NotepadPlugin/NotepadPluginConfig.cmake
+
+ # 在 插件开发层中,它的使用如下:
+ # 1. 查找 NotepadPlugin 模块
+ # find_package(NotepadPlugin)
+ # 2. 使用 add_notepad_plugin(<模块名称> <源代码、资源文件> [...])
+ # add_notepad_plugin(<plugin_name> <plugin_srcs> ...)
+ ```
+
+- 着手进行实现插件
+
+ > 将项目中的 src/plugin/helloworld 复制为单个项目,并使用 CMake 进行构建
+
+ ```cmake
+ cmake_minimum_required(VERSION 3.5.1)
+
+ project(template LANGUAGES CXX VERSION 0.0.1)
+
+ # 1. 查找 NotepadPlugin 模块
+ find_package(NotepadPlugin REQUIRED)
+
+ # 2. 使用 add_notepad_plugin(<模块名称> <源代码、资源文件> [...])
+ add_notepad_plugin(Helloworld
+ helloworld/helloworldexport.cpp
+ helloworld/qttestclass.cpp
+ helloworld/qttestclass.h
+ helloworld/qttestclass.ui
+ )
+
+ # 以上将会构建出一个名叫 libHelloworld.so 的插件扩展
+ ```
+
+- 一些 NotepadPluginConfig.cmake 中的变量声明
+
+ ```cmake
+
+ # NOTEPAD_PLUGIN [不重要]CMake 模块名称
+ # NOTEPAD_PLUGIN_CONFIG [不重要]CMake 模块文件名名称
+ # NOTEPAD_PLUGIN_INCLUDEDIR [插件 头文件目录]插件开发者可自行使用
+ # NOTEPAD_PLUGIN_LIBDIR [插件 库存放目录]插件开发者可自行使用
+ # NOTEPAD_PLUGIN_CORELIB [插件 核心库名称]插件开发者可自行使用
+ # NOTEPAD_PLUGIN_EXTERNAL_INCLUDES [插件 扩展的头文件目录]插件开发者可自行使用
+ # NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY [插件 扩展插件安装目录(位置)]插件开发者可自行使用
+
+ # NOTEPAD_BUILD_BY_QT5
+ # NOTEPAD_BUILD_BY_QT6
+ [NOTEPAD_BUILD_BY_约定]如果在构建 Notepad-- 时开启了此项,将会向 CMake 构建系统询问相关模块
+
+ 例如:
+ 询问 Qt5 基本模块: 将会在 find_package(NotepadPlugin REQUIRED) 时自动加入
+ set(CMAKE_AUTOMOC ON)
+ set(CMAKE_AUTOUIC ON)
+ find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
+
+ 为开发者自动添加 Qt5 模块依赖: 将会在 add_notepad_plugin 时自动加入
+ if(NOTEPAD_PLUGIN_QT5)
+ target_link_libraries(${PLUGIN_VAR} Qt5::Core Qt5::Widgets)
+ endif(NOTEPAD_PLUGIN_QT5)
+
+ ```
+
+- 当前提供插件的 Linux 目录结构
+
+ ```
+ build/_CPack_Packages/Linux/DEB/notepad---1.22.0-Linux
+ ├── control
+ ├── control.tar.gz
+ ├── data.tar.gz
+ ├── debian-binary
+ ├── md5sums
+ └── usr
+ ├── bin
+ │   └── notepad--
+ ├── include
+ │   └── NotepadPlugin
+ │   ├── pluginGl.h
+ │   └── Qsci
+ │   ├── qsciabstractapis.h
+ │   ├── qsciapis.h
+ │   ├── qscicommand.h
+ │   ├── qscicommandset.h
+ │   ├── qscidocument.h
+ │   ├── qsciglobal.h
+ │   ├── qscilexerasm.h
+ │   ├── qscilexeravs.h
+ │   ├── qscilexerbash.h
+ │   ├── qscilexerbatch.h
+ │   ├── qscilexercmake.h
+ │   ├── qscilexercoffeescript.h
+ │   ├── qscilexercpp.h
+ │   ├── qscilexercsharp.h
+ │   ├── qscilexercss.h
+ │   ├── qscilexercustom.h
+ │   ├── qscilexerd.h
+ │   ├── qscilexerdiff.h
+ │   ├── qscilexeredifact.h
+ │   ├── qscilexerfortran77.h
+ │   ├── qscilexerfortran.h
+ │   ├── qscilexerglobal.h
+ │   ├── qscilexergo.h
+ │   ├── qscilexer.h
+ │   ├── qscilexerhtml.h
+ │   ├── qscilexeridl.h
+ │   ├── qscilexerjava.h
+ │   ├── qscilexerjavascript.h
+ │   ├── qscilexerjson.h
+ │   ├── qscilexerlua.h
+ │   ├── qscilexermakefile.h
+ │   ├── qscilexermarkdown.h
+ │   ├── qscilexermatlab.h
+ │   ├── qscilexernsis.h
+ │   ├── qscilexeroctave.h
+ │   ├── qscilexerpascal.h
+ │   ├── qscilexerperl.h
+ │   ├── qscilexerpo.h
+ │   ├── qscilexerpostscript.h
+ │   ├── qscilexerpov.h
+ │   ├── qscilexerproperties.h
+ │   ├── qscilexerpython.h
+ │   ├── qscilexerruby.h
+ │   ├── qscilexerrust.h
+ │   ├── qscilexerspice.h
+ │   ├── qscilexersql.h
+ │   ├── qscilexertcl.h
+ │   ├── qscilexertex.h
+ │   ├── qscilexertext.h
+ │   ├── qscilexervb.h
+ │   ├── qscilexerverilog.h
+ │   ├── qscilexervhdl.h
+ │   ├── qscilexerxml.h
+ │   ├── qscilexeryaml.h
+ │   ├── qscimacro.h
+ │   ├── qsciprinter.h
+ │   ├── qsciscintillabase.h
+ │   ├── qsciscintilla.h
+ │   ├── qscistyledtext.h
+ │   └── qscistyle.h
+ ├── lib
+ │   ├── cmake
+ │   │   └── NotepadPlugin
+ │   │   └── NotepadPluginConfig.cmake
+ │   └── NotepadPlugin
+ │   └── libQSci.a
+ └── share
+ ├── applications
+ │   └── notepad--.desktop
+ └── notepad--
+ └── icons
+ └── spark.png
+
+ 13 directories, 71 files
+
+ ```
\ No newline at end of file
--
2.20.1
From 8c582a774e8cb0a3c347de5a574ecfd91f7522d2 Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Mon, 6 Feb 2023 01:37:46 +0800
Subject: [PATCH 12/13] =?UTF-8?q?fix-plugin-cmake:=20=E4=BF=AE=E5=A4=8D?=
=?UTF-8?q?=E6=8F=92=E4=BB=B6=20CMake=20=E9=83=A8=E5=88=86=E5=AE=9A?=
=?UTF-8?q?=E4=B9=89=E7=9A=84=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cmake/NotepadPluginConfig.cmake.in | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in
index 58e0bd7..37ad692 100644
--- a/cmake/NotepadPluginConfig.cmake.in
+++ b/cmake/NotepadPluginConfig.cmake.in
@@ -30,11 +30,11 @@ set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY @NOTEPAD_PLUGIN_EXTERNAL_PL
set(NOTEPAD_BUILD_BY_QT5 @NOTEPAD_BUILD_BY_QT5@)
set(NOTEPAD_BUILD_BY_QT6 @NOTEPAD_BUILD_BY_QT6@)
-if(NOTEPAD_PLUGIN_BY_QT5)
+if(NOTEPAD_BUILD_BY_QT5)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
-endif(NOTEPAD_PLUGIN_BY_QT5)
+endif(NOTEPAD_BUILD_BY_QT5)
if(NOTEPAD_BUILD_BY_QT6)
set(CMAKE_AUTOMOC ON)
@@ -42,8 +42,6 @@ if(NOTEPAD_BUILD_BY_QT6)
find_package(Qt6 COMPONENTS Core Widgets REQUIRED)
endif(NOTEPAD_BUILD_BY_QT6)
-
-
add_library(${NOTEPAD_PLUGIN} SHARED IMPORTED)
set_target_properties(${${NOTEPAD_PLUGIN}} PROPERTIES
IMPORTED_LOCATION
@@ -69,13 +67,13 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
target_include_directories(${PLUGIN_VAR} PUBLIC ${NOTEPAD_PLUGIN_INCLUDEDIR} ${NOTEPAD_PLUGIN_EXTERNAL_INCLUDES})
target_link_directories(${PLUGIN_VAR} PUBLIC ${NOTEPAD_PLUGIN_LIBDIR})
target_link_libraries(${PLUGIN_VAR} ${NOTEPAD_PLUGIN_CORELIB})
- if(NOTEPAD_PLUGIN_QT5)
+ if(NOTEPAD_BUILD_BY_QT5)
target_link_libraries(${PLUGIN_VAR} Qt5::Core Qt5::Widgets)
- endif(NOTEPAD_PLUGIN_QT5)
+ endif(NOTEPAD_BUILD_BY_QT5)
- if(NOTEPAD_PLUGIN_QT5)
+ if(NOTEPAD_BUILD_BY_QT6)
target_link_libraries(${PLUGIN_VAR} Qt6::Core Qt6::Widgets)
- endif(NOTEPAD_PLUGIN_QT5)
+ endif(NOTEPAD_BUILD_BY_QT6)
endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC)
@@ -84,7 +82,7 @@ macro(add_notepad_plugin_with_git PLUGIN_VAR GIT_REPO_URL GIT_REPO_PLUGIN_PATH)
execute_process(COMMAND git clone ${GIT_REPO_URL} ${PLUGIN_VAR}_git
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
ERROR_QUIET)
- aux_source_directory(${CMAKE_BINARY_DIR}/$${PLUGIN_VAR}_git/${GIT_REPO_PLUGIN_PATH} ${PLUGIN_VAR}_RESOURCES)
+ aux_source_directory(${CMAKE_BINARY_DIR}/${PLUGIN_VAR}_git/${GIT_REPO_PLUGIN_PATH} ${PLUGIN_VAR}_RESOURCES)
add_notepad_plugin(${PLUGIN_VAR} ${${PLUGIN_VAR}_RESOURCES})
endmacro(add_notepad_plugin_with_git PLUGIN_VAR GIT_REPO_URL GIT_REPO_PLUGIN_PATH)
--
2.20.1
From e9fed613d3f0fe2593f2d163df3d611bf3cd3c2a Mon Sep 17 00:00:00 2001
From: zinface <zinface@163.com>
Date: Mon, 6 Feb 2023 10:31:30 +0800
Subject: [PATCH 13/13] =?UTF-8?q?repo:=20=E9=87=87=E7=94=A8=E9=A1=B9?=
=?UTF-8?q?=E7=9B=AE=E4=B8=AD=E5=AE=8C=E6=95=B4=E7=9A=84=20Linux=20?=
=?UTF-8?q?=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E5=AE=89=E8=A3=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
CMakeLists.txt | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 28b3007..b8f5fa7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,12 +100,14 @@ if(CMAKE_HOST_UNIX)
# 应用分类: Category=
"Development"
)
- spark_install_file(/usr/share/applications/ ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.desktop)
- spark_install_file(/usr/share/notepad--/icons/ assets/spark.png)
- spark_install_target(/usr/bin/ ${PROJECT_NAME})
-
- # TODO如果主线已经将 linux/destkop 的PR合入即可移除此部分以上部分而使用以下部分
- # spark_install_directory(/usr src/linux/usr/*) # 完整的 Linux 资源文件
+ # spark_install_file(/usr/share/applications/ ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.desktop)
+ # spark_install_file(/usr/share/notepad--/icons/ assets/spark.png)
+ # spark_install_target(/usr/bin/ ${PROJECT_NAME})
+
+ # 完成:如果主线已经将 linux/destkop 的PR合入即可移除此部分以上部分而使用以下部分
+ # 但 spark_desktop_macros 不能移除,因为它被 Appimage 构建部分依赖
+ # Appimage 构建部分,要求(使用来自 Spark 构建的 Desktop 构建中配置的信息(必须要求 spark-desktop))
+ spark_install_directory(/usr src/linux/usr/*) # 完整的 Linux 资源文件
# ------------------ INSTALL PLUGIN CONFIG ------------------ #
# ------------------ INSTALL PLUGIN CONFIG ------------------ #
--
2.20.1