From 692b29d9e047ba0f220daf32834ce16a04aff1a8 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 22:34:12 +0800 Subject: [PATCH 001/102] =?UTF-8?q?cmake-patch:=20=E4=B8=BA=20ndd=20?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=20cmake?= =?UTF-8?q?=20=E6=9E=84=E5=BB=BA=E7=9A=84=E8=A1=A5=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 基于 coconil 引入的 cmake 构建支持 2. 基于 cmake 构建 引入的 spark 构建 deb 与 Appimage 在应用此补丁后: 1. 可以 直接 make package 构建 deb 2. 可以直接 make linuxdeploqt genrate-appimage --- patchs/coconil-cmake-spark-deb-appimage.patch | 1269 +++++++++++++++++ 1 file changed, 1269 insertions(+) create mode 100644 patchs/coconil-cmake-spark-deb-appimage.patch diff --git a/patchs/coconil-cmake-spark-deb-appimage.patch b/patchs/coconil-cmake-spark-deb-appimage.patch new file mode 100644 index 0000000..df402c4 --- /dev/null +++ b/patchs/coconil-cmake-spark-deb-appimage.patch @@ -0,0 +1,1269 @@ +From 0940320b6009c3a1a59395e774a204e70d8ae033 Mon Sep 17 00:00:00 2001 +From: coconil +Date: Tue, 31 Jan 2023 22:17:32 +0800 +Subject: [PATCH 1/4] add cmake support + +--- + CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ + src/findcmpwin.h | 4 ++++ + src/findwin.h | 5 ++++- + src/qscint/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ + 4 files changed, 74 insertions(+), 1 deletion(-) + create mode 100644 CMakeLists.txt + create mode 100644 src/qscint/CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..09769f8 +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,31 @@ ++cmake_minimum_required(VERSION 3.24) ++project(notepad--) ++ ++set(CMAKE_AUTOMOC ON) ++set(CMAKE_AUTOUIC ON) ++set(CMAKE_AUTORCC ON) ++ ++find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns) ++ ++add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint) ++ ++ ++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 ++ ++${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} 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/findcmpwin.h b/src/findcmpwin.h +index 4432e85..4f53fca 100755 +--- a/src/findcmpwin.h ++++ b/src/findcmpwin.h +@@ -7,10 +7,14 @@ + #include "ui_findcmpwin.h" + #include "rcglobal.h" + ++#ifndef DEF_FIND_TAB_INDEX ++#define DEF_FIND_TAB_INDEX ++ + enum FindTabIndex { + FIND_TAB, + REPLACE_TAB, + }; ++#endif + class ScintillaEditView; + + //struct FindCmpRecord { +diff --git a/src/findwin.h b/src/findwin.h +index c32a7d4..8633ce6 100755 +--- a/src/findwin.h ++++ b/src/findwin.h +@@ -6,13 +6,16 @@ + + + #include "ui_findwin.h" +- ++#ifndef DEF_FIND_TAB_INDEX ++#define DEF_FIND_TAB_INDEX + enum FindTabIndex { + FIND_TAB =0, + REPLACE_TAB, + DIR_FIND_TAB, + MARK_TAB, + }; ++#endif ++ + class ScintillaEditView; + class QsciScintilla; + +diff --git a/src/qscint/CMakeLists.txt b/src/qscint/CMakeLists.txt +new file mode 100644 +index 0000000..6987a2f +--- /dev/null ++++ b/src/qscint/CMakeLists.txt +@@ -0,0 +1,35 @@ ++cmake_minimum_required(VERSION 3.24) ++project(qscint CXX) ++ ++set(CMAKE_AUTOMOC ON) ++set(CMAKE_AUTOUIC ON) ++set(CMAKE_AUTORCC ON) ++ ++find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport) ++ ++aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC) ++aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/lexers SRC) ++aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/lexlib SRC) ++aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/src SRC) ++aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/boostregex SRC) ++ ++file(GLOB MOC_HEADER ${PROJECT_SOURCE_DIR}/src/Qsci/*.h) ++ ++#message(${MOC_HEADER}) ++ ++add_library(${PROJECT_NAME} STATIC ${SRC} ${MOC_HEADER}) ++ ++target_compile_definitions(${PROJECT_NAME} PRIVATE SCINTILLA_QT SCI_LEXER INCLUDE_DEPRECATED_FEATURES) ++ ++target_include_directories(${PROJECT_NAME} PRIVATE ++${PROJECT_SOURCE_DIR}/scintilla/lexlib ++${PROJECT_SOURCE_DIR}/scintilla/boostregex ++) ++ ++target_include_directories(${PROJECT_NAME} PUBLIC ++${PROJECT_SOURCE_DIR}/src ++${PROJECT_SOURCE_DIR}/src/Qsci ++${PROJECT_SOURCE_DIR}/scintilla/src ++${PROJECT_SOURCE_DIR}/scintilla/include) ++ ++target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport) +-- +2.20.1 + + +From c41bc435255a1e56615e7d8ab608c84d7e9772a2 Mon Sep 17 00:00:00 2001 +From: coconil +Date: Tue, 31 Jan 2023 22:49:55 +0800 +Subject: [PATCH 2/4] add cmake build doc + +--- + cmake.md | 8 ++++++++ + 1 file changed, 8 insertions(+) + create mode 100644 cmake.md + +diff --git a/cmake.md b/cmake.md +new file mode 100644 +index 0000000..8e9b440 +--- /dev/null ++++ b/cmake.md +@@ -0,0 +1,8 @@ ++# cmake构建说明 ++ ++## Ubuntu ++ ++1. 安装编译环境 `sudo apt-get install g++ make cmake` ++1. 安装qt工具和库 `sudo apt-get install qtbase5-dev qt5-qmake qtbase5-dev-tools libqt5printsupport5 libqt5xmlpatterns5-dev ` ++1. 配置 `cmake path_to_src` ++1. 编译 `make -j` +\ No newline at end of file +-- +2.20.1 + + +From 6115c0a6d3addc6e22504b2a71db67b412c8ef97 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Wed, 1 Feb 2023 20:04:05 +0800 +Subject: [PATCH 3/4] =?UTF-8?q?=20repo:=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 | 30 +++ + CMakeLists.txt | 34 ++- + 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 | 46 ++++ + cmake/spark-desktop.desktop.in | 12 + + 9 files changed, 670 insertions(+), 2 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..7adfee2 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -396,3 +396,33 @@ FodyWeavers.xsd + + # 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 09769f8..52efcf6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ + cmake_minimum_required(VERSION 3.24) +-project(notepad--) ++project(notepad-- VERSION 1.22.0) + + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTOUIC ON) +@@ -28,4 +28,34 @@ ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/lexlib + ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/boostregex + ) + +-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..c652e21 +--- /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 +zcmZ9Qc|26n`^T?!hOvx&4Pz%{EZLPYvTq^E5@pRcGGvX$AW~VT?0YC8CHu}WL)I*j +zCA+d^OJw_v@Avn|@AZ4V?z!iAo%_7*bMCpH^W6J>;>=8R>1nxX0RW)a*F)YU^_YtW +zrY4=^DWIpMj{2UVE)p04)_~)Bx;9qQ2n|Z_wm$&K2wgO?prUJmq(Kl`-&hB=G~+P>c2E7|m)F7F$6%61XMsolUg0zXycp@v@GZ1K>rt9xd?C!>%*+W7 +z%C&esu?1QvJQKjm(&8q^?oTJ)%8V0?)|OjY&d?Gr6jy6+xCM5i6!*6NB4P1KRCNm^ +zm+NR*M%4c-!-n9r0lIJ!D)W+&T9oD)Dem^7SRik@V(WfPQ@fFKyaf2lH?CLvA5uka +za&warZ&7cj6r);vpGc6CZ?~=95k;2K+aF*1m@^PTnvH2@U9bunlhI3nmsfK^BZU;4=_*3}V}PoZ +zEP*COH$^QdyIwzO=Shp{b@@LAC7u=@nYJ8)oEoIduWITqMn>MScBnM|V;V8ajW%>c +z2|9_!;}u5SRyWpkQzR8giy|l$Ivq`@U%TZM4}hv^OUIk_s0z#=s!u~04W3Iv&C;FbL%51jwmUPHQ@0l~qZwrDUlHbTaRh}I7O +zg75zlU9YVkytJ~+#_*>+av3b*ZLbM`=lrm(GyKlhzDKd&-~YS-XuB{i6aEdZrmT8V +z5=&CIeIGmv+apvfRY7`h1Zf4_L_-7KYf+zDaL#{K)Hw61>q|2q>%TNiMk|sXtmY*1 +z`E77tq7vBO#3uo(t!jj^QMa-dh___m=cxM&AL^ +zdT&14OSgK$%!-|9_M)?`i4B)w7eegd!IoH)mWyyhiqc1~EPAqoCCYEgl(hFM{^Ftj +z%GS_$^uT6K)$jtUK69tc1oS-cV3H( +zyzVwJW(p>4KWuO@dx-z65M|t#j~xmYkY<&V$cV9IcL@+9-%Akb(9C^=$km21|8lq_ +za=b^e+n~SA!s?z86LD4&0RU2Vl|bwCrvOB*uG>-oaP+AaCy?IW;MZ7A&oS_=puC#x +zTSjKS2X}HZv)}oKicKX7<~q>8hy|~*HpzV*Y^DRSBNNv-=R$KtX-5a5FE!_Wj#!o0njA +z8JkG4+{e@({dOMVP51|1y`CGI?{rMiLdMQTV)8ojeNwqrgP)*5q}hq9`jG=rE*1L0 +z=0gY)xu5I$L0nYIwuM<@k7MqNbid7Ko1mz?Wtyzjo`jUhJJU|J`Jq_(fZ+l%ogp5Y +zIDI`mBjycCE3h-oAO06y%KHv_U0fWu7`0F)$u5yL6u~KnhuEC++z(})gQ{w9X}O1^ +ziig+EPJfUA4&ecpZ?0Sc06XsoNMjeO3Wcj3%MW32I2nYaNKiwF#jknm8fO-R8aEHO +zS;P_Zcdx7H>7UoVjHFijGh;WVUGy??)C=6c|6BJ?%amgTP(}HCU2Z0Y^Sx|AO%6>B +z7k8KD-1)Kga0b7Xt>)Jmz><_Svi*-IB6_0ky0@X$d%1Z$EAcD*>w~VW$*SRrQOa6E +z)cKJdzv;DO-USxsZnV8sfR>g0;TF*eXKlHEv~kBDQlVHocet}SvAsdI1E^G1doNa$er}pksd?U1pF|_rB +zSIJIEOQLI~-J9cO}P)Oz~yJ4z~jwPCIW7GR>tKG}oJGSkdoz};#7?(Sg>_x?Y_Q?4k +zZ$BO!ta2Sdt}R&N@%WDQoxFGNn8p;VW$7qF|8D7og^|0?JUW*}Y|jx!#LUqPlwg=m +zRt9aEBD1%*_tO_~T=|(R%DbCN?p_VFK+vzERN1}RWAZ6OAYYD(J}CcnVj9+as%G)o +z;NJXAE1<2%q6D=&D&c&^K7J$1uCL+uS>u|xgNGNU%c~o5r72Q`D?M*NaI@;bFQ#CT +zV0IV|1Ll4vb*8mCG70}W_>J!pbL`q(Mk#Luq5Ho-?sljN6JfW)-Tyt?3`DZ%L +z>1cfFaA%b9aDM4sjzPiuCSI52j;PmRFq03dvd{@)=@Z9{wG$dz~4@#t3rj;1m%CZ{=~k9~XcBC6v7NckqV@1WVYQ<43f3{9(XPWS>EN{EO~*-CK*bt;ZS;!OLuY +z87ft)RVyp(Cw{BC?#*W-X}?E8n+mG`{Ikbd@Mf3BkFQ_T3aIyS+g0*qIBMqV83`?o +zX*3SoyLQT=V65w9M3)n><3cpp4wMiSNQ6I0WTSfL@yq6O5RJ^;rpPEzOSf?<#OEal +z#JE8?_%;i?y7A-hXB(+R7p{hi!m)9NPT7A;G|icpHm~wS^k`I({`l+|qO9g~*i~G*9imYv^HH~-3PeB-S_xwv+Y2l=g6>lXZk|B1v+dn| +zeA>r~Z}f3>@rByy3Q&w80&#K>pvR%5geJnqq +z#YL_Lw5jl$vkg7ZRPvcNku1Nz{`lM2`2I+BH-`3Ba?R1ny-~VYe +z9l%0>oH`pOV?m#)LN)yxXMS#M>?$?Ja6PLFE);UCNl#M06nrh>lc`K1PMyM&Ka>tI +zyKVLSSwJ-z2RXNRh*UcPO%t2{i@X_0uuwJ6@h;-=Qef3g6X8cFUHPoCZIv{}R78rZ%99agCe;SpR +z2&R5q?E=vp9E`14e_L9iWfefrys(&*EXOenhi}(uR8D%;1^v32tF*i$meYY6!3~@Q +zv5OSB5c`O2eYdLw^yThU*z33iu!U)sm(UUi!Yh5@S`weCs{BaFFDP7dWAap2{nG=s +zg+-P;PwqQ+?wHvS{X^xRx~)ampA>1zW`P2@zwfa|>{ +z(Zt?9q>hUSNyY-w8WjF3)S{^{Y;7-zeNdEWXCYNlYE#WdCdLmAQQa{ib}eB{46!Vm +zo13!fMtVj@*A05r-xRqe1O+nR=OyKWG>u1mlD&rJ7WUEOHCORSf`H4G9m&D*U>eu{ +zLp6o#gU{59h79h}@mqyQxAYnwjZ3|e)+cm~c9C*PmcN-nJ13-pb9}j+aMZB3eWbuU +z(aP`J@@Js(3eo*K%?H@(M#W~b(~+qW`F;+iobQ&M*W>{=WjBNNZqtpbh4N5N(I2dG +z-RX`fI|JPp?}OI)XaR2iVs;j=E!yAobeUouDw>}0b0z1W+MTAGY0eJ{GDB$rxn+Jx +zijgtNgG}Ip-xgzR(6Yw>ce#I{RXF)m?YpDnSx1P +z-qxP|)1Pe80-2Yo{|kjzD-b|ra*a%GbQ-JEf +zY4Ef^R`Uo`;5%GzqsAjSR8OWeT$^xkT*!`awX@U|_Abd2Kni%MHCjtQr!HimpSd78 +zqrPOZv^3?zweIu9Gt!GTOD19I)$#R&XHcKG{N6t4Uzm)% +z_&ik-;lla8ao5f-XCXafQiDpVG*V0{N!aCZPn=1CN`%)rVO5b3-l1<&5Rm>dgqG6& +zi6I?9NDN#D1uh~vl;mU=49d2IlV^tnzNl6O2YpihPema^^jse;K;WdUa}|$oaghqg +z(6Awt@Duo-@b4d^62bJ31eGM@W)0Qd@X!Ndd;7ddj(j^*YY2nz}q(w%?j=RPLP@eEF|B$PQ2KtCtcE0TG0n}qx$Q0g;>#Q +zXb4R~mYm3CJ1RdzfK4TCyeNO)4km{6`QK7Rtf74G7sV*O8|HzS0B>>4yF}W2o(lp* +zM{UWrv+Ba@vnVNI88u6!KF%=Wbx&cqT*am6q30wD#F98KVc5!5oJkm|LweHam10~r +zX@~3#%zVK@yDeBv6!qOETx37pSa`UBTxI#cHI-Sl3=?)E1K4yNsZ5YEKwM8qGV1Vn +zk8qYSbHYB+UTkQmS +t;Jjx^&~6n@&egfT2m_h_UkqA5Co_+SJESY3=}2`iKwrlMS%GlG{15vgE&>1m + +literal 0 +HcmV?d00001 + +diff --git a/cmake/DebPackageConfig.cmake b/cmake/DebPackageConfig.cmake +new file mode 100644 +index 0000000..59950ec +--- /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( ++# [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS | ++# FILE_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..52d9664 +--- /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 [REVERSE]) ++ string(FIND "${INSTALL_DIRECOTRY}" "*" INSTALL_DIRECTORY_FIND_INDEX) ++ # message(FATAL_ERROR "${INSTALL_DIRECTORY_FIND_INDEX}: ${INSTALL_DIRECTORY_DIR}") ++ ++ # file(GLOB ++ # [LIST_DIRECTORIES true|false] [RELATIVE ] [CONFIGURE_DEPENDS] ++ # [...]) ++ ++ if (NOT INSTALL_DIRECTORY_FIND_INDEX EQUAL -1) ++ # string(SUBSTRING ) ++ 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 ++ # [LIST_DIRECTORIES true|false] [RELATIVE ] [CONFIGURE_DEPENDS] ++ # [...]) ++ ++ 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..cfd1e7c +--- /dev/null ++++ b/cmake/package-deb.descript +@@ -0,0 +1,46 @@ ++# 注释行(使用方式) ++# 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 8dd955e0995e22d1c9cec7a8127cc9d08f593941 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Wed, 1 Feb 2023 20:09:49 +0800 +Subject: [PATCH 4/4] =?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 52efcf6..c1d2c59 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -54,6 +54,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 c652e21..35bf326 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..99fc9d6 +--- /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 + -- Gitee From ed5adfc5921b147df41d78ff21fc465c31bbf7ea Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 00:00:45 +0800 Subject: [PATCH 002/102] =?UTF-8?q?patchs-doc:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A1=A5=E4=B8=81=E6=93=8D=E4=BD=9C=E8=AF=B4=E6=98=8E=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patchs/README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 patchs/README.md diff --git a/patchs/README.md b/patchs/README.md new file mode 100644 index 0000000..701870c --- /dev/null +++ b/patchs/README.md @@ -0,0 +1,56 @@ +# 补丁操作说明 + +> 用于 patchs/coconil-cmake-spark-deb-appimage.patch 补丁化构建方式 + +- 如何使用此补丁(测试本补丁) + + > 注:此补丁仅可基于 master 分支进行构建 + + 1. 在项目中使用此补丁? + ```shell + git am --whitespace=fix < patchs/coconil-cmake-spark-deb-appimage.patch + ``` + 2. 使用在线的方式直接使用补丁文件,并对纯净的 ndd 项目进行打补丁 + ``` + # 克隆 notepad-- 项目 + git clone https://gitee.com/cxasm/notepad-- + cd notepad-- + + # 打在线补丁 + curl -s https://gitee.com/zinface/coconil-notepad--/raw/cmake-patchs/patchs/coconil-cmake-spark-deb-appimage.patch | git am --whitespace=fix + + make package # 构建 release 模式的 deb 包 + make linuxdeploy # 构建出相关文件与自动组织 appimage 的结构目录 + make genrate-appimage # 基于已 linuxdeploy 的结构目录进行打包为 Appimage + ``` + + +- 在应用补丁时,并对补丁进行的更新操作 + + ```shell + # 切换到一个新的分支,即可开始进行补丁内的更新提交 + git checkout -b coconil-cmake-spark-deb-appimage + + # origin/dev 表示本仓库的 dev 开发分支 + # 在应用过补丁,并产生了新的提交,即可在当前所在补丁更新分支内 + # 相对基于 origin/master 为参考,目前所包含的所有最新提交内容将生成为一个补丁文件(其中尾部为增量更新) + git format-patch --stdout origin/master > patchs/coconil-cmake-spark-deb-appimage.patch + + # 最后,回到你的原 master 分支,将被改变的补丁文件进行提交 + # 在推送完成后,即可放弃你在 coconil-cmake-spark-deb-appimage 分支中所有产生的内容(因为都已经进入补丁) + ``` + +- 一些注意事项 + + ```shell + # 在不了解补丁时,你需要认识一下补丁,但补丁与补丁之间有着不同的用法 + # 本 patchs/coconil-cmake-spark-deb-appimage.patch 补丁为支持 Appimage 构建 + + # 关于补丁的一些方面 + # 1. 首先你需要了解 git 是什么,以及简单的使用 + # 2. 你需要了解补丁是什么,以及简单的使用(应用补丁) + # 3. 你需要了解如何创建一个补丁,最基本的就是相对于旧目标分支,将本分区新增的提交进行导出为补丁 + # 4. 你可能只会将单个提交、或多个提交导出为补丁,但这还不够,你需要具有绝对的对于补丁的理解 + # 5. 对于不同的目的补丁,应该是多个 patch 文件存在的形式 + # 6. 最后,不管在什么时候,你在应用补丁前,你应该考虑是否应用到当前分支?为什么不切换到一个新的分支呢? + ``` \ No newline at end of file -- Gitee From 05a4a78f78aa3cd1a53b25224eb357ca3af06e5d Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:24:57 +0800 Subject: [PATCH 003/102] =?UTF-8?q?cmake-patchs:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A1=A5=E4=B8=81=E8=A1=A5=E5=85=85=20desktop=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=20MimeType=20=20=E4=B8=8E=20%F=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patchs/coconil-cmake-spark-deb-appimage.patch | 362 ++++++++++++------ 1 file changed, 238 insertions(+), 124 deletions(-) diff --git a/patchs/coconil-cmake-spark-deb-appimage.patch b/patchs/coconil-cmake-spark-deb-appimage.patch index df402c4..fc35b98 100644 --- a/patchs/coconil-cmake-spark-deb-appimage.patch +++ b/patchs/coconil-cmake-spark-deb-appimage.patch @@ -1,20 +1,20 @@ -From 0940320b6009c3a1a59395e774a204e70d8ae033 Mon Sep 17 00:00:00 2001 +From d8b90bb4d709d643c7490ce8a79534769185e24e Mon Sep 17 00:00:00 2001 From: coconil Date: Tue, 31 Jan 2023 22:17:32 +0800 -Subject: [PATCH 1/4] add cmake support +Subject: [PATCH 1/6] add cmake support --- CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ - src/findcmpwin.h | 4 ++++ - src/findwin.h | 5 ++++- + src/findcmpwin.h | 24 ++++++++++++++---------- + src/findwin.h | 29 ++++++++++++++++------------- src/qscint/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ - 4 files changed, 74 insertions(+), 1 deletion(-) + 4 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 src/qscint/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 -index 0000000..09769f8 +index 0000000..4dd3768 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ @@ -36,12 +36,12 @@ index 0000000..09769f8 +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 ++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/src/Qsci +${PROJECT_SOURCE_DIR}/src/qscint/scintilla/src +${PROJECT_SOURCE_DIR}/src/qscint/scintilla/include +${PROJECT_SOURCE_DIR}/src/qscint/scintilla/lexlib @@ -51,49 +51,83 @@ index 0000000..09769f8 +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/findcmpwin.h b/src/findcmpwin.h -index 4432e85..4f53fca 100755 +index 4432e85..70deee3 100755 --- a/src/findcmpwin.h +++ b/src/findcmpwin.h -@@ -7,10 +7,14 @@ - #include "ui_findcmpwin.h" - #include "rcglobal.h" - -+#ifndef DEF_FIND_TAB_INDEX -+#define DEF_FIND_TAB_INDEX -+ - enum FindTabIndex { - FIND_TAB, - REPLACE_TAB, - }; -+#endif - class ScintillaEditView; +@@ -4,16 +4,20 @@ + #include + #include - //struct FindCmpRecord { +-#include "ui_findcmpwin.h" +-#include "rcglobal.h" +- +-enum FindTabIndex { +- FIND_TAB, +- REPLACE_TAB, +-}; +-class ScintillaEditView; +- +-//struct FindCmpRecord { ++#include "ui_findcmpwin.h" ++#include "rcglobal.h" ++ ++#ifndef DEF_FIND_TAB_INDEX ++#define DEF_FIND_TAB_INDEX ++ ++enum FindTabIndex { ++ FIND_TAB, ++ REPLACE_TAB, ++}; ++#endif ++class ScintillaEditView; ++ ++//struct FindCmpRecord { + // int lineNum; + // int pos; + // QString lineContents; diff --git a/src/findwin.h b/src/findwin.h -index c32a7d4..8633ce6 100755 +index c32a7d4..be82deb 100755 --- a/src/findwin.h +++ b/src/findwin.h -@@ -6,13 +6,16 @@ - - - #include "ui_findwin.h" +@@ -3,19 +3,22 @@ + #include + #include + #include - -+#ifndef DEF_FIND_TAB_INDEX -+#define DEF_FIND_TAB_INDEX - enum FindTabIndex { - FIND_TAB =0, - REPLACE_TAB, - DIR_FIND_TAB, - MARK_TAB, - }; -+#endif -+ - class ScintillaEditView; - class QsciScintilla; - +- +-#include "ui_findwin.h" +- +-enum FindTabIndex { +- FIND_TAB =0, +- REPLACE_TAB, +- DIR_FIND_TAB, +- MARK_TAB, +-}; +-class ScintillaEditView; +-class QsciScintilla; +- ++ ++ ++#include "ui_findwin.h" ++#ifndef DEF_FIND_TAB_INDEX ++#define DEF_FIND_TAB_INDEX ++enum FindTabIndex { ++ FIND_TAB =0, ++ REPLACE_TAB, ++ DIR_FIND_TAB, ++ MARK_TAB, ++}; ++#endif ++ ++class ScintillaEditView; ++class QsciScintilla; ++ + struct FindRecord { + int lineNum; + int lineStartPos; //行开始位置 diff --git a/src/qscint/CMakeLists.txt b/src/qscint/CMakeLists.txt new file mode 100644 -index 0000000..6987a2f +index 0000000..f132dc6 --- /dev/null +++ b/src/qscint/CMakeLists.txt @@ -0,0 +1,35 @@ @@ -127,7 +161,7 @@ index 0000000..6987a2f + +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) + @@ -136,10 +170,10 @@ index 0000000..6987a2f 2.20.1 -From c41bc435255a1e56615e7d8ab608c84d7e9772a2 Mon Sep 17 00:00:00 2001 +From af0785b1f7060ac535900f159173153d2028d1a7 Mon Sep 17 00:00:00 2001 From: coconil Date: Tue, 31 Jan 2023 22:49:55 +0800 -Subject: [PATCH 2/4] add cmake build doc +Subject: [PATCH 2/6] add cmake build doc --- cmake.md | 8 ++++++++ @@ -148,7 +182,7 @@ Subject: [PATCH 2/4] add cmake build doc diff --git a/cmake.md b/cmake.md new file mode 100644 -index 0000000..8e9b440 +index 0000000..b5f9785 --- /dev/null +++ b/cmake.md @@ -0,0 +1,8 @@ @@ -159,16 +193,16 @@ index 0000000..8e9b440 +1. 安装编译环境 `sudo apt-get install g++ make cmake` +1. 安装qt工具和库 `sudo apt-get install qtbase5-dev qt5-qmake qtbase5-dev-tools libqt5printsupport5 libqt5xmlpatterns5-dev ` +1. 配置 `cmake path_to_src` -+1. 编译 `make -j` ++1. 编译 `make -j` \ No newline at end of file -- 2.20.1 -From 6115c0a6d3addc6e22504b2a71db67b412c8ef97 Mon Sep 17 00:00:00 2001 +From 44ef7d609c77688c46a0334bc08d863114b46998 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:04:05 +0800 -Subject: [PATCH 3/4] =?UTF-8?q?=20repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 3/6] =?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 @@ -176,16 +210,16 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- - .gitignore | 30 +++ + .gitignore | 36 ++- CMakeLists.txt | 34 ++- 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 | 46 ++++ + cmake/package-deb.descript | 45 ++++ cmake/spark-desktop.desktop.in | 12 + - 9 files changed, 670 insertions(+), 2 deletions(-) + 9 files changed, 672 insertions(+), 5 deletions(-) create mode 100644 Makefile create mode 100644 assets/spark.png create mode 100644 cmake/DebPackageConfig.cmake @@ -195,45 +229,51 @@ Content-Transfer-Encoding: 8bit create mode 100644 cmake/spark-desktop.desktop.in diff --git a/.gitignore b/.gitignore -index 8d723bc..7adfee2 100644 +index 8d723bc..30bcfd5 100644 --- a/.gitignore +++ b/.gitignore -@@ -396,3 +396,33 @@ FodyWeavers.xsd - - # 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 +@@ -393,6 +393,36 @@ FodyWeavers.xsd + *.msix + *.msm + *.msp +- +-# JetBrains Rider +-*.sln.iml ++ ++# 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 09769f8..52efcf6 100644 +index 4dd3768..a48badb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ @@ -257,7 +297,7 @@ index 09769f8..52efcf6 100644 + # 内容默认应用名称: Name= 应与项目名称相同 + spark_desktop_macros( + # 应用名称: Name= -+ ${PROJECT_NAME} ++ ${PROJECT_NAME} + # 应用名称: Name[zh_CN]= + "Notepad--" + # 应用说明: Comment= @@ -282,7 +322,7 @@ index 09769f8..52efcf6 100644 +endif(CMAKE_HOST_UNIX) diff --git a/Makefile b/Makefile new file mode 100644 -index 0000000..c652e21 +index 0000000..43e849f --- /dev/null +++ b/Makefile @@ -0,0 +1,61 @@ @@ -306,7 +346,7 @@ index 0000000..c652e21 +run: all + exec $(shell find build/ -maxdepth 1 -type f -executable | grep $(PROJECT_NAME)) + -+debug: ++debug: + mkdir -p build + cd build && cmake -DCMAKE_BUILD_TYPE=Debug .. + cd build && make -j$(CPUS) @@ -453,14 +493,14 @@ HcmV?d00001 diff --git a/cmake/DebPackageConfig.cmake b/cmake/DebPackageConfig.cmake new file mode 100644 -index 0000000..59950ec +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) @@ -578,7 +618,7 @@ index 0000000..59950ec + else() + set(CPACK_DEBIAN_PACKAGE_VERSION "${_IN_VAL}" PARENT_SCOPE) + endif(_IN_VAL STREQUAL "auto") -+ ++ + message("--> 软件版本: ${_IN_VAL}") + endif(_Version EQUAL "0") + @@ -590,7 +630,7 @@ index 0000000..59950ec + + find_str("${_IN_KEY}" "Architecture" _Architecture) + if(_Architecture EQUAL "0") -+ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE) ++ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE) + if(_IN_VAL STREQUAL "auto") + execute_process( + COMMAND dpkg --print-architecture @@ -601,7 +641,7 @@ index 0000000..59950ec + 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) @@ -631,7 +671,7 @@ index 0000000..59950ec + 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)函数 @@ -647,7 +687,7 @@ index 0000000..59950ec + 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) + @@ -721,7 +761,7 @@ index 0000000..59950ec + 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 ##################### @@ -729,7 +769,7 @@ index 0000000..59950ec + set(_Version "${CPACK_DEBIAN_PACKAGE_VERSION}") + set(_Architecture "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") + -+ set(_DebFileName ++ set(_DebFileName + "${_Package}_${_Version}_${_Architecture}${PACKAGE_SUFFIX}.deb" + ) + set(CPACK_DEBIAN_FILE_NAME ${_DebFileName}) @@ -824,7 +864,7 @@ index 0000000..223ac6b \ No newline at end of file diff --git a/cmake/SparkInstallMacrosConfig.cmake b/cmake/SparkInstallMacrosConfig.cmake new file mode 100644 -index 0000000..52d9664 +index 0000000..1f8939b --- /dev/null +++ b/cmake/SparkInstallMacrosConfig.cmake @@ -0,0 +1,131 @@ @@ -834,7 +874,7 @@ index 0000000..52d9664 +# 可接受的值为: 安装路径 目标A +# 可接受的值为: 安装路径 目标A 目标B 目标C... +macro(spark_install_target INSTALL_TARGET_DIR INSTALL_TARGETS) -+ install(TARGETS ++ install(TARGETS + ${INSTALL_TARGETS} ${ARGN} + DESTINATION ${INSTALL_TARGET_DIR}) +endmacro(spark_install_target INSTALL_TARGET_DIR INSTALL_TARGETS) @@ -844,7 +884,7 @@ index 0000000..52d9664 +# 可接受的值为: 安装路径 文件A +# 可接受的值为: 安装路径 文件A 文件B 文件C... +macro(spark_install_file INSTALL_FILE_DIR INSTALL_FILE) -+ install(FILES ++ install(FILES + ${INSTALL_FILE} ${ARGN} + DESTINATION ${INSTALL_FILE_DIR}) +endmacro(spark_install_file INSTALL_FILE_DIR INSTALL_FILE) @@ -854,7 +894,7 @@ index 0000000..52d9664 +# 可接受的值为: 安装路径 文件A +# 可接受的值为: 安装路径 文件A 文件B 文件C... +macro(spark_install_program INSTALL_PROGRAM_DIR INSTALL_PROGRAM) -+ install(PROGRAMS ++ install(PROGRAMS + ${INSTALL_PROGRAM} ${ARGN} + DESTINATION ${INSTALL_PROGRAM_DIR}) +endmacro(spark_install_program INSTALL_PROGRAM_DIR INSTALL_PROGRAM) @@ -904,7 +944,7 @@ index 0000000..52d9664 + # 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}") + @@ -949,7 +989,7 @@ index 0000000..52d9664 + + # include(GNUInstallDirs) + set(SPARK_INSTALL_CHANGE_LOG_DIR "/usr/share/doc/${PROJECT_NAME}/") -+ install(FILES ++ install(FILES + ${CMAKE_BINARY_DIR}/changelog.gz + debian/copyright + @@ -961,10 +1001,10 @@ index 0000000..52d9664 +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..cfd1e7c +index 0000000..be0fa83 --- /dev/null +++ b/cmake/package-deb.descript -@@ -0,0 +1,46 @@ +@@ -0,0 +1,45 @@ +# 注释行(使用方式) +# find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) +# add_package_descript(cmake/package-deb.descript) @@ -999,18 +1039,17 @@ index 0000000..cfd1e7c +# 软件包优先级[required|important|stantard|optional|extra] +Priority: optional +# 软件包依赖 -+Depends: ++Depends: +# 软件包维护者(组织或个人) +Maintainer: 尹作为 <757210198@qq.com> +# 软件包主页 +Homepage: https://gitee.com/cxasm/notepad-- +# 软件包建议 -+Recommends: ++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 @@ -1034,10 +1073,10 @@ index 0000000..e7c3b18 2.20.1 -From 8dd955e0995e22d1c9cec7a8127cc9d08f593941 Mon Sep 17 00:00:00 2001 +From b2c247073dfaf9539af26cb5372f8ba16c297cdc Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:09:49 +0800 -Subject: [PATCH 4/4] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 4/6] =?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 @@ -1054,14 +1093,14 @@ Content-Transfer-Encoding: 8bit create mode 100644 cmake/spark-appimage.desktop.in diff --git a/CMakeLists.txt b/CMakeLists.txt -index 52efcf6..c1d2c59 100644 +index a48badb..364adaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,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 中的默认的图标 @@ -1073,7 +1112,7 @@ index 52efcf6..c1d2c59 100644 find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) add_package_descript(cmake/package-deb.descript) diff --git a/Makefile b/Makefile -index c652e21..35bf326 100644 +index 43e849f..b71b27f 100644 --- a/Makefile +++ b/Makefile @@ -59,3 +59,26 @@ enter-qdebug-mode: @@ -1090,7 +1129,7 @@ index c652e21..35bf326 100644 +# 或指定你所想存放克隆项目的位置 +BUNDLE_LINUXDEPLOYQT := $(shell pwd)/build/bundle-linuxdeployqt + -+download-bundle-linuxdeploytools: ++download-bundle-linuxdeploytools: + -git clone https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git $(BUNDLE_LINUXDEPLOYQT) + +LINUXDEPLOYQT := "$(BUNDLE_LINUXDEPLOYQT)/linuxdeployqt-continuous-x86_64.AppImage" @@ -1105,7 +1144,7 @@ index c652e21..35bf326 100644 + cd build && make appimage diff --git a/cmake/SparkAppimageConfig.cmake b/cmake/SparkAppimageConfig.cmake new file mode 100644 -index 0000000..99fc9d6 +index 0000000..7463a48 --- /dev/null +++ b/cmake/SparkAppimageConfig.cmake @@ -0,0 +1,139 @@ @@ -1183,7 +1222,7 @@ index 0000000..99fc9d6 + 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() @@ -1191,8 +1230,8 @@ index 0000000..99fc9d6 +endfunction(add_appimage) + +function(add_appimage_desktop) -+ configure_file(cmake/spark-appimage.desktop.in -+ ${CMAKE_BINARY_DIR}/spark-appimage.desktop @ONLY) ++ configure_file(cmake/spark-appimage.desktop.in ++ ${CMAKE_BINARY_DIR}/spark-appimage.desktop @ONLY) +endfunction(add_appimage_desktop) + +function(add_appimage_icon _ICON_PATH) @@ -1202,11 +1241,11 @@ index 0000000..99fc9d6 + 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) ++endfunction(add_appimage_icon _ICON_PATH) + + + -+# 如果glic>=2.27,你就需要加上参数 -unsupported-allow-new-glibc (意思就是不再低版本发行版使用了) ++# 如果glic>=2.27,你就需要加上参数 -unsupported-allow-new-glibc (意思就是不再低版本发行版使用了) +# 或 -unsupported-bundle-everything(大概的意思是尝试兼容,实际测试,到其他发行版直接用不了了,有可能是发行版的原因,还是建议用前者,虽然放弃了低版本) + +# -unsupported-bundle-everything @@ -1235,7 +1274,7 @@ index 0000000..99fc9d6 +# 或指定你所想存放克隆项目的位置 +# BUNDLE_LINUXDEPLOYQT := $(shell pwd)/build/bundle-linuxdeployqt + -+# download-bundle-linuxdeploytools: ++# download-bundle-linuxdeploytools: +# -git clone https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git $(BUNDLE_LINUXDEPLOYQT) + +# LINUXDEPLOYQT := "$(BUNDLE_LINUXDEPLOYQT)/linuxdeployqt-continuous-x86_64.AppImage" @@ -1267,3 +1306,78 @@ index 0000000..0ca2577 -- 2.20.1 + +From bee93666ed61aa5f605ccf98aa79585708ea098a Mon Sep 17 00:00:00 2001 +From: zinface +Date: Thu, 2 Feb 2023 13:58:29 +0800 +Subject: [PATCH 5/6] =?UTF-8?q?desktop:=20=E4=B8=BA=20desktop=20=E6=B7=BB?= + =?UTF-8?q?=E5=8A=A0=E6=96=87=E6=9C=AC=E6=96=87=E4=BB=B6=E7=9A=84=E7=9B=B8?= + =?UTF-8?q?=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 d4d07795f09d33b4995e34c1f86a03c678025f96 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Thu, 2 Feb 2023 14:00:54 +0800 +Subject: [PATCH 6/6] =?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 364adaa..fed2a51 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -44,7 +44,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 + -- Gitee From 9a2ed8b18cfacfdc10d880e54bbdbc0d82050139 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:51:27 +0800 Subject: [PATCH 004/102] =?UTF-8?q?cmake-patch:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=20cmake=20=E7=89=88=E6=9C=AC=E9=99=8D?= =?UTF-8?q?=E7=BA=A7=E5=88=B0=203.22=20=E7=9A=84=E8=A1=A5=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patchs/coconil-cmake-version-3.22.patch | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 patchs/coconil-cmake-version-3.22.patch diff --git a/patchs/coconil-cmake-version-3.22.patch b/patchs/coconil-cmake-version-3.22.patch new file mode 100644 index 0000000..5f90ecd --- /dev/null +++ b/patchs/coconil-cmake-version-3.22.patch @@ -0,0 +1,38 @@ +From afb95e9e995366874845f021d4fb7dd9d7d2fdd1 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Thu, 2 Feb 2023 14:47:56 +0800 +Subject: [PATCH] =?UTF-8?q?cmake-version:=20=E5=B0=86=E7=89=88=E6=9C=AC?= + =?UTF-8?q?=E9=99=8D=E5=88=B0=203.22=20=E4=BB=A5=E9=80=82=E7=94=A8?= + =?UTF-8?q?=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 fed2a51..dc957c3 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 + -- Gitee From 61c27a73ac16d64020ced780533aec81e461565f Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 13:54:23 +0800 Subject: [PATCH 005/102] =?UTF-8?q?cmake-patch:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A1=A5=E4=B8=81=E7=94=A8=E4=BA=8E=E6=9C=80=E6=96=B0=20master?= =?UTF-8?q?=20=E5=88=86=E6=94=AF=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patchs/coconil-cmake-spark-deb-appimage.patch | 1208 ++++++++++++++--- 1 file changed, 1001 insertions(+), 207 deletions(-) diff --git a/patchs/coconil-cmake-spark-deb-appimage.patch b/patchs/coconil-cmake-spark-deb-appimage.patch index fc35b98..432ccdc 100644 --- a/patchs/coconil-cmake-spark-deb-appimage.patch +++ b/patchs/coconil-cmake-spark-deb-appimage.patch @@ -1,208 +1,53 @@ -From d8b90bb4d709d643c7490ce8a79534769185e24e Mon Sep 17 00:00:00 2001 +From 98323da5e5410ba2a3c98f2aaa1af4aa4ada45ca Mon Sep 17 00:00:00 2001 From: coconil Date: Tue, 31 Jan 2023 22:17:32 +0800 -Subject: [PATCH 1/6] add cmake support +Subject: [PATCH 1/8] add cmake support --- - CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ - src/findcmpwin.h | 24 ++++++++++++++---------- - src/findwin.h | 29 ++++++++++++++++------------- - src/qscint/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ - 4 files changed, 96 insertions(+), 23 deletions(-) - create mode 100644 CMakeLists.txt - create mode 100644 src/qscint/CMakeLists.txt + CMakeLists.txt | 2 ++ + src/qscint/CMakeLists.txt | 6 +++--- + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -new file mode 100644 -index 0000000..4dd3768 ---- /dev/null +index f1d6eea..f1c6d25 100644 +--- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -0,0 +1,31 @@ -+cmake_minimum_required(VERSION 3.24) -+project(notepad--) -+ -+set(CMAKE_AUTOMOC ON) -+set(CMAKE_AUTOUIC ON) -+set(CMAKE_AUTORCC ON) -+ -+find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent Network PrintSupport XmlPatterns) -+ -+add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint) -+ -+ -+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 -+ -+${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 -+) +@@ -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/findcmpwin.h b/src/findcmpwin.h -index 4432e85..70deee3 100755 ---- a/src/findcmpwin.h -+++ b/src/findcmpwin.h -@@ -4,16 +4,20 @@ - #include - #include - --#include "ui_findcmpwin.h" --#include "rcglobal.h" -- --enum FindTabIndex { -- FIND_TAB, -- REPLACE_TAB, --}; --class ScintillaEditView; -- --//struct FindCmpRecord { -+#include "ui_findcmpwin.h" -+#include "rcglobal.h" -+ -+#ifndef DEF_FIND_TAB_INDEX -+#define DEF_FIND_TAB_INDEX -+ -+enum FindTabIndex { -+ FIND_TAB, -+ REPLACE_TAB, -+}; -+#endif -+class ScintillaEditView; -+ -+//struct FindCmpRecord { - // int lineNum; - // int pos; - // QString lineContents; -diff --git a/src/findwin.h b/src/findwin.h -index c32a7d4..be82deb 100755 ---- a/src/findwin.h -+++ b/src/findwin.h -@@ -3,19 +3,22 @@ - #include - #include - #include -- -- --#include "ui_findwin.h" -- --enum FindTabIndex { -- FIND_TAB =0, -- REPLACE_TAB, -- DIR_FIND_TAB, -- MARK_TAB, --}; --class ScintillaEditView; --class QsciScintilla; -- -+ -+ -+#include "ui_findwin.h" -+#ifndef DEF_FIND_TAB_INDEX -+#define DEF_FIND_TAB_INDEX -+enum FindTabIndex { -+ FIND_TAB =0, -+ REPLACE_TAB, -+ DIR_FIND_TAB, -+ MARK_TAB, -+}; -+#endif -+ -+class ScintillaEditView; -+class QsciScintilla; -+ - struct FindRecord { - int lineNum; - int lineStartPos; //行开始位置 diff --git a/src/qscint/CMakeLists.txt b/src/qscint/CMakeLists.txt -new file mode 100644 -index 0000000..f132dc6 ---- /dev/null +index b114614..f132dc6 100644 +--- a/src/qscint/CMakeLists.txt +++ b/src/qscint/CMakeLists.txt -@@ -0,0 +1,35 @@ +@@ -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) -+set(CMAKE_AUTORCC ON) -+ -+find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport) -+ -+aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC) -+aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/lexers SRC) -+aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/lexlib SRC) -+aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/src SRC) -+aux_source_directory(${PROJECT_SOURCE_DIR}/scintilla/boostregex SRC) -+ -+file(GLOB MOC_HEADER ${PROJECT_SOURCE_DIR}/src/Qsci/*.h) -+ -+#message(${MOC_HEADER}) -+ -+add_library(${PROJECT_NAME} STATIC ${SRC} ${MOC_HEADER}) -+ -+target_compile_definitions(${PROJECT_NAME} PRIVATE SCINTILLA_QT SCI_LEXER INCLUDE_DEPRECATED_FEATURES) -+ -+target_include_directories(${PROJECT_NAME} PRIVATE -+${PROJECT_SOURCE_DIR}/scintilla/lexlib -+${PROJECT_SOURCE_DIR}/scintilla/boostregex -+) -+ -+target_include_directories(${PROJECT_NAME} PUBLIC -+${PROJECT_SOURCE_DIR}/src + + 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) -+ -+target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent Qt5::Network Qt5::PrintSupport) --- -2.20.1 - - -From af0785b1f7060ac535900f159173153d2028d1a7 Mon Sep 17 00:00:00 2001 -From: coconil -Date: Tue, 31 Jan 2023 22:49:55 +0800 -Subject: [PATCH 2/6] add cmake build doc - ---- - cmake.md | 8 ++++++++ - 1 file changed, 8 insertions(+) - create mode 100644 cmake.md - -diff --git a/cmake.md b/cmake.md -new file mode 100644 -index 0000000..b5f9785 ---- /dev/null -+++ b/cmake.md -@@ -0,0 +1,8 @@ -+# cmake构建说明 -+ -+## Ubuntu -+ -+1. 安装编译环境 `sudo apt-get install g++ make cmake` -+1. 安装qt工具和库 `sudo apt-get install qtbase5-dev qt5-qmake qtbase5-dev-tools libqt5printsupport5 libqt5xmlpatterns5-dev ` -+1. 配置 `cmake path_to_src` -+1. 编译 `make -j` -\ No newline at end of file + ${PROJECT_SOURCE_DIR}/scintilla/src + ${PROJECT_SOURCE_DIR}/scintilla/include) + -- 2.20.1 -From 44ef7d609c77688c46a0334bc08d863114b46998 Mon Sep 17 00:00:00 2001 +From 486ece6437385cf06cf99feba504a990ff5c2c6e Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:04:05 +0800 -Subject: [PATCH 3/6] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 2/8] =?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 @@ -210,8 +55,8 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- - .gitignore | 36 ++- - CMakeLists.txt | 34 ++- + .gitignore | 48 +++- + CMakeLists.txt | 36 ++- Makefile | 61 +++++ assets/spark.png | Bin 0 -> 4959 bytes cmake/DebPackageConfig.cmake | 323 +++++++++++++++++++++++++++ @@ -219,7 +64,7 @@ Content-Transfer-Encoding: 8bit cmake/SparkInstallMacrosConfig.cmake | 131 +++++++++++ cmake/package-deb.descript | 45 ++++ cmake/spark-desktop.desktop.in | 12 + - 9 files changed, 672 insertions(+), 5 deletions(-) + 9 files changed, 679 insertions(+), 12 deletions(-) create mode 100644 Makefile create mode 100644 assets/spark.png create mode 100644 cmake/DebPackageConfig.cmake @@ -229,16 +74,28 @@ Content-Transfer-Encoding: 8bit create mode 100644 cmake/spark-desktop.desktop.in diff --git a/.gitignore b/.gitignore -index 8d723bc..30bcfd5 100644 +index 8d723bc..bf38a86 100644 --- a/.gitignore +++ b/.gitignore -@@ -393,6 +393,36 @@ FodyWeavers.xsd - *.msix - *.msm - *.msp +@@ -387,12 +387,42 @@ FodyWeavers.xsd + # Local History for Visual Studio Code + .history/ + +-# Windows Installer files from build outputs +-*.cab +-*.msi +-*.msix +-*.msm +-*.msp - -# JetBrains Rider -*.sln.iml ++# Windows Installer files from build outputs ++*.cab ++*.msi ++*.msix ++*.msm ++*.msp + +# JetBrains Rider +*.sln.iml @@ -273,19 +130,20 @@ index 8d723bc..30bcfd5 100644 +# End of https://www.toptal.com/developers/gitignore/api/cmake +!/Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4dd3768..a48badb 100644 +index f1c6d25..666fbdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ - cmake_minimum_required(VERSION 3.24) +-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) -@@ -28,4 +28,34 @@ ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/lexlib - ${PROJECT_SOURCE_DIR}/src/qscint/scintilla/boostregex - ) +@@ -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 @@ -1073,10 +931,10 @@ index 0000000..e7c3b18 2.20.1 -From b2c247073dfaf9539af26cb5372f8ba16c297cdc Mon Sep 17 00:00:00 2001 +From 7aa88bae1182ba087631ad0bd0e336c6dda9699b Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:09:49 +0800 -Subject: [PATCH 4/6] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 3/8] =?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 @@ -1093,10 +951,10 @@ Content-Transfer-Encoding: 8bit create mode 100644 cmake/spark-appimage.desktop.in diff --git a/CMakeLists.txt b/CMakeLists.txt -index a48badb..364adaa 100644 +index 666fbdb..a8f27aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -54,6 +54,14 @@ if(CMAKE_HOST_UNIX) +@@ -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}) @@ -1307,10 +1165,10 @@ index 0000000..0ca2577 2.20.1 -From bee93666ed61aa5f605ccf98aa79585708ea098a Mon Sep 17 00:00:00 2001 +From 138dc3b7f574b9fd44054d2f1397ff737ce4f41c Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 13:58:29 +0800 -Subject: [PATCH 5/6] =?UTF-8?q?desktop:=20=E4=B8=BA=20desktop=20=E6=B7=BB?= +Subject: [PATCH 4/8] =?UTF-8?q?desktop:=20=E4=B8=BA=20desktop=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=96=87=E6=9C=AC=E6=96=87=E4=BB=B6=E7=9A=84=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=20MimeType?= MIME-Version: 1.0 @@ -1349,10 +1207,10 @@ index e7c3b18..e33c74e 100644 2.20.1 -From d4d07795f09d33b4995e34c1f86a03c678025f96 Mon Sep 17 00:00:00 2001 +From c75654ae45f30f8039fcf44b42ecb873aef69ddd Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:00:54 +0800 -Subject: [PATCH 6/6] =?UTF-8?q?repo:=20=E5=AF=B9=20desktop=20=E6=96=87?= +Subject: [PATCH 5/8] =?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?= @@ -1365,10 +1223,10 @@ Content-Transfer-Encoding: 8bit 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 364adaa..fed2a51 100644 +index a8f27aa..63e878c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -44,7 +44,8 @@ if(CMAKE_HOST_UNIX) +@@ -70,7 +70,8 @@ if(CMAKE_HOST_UNIX) # 应用类型: Type= "Application" # 执行程序: Exec= @@ -1381,3 +1239,939 @@ index 364adaa..fed2a51 100644 -- 2.20.1 + +From c47eb80929921e9f94ab9e176304b3c4fb1de157 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Thu, 2 Feb 2023 14:47:56 +0800 +Subject: [PATCH 6/8] =?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 653b68b44490ba0afbf99a95300aa46d96c4ec33 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Sun, 5 Feb 2023 12:55:38 +0800 +Subject: [PATCH 7/8] =?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_ 结构 ++ # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 名称 ++ # 同等于 spark_add_link(qt_ ${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_ 的宏 ++# 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 ) ++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_ 结构 ++ # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 名称 ++ # 同等于 spark_add_link(qt_ ${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_ 的宏 ++# 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 ) ++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 [files]... ++# 构建一个库,基于指定的源文件 ++ # 并根据库名生成 target_link_ 函数 ++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 ++# 构建一个库,基于指定的路径 ++ # 并根据库名生成 target_link_ 函数 ++ # 函数内增加以 头文件搜索路径 ++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 [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_ 函数 ++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- 生成构建目标, ++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_ 结构 ++ # _IN_NAME: 此宏生成 target_link_ 的要求参数 ++ # ARGN: 此宏剩余的参数列表 ++ # 在使用 target_link_ 时 ++ # _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 [REVERSE]) ++ # string(SUBSTRING ) ++ # 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 fe8a5e0bd891cc978c8fae6f43e34c9457e282a3 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Sun, 5 Feb 2023 13:00:22 +0800 +Subject: [PATCH 8/8] =?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 + -- Gitee From df73e80a378c071ffebbbe2dcf3ba779b393d61a Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 14:00:30 +0800 Subject: [PATCH 006/102] =?UTF-8?q?cmake-patch:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=20cmake=20=E7=89=88=E6=9C=AC=E9=99=8D?= =?UTF-8?q?=E7=BA=A7=E5=88=B0=203.16=20=E7=9A=84=E8=A1=A5=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patchs/coconil-cmake-version-3.16.patch | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 patchs/coconil-cmake-version-3.16.patch diff --git a/patchs/coconil-cmake-version-3.16.patch b/patchs/coconil-cmake-version-3.16.patch new file mode 100644 index 0000000..ff7b58f --- /dev/null +++ b/patchs/coconil-cmake-version-3.16.patch @@ -0,0 +1,27 @@ +From 3dd815a0893c7200605ba0f3e0806e460d0b2be7 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Sun, 5 Feb 2023 13:59:44 +0800 +Subject: [PATCH] =?UTF-8?q?cmake-version:=20=E5=B0=86=E7=89=88=E6=9C=AC?= + =?UTF-8?q?=E9=99=8D=E5=88=B0=203.16=20=E4=BB=A5=E9=80=82=E7=94=A8?= + =?UTF-8?q?=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 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d990b1d..e86ba02 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.22) ++cmake_minimum_required(VERSION 3.16) + + project(notepad-- VERSION 1.22.0) + +-- +2.20.1 + -- Gitee From 6b21884a229285f86eb96b28575bc058a6c39753 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:16:21 +0800 Subject: [PATCH 007/102] =?UTF-8?q?cmake-patch:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A1=A5=E4=B8=81=E6=B7=BB=E5=8A=A0=20Linux=20=20Notepad--=20?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=9E=84=E5=BB=BA=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patchs/coconil-cmake-spark-deb-appimage.patch | 515 +++++++++++++++++- 1 file changed, 491 insertions(+), 24 deletions(-) diff --git a/patchs/coconil-cmake-spark-deb-appimage.patch b/patchs/coconil-cmake-spark-deb-appimage.patch index 432ccdc..037fb85 100644 --- a/patchs/coconil-cmake-spark-deb-appimage.patch +++ b/patchs/coconil-cmake-spark-deb-appimage.patch @@ -1,7 +1,7 @@ -From 98323da5e5410ba2a3c98f2aaa1af4aa4ada45ca Mon Sep 17 00:00:00 2001 +From 25e3419aa28a77a1ff24a53a1e43f877412fdcc2 Mon Sep 17 00:00:00 2001 From: coconil Date: Tue, 31 Jan 2023 22:17:32 +0800 -Subject: [PATCH 1/8] add cmake support +Subject: [PATCH 01/11] add cmake support --- CMakeLists.txt | 2 ++ @@ -44,10 +44,10 @@ index b114614..f132dc6 100644 2.20.1 -From 486ece6437385cf06cf99feba504a990ff5c2c6e Mon Sep 17 00:00:00 2001 +From fd25cc015e42f42f3529008a56e473b8ecad1d8a Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:04:05 +0800 -Subject: [PATCH 2/8] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 02/11] =?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 @@ -55,7 +55,7 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- - .gitignore | 48 +++- + .gitignore | 54 ++++- CMakeLists.txt | 36 ++- Makefile | 61 +++++ assets/spark.png | Bin 0 -> 4959 bytes @@ -64,7 +64,7 @@ Content-Transfer-Encoding: 8bit cmake/SparkInstallMacrosConfig.cmake | 131 +++++++++++ cmake/package-deb.descript | 45 ++++ cmake/spark-desktop.desktop.in | 12 + - 9 files changed, 679 insertions(+), 12 deletions(-) + 9 files changed, 682 insertions(+), 15 deletions(-) create mode 100644 Makefile create mode 100644 assets/spark.png create mode 100644 cmake/DebPackageConfig.cmake @@ -74,13 +74,16 @@ Content-Transfer-Encoding: 8bit create mode 100644 cmake/spark-desktop.desktop.in diff --git a/.gitignore b/.gitignore -index 8d723bc..bf38a86 100644 +index 8d723bc..72fb977 100644 --- a/.gitignore +++ b/.gitignore -@@ -387,12 +387,42 @@ FodyWeavers.xsd - # Local History for Visual Studio Code - .history/ +@@ -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 @@ -90,6 +93,9 @@ index 8d723bc..bf38a86 100644 - -# JetBrains Rider -*.sln.iml ++# Local History for Visual Studio Code ++.history/ ++ +# Windows Installer files from build outputs +*.cab +*.msi @@ -931,10 +937,10 @@ index 0000000..e7c3b18 2.20.1 -From 7aa88bae1182ba087631ad0bd0e336c6dda9699b Mon Sep 17 00:00:00 2001 +From dc048016f2ac8a8ff20e99aaa0859239984730aa Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:09:49 +0800 -Subject: [PATCH 3/8] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 03/11] =?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 @@ -1165,12 +1171,12 @@ index 0000000..0ca2577 2.20.1 -From 138dc3b7f574b9fd44054d2f1397ff737ce4f41c Mon Sep 17 00:00:00 2001 +From 9826eba36f58b099d93918e9fd23bd8a63aaeca4 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 13:58:29 +0800 -Subject: [PATCH 4/8] =?UTF-8?q?desktop:=20=E4=B8=BA=20desktop=20=E6=B7=BB?= - =?UTF-8?q?=E5=8A=A0=E6=96=87=E6=9C=AC=E6=96=87=E4=BB=B6=E7=9A=84=E7=9B=B8?= - =?UTF-8?q?=E5=85=B3=20MimeType?= +Subject: [PATCH 04/11] =?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 @@ -1207,10 +1213,10 @@ index e7c3b18..e33c74e 100644 2.20.1 -From c75654ae45f30f8039fcf44b42ecb873aef69ddd Mon Sep 17 00:00:00 2001 +From 011c115d38eda8bf101ce0164eb5657e8c96d35d Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:00:54 +0800 -Subject: [PATCH 5/8] =?UTF-8?q?repo:=20=E5=AF=B9=20desktop=20=E6=96=87?= +Subject: [PATCH 05/11] =?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?= @@ -1240,10 +1246,10 @@ index a8f27aa..63e878c 100644 2.20.1 -From c47eb80929921e9f94ab9e176304b3c4fb1de157 Mon Sep 17 00:00:00 2001 +From 2e3eeac09c6bc18d863eee28f7a352acdbcfc3b7 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:47:56 +0800 -Subject: [PATCH 6/8] =?UTF-8?q?cmake-version:=20=E5=B0=86=E7=89=88?= +Subject: [PATCH 06/11] =?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 @@ -1279,10 +1285,10 @@ index f132dc6..77f02f2 100644 2.20.1 -From 653b68b44490ba0afbf99a95300aa46d96c4ec33 Mon Sep 17 00:00:00 2001 +From edcd7b2df99e30d6e6253d8df10126603f269dbc Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 12:55:38 +0800 -Subject: [PATCH 7/8] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 07/11] =?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 @@ -2028,10 +2034,10 @@ index 0000000..bd15f0d 2.20.1 -From fe8a5e0bd891cc978c8fae6f43e34c9457e282a3 Mon Sep 17 00:00:00 2001 +From 40e0220709909a649ad9d912a6d4d2d4d1839cf4 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 13:00:22 +0800 -Subject: [PATCH 8/8] =?UTF-8?q?repo:=20=E5=B0=86=E7=8E=B0=E6=9C=89?= +Subject: [PATCH 08/11] =?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 @@ -2175,3 +2181,464 @@ index 60e9171..d990b1d 100644 -- 2.20.1 + +From 64d0cae716e28770916bf3c6376b458ca716fed2 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Sun, 5 Feb 2023 16:58:53 +0800 +Subject: [PATCH 09/11] =?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 2d518ad7500692ce558076efd14722ef363ae299 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 6 Feb 2023 01:10:42 +0800 +Subject: [PATCH 10/11] =?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 ,所以此部分不被使用) ++ # 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( ...) ++ ++# 一些无关紧要的部分,如果需要实现插件安装操作时,即可进行使用 ++# 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( [...]) ++# ++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 c0da9de36fd4b9ff075afb15aa3c3cbb0466495a Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 6 Feb 2023 01:11:26 +0800 +Subject: [PATCH 11/11] =?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( ...) ++ ``` ++ ++- 着手进行实现插件 ++ ++ > 将项目中的 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 + -- Gitee From cc90eef3c3719ad390d6ba466c1d4e9dd0d735a4 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:40:24 +0800 Subject: [PATCH 008/102] =?UTF-8?q?cmake-patch:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A1=A5=E4=B8=81=20=E4=BF=AE=E5=A4=8D=E6=8F=92=E4=BB=B6=20Lin?= =?UTF-8?q?ux=20Notepad--=20=E6=8F=92=E4=BB=B6=E9=83=A8=E5=88=86=E7=9A=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patchs/coconil-cmake-spark-deb-appimage.patch | 116 ++++++++++++++---- 1 file changed, 94 insertions(+), 22 deletions(-) diff --git a/patchs/coconil-cmake-spark-deb-appimage.patch b/patchs/coconil-cmake-spark-deb-appimage.patch index 037fb85..91c7bc6 100644 --- a/patchs/coconil-cmake-spark-deb-appimage.patch +++ b/patchs/coconil-cmake-spark-deb-appimage.patch @@ -1,7 +1,7 @@ -From 25e3419aa28a77a1ff24a53a1e43f877412fdcc2 Mon Sep 17 00:00:00 2001 +From 89bf9397dd2cb22ab130154bb178aeb02b6a56b9 Mon Sep 17 00:00:00 2001 From: coconil Date: Tue, 31 Jan 2023 22:17:32 +0800 -Subject: [PATCH 01/11] add cmake support +Subject: [PATCH 01/12] add cmake support --- CMakeLists.txt | 2 ++ @@ -44,10 +44,10 @@ index b114614..f132dc6 100644 2.20.1 -From fd25cc015e42f42f3529008a56e473b8ecad1d8a Mon Sep 17 00:00:00 2001 +From 9fb717fbc4762011e6e9af3b9c5ec2d4a9235d3a Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:04:05 +0800 -Subject: [PATCH 02/11] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 02/12] =?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 @@ -937,10 +937,10 @@ index 0000000..e7c3b18 2.20.1 -From dc048016f2ac8a8ff20e99aaa0859239984730aa Mon Sep 17 00:00:00 2001 +From 24b61f0bab5a3f4f1221b11966993505a665a297 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:09:49 +0800 -Subject: [PATCH 03/11] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 03/12] =?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 @@ -1171,10 +1171,10 @@ index 0000000..0ca2577 2.20.1 -From 9826eba36f58b099d93918e9fd23bd8a63aaeca4 Mon Sep 17 00:00:00 2001 +From b4f833acb4cbc009e961f35fcd85aeaf6733cb98 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 13:58:29 +0800 -Subject: [PATCH 04/11] =?UTF-8?q?desktop:=20=E4=B8=BA=20desktop=20?= +Subject: [PATCH 04/12] =?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 @@ -1213,10 +1213,10 @@ index e7c3b18..e33c74e 100644 2.20.1 -From 011c115d38eda8bf101ce0164eb5657e8c96d35d Mon Sep 17 00:00:00 2001 +From 365d0971a551a9355b6e086eafa62bb2a8fc8eac Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:00:54 +0800 -Subject: [PATCH 05/11] =?UTF-8?q?repo:=20=E5=AF=B9=20desktop=20=E6=96=87?= +Subject: [PATCH 05/12] =?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?= @@ -1246,10 +1246,10 @@ index a8f27aa..63e878c 100644 2.20.1 -From 2e3eeac09c6bc18d863eee28f7a352acdbcfc3b7 Mon Sep 17 00:00:00 2001 +From 604823b6745436f4c05de2167df8f36e26c91098 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:47:56 +0800 -Subject: [PATCH 06/11] =?UTF-8?q?cmake-version:=20=E5=B0=86=E7=89=88?= +Subject: [PATCH 06/12] =?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 @@ -1285,10 +1285,10 @@ index f132dc6..77f02f2 100644 2.20.1 -From edcd7b2df99e30d6e6253d8df10126603f269dbc Mon Sep 17 00:00:00 2001 +From 49746538100d7dd4da0aa3107fccdefffd58892e Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 12:55:38 +0800 -Subject: [PATCH 07/11] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +Subject: [PATCH 07/12] =?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 @@ -2034,10 +2034,10 @@ index 0000000..bd15f0d 2.20.1 -From 40e0220709909a649ad9d912a6d4d2d4d1839cf4 Mon Sep 17 00:00:00 2001 +From b611c25abc6445a93287f58d3920ff8b3ea22bc8 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 13:00:22 +0800 -Subject: [PATCH 08/11] =?UTF-8?q?repo:=20=E5=B0=86=E7=8E=B0=E6=9C=89?= +Subject: [PATCH 08/12] =?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 @@ -2182,10 +2182,10 @@ index 60e9171..d990b1d 100644 2.20.1 -From 64d0cae716e28770916bf3c6376b458ca716fed2 Mon Sep 17 00:00:00 2001 +From fcab235ce53e400e6da96f57fb682a913cf79e53 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 16:58:53 +0800 -Subject: [PATCH 09/11] =?UTF-8?q?repo:=20=E9=A2=84=E7=95=99=E9=85=8D?= +Subject: [PATCH 09/12] =?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 @@ -2221,10 +2221,10 @@ index d990b1d..c18417f 100644 2.20.1 -From 2d518ad7500692ce558076efd14722ef363ae299 Mon Sep 17 00:00:00 2001 +From 4dce41dee6d30dc1804fbf0967bc23628f2b3066 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:10:42 +0800 -Subject: [PATCH 10/11] =?UTF-8?q?linux/plugin-support:=20=E6=B7=BB?= +Subject: [PATCH 10/12] =?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 @@ -2453,10 +2453,10 @@ index 1f8939b..204d16a 100644 2.20.1 -From c0da9de36fd4b9ff075afb15aa3c3cbb0466495a Mon Sep 17 00:00:00 2001 +From 8cefa82cf1339dcc0230be955047fab350de2685 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:11:26 +0800 -Subject: [PATCH 11/11] =?UTF-8?q?linux/plugin-doc:=20=E6=B7=BB=E5=8A=A0=20?= +Subject: [PATCH 11/12] =?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 @@ -2642,3 +2642,75 @@ index 0000000..c642fc7 -- 2.20.1 + +From 7026d476770c9d35dd3d06721805b83b3b554a73 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 6 Feb 2023 01:37:46 +0800 +Subject: [PATCH 12/12] =?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 + -- Gitee From aef7477ffa60884c0b3fef325b4f0365f8013d3e Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 10:32:33 +0800 Subject: [PATCH 009/102] =?UTF-8?q?cmake-patch:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A1=A5=E4=B8=81=E9=87=87=E7=94=A8=E9=A1=B9=E7=9B=AE=E4=B8=AD?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E7=9A=84=20Linux=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=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 --- patchs/coconil-cmake-spark-deb-appimage.patch | 91 ++++++++++++++----- 1 file changed, 67 insertions(+), 24 deletions(-) diff --git a/patchs/coconil-cmake-spark-deb-appimage.patch b/patchs/coconil-cmake-spark-deb-appimage.patch index 91c7bc6..b077d64 100644 --- a/patchs/coconil-cmake-spark-deb-appimage.patch +++ b/patchs/coconil-cmake-spark-deb-appimage.patch @@ -1,7 +1,7 @@ -From 89bf9397dd2cb22ab130154bb178aeb02b6a56b9 Mon Sep 17 00:00:00 2001 +From cc06baf3b21851b8addc0f691a31541ca436d395 Mon Sep 17 00:00:00 2001 From: coconil Date: Tue, 31 Jan 2023 22:17:32 +0800 -Subject: [PATCH 01/12] add cmake support +Subject: [PATCH 01/13] add cmake support --- CMakeLists.txt | 2 ++ @@ -44,10 +44,10 @@ index b114614..f132dc6 100644 2.20.1 -From 9fb717fbc4762011e6e9af3b9c5ec2d4a9235d3a Mon Sep 17 00:00:00 2001 +From 7466475538da85ba7eb24024e34b5fde8babe5f9 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:04:05 +0800 -Subject: [PATCH 02/12] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +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 @@ -937,10 +937,10 @@ index 0000000..e7c3b18 2.20.1 -From 24b61f0bab5a3f4f1221b11966993505a665a297 Mon Sep 17 00:00:00 2001 +From 684ced155e1c749b06e76449177c95db9392c0fc Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:09:49 +0800 -Subject: [PATCH 03/12] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +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 @@ -1171,10 +1171,10 @@ index 0000000..0ca2577 2.20.1 -From b4f833acb4cbc009e961f35fcd85aeaf6733cb98 Mon Sep 17 00:00:00 2001 +From c241f19bbcec29d7a1ed8fe8e1f0d6e36a957b69 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 13:58:29 +0800 -Subject: [PATCH 04/12] =?UTF-8?q?desktop:=20=E4=B8=BA=20desktop=20?= +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 @@ -1213,10 +1213,10 @@ index e7c3b18..e33c74e 100644 2.20.1 -From 365d0971a551a9355b6e086eafa62bb2a8fc8eac Mon Sep 17 00:00:00 2001 +From 4a74a60af053dfa4680918ceac8a78974d481d53 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:00:54 +0800 -Subject: [PATCH 05/12] =?UTF-8?q?repo:=20=E5=AF=B9=20desktop=20=E6=96=87?= +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?= @@ -1246,10 +1246,10 @@ index a8f27aa..63e878c 100644 2.20.1 -From 604823b6745436f4c05de2167df8f36e26c91098 Mon Sep 17 00:00:00 2001 +From b7f8abc6c6631ea598216c3606d0f61a9b653474 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:47:56 +0800 -Subject: [PATCH 06/12] =?UTF-8?q?cmake-version:=20=E5=B0=86=E7=89=88?= +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 @@ -1285,10 +1285,10 @@ index f132dc6..77f02f2 100644 2.20.1 -From 49746538100d7dd4da0aa3107fccdefffd58892e Mon Sep 17 00:00:00 2001 +From 8661b20c61ad6f70f645e69e89da46e2b945bf7d Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 12:55:38 +0800 -Subject: [PATCH 07/12] =?UTF-8?q?repo:=20=E5=BC=95=E5=85=A5=20Spark=20?= +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 @@ -2034,10 +2034,10 @@ index 0000000..bd15f0d 2.20.1 -From b611c25abc6445a93287f58d3920ff8b3ea22bc8 Mon Sep 17 00:00:00 2001 +From ba6310f45bd803ed6ac60b9851cecc14445cc942 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 13:00:22 +0800 -Subject: [PATCH 08/12] =?UTF-8?q?repo:=20=E5=B0=86=E7=8E=B0=E6=9C=89?= +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 @@ -2182,10 +2182,10 @@ index 60e9171..d990b1d 100644 2.20.1 -From fcab235ce53e400e6da96f57fb682a913cf79e53 Mon Sep 17 00:00:00 2001 +From 28e63cf37d6e4b41b4a0720ee7a321d484487eb5 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 16:58:53 +0800 -Subject: [PATCH 09/12] =?UTF-8?q?repo:=20=E9=A2=84=E7=95=99=E9=85=8D?= +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 @@ -2221,10 +2221,10 @@ index d990b1d..c18417f 100644 2.20.1 -From 4dce41dee6d30dc1804fbf0967bc23628f2b3066 Mon Sep 17 00:00:00 2001 +From 481a7f7b39fe4b67bec6a3cab24e59a4e06b39f0 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:10:42 +0800 -Subject: [PATCH 10/12] =?UTF-8?q?linux/plugin-support:=20=E6=B7=BB?= +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 @@ -2453,10 +2453,10 @@ index 1f8939b..204d16a 100644 2.20.1 -From 8cefa82cf1339dcc0230be955047fab350de2685 Mon Sep 17 00:00:00 2001 +From 7e215f5fe65a9962bf29588a0e566d239b734d25 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:11:26 +0800 -Subject: [PATCH 11/12] =?UTF-8?q?linux/plugin-doc:=20=E6=B7=BB=E5=8A=A0=20?= +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 @@ -2643,10 +2643,10 @@ index 0000000..c642fc7 2.20.1 -From 7026d476770c9d35dd3d06721805b83b3b554a73 Mon Sep 17 00:00:00 2001 +From 8c582a774e8cb0a3c347de5a574ecfd91f7522d2 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:37:46 +0800 -Subject: [PATCH 12/12] =?UTF-8?q?fix-plugin-cmake:=20=E4=BF=AE=E5=A4=8D?= +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 @@ -2714,3 +2714,46 @@ index 58e0bd7..37ad692 100644 -- 2.20.1 + +From e9fed613d3f0fe2593f2d163df3d611bf3cd3c2a Mon Sep 17 00:00:00 2001 +From: zinface +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 + -- Gitee From 5a30398f9b79925b33c3ebeeac9b130bc72da721 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 17:31:39 +0800 Subject: [PATCH 010/102] =?UTF-8?q?cmake-patchs:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E4=BA=8E=20ebird98=20=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E7=9A=84=20Qt6=20=E7=BA=AF=E5=8C=96=E7=9A=84=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E8=A1=A5=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...a504a9a2f8b06139d571caed3d-linux-qt6.patch | 890 ++++++++++++++++++ 1 file changed, 890 insertions(+) create mode 100644 patchs/base-4c8661d74aa78ea504a9a2f8b06139d571caed3d-linux-qt6.patch diff --git a/patchs/base-4c8661d74aa78ea504a9a2f8b06139d571caed3d-linux-qt6.patch b/patchs/base-4c8661d74aa78ea504a9a2f8b06139d571caed3d-linux-qt6.patch new file mode 100644 index 0000000..e2ea5c7 --- /dev/null +++ b/patchs/base-4c8661d74aa78ea504a9a2f8b06139d571caed3d-linux-qt6.patch @@ -0,0 +1,890 @@ +From 34d458cf82810609bee2c85f1eb772bbef40a152 Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 6 Feb 2023 16:40:36 +0800 +Subject: [PATCH] =?UTF-8?q?linux-qt6:=20=E6=B7=BB=E5=8A=A0=E7=94=A8?= + =?UTF-8?q?=E4=BA=8E=20Qt6=20=E7=BC=96=E8=AF=91=E7=9A=84=E7=9B=B8=E5=85=B3?= + =?UTF-8?q?=E5=8F=98=E6=9B=B4?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + src/CmpareMode.cpp | 4 +- + src/Encode.cpp | 2 +- + src/RealCompare.pro | 44 ++++++++++---------- + src/batchfindreplace.cpp | 6 +-- + src/cceditor/ccnotepad.cpp | 64 ++++++++++++++-------------- + src/columnedit.cpp | 4 +- + src/ctipwin.cpp | 2 +- + src/draglineedit.cpp | 1 + + src/encodeconvert.cpp | 2 +- + src/findresultwin.cpp | 26 +++++++----- + src/findwin.cpp | 4 +- + src/langstyledefine.cpp | 8 ++-- + src/nddsetting.cpp | 2 +- + src/qscint/src/qscilexer.cpp | 4 +- + src/qscint/src/qscintilla.pro | 18 ++------ + src/qtlangset.cpp | 78 +++++++++++++++++------------------ + src/scintillaeditview.cpp | 8 ++-- + src/userlexdef.cpp | 6 +-- + 18 files changed, 139 insertions(+), 144 deletions(-) + +diff --git a/src/CmpareMode.cpp b/src/CmpareMode.cpp +index b8fb335..1245275 100755 +--- a/src/CmpareMode.cpp ++++ b/src/CmpareMode.cpp +@@ -181,7 +181,7 @@ quint32 CmpareMode::readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fi + else if (mode == 2) + { + QString temp = lineInfo.unicodeStr; +- md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8()); ++ md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8()); + } + }; + +@@ -429,7 +429,7 @@ CODE_ID CmpareMode::readLineFromFile(uchar* m_fileFpr, const int fileLength, con + else if (mode == 2) + { + QString temp = lineInfo.unicodeStr; +- md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8()); ++ md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8()); + } + }; + +diff --git a/src/Encode.cpp b/src/Encode.cpp +index 2164880..9fd8af1 100755 +--- a/src/Encode.cpp ++++ b/src/Encode.cpp +@@ -1,6 +1,6 @@ + #include "Encode.h" + #include +-#include ++#include + + /* 检查字符串编码的类。看了大量文献,结论如下: + *如果是UTF BOM格式,或者UNICODE格式,其文件头部前几个字节(2-3)有一定的标识。由此标识直接按对应编码处理。 +diff --git a/src/RealCompare.pro b/src/RealCompare.pro +index 1035414..0da717e 100755 +--- a/src/RealCompare.pro ++++ b/src/RealCompare.pro +@@ -3,9 +3,9 @@ LANGUAGE = C++ + + TARGET = Notepad-- + +-CONFIG += qt warn_on Debug ++CONFIG += qt warn_on + +-QT += core gui widgets concurrent network xmlpatterns ++QT += core gui widgets concurrent network core5compat + + + HEADERS += *.h \ +@@ -33,47 +33,47 @@ INCLUDEPATH += cceditor + + TRANSLATIONS += realcompare_zh.ts + +- if(contains(QMAKE_HOST.arch, x86_64)){ +- CONFIG(Debug, Debug|Release){ ++ if(contains(QMAKE_HOST.arch, x86_64|loongarch64)){ ++ CONFIG(debug, debug|release){ + DESTDIR = x64/Debug +- LIBS += -Lx64/Debug +- LIBS += -lqmyedit_qt5d ++ LIBS += -Lx64/Debug ++ LIBS += -lqmyedit_qt6d + }else{ + DESTDIR = x64/Release + LIBS += -Lx64/Release +- LIBS += -lqmyedit_qt5 ++ LIBS += -lqmyedit_qt6 + #QMAKE_CXXFLAGS += /openmp + } +- } ++} ++ + unix{ +-if(CONFIG(debug, Debug|Release)){ +- LIBS += -L/home/yzw/build/CCNotePad/x64/Debug -lqmyedit_qt5 ++ if(CONFIG(debug, debug|release)){ ++ LIBS += -L/home/yzw/build/CCNotePad/x64/Debug -lqmyedit_qt6 + +-QMAKE_CXXFLAGS += -fopenmp +-LIBS += -lgomp -lpthread ++ QMAKE_CXXFLAGS += -fopenmp ++ LIBS += -lgomp -lpthread + }else{ +- LIBS += -L/home/yzw/build/CCNotePad/x64/Release -lqmyedit_qt5 ++ LIBS += -L/home/yzw/build/CCNotePad/x64/Release -lqmyedit_qt6 + DESTDIR = x64/Release + + QMAKE_CXXFLAGS += -fopenmp -O2 + LIBS += -lgomp -lpthread + } +- } +- ++} + + RC_FILE += RealCompare.rc ++ + unix + { +- +-INCLUDEPATH += $$PWD/. +-DEPENDPATH += $$PWD/. ++ INCLUDEPATH += $$PWD/. ++ DEPENDPATH += $$PWD/. + + +-unix:!macx: LIBS += -L$$PWD/x64/Release/ -lqmyedit_qt5 ++ unix:!macx: LIBS += -L$$PWD/x64/Release/ -lqmyedit_qt6 + +-INCLUDEPATH += $$PWD/x64/Release +-DEPENDPATH += $$PWD/x64/Release ++ INCLUDEPATH += $$PWD/x64/Release ++ DEPENDPATH += $$PWD/x64/Release + +-unix:!macx: PRE_TARGETDEPS += $$PWD/x64/Release/libqmyedit_qt5.a ++ unix:!macx: PRE_TARGETDEPS += $$PWD/x64/Release/libqmyedit_qt6.a + } + +diff --git a/src/batchfindreplace.cpp b/src/batchfindreplace.cpp +index cb071c3..2602e3c 100755 +--- a/src/batchfindreplace.cpp ++++ b/src/batchfindreplace.cpp +@@ -89,7 +89,7 @@ void BatchFindReplace::appendToFindReplaceTable(QStringList& findKeyword) + bool BatchFindReplace::tranInputKeyword(QString& findKeyWord, QStringList& outputKeyWordList) + { + //ѿհַո\t \r\n ַ滻Ϊո +- QRegExp re("\\s"); ++ QRegularExpression re("\\s"); + findKeyWord.replace(re, QString(" ")); + + //ٽпոָ +@@ -257,7 +257,7 @@ void BatchFindReplace::on_export() + if (!fileName.isEmpty()) + { + QSettings setting(fileName, QSettings::IniFormat); +- setting.setIniCodec("UTF-8"); ++// setting.setIniCodec("UTF-8"); + + int rowNums = ui.findReplaceTable->rowCount(); + +@@ -303,7 +303,7 @@ void BatchFindReplace::on_import() + QFileInfo fi(fileNameList[0]); + + QSettings setting(fi.filePath(), QSettings::IniFormat); +- setting.setIniCodec("UTF-8"); ++// setting.setIniCodec("UTF-8"); + + ui.findKeywordEdit->setPlainText(setting.value("find").toStringList().join(" ")); + ui.replaceKeywordEdit->setPlainText(setting.value("replace").toStringList().join(" ")); +diff --git a/src/cceditor/ccnotepad.cpp b/src/cceditor/ccnotepad.cpp +index 1f04879..5efe091 100755 +--- a/src/cceditor/ccnotepad.cpp ++++ b/src/cceditor/ccnotepad.cpp +@@ -507,7 +507,7 @@ void initFileTypeLangMap() + //把新语言tagName,和关联ext单独存放起来ext_tag.ini。只读取一个文件就能获取所有,避免遍历慢 + QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件 + QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + QStringList keys = qs.allKeys(); + //LangType lexId = L_USER_TXT; +@@ -3981,7 +3981,7 @@ void CCNotePad::initFileListDockWin() + } + }); + m_dockFileListWin->setAttribute(Qt::WA_DeleteOnClose); +- m_dockFileListWin->layout()->setMargin(0); ++ m_dockFileListWin->layout()->setContentsMargins(0, 0, 0, 0); + m_dockFileListWin->layout()->setSpacing(0); + + //暂时不提供关闭,因为关闭后需要同步菜单的check状态 +@@ -4312,7 +4312,7 @@ void CCNotePad::slot_actionSaveFile_toggle(bool /*checked*/) + if (pEdit != nullptr) + { + //如果是新建的文件,则弹出保存对话框,进行保存 +- if (pEdit->property(Edit_File_New) >= 0) ++ if (pEdit->property(Edit_File_New).toString().length() >= 0) + { + QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)"); + QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QString(), filter); +@@ -4472,7 +4472,7 @@ void CCNotePad::slot_actionSaveAsFile_toggle(bool /*checked*/) + if (pEdit != nullptr) + { + //如果是新建的文件,则弹出保存对话框,进行保存 +- if (pEdit->property(Edit_File_New) >= 0) ++ if (pEdit->property(Edit_File_New).toString().length() >= 0) + { + QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)"); + QString fileName = QFileDialog::getSaveFileName(this, tr("Save File As ..."),QString(), filter); +@@ -4763,7 +4763,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs) + return; + } + +- QVariant v = pEdit->property(Edit_Text_Change); ++ QVariant v = pEdit->property(Edit_Text_Change); + bool isDirty = v.toBool(); + + //不脏则不需要保存,直接跳过。不脏的文件,只记录1个名称,下次打开时恢复 +@@ -4773,7 +4773,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs) + //把文件记录到qs中去 + //index一定不能重复。n表示新建 + //如果是新建的文件 +- if (pEdit->property(Edit_File_New) >= 0) ++ if (pEdit->property(Edit_File_New).toInt() >= 0) + { + qs.setValue(QString("%1").arg(index), QString("%1|1").arg(fileName)); + } +@@ -4792,7 +4792,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs) + } + + //如果是新建的文件 +- if (pEdit->property(Edit_File_New) >= 0) ++ if (pEdit->property(Edit_File_New).toInt() >= 0) + { + QString qsSavePath = qs.fileName(); + +@@ -4963,7 +4963,7 @@ void CCNotePad::closeAllFileStatic() + { + QString tempFileList = QString("notepad/temp/list"); + QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + qs.clear(); + + //从尾部开始依次调用保存所有文件。没修改的不需要保存 +@@ -5047,7 +5047,7 @@ void CCNotePad::closeEvent(QCloseEvent * event) + #else + if ((s_restoreLastFile == 1) && m_isMainWindows) + { +- closeAllFileStatic(); ++ closeAllFileStatic(); + m_isQuitCancel = false; + } + else +@@ -5094,9 +5094,9 @@ void CCNotePad::closeEvent(QCloseEvent * event) + { + c->showNormal(); + } +- qlonglong winId = (qlonglong)c->effectiveWinId(); +- m_shareMem->lock(); +- memcpy(m_shareMem->data(), &winId, sizeof(qlonglong)); ++ qlonglong winId = (qlonglong)c->effectiveWinId(); ++ m_shareMem->lock(); ++ memcpy(m_shareMem->data(), &winId, sizeof(qlonglong)); + m_shareMem->unlock(); + c->m_isMainWindows = true; + } +@@ -5480,7 +5480,7 @@ void CCNotePad::initFindWindow() + //从历史查找记录文件中加载 + QString searchHistory = QString("notepad/searchHistory");//历史查找记录 + QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + if (qs.contains("keys")) + { +@@ -5545,7 +5545,7 @@ void CCNotePad::slot_saveSearchHistory() + //从历史查找记录文件中加载 + QString searchHistory = QString("notepad/searchHistory");//历史查找记录 + QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + if (s_findHistroy.count() > 15) + { +@@ -5772,7 +5772,7 @@ void CCNotePad::initFindResultDockWin() + m_dockSelectTreeWin = new QDockWidget(tr("Find result"), this); + connect(m_dockSelectTreeWin, &QDockWidget::dockLocationChanged, this, &CCNotePad::slot_findResultPosChangeed); + +- m_dockSelectTreeWin->layout()->setMargin(0); ++ m_dockSelectTreeWin->layout()->setContentsMargins(0, 0, 0, 0); + m_dockSelectTreeWin->layout()->setSpacing(0); + + //暂时不提供关闭,因为关闭后需要同步菜单的check状态 +@@ -6573,7 +6573,7 @@ bool CCNotePad::eventFilter(QObject * watched, QEvent * event) + } + return false; + } +- ++ + + #ifdef Q_OS_WIN + static const ULONG_PTR CUSTOM_TYPE = 10000; +@@ -6581,16 +6581,16 @@ static const ULONG_PTR OPEN_NOTEPAD_TYPE = 10001; + + bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, long * result) + { +- MSG *param = static_cast(message); +- +- switch (param->message) +- { +- case WM_COPYDATA: +- { +- COPYDATASTRUCT *cds = reinterpret_cast(param->lParam); +- if (cds->dwData == CUSTOM_TYPE) +- { +- QString openFilePath = QString::fromUtf8(reinterpret_cast(cds->lpData), cds->cbData); ++ MSG *param = static_cast(message); ++ ++ switch (param->message) ++ { ++ case WM_COPYDATA: ++ { ++ COPYDATASTRUCT *cds = reinterpret_cast(param->lParam); ++ if (cds->dwData == CUSTOM_TYPE) ++ { ++ QString openFilePath = QString::fromUtf8(reinterpret_cast(cds->lpData), cds->cbData); + + int retIndex = findFileIsOpenAtPad(openFilePath); + if (-1 == retIndex) +@@ -6622,9 +6622,9 @@ bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, long * + + + this->activateWindow(); +- *result = 1; +- return true; +- } ++ *result = 1; ++ return true; ++ } + else if (cds->dwData == OPEN_NOTEPAD_TYPE) + { + activateWindow(); +@@ -6632,8 +6632,8 @@ bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, long * + + *result = 1; + return true; +- } +- } ++ } ++ } + } + + return QWidget::nativeEvent(eventType, message, result); +@@ -7124,7 +7124,7 @@ int CCNotePad::restoreLastFiles() + + QString tempFileList = QString("notepad/temp/list"); + QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + QStringList fileList = qs.allKeys(); + //从小到大排序一下 +diff --git a/src/columnedit.cpp b/src/columnedit.cpp +index 50fd9ae..aaf93f1 100755 +--- a/src/columnedit.cpp ++++ b/src/columnedit.cpp +@@ -216,13 +216,13 @@ void ColumnEdit::slot_ok() + { + QByteArray s_space(cursorCol - lineEndCol, ' '); + lineData.append(s_space); +- lineData.append(text); ++ lineData.append(text.toLatin1()); + } + else + { + int posAbs2Start = pEdit->execute(SCI_FINDCOLUMN, i, cursorCol); + int posRelative2Start = posAbs2Start - lineBegin; +- lineData.insert(posRelative2Start, text); ++ lineData.insert(posRelative2Start, text.toLatin1()); + } + + pEdit->SendScintilla(SCI_SETTARGETRANGE, lineBegin, lineEnd); +diff --git a/src/ctipwin.cpp b/src/ctipwin.cpp +index 9412777..5bf16a9 100755 +--- a/src/ctipwin.cpp ++++ b/src/ctipwin.cpp +@@ -9,7 +9,7 @@ CTipWin::CTipWin(QWidget *parent) + this->setWindowFlags(Qt::ToolTip); + + QPalette palette(this->palette()); +- palette.setColor(QPalette::Background, QColor(0xfff29d)); ++ palette.setColor(QPalette::Window, QColor(0xfff29d)); + this->setPalette(palette); + } + +diff --git a/src/draglineedit.cpp b/src/draglineedit.cpp +index c21f3de..d8a8513 100755 +--- a/src/draglineedit.cpp ++++ b/src/draglineedit.cpp +@@ -1,4 +1,5 @@ + #include "draglineedit.h" ++#include + + DragLineEdit::DragLineEdit(QWidget *parent) + : QLineEdit(parent) +diff --git a/src/encodeconvert.cpp b/src/encodeconvert.cpp +index c17022e..7bbcfc5 100755 +--- a/src/encodeconvert.cpp ++++ b/src/encodeconvert.cpp +@@ -11,7 +11,7 @@ + #include + #include + #include +- ++#include + + const int ITEM_CODE = Qt::UserRole + 1; + +diff --git a/src/findresultwin.cpp b/src/findresultwin.cpp +index 7d86701..ad01b46 100755 +--- a/src/findresultwin.cpp ++++ b/src/findresultwin.cpp +@@ -5,7 +5,7 @@ + #include + #include + #include +-#include ++#include > + #include + #include + #include +@@ -151,8 +151,8 @@ void FindResultWin::slot_selectAll() + QModelIndex pMi = curSelItem.parent(); + if (pMi.isValid()) + { +- curSelItem = pMi; +-} ++ curSelItem = pMi; ++ } + else + { + break; +@@ -176,12 +176,13 @@ void FindResultWin::slot_selectAll() + //遍历下面的子节点 + int i = 0; + QModelIndex childMi; +- childMi = sectionItem.child(i, 0); ++ const QAbstractItemModel *const sectionItemModel = sectionItem.model(); ++ childMi = sectionItemModel->index(i, 0); + while (childMi.isValid()) + { + ++i; + ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select); +- childMi = sectionItem.child(i, 0); ++ childMi = sectionItemModel->index(i, 0); + } + return i+1; + }; +@@ -189,17 +190,20 @@ void FindResultWin::slot_selectAll() + QModelIndex rootItem = firstRootItem; + int j = 0; + int selectCount = 0; ++ const QAbstractItemModel *const rootItemModel = rootItem.model(); ++ const QAbstractItemModel *const firstRootItemModel = firstRootItem.model(); ++ + while (rootItem.isValid()) + { + //遍历根节点下面每一个section + { + int i = 0; +- QModelIndex section = rootItem.child(i, 0); ++ QModelIndex section = rootItemModel->index(i, 0); + while (section.isValid() && !section.data(ResultItemEditor).isNull()) + { + ++i; + selectCount += selectSection(section); +- section = firstRootItem.child(i, 0); ++ section = firstRootItemModel->index(i, 0); + } + } + +@@ -223,12 +227,12 @@ void FindResultWin::slot_selectSection() + //遍历下面的子节点 + int i = 0; + QModelIndex childMi; +- childMi = sectionItem.child(i, 0); ++ childMi = sectionItem.model()->index(i, 0); + while (childMi.isValid()) + { + ++i; + ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select); +- childMi = sectionItem.child(i, 0); ++ childMi = sectionItem.model()->index(i, 0); + } + return i+1; + }; +@@ -420,7 +424,7 @@ QString FindResultWin::highlightFindText(FindRecord& record) + } + src = QString("%1").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped()); + tail = QString(utf8bytes.mid(tailStart)); +- if (tail > MAX_TAIL_LENGTH) ++ if (tail.size() > MAX_TAIL_LENGTH) + { + tail = (tail.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped(); + } +@@ -454,7 +458,7 @@ QString FindResultWin::highlightFindText(FindRecord& record) + src = QString("%1").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped()); + + QString tailContens = QString(utf8bytes.mid(tailStart)); +- if (tailContens > MAX_TAIL_LENGTH) ++ if (tailContens.size() > MAX_TAIL_LENGTH) + { + tailContens = (tailContens.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped(); + } +diff --git a/src/findwin.cpp b/src/findwin.cpp +index 7a55059..8fe891e 100755 +--- a/src/findwin.cpp ++++ b/src/findwin.cpp +@@ -559,8 +559,8 @@ bool readBase(const QChar * str, int * value, int base, int size) + current = str[i]; + if (current >= 'A') + { +- current = current.digitValue() & 0xdf; +- current = current.digitValue() - ('A' - '0' - 10); ++ current = static_cast(current.digitValue() & 0xdf); ++ current = static_cast(current.digitValue() - ('A' - '0' - 10)); + } + else if (current > '9') + return false; +diff --git a/src/langstyledefine.cpp b/src/langstyledefine.cpp +index 2df3a4f..f667f09 100755 +--- a/src/langstyledefine.cpp ++++ b/src/langstyledefine.cpp +@@ -30,7 +30,7 @@ bool LangStyleDefine::readLangSetFile(QString langName, bool isLoadToUI) + { + QString userLangFile = QString("notepad/userlang/%1").arg(langName);//自定义语言中不能有.字符,否则可能有错,后续要检查 + QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + qDebug() << qs.fileName(); + + if (!qs.contains("mz")) +@@ -160,7 +160,7 @@ void LangStyleDefine::slot_save() + //把新语言tagName,和关联ext单独存放起来。后面只读取一个文件就能获取所有,避免遍历慢 + QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件 + QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + QStringList extList = ui.extNameLe->text().trimmed().split(" "); + extList.append(QString::number(motherLangs)); //最后一个是mother lexer +@@ -201,7 +201,7 @@ void LangStyleDefine::slot_delete() + { + QString userLangFile = QString("notepad/userlang/%1").arg(name);//自定义语言中不能有.字符,否则可能有错,后续要检查 + QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + //删除userlang下面的tag.ini + QFile::remove(qs.fileName()); +@@ -211,7 +211,7 @@ void LangStyleDefine::slot_delete() + //把新语言在ext_tag中的关联文件记录也删除 + QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件 + QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + QStringList extList = qs.value(name).toStringList(); + //更新当前ExtLexerManager::getInstance()。如果不更新,就要重启软件才能生效 +diff --git a/src/nddsetting.cpp b/src/nddsetting.cpp +index ed20f73..7e2070a 100755 +--- a/src/nddsetting.cpp ++++ b/src/nddsetting.cpp +@@ -50,7 +50,7 @@ void NddSetting::init() + QString qsSetPath = qs.fileName(); + + s_nddSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir); +- s_nddSet->setIniCodec("UTF-8"); ++// s_nddSet->setIniCodec("UTF-8"); + bool initOk = true; + + auto initNddSet = []() { +diff --git a/src/qscint/src/qscilexer.cpp b/src/qscint/src/qscilexer.cpp +index b49fdc5..f21fff8 100755 +--- a/src/qscint/src/qscilexer.cpp ++++ b/src/qscint/src/qscilexer.cpp +@@ -896,7 +896,7 @@ const char* QsciLexer::getUserDefineKeywords() + + QString userLangFile = QString("notepad/userlang/%1").arg(m_tagName);//自定义语言中不能有.字符,否则可能有错,后续要检查 + QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + if (!qs.contains("mz")) + { +@@ -948,4 +948,4 @@ void QsciLexer::setCommentEnd(QByteArray commentEnd) + void QsciLexer::setCurThemes(int themesId) + { + m_themesId = themesId; +-} +\ No newline at end of file ++} +diff --git a/src/qscint/src/qscintilla.pro b/src/qscint/src/qscintilla.pro +index 2704d72..9ef4520 100755 +--- a/src/qscint/src/qscintilla.pro ++++ b/src/qscint/src/qscintilla.pro +@@ -21,24 +21,14 @@ + !win32:VERSION = 15.1.0 + + TEMPLATE = lib +-CONFIG += qt warn_off thread exceptions hide_symbols debug staticlib ++CONFIG += qt warn_off thread exceptions hide_symbols staticlib + + CONFIG(debug, debug|release) { +- mac: { +- TARGET = qmyedit_qt$${QT_MAJOR_VERSION}_debug +- } else { +- win32: { +- TARGET = qmyedit_qt$${QT_MAJOR_VERSION}d +- } else { +- TARGET = qmyedit_qt$${QT_MAJOR_VERSION} +- } +- } +- +- DESTDIR = ../../x64/Debug ++ TARGET = qmyedit_qt$${QT_MAJOR_VERSION} ++ DESTDIR = ../../x64/Debug + } else { + TARGET = qmyedit_qt$${QT_MAJOR_VERSION} +- +- DESTDIR = ../../x64/Release ++ DESTDIR = ../../x64/Release + } + + macx:!CONFIG(staticlib) { +diff --git a/src/qtlangset.cpp b/src/qtlangset.cpp +index e88d132..99b6258 100755 +--- a/src/qtlangset.cpp ++++ b/src/qtlangset.cpp +@@ -36,8 +36,8 @@ enum LangType { + // Don't use L_JS, use L_JAVASCRIPT instead + // The end of enumated language type, so it should be always at the end + L_EXTERNAL = 100, L_USER_DEFINE = 200 +-}; +-#endif ++}; ++#endif + + //static const QColor blackColor(Qt::black); + //static const QColor lightColor(0xdedede); +@@ -421,14 +421,14 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) + QsciLexer *pLexer = ScintillaEditView::createLexer(index); + if (nullptr != pLexer) + { +- ++ + switch (flag) + { + case GLOBAL_FONT: + { +- for (int i = 0; i <= 255; ++i) +- { +- if (!pLexer->description(i).isEmpty()) ++ for (int i = 0; i <= 255; ++i) ++ { ++ if (!pLexer->description(i).isEmpty()) + { + oldfont = pLexer->font(i); + oldfont.setFamily(m_curStyleData.font.family()); +@@ -439,9 +439,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) + break; + case GLOBAL_FONT_SIZE: + { +- for (int i = 0; i <= 255; ++i) +- { +- if (!pLexer->description(i).isEmpty()) ++ for (int i = 0; i <= 255; ++i) ++ { ++ if (!pLexer->description(i).isEmpty()) + { + oldfont = pLexer->font(i); + oldfont.setPointSize(m_curStyleData.font.pointSize()); +@@ -452,9 +452,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) + break; + case GLOBAL_FONT_BOLD: + { +- for (int i = 0; i <= 255; ++i) +- { +- if (!pLexer->description(i).isEmpty()) ++ for (int i = 0; i <= 255; ++i) ++ { ++ if (!pLexer->description(i).isEmpty()) + { + oldfont = pLexer->font(i); + oldfont.setBold(m_curStyleData.font.bold()); +@@ -465,9 +465,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) + break; + case GLOBAL_FONT_UNDERLINE: + { +- for (int i = 0; i <= 255; ++i) +- { +- if (!pLexer->description(i).isEmpty()) ++ for (int i = 0; i <= 255; ++i) ++ { ++ if (!pLexer->description(i).isEmpty()) + { + oldfont = pLexer->font(i); + oldfont.setUnderline(m_curStyleData.font.underline()); +@@ -478,9 +478,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) + break; + case GLOBAL_FONT_ITALIC: + { +- for (int i = 0; i <= 255; ++i) +- { +- if (!pLexer->description(i).isEmpty()) ++ for (int i = 0; i <= 255; ++i) ++ { ++ if (!pLexer->description(i).isEmpty()) + { + oldfont = pLexer->font(i); + oldfont.setItalic(m_curStyleData.font.italic()); +@@ -503,10 +503,10 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) + break; + default: + break; +- } ++ } + + saveLangeSet(pLexer); +- } ++ } + delete pLexer; + } + } +@@ -537,7 +537,7 @@ void QtLangSet::restoreOriginLangAllStyle() + { + QFile::remove(qs.fileName()); + } +- ++ + delete pLexer; + pLexer = nullptr; + } +@@ -578,12 +578,12 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag) + QsciLexer *pLexer = ScintillaEditView::createLexer(index); + QsciLexer *pOriginLexer = ScintillaEditView::createLexer(index,"",true); + if (nullptr != pLexer) +- { +- for (int i = 0; i <= 255; ++i) +- { +- if (!pLexer->description(i).isEmpty()) +- { +- ++ { ++ for (int i = 0; i <= 255; ++i) ++ { ++ if (!pLexer->description(i).isEmpty()) ++ { ++ + switch (flag) + { + case GLOBAL_FONT: +@@ -649,11 +649,11 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag) + break; + default: + break; +- } +- } ++ } ++ } + } + saveLangeSet(pLexer); +- } ++ } + delete pLexer; + delete pOriginLexer; + } +@@ -795,7 +795,7 @@ bool QtLangSet::readLangSetFile(QString langName,QString &keyword, QString &moth + { + QString userLangFile = QString("notepad/userlang/%1").arg(langName);//Զв.ַдҪ + QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + //qDebug() << qs.fileName(); + + if (!qs.contains("mz")) +@@ -917,15 +917,15 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item) + ui.keywordTe->setPlainText(keyword); + ui.motherLangCb->setCurrentIndex(0); + +- for (int i = 0; i <= 255; ++i) +- { +- QString desc = pLexer->description(i); +- if (!desc.isEmpty()) +- { ++ for (int i = 0; i <= 255; ++i) ++ { ++ QString desc = pLexer->description(i); ++ if (!desc.isEmpty()) ++ { + QListWidgetItem *itemtemp = new QListWidgetItem(desc); +- itemtemp->setData(Qt::UserRole, i); +- ui.styleListWidget->addItem(itemtemp); +- } ++ itemtemp->setData(Qt::UserRole, i); ++ ui.styleListWidget->addItem(itemtemp); ++ } + } + } + +diff --git a/src/scintillaeditview.cpp b/src/scintillaeditview.cpp +index 60181dd..fac3648 100755 +--- a/src/scintillaeditview.cpp ++++ b/src/scintillaeditview.cpp +@@ -2155,7 +2155,7 @@ void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString& + else if (caseToConvert == TITLECASE_FORCE) + strToConvert[i] = strToConvert[i].toLower(); + //An exception +- if ((i < 2) ? false : (strToConvert[i - 1] == L'\'' && (strToConvert[i - 2].isLetter()))) ++ if ((i < 2) ? false : (strToConvert[i - 1] == QChar(L'\'') && (strToConvert[i - 2].isLetter()))) + strToConvert[i] = strToConvert[i].toLower(); + } + } +@@ -2183,11 +2183,11 @@ void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString& + wasEolR = false; + wasEolN = false; + //An exception +- if (strToConvert[i] == L'i' && ++ if (strToConvert[i] == static_cast(L'i') && + ((i < 1) ? false : (strToConvert[i - 1].isSpace() || strToConvert[i - 1] == '(' || strToConvert[i - 1] == '"')) && \ + ((i + 1 == nbChars) ? false : (strToConvert[i + 1].isSpace() || strToConvert[i + 1] == '\''))) + { +- strToConvert[i] = L'I'; ++ strToConvert[i] = static_cast(L'I'); + } + } + else if (strToConvert[i] == '.' || strToConvert[i] == '!' || strToConvert[i] == '?') +@@ -2856,7 +2856,7 @@ bool isUrlQueryDelimiter(QChar const c) + void scanToUrlEnd(QString & text, int textLen, int start, int* distance) + { + int p = start; +- QChar q = 0; ++ QChar q; + enum { sHostAndPath, sQuery, sQueryAfterDelimiter, sQueryQuotes, sQueryAfterQuotes, sFragment } s = sHostAndPath; + while (p < textLen) + { +diff --git a/src/userlexdef.cpp b/src/userlexdef.cpp +index 6b8c7d2..86e238b 100755 +--- a/src/userlexdef.cpp ++++ b/src/userlexdef.cpp +@@ -24,7 +24,7 @@ bool UserLexDef::readUserSettings(QString langTagName) + + QString userLangFile = QString("notepad/userlang/%1").arg(langTagName); + QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + + if (!qs.contains(QString("mz"))) + { +@@ -93,13 +93,13 @@ bool UserLexDef::writeUserSettings(QString langTagName) + + QString userLangFile = QString("notepad/userlang/%1").arg(langTagName); + QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +- qs.setIniCodec("UTF-8"); ++// qs.setIniCodec("UTF-8"); + qs.clear(); + + qs.setValue("mz", langTagName); + qs.setValue("mother", m_motherLang); + qs.setValue("ext", m_extTypes); +- qs.setValue("keyword", m_keyword.data()); ++ qs.setValue("keyword", m_keyword.toStdString().c_str()); + + return true; + } +-- +2.20.1 + -- Gitee From 43df23b4f45f76cc196293015f756e2f4b4ff807 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 21:19:34 +0800 Subject: [PATCH 011/102] =?UTF-8?q?cmake-patchs:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=20Windows=20QtCreator=20=E4=B8=AD=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=BC=96=E8=AF=91=E9=97=AE=E9=A2=98=E7=9A=84=E8=A1=A5?= =?UTF-8?q?=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patchs/fix-windows-qtcreator-build-fail.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 patchs/fix-windows-qtcreator-build-fail.patch diff --git a/patchs/fix-windows-qtcreator-build-fail.patch b/patchs/fix-windows-qtcreator-build-fail.patch new file mode 100644 index 0000000..a16955e --- /dev/null +++ b/patchs/fix-windows-qtcreator-build-fail.patch @@ -0,0 +1,38 @@ +From 3ced487bd23b92a6f35eb590123bc510c9e2429c Mon Sep 17 00:00:00 2001 +From: zinface +Date: Mon, 6 Feb 2023 21:13:23 +0800 +Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8=20Windows=20QtCreator=20?= + =?UTF-8?q?=E4=B8=AD=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=A4=84=E7=90=86=E5=AF=BC?= + =?UTF-8?q?=E8=87=B4=E7=BC=96=E8=AF=91=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= + =?UTF-8?q?=E9=A2=98?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + src/cceditor/ccnotepad.cpp | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/cceditor/ccnotepad.cpp b/src/cceditor/ccnotepad.cpp +index ae615be..b2071d3 100755 +--- a/src/cceditor/ccnotepad.cpp ++++ b/src/cceditor/ccnotepad.cpp +@@ -983,11 +983,12 @@ int CCNotePad::runAsAdmin(const QString& filePath) + //} + QString argStr = QString("-muti %1").arg(filePath); + +- std::basic_string args = StringToWString(argStr.toStdString()); +- size_t shellExecRes = (size_t)::ShellExecute(NULL, TEXT("runas"), nddFullPath, args.c_str(), TEXT("."), SW_SHOW); ++// std::basic_string args = StringToWString(argStr.toStdString()); ++// size_t shellExecRes = (size_t)::ShellExecute(NULL, TEXT("runas"), nddFullPath, args.c_str(), TEXT("."), SW_SHOW); ++ size_t shellExecRes = (size_t)::ShellExecute(NULL, TEXT("runas"), nddFullPath, argStr.toUtf8(), TEXT("."), SW_SHOW); + + // If the function succeeds, it returns a value greater than 32. If the function fails, +- // it returns an error value that indicates the cause of the failure. ++ // it returns an error value that indicates the cause of the failure. + // https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx + + if (shellExecRes < 32) +-- +2.39.1.windows.1 + -- Gitee From 8c2478f6fa475496abb5a5706c99e41a28db5540 Mon Sep 17 00:00:00 2001 From: coconil Date: Tue, 31 Jan 2023 22:17:32 +0800 Subject: [PATCH 012/102] 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) -- Gitee From 2b28d310d67d57386e33387d2f5e5bf4b3dd27f3 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:04:05 +0800 Subject: [PATCH 013/102] =?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 zcmZ9Qc|26n`^T?!hOvx&4Pz%{EZLPYvTq^E5@pRcGGvX$AW~VT?0YC8CHu}WL)I*j zCA+d^OJw_v@Avn|@AZ4V?z!iAo%_7*bMCpH^W6J>;>=8R>1nxX0RW)a*F)YU^_YtW zrY4=^DWIpMj{2UVE)p04)_~)Bx;9qQ2n|Z_wm$&K2wgO?prUJmq(Kl`-&hB=G~+P>c2E7|m)F7F$6%61XMsolUg0zXycp@v@GZ1K>rt9xd?C!>%*+W7 z%C&esu?1QvJQKjm(&8q^?oTJ)%8V0?)|OjY&d?Gr6jy6+xCM5i6!*6NB4P1KRCNm^ zm+NR*M%4c-!-n9r0lIJ!D)W+&T9oD)Dem^7SRik@V(WfPQ@fFKyaf2lH?CLvA5uka za&warZ&7cj6r);vpGc6CZ?~=95k;2K+aF*1m@^PTnvH2@U9bunlhI3nmsfK^BZU;4=_*3}V}PoZ zEP*COH$^QdyIwzO=Shp{b@@LAC7u=@nYJ8)oEoIduWITqMn>MScBnM|V;V8ajW%>c z2|9_!;}u5SRyWpkQzR8giy|l$Ivq`@U%TZM4}hv^OUIk_s0z#=s!u~04W3Iv&C;FbL%51jwmUPHQ@0l~qZwrDUlHbTaRh}I7O zg75zlU9YVkytJ~+#_*>+av3b*ZLbM`=lrm(GyKlhzDKd&-~YS-XuB{i6aEdZrmT8V z5=&CIeIGmv+apvfRY7`h1Zf4_L_-7KYf+zDaL#{K)Hw61>q|2q>%TNiMk|sXtmY*1 z`E77tq7vBO#3uo(t!jj^QMa-dh___m=cxM&AL^ zdT&14OSgK$%!-|9_M)?`i4B)w7eegd!IoH)mWyyhiqc1~EPAqoCCYEgl(hFM{^Ftj z%GS_$^uT6K)$jtUK69tc1oS-cV3H( zyzVwJW(p>4KWuO@dx-z65M|t#j~xmYkY<&V$cV9IcL@+9-%Akb(9C^=$km21|8lq_ za=b^e+n~SA!s?z86LD4&0RU2Vl|bwCrvOB*uG>-oaP+AaCy?IW;MZ7A&oS_=puC#x zTSjKS2X}HZv)}oKicKX7<~q>8hy|~*HpzV*Y^DRSBNNv-=R$KtX-5a5FE!_Wj#!o0njA z8JkG4+{e@({dOMVP51|1y`CGI?{rMiLdMQTV)8ojeNwqrgP)*5q}hq9`jG=rE*1L0 z=0gY)xu5I$L0nYIwuM<@k7MqNbid7Ko1mz?Wtyzjo`jUhJJU|J`Jq_(fZ+l%ogp5Y zIDI`mBjycCE3h-oAO06y%KHv_U0fWu7`0F)$u5yL6u~KnhuEC++z(})gQ{w9X}O1^ ziig+EPJfUA4&ecpZ?0Sc06XsoNMjeO3Wcj3%MW32I2nYaNKiwF#jknm8fO-R8aEHO zS;P_Zcdx7H>7UoVjHFijGh;WVUGy??)C=6c|6BJ?%amgTP(}HCU2Z0Y^Sx|AO%6>B z7k8KD-1)Kga0b7Xt>)Jmz><_Svi*-IB6_0ky0@X$d%1Z$EAcD*>w~VW$*SRrQOa6E z)cKJdzv;DO-USxsZnV8sfR>g0;TF*eXKlHEv~kBDQlVHocet}SvAsdI1E^G1doNa$er}pksd?U1pF|_rB zSIJIEOQLI~-J9cO}P)Oz~yJ4z~jwPCIW7GR>tKG}oJGSkdoz};#7?(Sg>_x?Y_Q?4k zZ$BO!ta2Sdt}R&N@%WDQoxFGNn8p;VW$7qF|8D7og^|0?JUW*}Y|jx!#LUqPlwg=m zRt9aEBD1%*_tO_~T=|(R%DbCN?p_VFK+vzERN1}RWAZ6OAYYD(J}CcnVj9+as%G)o z;NJXAE1<2%q6D=&D&c&^K7J$1uCL+uS>u|xgNGNU%c~o5r72Q`D?M*NaI@;bFQ#CT zV0IV|1Ll4vb*8mCG70}W_>J!pbL`q(Mk#Luq5Ho-?sljN6JfW)-Tyt?3`DZ%L z>1cfFaA%b9aDM4sjzPiuCSI52j;PmRFq03dvd{@)=@Z9{wG$dz~4@#t3rj;1m%CZ{=~k9~XcBC6v7NckqV@1WVYQ<43f3{9(XPWS>EN{EO~*-CK*bt;ZS;!OLuY z87ft)RVyp(Cw{BC?#*W-X}?E8n+mG`{Ikbd@Mf3BkFQ_T3aIyS+g0*qIBMqV83`?o zX*3SoyLQT=V65w9M3)n><3cpp4wMiSNQ6I0WTSfL@yq6O5RJ^;rpPEzOSf?<#OEal z#JE8?_%;i?y7A-hXB(+R7p{hi!m)9NPT7A;G|icpHm~wS^k`I({`l+|qO9g~*i~G*9imYv^HH~-3PeB-S_xwv+Y2l=g6>lXZk|B1v+dn| zeA>r~Z}f3>@rByy3Q&w80&#K>pvR%5geJnqq z#YL_Lw5jl$vkg7ZRPvcNku1Nz{`lM2`2I+BH-`3Ba?R1ny-~VYe z9l%0>oH`pOV?m#)LN)yxXMS#M>?$?Ja6PLFE);UCNl#M06nrh>lc`K1PMyM&Ka>tI zyKVLSSwJ-z2RXNRh*UcPO%t2{i@X_0uuwJ6@h;-=Qef3g6X8cFUHPoCZIv{}R78rZ%99agCe;SpR z2&R5q?E=vp9E`14e_L9iWfefrys(&*EXOenhi}(uR8D%;1^v32tF*i$meYY6!3~@Q zv5OSB5c`O2eYdLw^yThU*z33iu!U)sm(UUi!Yh5@S`weCs{BaFFDP7dWAap2{nG=s zg+-P;PwqQ+?wHvS{X^xRx~)ampA>1zW`P2@zwfa|>{ z(Zt?9q>hUSNyY-w8WjF3)S{^{Y;7-zeNdEWXCYNlYE#WdCdLmAQQa{ib}eB{46!Vm zo13!fMtVj@*A05r-xRqe1O+nR=OyKWG>u1mlD&rJ7WUEOHCORSf`H4G9m&D*U>eu{ zLp6o#gU{59h79h}@mqyQxAYnwjZ3|e)+cm~c9C*PmcN-nJ13-pb9}j+aMZB3eWbuU z(aP`J@@Js(3eo*K%?H@(M#W~b(~+qW`F;+iobQ&M*W>{=WjBNNZqtpbh4N5N(I2dG z-RX`fI|JPp?}OI)XaR2iVs;j=E!yAobeUouDw>}0b0z1W+MTAGY0eJ{GDB$rxn+Jx zijgtNgG}Ip-xgzR(6Yw>ce#I{RXF)m?YpDnSx1P z-qxP|)1Pe80-2Yo{|kjzD-b|ra*a%GbQ-JEf zY4Ef^R`Uo`;5%GzqsAjSR8OWeT$^xkT*!`awX@U|_Abd2Kni%MHCjtQr!HimpSd78 zqrPOZv^3?zweIu9Gt!GTOD19I)$#R&XHcKG{N6t4Uzm)% z_&ik-;lla8ao5f-XCXafQiDpVG*V0{N!aCZPn=1CN`%)rVO5b3-l1<&5Rm>dgqG6& zi6I?9NDN#D1uh~vl;mU=49d2IlV^tnzNl6O2YpihPema^^jse;K;WdUa}|$oaghqg z(6Awt@Duo-@b4d^62bJ31eGM@W)0Qd@X!Ndd;7ddj(j^*YY2nz}q(w%?j=RPLP@eEF|B$PQ2KtCtcE0TG0n}qx$Q0g;>#Q zXb4R~mYm3CJ1RdzfK4TCyeNO)4km{6`QK7Rtf74G7sV*O8|HzS0B>>4yF}W2o(lp* zM{UWrv+Ba@vnVNI88u6!KF%=Wbx&cqT*am6q30wD#F98KVc5!5oJkm|LweHam10~r zX@~3#%zVK@yDeBv6!qOETx37pSa`UBTxI#cHI-Sl3=?)E1K4yNsZ5YEKwM8qGV1Vn zk8qYSbHYB+UTkQmS t;Jjx^&~6n@&egfT2m_h_UkqA5Co_+SJESY3=}2`iKwrlMS%GlG{15vgE&>1m 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( +# [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS | +# FILE_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 [REVERSE]) + string(FIND "${INSTALL_DIRECOTRY}" "*" INSTALL_DIRECTORY_FIND_INDEX) + # message(FATAL_ERROR "${INSTALL_DIRECTORY_FIND_INDEX}: ${INSTALL_DIRECTORY_DIR}") + + # file(GLOB + # [LIST_DIRECTORIES true|false] [RELATIVE ] [CONFIGURE_DEPENDS] + # [...]) + + if (NOT INSTALL_DIRECTORY_FIND_INDEX EQUAL -1) + # string(SUBSTRING ) + 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 + # [LIST_DIRECTORIES true|false] [RELATIVE ] [CONFIGURE_DEPENDS] + # [...]) + + 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 -- Gitee From b8d855c95f3d6d0c59747d59ddfbdd0b6c87e91d Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Feb 2023 20:09:49 +0800 Subject: [PATCH 014/102] =?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 -- Gitee From b0ee89991decf4530ec3a46f85d1edf53a3a4d6c Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 13:58:29 +0800 Subject: [PATCH 015/102] =?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 -- Gitee From c44449cd8abb160f92a44acc4b3060f49f8dc64c Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:00:54 +0800 Subject: [PATCH 016/102] =?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= -- Gitee From 73bb01ce7987a364436c6a537a5f705448c47165 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Feb 2023 14:47:56 +0800 Subject: [PATCH 017/102] =?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) -- Gitee From a1ed99ab27b36fd6cb4374c38aa312521b68c101 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 12:55:38 +0800 Subject: [PATCH 018/102] =?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_ 结构 + # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 名称 + # 同等于 spark_add_link(qt_ ${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_ 的宏 +# 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 ) +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_ 结构 + # _IN_NAME: 此宏使用嵌套宏 spark_add_link 时追加 名称 + # 同等于 spark_add_link(qt_ ${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_ 的宏 +# 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 ) +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 [files]... +# 构建一个库,基于指定的源文件 + # 并根据库名生成 target_link_ 函数 +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 +# 构建一个库,基于指定的路径 + # 并根据库名生成 target_link_ 函数 + # 函数内增加以 头文件搜索路径 +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 [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_ 函数 +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- 生成构建目标, +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_ 结构 + # _IN_NAME: 此宏生成 target_link_ 的要求参数 + # ARGN: 此宏剩余的参数列表 + # 在使用 target_link_ 时 + # _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 [REVERSE]) + # string(SUBSTRING ) + # 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) -- Gitee From 1f1a6167d98058f31a7170ea0c7480ed9c79e315 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 13:00:22 +0800 Subject: [PATCH 019/102] =?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) -- Gitee From d69e43f2ef9468931e13cbbc6d53f89b46574b9a Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 5 Feb 2023 16:58:53 +0800 Subject: [PATCH 020/102] =?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) -- Gitee From 5e9814c4d9ec81fe201fac5205490a76b8e34869 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:10:42 +0800 Subject: [PATCH 021/102] =?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 ,所以此部分不被使用) + # 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( ...) + +# 一些无关紧要的部分,如果需要实现插件安装操作时,即可进行使用 +# 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( [...]) +# +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} -- Gitee From 005783e605255bca33c28da14449f7817bf71cfe Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:11:26 +0800 Subject: [PATCH 022/102] =?UTF-8?q?linux/plugin-doc:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20Notepad--=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( ...) + ``` + +- 着手进行实现插件 + + > 将项目中的 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 -- Gitee From 3eb29c2e901c06d75070a467461ced14d04615b3 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 01:37:46 +0800 Subject: [PATCH 023/102] =?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) -- Gitee From 23eb1564b7cf2d4936bf726795d3ae7b5dbe2c4a Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 6 Feb 2023 10:31:30 +0800 Subject: [PATCH 024/102] =?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 ------------------ # -- Gitee From b751207a0ff67d2f6de5917fcce315e923c109d1 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 8 Feb 2023 01:49:39 +0800 Subject: [PATCH 025/102] =?UTF-8?q?repo:=20=E5=9C=A8=E8=B0=83=E6=95=B4=20C?= =?UTF-8?q?MakeLists.txt=20=E4=B8=AD=E4=B8=89=E4=B8=AA=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=E5=88=86=E9=9A=94=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8f5fa7..541aa11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(cmake/SparkFindQt5Config.cmake) # include(cmake/SparkFindQt6Config.cmake) include(cmake/SparkMacrosExtendConfig.cmake) -# ----------------- Build QScint ----------------- # +# ----------------- 构建 QSci 静态库 ----------------- # if(TRUE) # add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint) # file(GLOB MOC_HEADER src/qscint/src/Qsci/*.h) @@ -40,7 +40,7 @@ if(TRUE) endif(TRUE) -# ----------------- Build CCEditor ----------------- # +# ----------------- 构建 Notepad-- 程序 ----------------- # if(TRUE) # 准备构建 CCEditor @@ -67,7 +67,7 @@ if(TRUE) endif(TRUE) -# ----------------- CCEditor Plugin Support or Other ----------------- # +# ----------------- Notepad-- 插件支持相关 ----------------- # if(TRUE) # 开启插件支持 -- Gitee From 5eeb6f8d47b79c1ab5efffdb820b5ac15225ce79 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 8 Feb 2023 03:07:37 +0800 Subject: [PATCH 026/102] =?UTF-8?q?repo:=20=E6=9B=B4=E6=96=B0=20SparkDeskt?= =?UTF-8?q?opMacros=20=E6=A0=87=E5=87=86=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/SparkDesktopMacros.cmake | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/SparkDesktopMacros.cmake b/cmake/SparkDesktopMacros.cmake index 223ac6b..c1447c5 100644 --- a/cmake/SparkDesktopMacros.cmake +++ b/cmake/SparkDesktopMacros.cmake @@ -1,15 +1,16 @@ 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}) + 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 ) + set(SPARK_DESKTOP_FILE ${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) -- Gitee From 2026803d8ad4da97514b4aa634c678a389495e53 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 8 Feb 2023 03:10:59 +0800 Subject: [PATCH 027/102] =?UTF-8?q?pluginGl:=20=E6=B7=BB=E5=8A=A0=20NOTEPA?= =?UTF-8?q?D=5FPLUGIN=5FMANAGER=20=E6=8E=A7=E5=88=B6=E5=AE=8F=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=8F=92=E4=BB=B6=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/pluginGl.h | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/include/pluginGl.h b/src/include/pluginGl.h index 069f6c2..b0caa0d 100755 --- a/src/include/pluginGl.h +++ b/src/include/pluginGl.h @@ -13,11 +13,11 @@ struct ndd_proc_data { - QString m_strPlugName; // ѡ - QString m_strFilePath; //lib ȫ·ѡ - QString m_strComment; //˵ - QString m_version; //汾롣ѡ - QString m_auther;//ơѡ + QString m_strPlugName; //插件名称 必选 + QString m_strFilePath; //lib 插件的全局路径。必选 + QString m_strComment; //插件说明 + QString m_version; //版本号码。可选 + QString m_auther;//作者名称。可选 }; @@ -25,3 +25,32 @@ typedef struct ndd_proc_data NDD_PROC_DATA; typedef bool (*NDD_PROC_IDENTIFY_CALLBACK)(NDD_PROC_DATA* pProcData); typedef void (*NDD_PROC_FOUND_CALLBACK)(NDD_PROC_DATA* pProcData, void* pUserData); + + +/***********在编译插件时提供的内容**************/ + +#ifdef NOTEPAD_PLUGIN_MANAGER + +#if defined(Q_OS_WIN) +#if defined(NDD_EXPORTDLL) +#define NDD_EXPORT __declspec(dllexport) +#else +#define NDD_EXPORT __declspec(dllimport) +#endif +#endif + +#include + +#ifdef __cplusplus + extern "C" { +#endif + + NDD_EXPORT bool NDD_PROC_IDENTIFY(NDD_PROC_DATA* pProcData); + NDD_EXPORT int NDD_PROC_MAIN(QWidget* pNotepad, const QString& strFileName, std::functiongetCurEdit); + +#ifdef __cplusplus + } +#endif + +#endif //NOTEPAD_PLUGIN_MANAGER +/***********在编译插件时提供的内容**************/ -- Gitee From 02549b5739eaef3fd40a9409a8c083390013ddd3 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 8 Feb 2023 03:12:03 +0800 Subject: [PATCH 028/102] =?UTF-8?q?plugin-cmake:=20=E5=AF=B9=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=BC=80=E5=8F=91=E6=97=B6=E5=90=AF=E7=94=A8=20NOTEPA?= =?UTF-8?q?D=5FPLUGIN=5FMANAGER=20=E5=AE=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index 37ad692..77a4278 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -56,6 +56,7 @@ set_target_properties(${${NOTEPAD_PLUGIN}} PROPERTIES 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) @@ -64,8 +65,12 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) 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}) + + # Notepad-- 插件开发时应该使用的 头文件安装目录、库文件安装目录 + 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_BUILD_BY_QT5) target_link_libraries(${PLUGIN_VAR} Qt5::Core Qt5::Widgets) @@ -74,6 +79,10 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) if(NOTEPAD_BUILD_BY_QT6) target_link_libraries(${PLUGIN_VAR} Qt6::Core Qt6::Widgets) endif(NOTEPAD_BUILD_BY_QT6) + + # 这是插件实现接口中增加的 NOTEPAD_PLUGIN_MANAGER 宏开关 + # 来处理减少 Notepad-- 在编译时不需要,但在插件编译时所需要的模板内容 + target_compile_definitions(${PLUGIN_VAR} PUBLIC NOTEPAD_PLUGIN_MANAGER=) endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) -- Gitee From 43d5b525fb642179973256d56012eb235b4bf7d6 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 8 Feb 2023 22:50:32 +0800 Subject: [PATCH 029/102] =?UTF-8?q?cmake/platforms:=20=E5=8C=BA=E5=88=86?= =?UTF-8?q?=20linux/macos/windows=20=E7=9B=AE=E6=A0=87=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=9A=84=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 118 +++------------------------------- cmake/platforms/linux.cmake | 109 +++++++++++++++++++++++++++++++ cmake/platforms/macos.cmake | 0 cmake/platforms/windows.cmake | 0 4 files changed, 119 insertions(+), 108 deletions(-) create mode 100644 cmake/platforms/linux.cmake create mode 100644 cmake/platforms/macos.cmake create mode 100644 cmake/platforms/windows.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 541aa11..51e603f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,111 +77,13 @@ if(TRUE) endif(TRUE) -# 可能需要变更为 CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" ?? -# 并使用 Linux.cmake 维护? -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= - # 有关此 %F 参数可查看: https://gitee.com/zinface/z-tools/blob/desktop-dev/src/DesktopGenerater/desktopexecparamdialog.cpp - "notepad-- %F" - # 图标路径: 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}) - - # 完成:如果主线已经将 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 ------------------ # - # ------------------ 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 ,所以此部分不被使用) - # 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 构建 - 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) - -endif(CMAKE_HOST_UNIX) +# ----------------- Notepad-- 其它主线构建相关 ----------------- # + +# 使用 macos.cmake / linux.cmake / windows.cmake 维护构建. +if(APPLE) + include(cmake/platforms/macos.cmake) +elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) + include(cmake/platforms/linux.cmake) +elseif(WIN32) + include(cmake/platforms/windows.cmake) +endif() diff --git a/cmake/platforms/linux.cmake b/cmake/platforms/linux.cmake new file mode 100644 index 0000000..df0981d --- /dev/null +++ b/cmake/platforms/linux.cmake @@ -0,0 +1,109 @@ + +# 可能需要变更为 CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" ?? +# 并使用 Linux.cmake 维护? +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= + # 有关此 %F 参数可查看: https://gitee.com/zinface/z-tools/blob/desktop-dev/src/DesktopGenerater/desktopexecparamdialog.cpp + "notepad-- %F" + # 图标路径: 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}) + + # 完成:如果主线已经将 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 ------------------ # + # ------------------ 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 ,所以此部分不被使用) + # 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 构建 + 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) + +endif(CMAKE_HOST_UNIX) diff --git a/cmake/platforms/macos.cmake b/cmake/platforms/macos.cmake new file mode 100644 index 0000000..e69de29 diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake new file mode 100644 index 0000000..e69de29 -- Gitee From 9e78c806d3ec215e288093ff422b8d07c51e742d Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 9 Feb 2023 11:18:36 +0800 Subject: [PATCH 030/102] =?UTF-8?q?plugin-cmake:=20=E5=A4=84=E7=90=86=20No?= =?UTF-8?q?tepadPlugin=20=E4=B8=BA=E5=90=8E=E7=BB=AD=E7=9A=84=E5=85=B6?= =?UTF-8?q?=E5=AE=83=E5=B9=B3=E5=8F=B0=E6=8F=92=E4=BB=B6=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 88 +++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index 77a4278..b5c895a 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -13,22 +13,47 @@ # 一些无关紧要的部分,如果需要实现插件安装操作时,即可进行使用 # 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_BUILD_BY_QT5 @NOTEPAD_BUILD_BY_QT5@) +set(NOTEPAD_BUILD_BY_QT6 @NOTEPAD_BUILD_BY_QT6@) +set(NOTEPAD_BUILD_BY_SHARED FALSE) 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@) +set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY + @NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_DIRECTORY@) + +# 这些是被废除的内容 +# set(NOTEPAD_PLUGIN_INCLUDEDIR @NOTEPAD_PLUGIN_INCLUDEDIR@) +# set(NOTEPAD_PLUGIN_LIBDIR @NOTEPAD_PLUGIN_LIBDIR@) + +# 一些核心位置设定参考 +# ./usr/bin/ +# ./usr/bin/notepad-- +# ./usr/include/ +# ./usr/include/NotepadPlugin/ +# ./usr/include/NotepadPlugin/Qsci/ +# ./usr/include/NotepadPlugin/Qsci/... +# ./usr/include/NotepadPlugin/qscint/ +# ./usr/include/NotepadPlugin/qscint/scintilla/src/XPM.cp +# ./usr/lib/ +# ./usr/lib/NotepadPlugin/ +# ./usr/lib/NotepadPlugin/libQSci.a +# ./usr/lib/cmake/ +# ./usr/lib/cmake/NotepadPlugin/ +# ./usr/lib/cmake/NotepadPlugin/NotepadPluginConfig.cmake +# ^ 以此文件目录位置开始,Linux/Windows中都相同,但不是写死路径 +# ../ 为 /usr/lib/cmake 目录 +# ../../ 为 /usr/lib 目录 +# ../../../ 为 /usr 目录 +# ../../../include 为 /usr/include 目录 +# ../../../include/NotepadPlugin # 头文件目录 +set(NOTEPAD_PLUGIN_INCLUDEDIR + ${CMAKE_CURRENT_LIST_DIR}/../../../include/${NOTEPAD_PLUGIN} + ${CMAKE_CURRENT_LIST_DIR}/../../../include/${NOTEPAD_PLUGIN}/Qsci) +set(NOTEPAD_PLUGIN_LIBDIR + ${CMAKE_CURRENT_LIST_DIR}/../../${NOTEPAD_PLUGIN}) if(NOTEPAD_BUILD_BY_QT5) set(CMAKE_AUTOMOC ON) @@ -42,17 +67,28 @@ 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 - ${NOTEPAD_PLUGIN_LIBDIR}/lib${NOTEPAD_PLUGIN_CORELIB}.so - - INCLUDE_DIRECTORIES - "${NOTEPAD_PLUGIN_INCLUDEDIR};${NOTEPAD_PLUGIN_EXTERNAL_INCLUDES}" -) +if(NOTEPAD_BUILD_BY_SHARED) + set(NOTEPAD_IMPORTED_CORELIB_PATH ${NOTEPAD_PLUGIN_LIBDIR}/lib${NOTEPAD_PLUGIN_CORELIB}.so) + add_library(${NOTEPAD_PLUGIN} SHARED IMPORTED) + set_target_properties(${${NOTEPAD_PLUGIN}} PROPERTIES + IMPORTED_LOCATION + ${NOTEPAD_IMPORTED_CORELIB_PATH} + INCLUDE_DIRECTORIES + "${NOTEPAD_PLUGIN_INCLUDEDIR}" + ) +else() + set(NOTEPAD_IMPORTED_CORELIB_PATH ${NOTEPAD_PLUGIN_LIBDIR}/lib${NOTEPAD_PLUGIN_CORELIB}.a) + add_library(${NOTEPAD_PLUGIN} STATIC IMPORTED) + set_target_properties(${${NOTEPAD_PLUGIN}} PROPERTIES + IMPORTED_LOCATION + ${NOTEPAD_IMPORTED_CORELIB_PATH} + INCLUDE_DIRECTORIES + "${NOTEPAD_PLUGIN_INCLUDEDIR}" + ) +endif() # add_notepad_plugin( [...]) -# +# 此宏定义了,基于源代码文件构建 Notepad-- 插件时所需要的一系列流程内容 macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) # aux_source_directory(${PLUGIN_VAR}_SOURCES ${ARGN}) add_library(${PLUGIN_VAR} SHARED ${PLUGIN_SRC} ${ARGN}) @@ -68,7 +104,7 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) # Notepad-- 插件开发时应该使用的 头文件安装目录、库文件安装目录 target_include_directories(${PLUGIN_VAR} PUBLIC - ${NOTEPAD_PLUGIN_INCLUDEDIR} ${NOTEPAD_PLUGIN_EXTERNAL_INCLUDES}) + ${NOTEPAD_PLUGIN_INCLUDEDIR}) target_link_directories(${PLUGIN_VAR} PUBLIC ${NOTEPAD_PLUGIN_LIBDIR}) target_link_libraries(${PLUGIN_VAR} ${NOTEPAD_PLUGIN_CORELIB}) @@ -87,10 +123,11 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) # support git plugin +# add_notepad_plugin_with_git +# 该宏定义了从指定的 git 仓库中获取插件源代码,并进行简单的构建 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) + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) 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) @@ -100,4 +137,5 @@ message(" - ${CMAKE_CURRENT_LIST_FILE}") message(" - ${NOTEPAD_PLUGIN_INCLUDEDIR}") message(" - ${NOTEPAD_PLUGIN_LIBDIR}") message(" - ${NOTEPAD_PLUGIN_CORELIB}") +message(" - ${NOTEPAD_IMPORTED_CORELIB_PATH}") message("- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<") \ No newline at end of file -- Gitee From 6c73b3530e281c60e06685420dd6b6a256a29317 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 9 Feb 2023 11:23:48 +0800 Subject: [PATCH 031/102] =?UTF-8?q?cmake/platforms:=20=E5=AF=B9=20linux=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=9A=84=E5=AE=89=E8=A3=85=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E9=83=A8=E5=88=86=E8=BF=9B=E8=A1=8C=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/linux.cmake | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/cmake/platforms/linux.cmake b/cmake/platforms/linux.cmake index df0981d..9a16591 100644 --- a/cmake/platforms/linux.cmake +++ b/cmake/platforms/linux.cmake @@ -43,13 +43,8 @@ if(CMAKE_HOST_UNIX) # 定义开发插件时的配置目录与 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) + set(NOTEPAD_PLUGIN_CORELIB QSci) # QSci 为构建的 QScintllia 库 # 定义在插件开发的 CMake 模块中,Notepad-- 是否是基于 QT5 实现 # 并自动为插件开发层自动开启相关 Qt 依赖组件 @@ -57,9 +52,15 @@ if(CMAKE_HOST_UNIX) set(NOTEPAD_BUILD_BY_QT5 TRUE) set(NOTEPAD_BUILD_BY_QT6 FALSE) - # 定义在插件开发的 CMake 模块中,Notepad-- 是否将提供 "插件安装目录(位置)" + # 定义在平台中插件应该安装的位置(待确定) + # 定义在插件开发的 CMake 模块中,Notepad-- 是否将提供 "插件安装目录(位置)" set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY "") + # 这些是在此部分安装时使用,但不被用于填充 NotepadPlugin.cmake.in 的内容 + set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN}) + set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN}) + + # 将 NOTEPAD_PLUGIN_INCLUDEDIR NOTEPAD_PLUGIN_LIBDIR 填充到 cmake 文件 configure_package_config_file(cmake/NotepadPluginConfig.cmake.in ${CMAKE_BINARY_DIR}/${NOTEPAD_PLUGIN_CONFIG} @@ -73,7 +74,10 @@ if(CMAKE_HOST_UNIX) # 安装插件所需要的Qsci文件 spark_install_directory(${NOTEPAD_PLUGIN_INCLUDEDIR} src/qscint/src/Qsci) - + # 安装开发插件高级功能所需要的内容 + spark_install_directory(${NOTEPAD_PLUGIN_INCLUDEDIR}/qscint + src/qscint/scintilla) + # 导出 QSci 的头文件(从插件实现层面来看,目前是使用*.h 与 pluginGl.h # 但从 Qsci 层面来看,*.h 使用的是 #include ,所以此部分不被使用) # spark_file_glob(QSci_HEADERS src/qscint/src/Qsci/*.h src/include/pluginGl.h) @@ -85,10 +89,10 @@ if(CMAKE_HOST_UNIX) # 安装项目文件与 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} + 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 ------------------ # -- Gitee From 07624d37a3f7b5dec72fc83dbed06b77580576e2 Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 10 Feb 2023 09:41:59 +0800 Subject: [PATCH 032/102] =?UTF-8?q?plugin-cmake:=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=E9=83=A8=E5=88=86=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E5=87=BA=20compile=5Fcommands.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index b5c895a..0b01f66 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -48,7 +48,11 @@ set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY # ../../ 为 /usr/lib 目录 # ../../../ 为 /usr 目录 # ../../../include 为 /usr/include 目录 -# ../../../include/NotepadPlugin # 头文件目录 +# ../../../lib 为 /usr/lib 目录 + +# ../../../include/NotepadPlugin # (/usr)头文件目录(NOTEPAD_PLUGIN_INCLUDEDIR) +# ../../NotepadPlugin # (/usr/lib)库文件目录(NOTEPAD_PLUGIN_LIBDIR) +# ../../cmake # (/usr/lib)cmake文件目录(无需关心) set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_CURRENT_LIST_DIR}/../../../include/${NOTEPAD_PLUGIN} ${CMAKE_CURRENT_LIST_DIR}/../../../include/${NOTEPAD_PLUGIN}/Qsci) @@ -87,6 +91,11 @@ else() ) endif() +if(CMAKE_HOST_UNIX) + # 在 Linux 中开启 compile_commands.json 文件输出,增强 clangd 能力 + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +endif(CMAKE_HOST_UNIX) + # add_notepad_plugin( [...]) # 此宏定义了,基于源代码文件构建 Notepad-- 插件时所需要的一系列流程内容 macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) -- Gitee From 2b9774a1718dc84b1cc40a25658b46d924115915 Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 10 Feb 2023 09:46:34 +0800 Subject: [PATCH 033/102] =?UTF-8?q?pluginGl:=20=E5=A2=9E=E5=8A=A0=20NOTEPA?= =?UTF-8?q?D=5FPLUGIN=5F[METADATA|IMPLEMENT]=20=E5=AE=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 依赖 NOTEPAD_PLUGIN_MANAGER 提供 --- src/include/pluginGl.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/include/pluginGl.h b/src/include/pluginGl.h index b0caa0d..be4edfb 100755 --- a/src/include/pluginGl.h +++ b/src/include/pluginGl.h @@ -13,11 +13,11 @@ struct ndd_proc_data { - QString m_strPlugName; //插件名称 必选 - QString m_strFilePath; //lib 插件的全局路径。必选 - QString m_strComment; //插件说明 - QString m_version; //版本号码。可选 - QString m_auther;//作者名称。可选 + QString m_strPlugName; // [必选]插件名称 + QString m_strFilePath; // [必选]插件的全局路径 + QString m_strComment; // [可选]插件说明 + QString m_version; // [可选]版本号码 + QString m_auther; // [可选]作者名称 }; @@ -52,5 +52,17 @@ typedef void (*NDD_PROC_FOUND_CALLBACK)(NDD_PROC_DATA* pProcData, void* pUserDat } #endif +#define NOTEPAD_PLUGIN_METADATA(name, version, author, comment, filepath)\ + pProcData->m_strPlugName = QString(name); \ + pProcData->m_version = QString(version); \ + pProcData->m_strComment = QString(comment); \ + pProcData->m_auther = QString(author); \ + pProcData->m_strFilePath = QString(filepath); \ + +#define NOTEPAD_PLUGIN_IMPLEMENT(imp_class) \ + imp_class *imp = new imp_class(pNotepad, getCurEdit()); \ + imp->setWindowFlag(Qt::Window); \ + imp->show(); + #endif //NOTEPAD_PLUGIN_MANAGER /***********在编译插件时提供的内容**************/ -- Gitee From 44b879f7cef9f050817da3ae9411b210063875bb Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 12 Feb 2023 23:06:48 +0800 Subject: [PATCH 034/102] =?UTF-8?q?plugin-cmake:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E4=B8=8D=E5=90=8C=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=89=A9=E5=B1=95=E6=97=B6=E6=B7=BB=E5=8A=A0=E5=B0=BE=E5=B7=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 62 +++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index 0b01f66..56ba488 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -108,8 +108,68 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) endif(CMAKE_HOST_WIN32) if(CMAKE_HOST_UNIX) - target_compile_definitions(${PLUGIN_VAR} PUBLIC NDD_EXPORT=export) + target_compile_definitions(${PLUGIN_VAR} PUBLIC NDD_EXPORT=) endif(CMAKE_HOST_UNIX) + + # ------------ 为在不同平台构建的插件定义输出名称(尾巴) ------------- # + # 平台: Windows/MacOS/Linux + # 架构: X86_64、AMD64、ARM64、.... + # 编译器:MinGW、Cygwin、MSVC、GNU、Clang、Intel.... + # Qt版本: + set(${PLUGIN_VAR}_OUTPUT_NAME ${PLUGIN_VAR}) + + # ------- 确定平台 Apple/Linux/Windows ------------------- # + if(APPLE) + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_MacOS") + elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Linux") + elseif(WIN32) + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Win32") + endif() + + # ------- 确定架构 X86_64/AMD64/ARM64/... -------------- # + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${CMAKE_HOST_SYSTEM_PROCESSOR}") + # if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) + # if(CMAKE_APPLE_SILICON_PROCESSOR) + # string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Silicon") + # endif(CMAKE_APPLE_SILICON_PROCESSOR) + # endif(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) + + # ----- 确定编译器类型 + # string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_MinGW") + if(WIN32) + if(MINGW) + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_MinGW") + elseif(CYGWIN) + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Cygwin") + elseif(MSVC) + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_MSVC") + else() # 如果不是 MinGW、 Cygwin 、MSVC + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "") + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Unknow") + else() # 如果不是 CMAKE_CXX_COMPILER_ID 不为空 + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${CMAKE_CXX_COMPILER_ID}") + endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "") + endif() + else() + # 此处:如果不提前进行 MINGW 判断,MINGW 也将会是 GNU + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${CMAKE_CXX_COMPILER_ID}") + endif() + + # 预留: GNU Compiler 系列并不清楚如何区分 + # if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + # string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_GCC") + # endif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + + # + # if(NOT "${Qt5_}" STREQUAL "") + # string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${QT_VERSION}") + # endif(NOT "${QT_VERSION}" STREQUAL "") + + set_property(TARGET ${PLUGIN_VAR} + PROPERTY + OUTPUT_NAME "${${PLUGIN_VAR}_OUTPUT_NAME}") + # ------------ 为构建的插件配置尾巴 ------------- # # Notepad-- 插件开发时应该使用的 头文件安装目录、库文件安装目录 target_include_directories(${PLUGIN_VAR} PUBLIC -- Gitee From bfade94164c1a8601d1eefd6a14b1043114b384f Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 12 Feb 2023 23:07:39 +0800 Subject: [PATCH 035/102] =?UTF-8?q?pluginGl:=20=E8=B0=83=E6=95=B4=20if=20d?= =?UTF-8?q?efined=20=E6=A3=80=E6=9F=A5=E7=9A=84=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/pluginGl.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/include/pluginGl.h b/src/include/pluginGl.h index be4edfb..ecd66aa 100755 --- a/src/include/pluginGl.h +++ b/src/include/pluginGl.h @@ -32,11 +32,11 @@ typedef void (*NDD_PROC_FOUND_CALLBACK)(NDD_PROC_DATA* pProcData, void* pUserDat #ifdef NOTEPAD_PLUGIN_MANAGER #if defined(Q_OS_WIN) -#if defined(NDD_EXPORTDLL) -#define NDD_EXPORT __declspec(dllexport) -#else -#define NDD_EXPORT __declspec(dllimport) -#endif +# if defined(NDD_EXPORTDLL) +# define NDD_EXPORT __declspec(dllexport) +# else +# define NDD_EXPORT __declspec(dllimport) +# endif #endif #include -- Gitee From 8a464fa8ade6c6081af8b9eb7cfb4ce6ed570013 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 9 Feb 2023 11:55:48 +0800 Subject: [PATCH 036/102] =?UTF-8?q?cmake/platforms:=20=E5=AF=B9=20windows?= =?UTF-8?q?=20=E5=B9=B3=E5=8F=B0=E7=9A=84=E5=AE=89=E8=A3=85=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=8F=92=E4=BB=B6=E5=BC=80=E5=8F=91=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/windows.cmake | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake index e69de29..c209b80 100644 --- a/cmake/platforms/windows.cmake +++ b/cmake/platforms/windows.cmake @@ -0,0 +1,79 @@ + +if(CMAKE_HOST_WIN32) + # ------------------ INSTALL PLUGIN CONFIG ------------------ # + # ------------------ INSTALL PLUGIN CONFIG ------------------ # + # ------------------ INSTALL PLUGIN CONFIG ------------------ # + include(CMakePackageConfigHelpers) + include(GNUInstallDirs) + + # 定义插件配置安装位置 + # set(CMAKE_INSTALL_PREFIX "/usr") # 仅限 Linux ,Windows 中不使用 + set(NOTEPAD_PLUGIN NotepadPlugin) + + # 定义开发插件时的配置目录与 CMake 模块文件名称 + set(NOTEPAD_PLUGIN_CONFIG ${NOTEPAD_PLUGIN}Config.cmake) + # 定义一些扩展内容,主要是提供给 CMake 模块文件填充 + set(NOTEPAD_PLUGIN_CORELIB QSci) # QSci 为构建的 QScintllia 库 + + # 定义在插件开发的 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 "") + + # 这些是在此部分安装时使用,但不被用于填充 NotepadPlugin.cmake.in 的内容 + set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN}) + set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN}) + + + # 将 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) + # 安装开发插件高级功能所需要的内容 + spark_install_directory(${NOTEPAD_PLUGIN_INCLUDEDIR}/qscint + src/qscint/scintilla) + + # 导出 QSci 的头文件(从插件实现层面来看,目前是使用*.h 与 pluginGl.h + # 但从 Qsci 层面来看,*.h 使用的是 #include ,所以此部分不被使用) + # 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 ------------------ # + + message(" -------- ${CMAKE_INSTALL_PREFIX} ---------- ") + message("${Qt5_DIR}/../../../bin/windeployqt") + + # 1. 在顶层构建中导入 WindowsQtDeploy 的构建 + # 自动化构建 Windows Qt 部署功能 + add_custom_target(windeployqt + COMMAND ${Qt5_DIR}/../../../bin/windeployqt ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.exe --compiler-runtime --verbose 2 --dir ${CMAKE_BINARY_DIR}/winqt/) + +endif(CMAKE_HOST_WIN32) + -- Gitee From 2e50a08a8c051bbd35a21e602699faa3d1d9877a Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 10 Feb 2023 00:37:36 +0800 Subject: [PATCH 037/102] =?UTF-8?q?cmake/platforms:=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=20windows=20=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA=E7=9A=84?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E6=A8=A1=E5=9D=97=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/windows.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake index c209b80..f3648d8 100644 --- a/cmake/platforms/windows.cmake +++ b/cmake/platforms/windows.cmake @@ -1,5 +1,6 @@ if(CMAKE_HOST_WIN32) + include(cmake/SparkInstallMacrosConfig.cmake) # ------------------ INSTALL PLUGIN CONFIG ------------------ # # ------------------ INSTALL PLUGIN CONFIG ------------------ # # ------------------ INSTALL PLUGIN CONFIG ------------------ # -- Gitee From 44de15f3dec3cfbae916ce7ac8fc70ade263293b Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Feb 2023 13:12:27 +0800 Subject: [PATCH 038/102] =?UTF-8?q?plugin-cmake:=20=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E5=AF=B9=20qrc=20=E6=96=87=E4=BB=B6=E7=9A=84=20CMAKE=5FAUTORCC?= =?UTF-8?q?=20=E9=BB=98=E8=AE=A4=E6=9E=84=E5=BB=BA=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index 56ba488..b0b3ffc 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -62,12 +62,14 @@ set(NOTEPAD_PLUGIN_LIBDIR if(NOTEPAD_BUILD_BY_QT5) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) + set(CMAKE_AUTORCC ON) find_package(Qt5 COMPONENTS Core Widgets REQUIRED) endif(NOTEPAD_BUILD_BY_QT5) if(NOTEPAD_BUILD_BY_QT6) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) + set(CMAKE_AUTORCC ON) find_package(Qt6 COMPONENTS Core Widgets REQUIRED) endif(NOTEPAD_BUILD_BY_QT6) -- Gitee From 51b678e5dc863d98f47fd4b5133ab6f380e2840a Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Feb 2023 14:16:33 +0800 Subject: [PATCH 039/102] =?UTF-8?q?repo:=20=E5=9C=A8=E6=95=B4=E4=BD=93?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E4=B9=8B=E5=89=8D=E5=A2=9E=E5=8A=A0=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51e603f..37594e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,13 @@ include(cmake/SparkFindQt5Config.cmake) # include(cmake/SparkFindQt6Config.cmake) include(cmake/SparkMacrosExtendConfig.cmake) + +# ----------------- 构建之前 全局定义 ----------------- # +# 在 Windows 中开启 UNICODE 以支持 TCHAR 功能 +if(WIN32) + add_compile_definitions(-D_UNICODE -DUNICODE) +endif() + # ----------------- 构建 QSci 静态库 ----------------- # if(TRUE) # add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint) -- Gitee From e7b041029583bceae24291e697f6cae0b8e81131 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 14 Feb 2023 00:06:16 +0800 Subject: [PATCH 040/102] =?UTF-8?q?plugin-cmake:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E4=B8=8D=E5=90=8CQt=E7=89=88=E6=9C=AC=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=97=B6=E7=9A=84=E5=B0=BE=E5=B7=B4=EF=BC=8C=E7=9B=AE?= =?UTF-8?q?=E5=89=8D=E4=BB=85=E5=8C=BA=E5=88=86=20Qt5/Qt6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index b0b3ffc..517ea96 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -163,10 +163,16 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) # string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_GCC") # endif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") - # + # # if(NOT "${Qt5_}" STREQUAL "") # string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_${QT_VERSION}") # endif(NOT "${QT_VERSION}" STREQUAL "") + if(NOTEPAD_BUILD_BY_QT5) + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Qt5") + else() + string(APPEND ${PLUGIN_VAR}_OUTPUT_NAME "_Qt6") + endif(NOTEPAD_BUILD_BY_QT5) + set_property(TARGET ${PLUGIN_VAR} PROPERTY -- Gitee From cb597ca5ec277899d60caa53cb20f8d9ac780a31 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 14 Feb 2023 13:36:44 +0800 Subject: [PATCH 041/102] =?UTF-8?q?repo:=20=E8=B0=83=E6=95=B4=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=AE=9A=E4=B9=89=E4=B8=AD=E5=AE=9A=E4=B9=89=E5=A3=B0?= =?UTF-8?q?=E6=98=8E=E5=BD=A2=E5=BC=8F=E5=B0=86=20-DUNICODE=20=E8=BD=AC?= =?UTF-8?q?=E4=B8=BA=20UNICODE=3D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37594e5..e795e9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ include(cmake/SparkMacrosExtendConfig.cmake) # ----------------- 构建之前 全局定义 ----------------- # # 在 Windows 中开启 UNICODE 以支持 TCHAR 功能 if(WIN32) - add_compile_definitions(-D_UNICODE -DUNICODE) + add_compile_definitions(_UNICODE= UNICODE=) endif() # ----------------- 构建 QSci 静态库 ----------------- # -- Gitee From 9fe169963e46835d0a233749aee75549a4aae037 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 14 Feb 2023 13:40:49 +0800 Subject: [PATCH 042/102] =?UTF-8?q?cmake-modules:=20=E4=B8=8B=E4=B8=80?= =?UTF-8?q?=E4=BB=A3=E6=A8=A1=E5=9D=97=E5=8C=96=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 62 ++--------------------------------- cmake/modules/Notepad--.cmake | 33 +++++++++++++++++++ cmake/modules/QScint.cmake | 29 ++++++++++++++++ 3 files changed, 64 insertions(+), 60 deletions(-) create mode 100644 cmake/modules/Notepad--.cmake create mode 100644 cmake/modules/QScint.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e795e9b..f11220a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,71 +17,13 @@ endif() # ----------------- 构建 QSci 静态库 ----------------- # 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) + include(cmake/modules/QScint.cmake) endif(TRUE) # ----------------- 构建 Notepad-- 程序 ----------------- # 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) - -# ----------------- Notepad-- 插件支持相关 ----------------- # -if(TRUE) - - # 开启插件支持 - target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN=0) - - # 其它有关插件的部分处理... - + include(cmake/modules/Notepad--.cmake) endif(TRUE) # ----------------- Notepad-- 其它主线构建相关 ----------------- # diff --git a/cmake/modules/Notepad--.cmake b/cmake/modules/Notepad--.cmake new file mode 100644 index 0000000..a7ab865 --- /dev/null +++ b/cmake/modules/Notepad--.cmake @@ -0,0 +1,33 @@ +if(TRUE) + # 准备构建 Notepad-- 主程序 + 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) + +# ----------------- Notepad-- 插件支持相关 ----------------- # +if(TRUE) + # 开启插件支持 + target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN=0) + # 其它有关插件的部分处理... +endif(TRUE) + + diff --git a/cmake/modules/QScint.cmake b/cmake/modules/QScint.cmake new file mode 100644 index 0000000..d23b46e --- /dev/null +++ b/cmake/modules/QScint.cmake @@ -0,0 +1,29 @@ +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) -- Gitee From 347f3a3616f7df2db168b7fbc7dc8e067f4e8eb6 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 16 Feb 2023 23:16:50 +0800 Subject: [PATCH 043/102] =?UTF-8?q?repo:=20=E5=85=A8=E6=96=B0=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E7=BB=93=E6=9E=84=E4=B8=8E=E6=A8=A1=E5=BC=8F=E8=A7=84?= =?UTF-8?q?=E5=88=92=EF=BC=8C=E4=BB=8E=20Makefile=20=E5=88=B0=20CMakeLists?= =?UTF-8?q?.txt=20=E7=9A=84=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 72 +++++++++++++++++++++++++++++++-- Makefile | 107 ++++++++++++------------------------------------- linux.mk | 4 ++ macos.mk | 4 ++ windows.mk | 4 ++ 5 files changed, 105 insertions(+), 86 deletions(-) create mode 100644 linux.mk create mode 100644 macos.mk create mode 100644 windows.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index f11220a..b046ebb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.22) -project(notepad-- VERSION 1.22.0) +project(Notepad-- VERSION 1.22.0) include(cmake/SparkEnvConfig.cmake) include(cmake/SparkMacrosConfig.cmake) @@ -27,12 +27,76 @@ if(TRUE) endif(TRUE) # ----------------- Notepad-- 其它主线构建相关 ----------------- # +option(USE_MACOS_UNIVERSAL "通用 MacOS 平台构建" OFF) +# +option(USE_LINUX_UNIVERSAL "通用 Linux 平台构建" OFF) +option(USE_LINUX_DEBIAN "通用 Debian Linux 平台构建" OFF) +option(USE_LINUX_APPIMGE "通用 Appimage Linux 平台构建" OFF) +# +option(USE_LINUX_UOS "独立 Linux 平台的 Uos 构建" OFF) +# +option(USE_WINDOWS_UNIVERSAL "通用 Windows 平台构建" OFF) +option(USE_WINDOWS_MINGW "通用 Windows 平台 MinGW 构建" OFF) +option(USE_WINDOWS_MSVC "通用 Windows 平台 MSVC 构建" OFF) +# +option(WINDOWS_DEPLOY_QT5 "通用 Windows Qt5 构建 windeployqt" OFF) +option(WINDOWS_DEPLOY_QT6 "通用 Windows Qt6 构建 windeployqt" OFF) + # 使用 macos.cmake / linux.cmake / windows.cmake 维护构建. if(APPLE) - include(cmake/platforms/macos.cmake) + # 通用 MacOS 平台的构建(一个无具体实现的空构建) + # include(cmake/platforms/macos.cmake) + + # 在 Linux 中此处将由通用构建、Debian 打包构建、Appimage 打包构建、Uos 打包构建组成 elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) - include(cmake/platforms/linux.cmake) + + # 通用 Linux 平台构建,一切的起始 + if(USE_LINUX_UNIVERSAL) + # include(cmake/platforms/linux-universal.cmake) + + # 通用平台的 Debian deb 构建 + if(USE_LINUX_DEBIAN) + # include(cmake/platforms/linux-debian.cmake) + endif() + + # 通用平台的 Appimage 构建 + if(USE_LINUX_APPIMGE) + # include(cmake/platforms/linux-appimage.cmake) + endif() + + # 独立 Linux 平台的 Uos 构建 + elseif(USE_LINUX_UOS) + # include(cmake/platforms/linux-uos.cmake) + + # 其它 Linux 平台的构建 + else() + # include(cmake/platforms/linux.cmake) + endif(USE_LINUX_UNIVERSAL) + + # 在 Windows 中此处将由通用构建、MinGW 构建、MSVC 构建组成 elseif(WIN32) - include(cmake/platforms/windows.cmake) + + # 通用 Windows 平台构建,一切的起始 + if(USE_WINDOWS_UNIVERSAL) + # include(cmake/platforms/windows.cmake) + + # 通用平台的 Windows MinGW 构建 + if(USE_WINDOWS_MINGW) + # include(cmake/platforms/windows-mingw.cmake) + endif() + + # 通用平台的 Windows MSVC 构建 + if(USE_WINDOWS_MSVC) + # include(cmake/platforms/windows-msvc.cmake) + endif() + + # 其它 Windows 平台的构建 + else() + # include(cmake/platforms/windows.cmake) + endif(USE_WINDOWS_UNIVERSAL) + endif() + +# ----------------- Notepad-- 其它主线构建相关 ----------------- # + diff --git a/Makefile b/Makefile index b71b27f..bd4b430 100644 --- a/Makefile +++ b/Makefile @@ -1,84 +1,27 @@ -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) +# 主体构建入口 + +# 1. 在 Windows 中 $(OS) 为 Windows_NT +# 2. 在 Linux 中 $(OS) 为空的,此时应该使用 uname + # 注意:在 Linux 中 uanme -s 显示为 Linux + # 注意:在 Linux 中某些内核 uanme -p 显示为 unknow +# 3. 待验证:在 OSX 中 $(OS) 为空的,此时应该使用 uname + # 待验证:在 OSX 中 uname -s 显示为 Darwin + # 待验证:在 OSX 中 uname -p 显示为 ? + +# Windows 平台相关 +ifeq ($(OS),Windows_NT) + include windows.mk +# Unix 平台相关 +else + UNAME_S := $(shell uname -s) + # Linux 构建 + ifeq ($(UNAME_S),Linux) + include linux.mk + endif + + # MacOS 构建 + ifeq ($(UNAME_S),Darwin) + include macos.mk + endif 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 - -# 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/linux.mk b/linux.mk new file mode 100644 index 0000000..8a0c07a --- /dev/null +++ b/linux.mk @@ -0,0 +1,4 @@ +Msg := 'Build with the following configuration:' + +all: + @echo $(Msg) diff --git a/macos.mk b/macos.mk new file mode 100644 index 0000000..8a0c07a --- /dev/null +++ b/macos.mk @@ -0,0 +1,4 @@ +Msg := 'Build with the following configuration:' + +all: + @echo $(Msg) diff --git a/windows.mk b/windows.mk new file mode 100644 index 0000000..e2f3111 --- /dev/null +++ b/windows.mk @@ -0,0 +1,4 @@ +Msg := 'Build with the following configuration:' + +all: + @echo -e $(Msg) -- Gitee From b2bdd382a1b9f48abc6678a2fa5d8dd4c19d3624 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 16 Feb 2023 23:41:58 +0800 Subject: [PATCH 044/102] =?UTF-8?q?repo:=20=E9=80=9A=E7=94=A8=20Linux=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA=EF=BC=8C=E4=B8=80=E5=88=87?= =?UTF-8?q?=E7=9A=84=E8=B5=B7=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 +- cmake/platforms/linux-universal.cmake | 110 +++ .../io.gitee.cxasm.notepad--.desktop | 13 + .../icons/hicolor/128x128/apps/notepad--.png | Bin 0 -> 1626 bytes .../icons/hicolor/32x32/apps/notepad--.png | Bin 0 -> 792 bytes .../icons/hicolor/64x64/apps/notepad--.png | Bin 0 -> 1064 bytes .../usr/share/licenses/notepad--/LICENSE | 674 ++++++++++++++++++ .../io.gitee.cxasm.notepad--.metainfo.xml | 18 + linux-universal.mk | 21 + linux.mk | 4 + 10 files changed, 843 insertions(+), 3 deletions(-) create mode 100644 cmake/platforms/linux-universal.cmake create mode 100644 cmake/platforms/linux/universal/usr/share/applications/io.gitee.cxasm.notepad--.desktop create mode 100644 cmake/platforms/linux/universal/usr/share/icons/hicolor/128x128/apps/notepad--.png create mode 100644 cmake/platforms/linux/universal/usr/share/icons/hicolor/32x32/apps/notepad--.png create mode 100644 cmake/platforms/linux/universal/usr/share/icons/hicolor/64x64/apps/notepad--.png create mode 100644 cmake/platforms/linux/universal/usr/share/licenses/notepad--/LICENSE create mode 100644 cmake/platforms/linux/universal/usr/share/metainfo/io.gitee.cxasm.notepad--.metainfo.xml create mode 100644 linux-universal.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index b046ebb..98726e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,14 +53,14 @@ elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) # 通用 Linux 平台构建,一切的起始 if(USE_LINUX_UNIVERSAL) - # include(cmake/platforms/linux-universal.cmake) + include(cmake/platforms/linux-universal.cmake) - # 通用平台的 Debian deb 构建 + # 通用 Linux 平台的 Debian deb 构建 if(USE_LINUX_DEBIAN) # include(cmake/platforms/linux-debian.cmake) endif() - # 通用平台的 Appimage 构建 + # 通用 Linux 平台的 Appimage 构建 if(USE_LINUX_APPIMGE) # include(cmake/platforms/linux-appimage.cmake) endif() diff --git a/cmake/platforms/linux-universal.cmake b/cmake/platforms/linux-universal.cmake new file mode 100644 index 0000000..2e58419 --- /dev/null +++ b/cmake/platforms/linux-universal.cmake @@ -0,0 +1,110 @@ +# linux-universal.cmake + +# 此构建表示,在 Linux 中以通用平台的构建方式进行构建此内容 +# +# /usr/bin/ 在 Linux 中标准的程序位置 +# Notepad-- +# +# /usr/inculde/ 在 Linux 中提供一系列可提供插件开发的头文件 +# NotepadPlugin/ +# pluginGl.h +# QSci/ +# qscint/scintilla/ +# +# /usr/lib/ 在 Linux 中提供一个用于插件开发的核心依赖文件 +# NotepadPlugin/ +# libQSci.so +# +# /usr/lib/cmake/ 在 Linux 中提供一个用于插件开发的核心开发配置 +# NotepadPlugin/ +# NotepadPluginConfig.cmake +# +# /usr/share/Notepad--/ 在 Linux 中提供一个用于随带资源文件的目录 +# plugin/ +# themes/ +# + + +# 可能需要变更为 CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" ?? +# 并使用 Linux.cmake 维护? +if(CMAKE_HOST_UNIX) + include(cmake/SparkInstallMacrosConfig.cmake) + + # 当使用 Linux 构建应用时,可执行程序的资源文件应该存放在此处 + set(LINUX_APPLICATION_DIR /usr/share/${PROJECT_NAME}) + + # 通用的 Linux 资源文件 + spark_install_directory(/usr cmake/platforms/linux/universal/usr/*) + + # 如何安装 themes ? 安装到该程序的资源目录/themes + # 如何准备 plugin ? 安装到该程序的资源目录/plugin + spark_install_directory(${LINUX_APPLICATION_DIR} src/themes) + + # ------------------ 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) + # 定义一些扩展内容,主要是提供给 CMake 模块文件填充 + set(NOTEPAD_PLUGIN_CORELIB QSci) # QSci 为构建的 QScintllia 库 + + # 定义在插件开发的 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 "") + + # 这些是在此部分安装时使用,但不被用于填充 NotepadPlugin.cmake.in 的内容 + set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN}) + set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN}) + + + # 将 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) + # 安装开发插件高级功能所需要的内容 + spark_install_directory(${NOTEPAD_PLUGIN_INCLUDEDIR}/qscint + src/qscint/scintilla) + + # 导出 QSci 的头文件(从插件实现层面来看,目前是使用*.h 与 pluginGl.h + # 但从 Qsci 层面来看,*.h 使用的是 #include ,所以此部分不被使用) + # 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 ------------------ # + +endif(CMAKE_HOST_UNIX) diff --git a/cmake/platforms/linux/universal/usr/share/applications/io.gitee.cxasm.notepad--.desktop b/cmake/platforms/linux/universal/usr/share/applications/io.gitee.cxasm.notepad--.desktop new file mode 100644 index 0000000..8a1d589 --- /dev/null +++ b/cmake/platforms/linux/universal/usr/share/applications/io.gitee.cxasm.notepad--.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Version=1.0 +Name=Notepad-- +Name[zh_CN]=Notepad-- +Comment=Notepad-- 是一个国产跨平台、简单的文本编辑器。 +Type=Application +Exec=Notepad-- %F +Icon=notepad-- +Categories=Development;Office; +Terminal=false +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 diff --git a/cmake/platforms/linux/universal/usr/share/icons/hicolor/128x128/apps/notepad--.png b/cmake/platforms/linux/universal/usr/share/icons/hicolor/128x128/apps/notepad--.png new file mode 100644 index 0000000000000000000000000000000000000000..8df364d4e3ac4b5c81bfdd704be06edec736240d GIT binary patch literal 1626 zcmbVM2~5*h7=JAl3W`uAh!tF^C_`Z_1%;NwQm%S|98nlh=mi$&p>2^vYDFi52|AB> z4A6}tBBMn)6a=9$R0V`^%xVD(;Sw1ju!t3b{V_|nWtmy_CExqy`+e{Ge(!sEd0G1d z{Edy!MgRcgT~wc72&Kzzst>IfvnxN+S3ogL80=30@;1vcD8MkO z!TSJ6-2xSz0^kEgNnZmX#slys1_06(0M-feYJ=RNgg#@BzYm0v>AW8thrm!k4HrU4 z{p5a66Fecgggp~;$wzG!N`*rIWIG`-kqNlbk-fI3YwsNI*e9bUpa9bt3L*|9dq z%F<~ZYjMe^l5S>PM@7Y%I$N|>ak7Gtv`NOcu&r$x4R46GSYlP(EzEt$KNy^2-IYI^ z);{m4ZGTqd);{a@RzjR23UZOq0sb^?MIE}Xbg@Dqk=X9sIn7jtzUs(bUHa0)p?Cv& zXvND-kBW*2xcujyEfov>#z%u{dpT#Mm6sQ%E)2WIZ1j&hs+f$`W zWipvfN>}~Rs+_YecO%c8Uzo3#Sf8WcmOcNVJp9~*hWi2AXD666RLN*p#}=FT9D@g=pBgxpyzHlyl}PczuIit z_POfb6h%?fc-6<|_i=!{JMk2TUO#a$s*Z}R&IFBGq;jn_K(UGnYv0;M(q5$(O-45zRW(o21#%TGu|Br2+D++vUvtiJ|EKNYkqoEdOhd)u0Rd0`K$e?sT-Ei7FY7lG$F~gf|dX1x-6-H zb+MA(DNnM3Squi+CUpi|DnmgF#D^{M+O$Y}<-mfCJ6u-)y-%=N~Y;3KERWc&_>ns09a literal 0 HcmV?d00001 diff --git a/cmake/platforms/linux/universal/usr/share/icons/hicolor/32x32/apps/notepad--.png b/cmake/platforms/linux/universal/usr/share/icons/hicolor/32x32/apps/notepad--.png new file mode 100644 index 0000000000000000000000000000000000000000..fa547b6c787bc9256b9c5bfeb27d6d064478a2c6 GIT binary patch literal 792 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmUKs7M+SzC{oH>NSwWJ?9znhg z3{`3j3=J&|48MRv4KElNN(~qoUL`OvSj}Ky5HFasE6@fg;gTBRnda-upao=eFfg`f zGOz$yj6f^}#0(6~3m6%gfixpXYylHoR$&1%f(=r*rY-3+0|QgAr;B4q1n1l7XR|~c z1&;r}`+1@-(<44d!AF`qD?V#kRteg4tQY*q*`uJ6ufR6{V6%YD>WY&GCqF+@(aF+s zcHNO3@srzEa`9I7^n$*P43nm}mp2r|w@iHfb#Y;o^YXoOpFR6^`Qphy|BPK*E_HIS zmh4a7wYryet76yoNq5f|G)~xNwRNu659P;vF<-bl-bO~LHbg$``^@I@_vpcMTUI|~ zJ|J1lA$fhCPxB0U2hOHzM{e9UjAvk0il1@2;@iEbAD`I`6a-qL!`H9P+pyZ8ds%^> z)vkB^uO9|=Jl*Z>u`_1Jj|k3$H5*o%75k{Jn4{8P$`nv?_f%5D-QCvh+wzX)%2P*_@4xW@Zy%|>B{@=flCeyhtCq`u|ujXwFI zwe-TP$9D^*y}!skywTwxv&(;CAA`(^CPU86fy@F@s-G$vpZy5Gy6paiRatT$|1SucHvdL-9m36oIAqF{Qek!r1x%zK*M=Uc}&&&jdD*V&bZ2`=ql{xc%<9y z#C_?s`LE|3HsD?`b4~pk^Zj?OXMSH6u;SnKGXi@2TUpA#?{Kv|RXqLoAMwbiI|{ZO S5dtPJ1_n=8KbLh*2~7am22xW1 literal 0 HcmV?d00001 diff --git a/cmake/platforms/linux/universal/usr/share/icons/hicolor/64x64/apps/notepad--.png b/cmake/platforms/linux/universal/usr/share/icons/hicolor/64x64/apps/notepad--.png new file mode 100644 index 0000000000000000000000000000000000000000..8d3f055968d51a2be8cd305ef26af608cc09a190 GIT binary patch literal 1064 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=Ea{HEjtmSN`?>!lvI6-E$sR$z z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBDB+SC;hE;^%b*2hb1*Qr zXELw=S&Tp|1;h*t%nKM9n1M7SNNfQUT-IR$GlC6L=oaX-0jNCL)5S5Qg7NL_vw4>t z1dgZg^}95M#c6^@kYLDyPlXO1GL`Ip99P60VzgM&EeR-=Tx>DzXpp(?jQEmNXa;KC`BCe$t-*2 z8=uT(;mP;l;`ESvBKeU;fA*{hXD?X!BZTpQ5U0Sl%`DSOmzr3w6=_nOJlk{)Puo5H zH&$m4e6VZy8or)U;+Tr@S@EAg*Ndml+PlS@(PVDoGeyJIY)py_&(DWCyFJ!GWHC+6&$qwuDPCEY{Qu2{NRssDp(^jQ*Yncu(A zx}Cq$Yv<2RY#xhSH#jqMJY2$}GpvQAz_@l7bSFTm{$sgbMhW$j#rE0s}S@$acvh($RoLg&mi#uZFt=@eK z-Mo2?TCS#Evhyv4-sz{#f^C>gPrJR_!bJw=oWO(Ggdt6wPaK!&hkLr)@S6{1lUkqL+ gn$0xJA%Nu{bAh|wI@gqllb~$p>FVdQ&MBb@00w}pp#T5? literal 0 HcmV?d00001 diff --git a/cmake/platforms/linux/universal/usr/share/licenses/notepad--/LICENSE b/cmake/platforms/linux/universal/usr/share/licenses/notepad--/LICENSE new file mode 100644 index 0000000..818433e --- /dev/null +++ b/cmake/platforms/linux/universal/usr/share/licenses/notepad--/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/cmake/platforms/linux/universal/usr/share/metainfo/io.gitee.cxasm.notepad--.metainfo.xml b/cmake/platforms/linux/universal/usr/share/metainfo/io.gitee.cxasm.notepad--.metainfo.xml new file mode 100644 index 0000000..8b337d1 --- /dev/null +++ b/cmake/platforms/linux/universal/usr/share/metainfo/io.gitee.cxasm.notepad--.metainfo.xml @@ -0,0 +1,18 @@ + + + io.gitee.cxasm.notepad-- + + Notepad-- + Notepad-- + + MIT + GPL-2.0-or-later + + +

+ notepad--是一个国产跨平台、简单的文本编辑器,是替换notepad++的一种选择。其内置强大的代码对比功能,让你丢掉付费的beyond compare。 +

+
+ + io.gitee.cxasm.notepad--.desktop +
diff --git a/linux-universal.mk b/linux-universal.mk new file mode 100644 index 0000000..15411cd --- /dev/null +++ b/linux-universal.mk @@ -0,0 +1,21 @@ +# Linux Universla - 通用 Linux 平台 构建方案 + +CPUS=$(shell nproc) + +builddir := build +sourcedir := . +CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_OPTIONS := -DUSE_LINUX_UNIVERSAL=ON + + +linux-universal: + cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_DEBUG) + cmake --build build -- -j$(CPUS) + + +linux-universal-release: + cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_RELEASE) + cmake --build $(builddir) -- -j$(CPUS) + +# 此配置为构建 linux 通用版本构建 \ No newline at end of file diff --git a/linux.mk b/linux.mk index 8a0c07a..859f8dd 100644 --- a/linux.mk +++ b/linux.mk @@ -1,4 +1,8 @@ Msg := 'Build with the following configuration:' +One := '1. make -f linux-universal.mk' + all: @echo $(Msg) + @echo $(One) "\n\t默认的通用 Linux 平台构建." + -- Gitee From 7a3ee61a91eaf8373adb8cf776df4daf7b483f8a Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 17 Feb 2023 00:09:34 +0800 Subject: [PATCH 045/102] =?UTF-8?q?repo:=20=E9=80=9A=E7=94=A8=20Linux=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=9A=84=20Debian=20deb=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 +- cmake/platforms/linux-debian.cmake | 18 ++++++++++++++++++ linux-debian.mk | 19 +++++++++++++++++++ linux.mk | 2 ++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 cmake/platforms/linux-debian.cmake create mode 100644 linux-debian.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index 98726e5..042652e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) # 通用 Linux 平台的 Debian deb 构建 if(USE_LINUX_DEBIAN) - # include(cmake/platforms/linux-debian.cmake) + include(cmake/platforms/linux-debian.cmake) endif() # 通用 Linux 平台的 Appimage 构建 diff --git a/cmake/platforms/linux-debian.cmake b/cmake/platforms/linux-debian.cmake new file mode 100644 index 0000000..29e2426 --- /dev/null +++ b/cmake/platforms/linux-debian.cmake @@ -0,0 +1,18 @@ +# linux-debian.cmake + +# 此构建表示,在 Linux 中以通用平台的构建方式进行 Debian 打包 + +# 1. 在 cmake/package-deb.descript 中提供标准软件包描述信息 +# 2. 在 DebPackageConfig.cmake 构建模块中分析与自动化配置 + +option(USE_LINUX_DEBIAN "为 Linux 生成 deb 软件包" OFF) + +if(USE_LINUX_DEBIAN) + + find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) + add_package_descript(cmake/package-deb.descript) + +endif(USE_LINUX_DEBIAN) + + + diff --git a/linux-debian.mk b/linux-debian.mk new file mode 100644 index 0000000..d1dc258 --- /dev/null +++ b/linux-debian.mk @@ -0,0 +1,19 @@ +# Linux Debian - 通用 Linux 平台 Debian 构建方案 + +include linux-universal.mk + +CPUS=$(shell nproc) + +# builddir := build +# sourcedir := . +# CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +# CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_OPTIONS := -DUSE_LINUX_DEBIAN=ON $(CMAKE_OPTIONS) + +package: linux-universal-release + make -C $(builddir) package + +linux-build-options: + @echo $(CMAKE_OPTIONS) + +# 此配置为构建 linux debian 通用版本构建 \ No newline at end of file diff --git a/linux.mk b/linux.mk index 859f8dd..b212b19 100644 --- a/linux.mk +++ b/linux.mk @@ -1,8 +1,10 @@ Msg := 'Build with the following configuration:' One := '1. make -f linux-universal.mk' +Two := '2. make -f linux-debian.mk package' all: @echo $(Msg) @echo $(One) "\n\t默认的通用 Linux 平台构建." + @echo $(Two) "\n\t通用 Linux 平台的 Debian deb 构建." -- Gitee From f92b3a859c3dd5a6045f11c6d2865213053bc74a Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 17 Feb 2023 00:45:30 +0800 Subject: [PATCH 046/102] =?UTF-8?q?repo:=20=E9=80=9A=E7=94=A8=20Linux=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=9A=84=20Appimage=20=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 6 ++-- cmake/platforms/linux-appimage.cmake | 48 ++++++++++++++++++++++++++++ linux-appimage.mk | 47 +++++++++++++++++++++++++++ linux.mk | 2 ++ 4 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 cmake/platforms/linux-appimage.cmake create mode 100644 linux-appimage.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index 042652e..2dcbdfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ option(USE_MACOS_UNIVERSAL "通用 MacOS 平台构建" OFF) # option(USE_LINUX_UNIVERSAL "通用 Linux 平台构建" OFF) option(USE_LINUX_DEBIAN "通用 Debian Linux 平台构建" OFF) -option(USE_LINUX_APPIMGE "通用 Appimage Linux 平台构建" OFF) +option(USE_LINUX_APPIMAGE "通用 Appimage Linux 平台构建" OFF) # option(USE_LINUX_UOS "独立 Linux 平台的 Uos 构建" OFF) # @@ -61,8 +61,8 @@ elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) endif() # 通用 Linux 平台的 Appimage 构建 - if(USE_LINUX_APPIMGE) - # include(cmake/platforms/linux-appimage.cmake) + if(USE_LINUX_APPIMAGE) + include(cmake/platforms/linux-appimage.cmake) endif() # 独立 Linux 平台的 Uos 构建 diff --git a/cmake/platforms/linux-appimage.cmake b/cmake/platforms/linux-appimage.cmake new file mode 100644 index 0000000..02f7f25 --- /dev/null +++ b/cmake/platforms/linux-appimage.cmake @@ -0,0 +1,48 @@ +# linux-appimage.cmake + +# 此构建表示,在 Linux 中以通用平台的构建方式进行 Appimage 打包 + +# 1. SparkAppimageConfig.cmake 依赖于 SparkDesktopMacros.cmake 构建的 desktop +# 2. 为可执行程序进行部署一个 linuxdeployqt 操作,并生成为 Appimage 可用于打包的目录结构 +# 3. 使用 Appimagetool 对已生成的 Appimage 标准目录进行打包 +# 4. 将会生成一个 Notepad--.X86_64.Appimage + +# 参看 Appimagetool 相关的内容: + # https://doc.appimage.cn/docs/appimagetool-usage/ + +option(LINUX_DEPLOY_QT "为 Linux 中构建的应用进程 linuxdeployqt" OFF) +if(LINUX_DEPLOY_QT) + # ... 已由 Appimage 自动化构建组件完成 +endif(LINUX_DEPLOY_QT) + +option(USE_LINUX_APPIMAGE "为 Linux 生成 Appimage 可执行程序" OFF) + +if(USE_LINUX_APPIMAGE) + + include(cmake/SparkDesktopMacros.cmake) + # 内容默认应用名称: Name= 应与项目名称相同 + spark_desktop_macros( + # 应用名称: Name= + ${PROJECT_NAME} + # 应用名称: Name[zh_CN]= + "Notepad--" + # 应用说明: Comment= + "Notepad-- 是一个国产跨平台、简单的文本编辑器。" + # 应用类型: Type= + "Application" + # 执行程序: Exec= + # 有关此 %F 参数可查看: https://gitee.com/zinface/z-tools/blob/desktop-dev/src/DesktopGenerater/desktopexecparamdialog.cpp + "notepad-- %F" + # 图标路径: Icon= + "/usr/share/notepad--/icons/spark.png" + # 应用分类: Category= + "Development" + ) + + # 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 的构建 + +endif(USE_LINUX_APPIMAGE) diff --git a/linux-appimage.mk b/linux-appimage.mk new file mode 100644 index 0000000..69685b6 --- /dev/null +++ b/linux-appimage.mk @@ -0,0 +1,47 @@ +# Linux Appimage - 通用 Linux 平台 Appimage 构建方案 + +include linux-universal.mk + +CPUS=$(shell nproc) + +# builddir := build +# sourcedir := . +# CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +# CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_OPTIONS := -DUSE_LINUX_APPIMAGE=ON $(CMAKE_OPTIONS) + + +# -------------------------------- Appimage Build Tools -------------------------------- # +# 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" + +# 追加 Appimagetool、linuxdeployqt 构建配置 +CMAKE_OPTIONS := -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL) $(CMAKE_OPTIONS) + +linuxdeploy: download-bundle-linuxdeploytools + cmake -B$(builddir) $(CMAKE_OPTIONS) + cmake --build $(builddir) -- linuxdeploy + +genrate-appimage: + cmake -B$(builddir) $(CMAKE_OPTIONS) + cmake --build $(builddir) -- appimage + + +package: linux-universal-release linuxdeploy genrate-appimage + +linux-build-options: + @echo $(CMAKE_OPTIONS) + +# 此配置为构建 linux Appimage 通用版本构建 \ No newline at end of file diff --git a/linux.mk b/linux.mk index b212b19..6314e79 100644 --- a/linux.mk +++ b/linux.mk @@ -1,10 +1,12 @@ Msg := 'Build with the following configuration:' One := '1. make -f linux-universal.mk' Two := '2. make -f linux-debian.mk package' +Three := '3. make -f linux-appimage.mk package' all: @echo $(Msg) @echo $(One) "\n\t默认的通用 Linux 平台构建." @echo $(Two) "\n\t通用 Linux 平台的 Debian deb 构建." + @echo $(Three) "\n\t通用 Linux 平台的 Appimage 构建." -- Gitee From 359365c49b2a996b06177cca5b352a0a1a5f9b1c Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 17 Feb 2023 02:00:13 +0800 Subject: [PATCH 047/102] =?UTF-8?q?repo:=20=E7=8B=AC=E7=AB=8B=20Linux=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=9A=84=20Uos=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 +- cmake/platforms/linux-uos.cmake | 72 ++ .../io.gitee.cxasm.notepad--.desktop | 17 + .../icons/hicolor/scalable/apps/ndd.svg | 2 + .../entries/licenses/notepad--/LICENSE | 674 ++++++++++++++++++ .../io.gitee.cxasm.notepad--.metainfo.xml | 18 + .../linux/uos/opt/apps/com.hmja.notepad/info | 18 + linux-uos.mk | 39 + linux.mk | 2 + 9 files changed, 843 insertions(+), 1 deletion(-) create mode 100644 cmake/platforms/linux-uos.cmake create mode 100644 cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/applications/io.gitee.cxasm.notepad--.desktop create mode 100644 cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/icons/hicolor/scalable/apps/ndd.svg create mode 100644 cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/licenses/notepad--/LICENSE create mode 100644 cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/metainfo/io.gitee.cxasm.notepad--.metainfo.xml create mode 100644 cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/info create mode 100644 linux-uos.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dcbdfb..f42b915 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) # 独立 Linux 平台的 Uos 构建 elseif(USE_LINUX_UOS) - # include(cmake/platforms/linux-uos.cmake) + include(cmake/platforms/linux-uos.cmake) # 其它 Linux 平台的构建 else() diff --git a/cmake/platforms/linux-uos.cmake b/cmake/platforms/linux-uos.cmake new file mode 100644 index 0000000..2a52f2a --- /dev/null +++ b/cmake/platforms/linux-uos.cmake @@ -0,0 +1,72 @@ +# linux-uos.cmake + +# 此构建表示,在独立于 Linux 的 Uos 或 Deepin 平台,以此方式构建内容 +# 1. 主要用于规范化构建,并使用项目中准备好的目录结构进行构建 +# 2. 安装内容 + # 1. 起始路径要求: /opt/apps// + # 2. 系统路径要求: entries + # 1. icon、applications、metadata 等位于 entries + # 3. 文件部分要求: files + # 1. Notepad-- 位于 files + # 2. themes 位于 files + # 3. plugin 位于 files + +# /. +# /opt +# /opt/apps +# /opt/apps/com.hmja.notepad +# /opt/apps/com.hmja.notepad/entries +# /opt/apps/com.hmja.notepad/entries/applications +# /opt/apps/com.hmja.notepad/entries/applications/com.hmja.notepad.desktop +# /opt/apps/com.hmja.notepad/entries/icons +# /opt/apps/com.hmja.notepad/entries/icons/hicolor +# /opt/apps/com.hmja.notepad/entries/icons/hicolor/scalable +# /opt/apps/com.hmja.notepad/entries/icons/hicolor/scalable/apps +# /opt/apps/com.hmja.notepad/entries/icons/hicolor/scalable/apps/ndd.svg +# /opt/apps/com.hmja.notepad/files +# /opt/apps/com.hmja.notepad/files/Notepad-- +# /opt/apps/com.hmja.notepad/files/themes +# /opt/apps/com.hmja.notepad/files/themes/.... +# /opt/apps/com.hmja.notepad/info + +option(USE_LINUX_UOS "为 Linux Uos 生成规范的软件包" OFF) + +if(USE_LINUX_UOS) + + # 一些相关的信息,用标准结构定义 + set(UOS_APP_ID "com.hmja.notepad") + set(UOS_APP_HOME_DIR "/opt/apps/${UOS_APP_ID}") + set(UOS_APP_HOME_ENTRY_DIR "${UOS_APP_HOME_DIR}/entries") + set(UOS_APP_HOME_FILES_DIR "${UOS_APP_HOME_DIR}/files") + set(UOS_APP_HOME_INFO_FILE "${UOS_APP_HOME_DIR}/info") + + # 当使用 Linux 构建应用时,可执行程序的资源文件应该存放在此处 + set(LINUX_UOS_APP_HOME_DIR ${UOS_APP_HOME_DIR}) + + include(cmake/SparkInstallMacrosConfig.cmake) + + # ------------------ 部署应用目录结构 ------------------ # + # 1. 将项目内准备的 Uos 应用目录安装到 /opt/apps/ 中 + spark_install_directory(/opt/apps/ + cmake/platforms/linux/uos/${UOS_APP_HOME_DIR} + ) + + # ------------------ 构建与资源文件安装 ------------------ # + # 1. 安装可执行文件到 files 目录 + spark_install_target(${UOS_APP_HOME_FILES_DIR} + ${PROJECT_NAME} + ) + # 2. 安装 themes 目录到 files 目录 + spark_install_directory(${UOS_APP_HOME_FILES_DIR} + src/themes + ) + + # ------------------ 最终打包 deb 部分 ------------------ # + # 1. 为即将构建的 Uos 增加 Uos 后缀 + set(PACKAGE_SUFFIX "_Uos") + + # 2. 使用同样来自 debian 系列的 deb 构建能力 + find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) + add_package_descript(cmake/package-deb.descript) + +endif(USE_LINUX_UOS) diff --git a/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/applications/io.gitee.cxasm.notepad--.desktop b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/applications/io.gitee.cxasm.notepad--.desktop new file mode 100644 index 0000000..9d14570 --- /dev/null +++ b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/applications/io.gitee.cxasm.notepad--.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Version=1.0 +Name=Notepad-- +Name[zh_CN]=Notepad-- +Comment=Notepad-- 是一个国产跨平台、简单的文本编辑器。 +Type=Application +Exec=/opt/apps/com.hmja.notepad/files/Notepad-- %U +Icon=/opt/apps/com.hmja.notepad/entries/icons/hicolor/scalable/apps/ndd.svg +Categories=TextEditor; +Encoding=UTF-8 +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; +StartupNotify=true +Terminal=false +TryExec=/opt/apps/com.hmja.notepad/files/Notepad-- +X-DDE-FileManager-MenuTypes=SingleFile + +# Generated from the DesktopGenerater component of the z-Tools toolkit diff --git a/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/icons/hicolor/scalable/apps/ndd.svg b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/icons/hicolor/scalable/apps/ndd.svg new file mode 100644 index 0000000..8c25acd --- /dev/null +++ b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/icons/hicolor/scalable/apps/ndd.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/licenses/notepad--/LICENSE b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/licenses/notepad--/LICENSE new file mode 100644 index 0000000..818433e --- /dev/null +++ b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/licenses/notepad--/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/metainfo/io.gitee.cxasm.notepad--.metainfo.xml b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/metainfo/io.gitee.cxasm.notepad--.metainfo.xml new file mode 100644 index 0000000..8b337d1 --- /dev/null +++ b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/entries/metainfo/io.gitee.cxasm.notepad--.metainfo.xml @@ -0,0 +1,18 @@ + + + io.gitee.cxasm.notepad-- + + Notepad-- + Notepad-- + + MIT + GPL-2.0-or-later + + +

+ notepad--是一个国产跨平台、简单的文本编辑器,是替换notepad++的一种选择。其内置强大的代码对比功能,让你丢掉付费的beyond compare。 +

+
+ + io.gitee.cxasm.notepad--.desktop +
diff --git a/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/info b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/info new file mode 100644 index 0000000..c2f0b44 --- /dev/null +++ b/cmake/platforms/linux/uos/opt/apps/com.hmja.notepad/info @@ -0,0 +1,18 @@ +{ + "appid": "com.hmja.notepad", + "name": "Notepad--", + "version": "1.22.1.0", + "arch": ["amd64"], + "permissions": { + "autostart": false, + "notification": false, + "trayicon": false, + "clipboard": true, + "account": false, + "bluetooth": false, + "camera": false, + "audio_record": false, + "installed_apps": false + } +} + diff --git a/linux-uos.mk b/linux-uos.mk new file mode 100644 index 0000000..5b81f41 --- /dev/null +++ b/linux-uos.mk @@ -0,0 +1,39 @@ +# 独立 Linux 平台的 Uos 构建 + +include linux-universal.mk + +# 覆盖 linux-universal.mk 中定义的部分 +linux-universal: + @echo "此目标不应该由 UOS 配方构建" +linux-universal-release: + @echo "此目标不应该由 UOS 配方构建" + + +CPUS=$(shell nproc) + +builddir := build/linux-uos +# sourcedir := . +# CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +# CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_OPTIONS := -DUSE_LINUX_UOS=ON + + +linux-uos: + cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_DEBUG) + cmake --build build -- -j$(CPUS) + +linux-uos-release: + cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_RELEASE) + cmake --build build -- -j$(CPUS) + +package: + cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_RELEASE) + cmake --build $(builddir) -- -j$(CPUS) package + +package-contents: + -cd $(builddir)/_CPack_Packages/Linux/DEB/ && find + +package-contents-tree: + -tree $(builddir)/_CPack_Packages/Linux/DEB/ + +# 此配置为构建 linux 通用版本构建 \ No newline at end of file diff --git a/linux.mk b/linux.mk index 6314e79..c16e9f5 100644 --- a/linux.mk +++ b/linux.mk @@ -2,6 +2,7 @@ Msg := 'Build with the following configuration:' One := '1. make -f linux-universal.mk' Two := '2. make -f linux-debian.mk package' Three := '3. make -f linux-appimage.mk package' +Four := '4. make -f linux-uos.mk package' all: @@ -9,4 +10,5 @@ all: @echo $(One) "\n\t默认的通用 Linux 平台构建." @echo $(Two) "\n\t通用 Linux 平台的 Debian deb 构建." @echo $(Three) "\n\t通用 Linux 平台的 Appimage 构建." + @echo $(Four) "\n\t独立 Linux 平台的 Uos 构建." -- Gitee From 4187a875c4ca518a34c6a803846f76028c72e9ae Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 17 Feb 2023 02:25:32 +0800 Subject: [PATCH 048/102] =?UTF-8?q?repo:=20=E6=9C=80=E7=BB=88=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E9=80=9A=E7=94=A8=20Linux=20=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E6=9E=84=E5=BB=BA=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linux-appimage.mk | 4 ++-- linux-debian.mk | 2 +- linux-universal.mk | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/linux-appimage.mk b/linux-appimage.mk index 69685b6..108b9d4 100644 --- a/linux-appimage.mk +++ b/linux-appimage.mk @@ -4,7 +4,7 @@ include linux-universal.mk CPUS=$(shell nproc) -# builddir := build +builddir := build/linux-appimage # sourcedir := . # CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug # CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release @@ -19,7 +19,7 @@ CMAKE_OPTIONS := -DUSE_LINUX_APPIMAGE=ON $(CMAKE_OPTIONS) # 来自于 https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git 托管存储的工具 # 或指定你所想存放克隆项目的位置 -BUNDLE_LINUXDEPLOYQT := $(shell pwd)/build/bundle-linuxdeployqt +BUNDLE_LINUXDEPLOYQT := $(shell pwd)/$(builddir)/bundle-linuxdeployqt download-bundle-linuxdeploytools: -git clone https://gitlink.org.cn/zinface/bundle-linuxdeployqt.git $(BUNDLE_LINUXDEPLOYQT) diff --git a/linux-debian.mk b/linux-debian.mk index d1dc258..081973f 100644 --- a/linux-debian.mk +++ b/linux-debian.mk @@ -4,7 +4,7 @@ include linux-universal.mk CPUS=$(shell nproc) -# builddir := build +builddir := build/linux-debian # sourcedir := . # CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug # CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release diff --git a/linux-universal.mk b/linux-universal.mk index 15411cd..f69314b 100644 --- a/linux-universal.mk +++ b/linux-universal.mk @@ -1,8 +1,8 @@ -# Linux Universla - 通用 Linux 平台 构建方案 +# Linux Universal - 通用 Linux 平台 构建方案 CPUS=$(shell nproc) -builddir := build +builddir := build/linux-universal sourcedir := . CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release @@ -11,7 +11,7 @@ CMAKE_OPTIONS := -DUSE_LINUX_UNIVERSAL=ON linux-universal: cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_DEBUG) - cmake --build build -- -j$(CPUS) + cmake --build $(builddir) -- -j$(CPUS) linux-universal-release: -- Gitee From 4432551a1ed41b14ad8c17e0ba081f0c9dcee73b Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 19 Feb 2023 02:34:27 +0800 Subject: [PATCH 049/102] =?UTF-8?q?repo:=20=E9=80=9A=E7=94=A8=20Windows=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA=EF=BC=8C=E4=B8=80=E5=88=87?= =?UTF-8?q?=E7=9A=84=E8=B5=B7=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 12 ++-- cmake/platforms/windows-deployqt.cmake | 94 +++++++++++++++++++++++++ cmake/platforms/windows-universal.cmake | 93 ++++++++++++++++++++++++ windows-universal.mk | 31 ++++++++ windows.mk | 2 + 5 files changed, 228 insertions(+), 4 deletions(-) create mode 100644 cmake/platforms/windows-deployqt.cmake create mode 100644 cmake/platforms/windows-universal.cmake create mode 100644 windows-universal.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index f42b915..2bdc216 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,8 +39,9 @@ option(USE_WINDOWS_UNIVERSAL "通用 Windows 平台构建" OFF) option(USE_WINDOWS_MINGW "通用 Windows 平台 MinGW 构建" OFF) option(USE_WINDOWS_MSVC "通用 Windows 平台 MSVC 构建" OFF) # -option(WINDOWS_DEPLOY_QT5 "通用 Windows Qt5 构建 windeployqt" OFF) -option(WINDOWS_DEPLOY_QT6 "通用 Windows Qt6 构建 windeployqt" OFF) +option(WINDOWS_DEPLOY_QT "通用 Windows 平台 Qt 部署" OFF) +option(WINDOWS_DEPLOY_QT5 "通用 Windows 平台指定 Qt5 部署 windeployqt" OFF) +option(WINDOWS_DEPLOY_QT6 "通用 Windows 平台指定 Qt6 部署 windeployqt" OFF) # 使用 macos.cmake / linux.cmake / windows.cmake 维护构建. @@ -79,7 +80,10 @@ elseif(WIN32) # 通用 Windows 平台构建,一切的起始 if(USE_WINDOWS_UNIVERSAL) - # include(cmake/platforms/windows.cmake) + include(cmake/platforms/windows-universal.cmake) + + # 为 Windows 中构建的应用进行 windeployqt 的配方 + include(cmake/platforms/windows-deployqt.cmake) # 通用平台的 Windows MinGW 构建 if(USE_WINDOWS_MINGW) @@ -93,7 +97,7 @@ elseif(WIN32) # 其它 Windows 平台的构建 else() - # include(cmake/platforms/windows.cmake) + # include(cmake/platforms/windows-other.cmake) endif(USE_WINDOWS_UNIVERSAL) endif() diff --git a/cmake/platforms/windows-deployqt.cmake b/cmake/platforms/windows-deployqt.cmake new file mode 100644 index 0000000..8d5bdc4 --- /dev/null +++ b/cmake/platforms/windows-deployqt.cmake @@ -0,0 +1,94 @@ +# windows-deployqt.cmake + +# Windows 平台 windeployqt 自动化模块 +# 在对项目进行构建时,是否需要配置 deployqt 来为项目进行构建部署设计 + +# 1. 如果需要进行 windeployqt,需要提供此 WINDOWS_DEPLOY_QT 开关 +# 2. 默认应用构建的内容将随附在此处 +# 3. 预先设置一个默认的 Windows Qt 目录变量 +set(WINDOWS_QT_DIR "") + +option(WINDOWS_DEPLOY_QT "为 Windows 中构建的应用进行 windeployqt" OFF) +option(WINDOWS_DEPLOY_QT5 "为 Windows 中构建的 QT5 应用进行 windeployqt" OFF) +option(WINDOWS_DEPLOY_QT6 "为 Windows 中构建的 QT6 应用进行 windeployqt" OFF) + +if(WINDOWS_DEPLOY_QT) + + if(WINDOWS_DEPLOY_QT5) + # 当使用 WINDOWS_DEPLOY_QT5 配方时,将使用来源于 Qt5 中提供的路径 + set(WINDOWS_QT_DIR "${Qt5_DIR}") + elseif(WINDOWS_DEPLOY_QT6) + # 当使用 WINDOWS_DEPLOY_QT6 配方时,将使用来源于 Qt6 中提供的路径 + set(WINDOWS_QT_DIR "${Qt6_DIR}") + endif() + + if (WINDOWS_DEPLOY_QT5 OR WINDOWS_DEPLOY_QT6) + message(" -------- ${CMAKE_INSTALL_PREFIX} ---------- ") + message("${WINDOWS_QT_DIR}/../../../bin/windeployqt") + + # install(TARGETS ${PROJECT_NAME} + # DESTINATION ${CMAKE_BINARY_DIR}/windows-deployqt) + + + # 配置一个自动运行 windeployqt 配方的位置 + # 当使用 Windows Deploy Qt 时,可执行程序与即将部署的应用运行时将在此处出现 + set(WINDOWS_APPLICATION_DEPLOY_PATH + ${CMAKE_BINARY_DIR}/windows-deployqt/${PROJECT_NAME}.app/bin) + + # 在开启支持 windeployqt 配方后,这部分将会改变默认构建的目标的一些行为 + # 这是 windeployqt,所以,它应该是一个 WIN32 程序 + # 它的输出目录将定义为 + set_target_properties(${PROJECT_NAME} + PROPERTIES + # 这是一个 WIN32 程序,即可执行文件不再出现黑窗口,转而使用 WinMain(某种 Windows 内部特性) + WIN32_EXECUTABLE true + # 静态库生成目录 + # ARCHIVE_OUTPUT_DIRECTORY "" + # 动态库生成目录 + # LIBRARY_OUTPUT_DIRECTORY "" + # 可执行文件生成目录 + RUNTIME_OUTPUT_DIRECTORY ${WINDOWS_APPLICATION_DEPLOY_PATH}) + + # 自动化构建 Windows Deploy Qt Application + # 参考: windeployqt --qmldir + add_custom_command(TARGET ${PROJECT_NAME} + # 在构建之后计划进行执行以下命令 + POST_BUILD + # 即将在构建目录中 + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + # 执行以下命令进行 windeployqt + COMMAND ${WINDOWS_QT_DIR}/../../../bin/windeployqt + # + ${WINDOWS_APPLICATION_DEPLOY_PATH}/${PROJECT_NAME}.exe + + # 扫描QML-从目录开始导入。 + --qmlimport ${WINDOWS_QT_DIR}/../../../qml + # 部署编译器运行时(仅限桌面)。 + --compiler-runtime + # 详细级别(0-2) + --verbose 2 + # 部署运行时使用指定的目录 + --dir ${WINDOWS_APPLICATION_DEPLOY_PATH} + ) + + # 此部分为创建一个 windows-deployqt 的虚拟目标,用于对执行安装后的应用进行 windeployqt + # 手动化构建 Windows Deploy Qt Application + # 参考: windeployqt --qmldir + add_custom_target(windows-deployqt + COMMAND ${WINDOWS_QT_DIR}/../../../bin/windeployqt + # + ${WINDOWS_APPLICATION_DEPLOY_PATH}/${PROJECT_NAME}.exe + + # 扫描QML-从目录开始导入。 + --qmlimport ${WINDOWS_QT_DIR}/../../../qml + # 部署编译器运行时(仅限桌面)。 + --compiler-runtime + # 详细级别(0-2) + --verbose 2 + # 部署运行时使用指定的目录 + --dir ${CMAKE_INSTALL_PREFIX}/bin + ) + + endif (WINDOWS_DEPLOY_QT5 OR WINDOWS_DEPLOY_QT6) + +endif(WINDOWS_DEPLOY_QT) \ No newline at end of file diff --git a/cmake/platforms/windows-universal.cmake b/cmake/platforms/windows-universal.cmake new file mode 100644 index 0000000..3f21605 --- /dev/null +++ b/cmake/platforms/windows-universal.cmake @@ -0,0 +1,93 @@ +# windows-universal.cmake + +# 此构建表示,在 Windows 中以通用平台构建方式进行构建此内容 +# 为 Notepad-- 通用构建的设计安装结构 +# +# /bin 在 Windows 中标准的程序位置 +# Notepad--.exe +# plugin/ +# themes +# +# /include/ 在 Windows 中提供一系列可提供插件开发的头文件 +# NotepadPlugin/ +# pluginGl.h +# QSci/ +# qscint/scintilla/ +# +# /lib/ 在 Windows 中提供一个用于插件开发的核心依赖文件 +# NotepadPlugin/ +# libQSci.so +# + + +if(CMAKE_HOST_WIN32) + include(cmake/SparkInstallMacrosConfig.cmake) + # ------------------ INSTALL PLUGIN CONFIG ------------------ # + # ------------------ INSTALL PLUGIN CONFIG ------------------ # + # ------------------ INSTALL PLUGIN CONFIG ------------------ # + include(CMakePackageConfigHelpers) + include(GNUInstallDirs) + + # 定义插件配置安装位置 + # set(CMAKE_INSTALL_PREFIX "/usr") # 仅限 Linux ,Windows 中不使用 + set(NOTEPAD_PLUGIN NotepadPlugin) + + # 定义开发插件时的配置目录与 CMake 模块文件名称 + set(NOTEPAD_PLUGIN_CONFIG ${NOTEPAD_PLUGIN}Config.cmake) + # 定义一些扩展内容,主要是提供给 CMake 模块文件填充 + set(NOTEPAD_PLUGIN_CORELIB QSci) # QSci 为构建的 QScintllia 库 + + # 定义在插件开发的 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 "") + + # 这些是在此部分安装时使用,但不被用于填充 NotepadPlugin.cmake.in 的内容 + set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN}) + set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN}) + + + # 将 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) + # 安装开发插件高级功能所需要的内容 + spark_install_directory(${NOTEPAD_PLUGIN_INCLUDEDIR}/qscint + src/qscint/scintilla) + + # 导出 QSci 的头文件(从插件实现层面来看,目前是使用*.h 与 pluginGl.h + # 但从 Qsci 层面来看,*.h 使用的是 #include ,所以此部分不被使用) + # 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 ------------------ # + +endif(CMAKE_HOST_WIN32) + diff --git a/windows-universal.mk b/windows-universal.mk new file mode 100644 index 0000000..2de806e --- /dev/null +++ b/windows-universal.mk @@ -0,0 +1,31 @@ +# windows-universal.mk +# Windows Universal - 通用 Windows 平台构建方案 + +builddir := build +sourcedir := . +CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_OPTIONS := -DUSE_WINDOWS_UNIVERSAL=ON +CMAKE_GENERATER := "" +CMAKE_UNIVERSAL_QT := $(CMAKE_OPTIONS) -DWINDOWS_DEPLOY_QT=ON +CMAKE_UNIVERSAL_QT5 := $(CMAKE_UNIVERSAL_QT) -DWINDOWS_DEPLOY_QT5=ON +CMAKE_UNIVERSAL_QT6 := $(CMAKE_UNIVERSAL_QT) -DWINDOWS_DEPLOY_QT6=ON + +JOBS=$(shell nproc) + + +windows-universal: + cmake -B$(builddir) $(CMAKE_DEBUG) $(CMAKE_GENERATER) $(CMAKE_OPTIONS) + cmake --build $(builddir) -- -j$(JOBS) + +windows-universal-release: + cmake -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_GENERATER) $(CMAKE_OPTIONS) + cmake --build $(builddir) -- -j$(JOBS) + +windows-universal-release-qt5: + cmake $(CMAKE_GENERATER) -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_UNIVERSAL_QT5) + cmake --build $(builddir) -- -j$(JOBS) + +windows-universal-release-qt6: + cmake $(CMAKE_GENERATER) -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_UNIVERSAL_QT6) + cmake --build $(builddir) -- -j$(JOBS) \ No newline at end of file diff --git a/windows.mk b/windows.mk index e2f3111..0439019 100644 --- a/windows.mk +++ b/windows.mk @@ -1,4 +1,6 @@ Msg := 'Build with the following configuration:' +One := '1. make -f windows-universal.mk' all: @echo -e $(Msg) + @echo -e $(One) "\n\tThe default Universal Windows platform build" -- Gitee From 34f29c7a64af01ff2a45b897b00b2510dee786c2 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 19 Feb 2023 03:58:11 +0800 Subject: [PATCH 050/102] =?UTF-8?q?repo:=20=E4=B8=BA=E6=A0=B8=E5=BF=83?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=9E=84=E5=BB=BA=E8=BF=9B=E8=A1=8C=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/modules/Notepad--.cmake | 8 ++++++++ cmake/modules/QScint.cmake | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/cmake/modules/Notepad--.cmake b/cmake/modules/Notepad--.cmake index a7ab865..5c61907 100644 --- a/cmake/modules/Notepad--.cmake +++ b/cmake/modules/Notepad--.cmake @@ -1,3 +1,10 @@ +# Notepad--.cmake + +# Notepad-- 核心构建 +# 在模块化构建中,这个部分代表着构建 Notepad-- +# 1. 默认构建时产出的目标为 Notepad-- +# 2. 在此处可对 Notepad-- 目标进行详细的构建计划 + if(TRUE) # 准备构建 Notepad-- 主程序 set(QRC_SOURCES src/RealCompare.qrc) @@ -31,3 +38,4 @@ if(TRUE) endif(TRUE) +# Notepad-- 目标在构建时依赖了一些其它内容,像先前构建的 QSci 目标、Qt5::XmlPatterns \ No newline at end of file diff --git a/cmake/modules/QScint.cmake b/cmake/modules/QScint.cmake index d23b46e..8e24e1a 100644 --- a/cmake/modules/QScint.cmake +++ b/cmake/modules/QScint.cmake @@ -1,3 +1,9 @@ +# QScint.cmake + +# 在模块化构建中,这个部分代表着构建 Qscintilla +# 1. 静态化构建库时产出的目标为 libQSci.a +# 2. 在此处可对 QSci 目标进行详细的构建计划 + if(TRUE) # add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint) # file(GLOB MOC_HEADER src/qscint/src/Qsci/*.h) @@ -27,3 +33,7 @@ if(TRUE) target_link_qt5_PrintSupport(QSci) target_link_qt5_Concurrent(QSci) endif(TRUE) + + +# QSci 库构建时依赖了一些其它内容,像 PrintSupport,Concurrent 等 +# QSci 库构建... -- Gitee From 282eb0f870b28df6f737e77ce22ff0272aeb052f Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 19 Feb 2023 16:41:31 +0800 Subject: [PATCH 051/102] =?UTF-8?q?repo:=20=E8=A1=A5=E5=85=85=20windows-un?= =?UTF-8?q?iversal.cmake=20=E4=B8=AD=E7=9A=84=E7=BB=93=E6=9E=84=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/windows-universal.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/platforms/windows-universal.cmake b/cmake/platforms/windows-universal.cmake index 3f21605..0e9f9ae 100644 --- a/cmake/platforms/windows-universal.cmake +++ b/cmake/platforms/windows-universal.cmake @@ -15,8 +15,11 @@ # qscint/scintilla/ # # /lib/ 在 Windows 中提供一个用于插件开发的核心依赖文件 +# cmake/ +# NotepadPlugin/ +# NotepadPluginConfig.cmake # NotepadPlugin/ -# libQSci.so +# QSci.lib # -- Gitee From 7cf57ceb3609590e9ec64a3d719690ab83e1b9c6 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 19 Feb 2023 16:59:44 +0800 Subject: [PATCH 052/102] =?UTF-8?q?bug:=20=E5=9C=A8=20Visual=20Studio=20?= =?UTF-8?q?=E4=B8=AD=E5=BC=95=E5=8F=91=E6=97=A0=E6=B3=95=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E6=AD=A4=E5=A4=84=E8=A2=AB?= =?UTF-8?q?=E9=94=81=E5=AE=9A=E6=9E=84=E5=BB=BA=E4=B8=BA=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/qscint/src/Qsci/qsciglobal.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/qscint/src/Qsci/qsciglobal.h b/src/qscint/src/Qsci/qsciglobal.h index 89e404b..d53956c 100755 --- a/src/qscint/src/Qsci/qsciglobal.h +++ b/src/qscint/src/Qsci/qsciglobal.h @@ -37,14 +37,17 @@ // Define QSCINTILLA_MAKE_DLL to create a QScintilla shared library, or // define QSCINTILLA_DLL to link against a QScintilla shared library, or define // neither to either build or link against a static QScintilla library. -#define QSCINTILLA_DLL + +// Bug: 在 Visual Studio 中引发无法构建的问题,此处被锁定构建为动态库 +// Unassign as Q_DECL_IMPORT. +// #define QSCINTILLA_DLL #if defined(QSCINTILLA_DLL) -#define QSCINTILLA_EXPORT Q_DECL_IMPORT +# define QSCINTILLA_EXPORT Q_DECL_IMPORT #elif defined(QSCINTILLA_MAKE_DLL) -#define QSCINTILLA_EXPORT Q_DECL_EXPORT +# define QSCINTILLA_EXPORT Q_DECL_EXPORT #else -#define QSCINTILLA_EXPORT +# define QSCINTILLA_EXPORT #endif -- Gitee From d5d4683d3fddd6f6b0e9a633e2c921db50d46240 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 19 Feb 2023 22:44:27 +0800 Subject: [PATCH 053/102] =?UTF-8?q?repo:=20=E4=B8=BA=20=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=20Linux=20=E5=B9=B3=E5=8F=B0=E7=9A=84=20Uos=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E8=BF=9B=E8=A1=8C=E6=89=93=E5=8C=85=E6=97=B6=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=20OS=20ID=20=E6=98=AF=E5=90=A6=E4=B8=BA=20Uos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linux-uos.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/linux-uos.mk b/linux-uos.mk index 5b81f41..0fef217 100644 --- a/linux-uos.mk +++ b/linux-uos.mk @@ -36,4 +36,16 @@ package-contents: package-contents-tree: -tree $(builddir)/_CPack_Packages/Linux/DEB/ -# 此配置为构建 linux 通用版本构建 \ No newline at end of file +# 此配置为构建 linux 通用版本构建 + +# 一次系统检察 +UOS_OS_ID=$(shell lsb_release -si) +ifneq ($(UOS_OS_ID),Uos) +linux-uos: + @echo "此目标不应该由 $(UOS_OS_ID) 来构建 Uos 配方, 否则实际 Uos 系统可能由于 Qt 版本过低将无法使用." +linux-uos-release: + @echo "此目标不应该由 $(UOS_OS_ID) 来构建 Uos 配方, 否则实际 Uos 系统可能由于 Qt 版本过低将无法使用." +package: + @echo "此目标不应该由 $(UOS_OS_ID) 来构建 Uos 配方, 否则实际 Uos 系统可能由于 Qt 版本过低将无法使用." +endif +# repo: 要求使用 Uos 平台来进行独立 Linux 平台的 Uos 构建 \ No newline at end of file -- Gitee From 7c9c38042e2b8725dc010ca403ece44e98dca0b5 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 20 Feb 2023 20:03:28 +0800 Subject: [PATCH 054/102] =?UTF-8?q?Bugs:=20=E5=A4=84=E7=90=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E5=9C=A8=20Visual=20Studio=20=E4=B8=AD=E5=BC=95?= =?UTF-8?q?=E5=8F=91=E6=97=A0=E6=B3=95=E6=9E=84=E5=BB=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Bug: 在 Visual Studio 中引发无法构建的问题,此处被重复定义(在 cmake 中已对其定义) // #define NO_PLUGIN 1 2. Bug: 在 Visual Studio 中引发无法构建的问题,此处为无法找到 qmyedit_x 库 //#pragma comment(lib, "qmyedit_qt5d.lib") #else //#pragma comment(lib, "qmyedit_qt5.lib") 3. 虽然 QSci 被用于静态构建,但 cmake 中未设置导出宏 QSCINTILLA_MAKE_DLL --- cmake/modules/QScint.cmake | 2 +- src/main.cpp | 5 +++-- src/rcglobal.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmake/modules/QScint.cmake b/cmake/modules/QScint.cmake index 8e24e1a..46df5e3 100644 --- a/cmake/modules/QScint.cmake +++ b/cmake/modules/QScint.cmake @@ -20,7 +20,7 @@ if(TRUE) # 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_compile_definitions(QSci PRIVATE SCINTILLA_QT SCI_LEXER INCLUDE_DEPRECATED_FEATURES QSCINTILLA_MAKE_DLL) target_include_directories(QSci PRIVATE src/qscint/scintilla/boostregex src/qscint/scintilla/lexlib) diff --git a/src/main.cpp b/src/main.cpp index 5d94509..384f5e3 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,9 +24,10 @@ #ifdef Q_OS_WIN #pragma comment(lib, "user32.lib") #if _DEBUG -#pragma comment(lib, "qmyedit_qt5d.lib") +// Bug: 在 Visual Studio 中引发无法构建的问题,此处为无法找到 qmyedit_x 库 +//#pragma comment(lib, "qmyedit_qt5d.lib") #else -#pragma comment(lib, "qmyedit_qt5.lib") +//#pragma comment(lib, "qmyedit_qt5.lib") #endif #include const ULONG_PTR CUSTOM_TYPE = 10000; diff --git a/src/rcglobal.h b/src/rcglobal.h index 50a4d4c..7c899a3 100755 --- a/src/rcglobal.h +++ b/src/rcglobal.h @@ -14,8 +14,8 @@ static const char* VersionStr = u8"(内部测试非稳定) v1.22.1"; static const char* VersionStr = "v1.22.2"; #endif // TEST_PRE - -#define NO_PLUGIN 1 +// Bug: 在 Visual Studio 中引发无法构建的问题,此处被重复定义(在 cmake 中已对其定义) +// #define NO_PLUGIN 1 #define CMP_CODE_NOEQUAL -- Gitee From 41f0802e84c0c8abc29d124a8fcd7b0b67bc8086 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 21 Feb 2023 17:53:06 +0800 Subject: [PATCH 055/102] =?UTF-8?q?cmake-deb-package:=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=A3=B0=E6=98=8E=E5=8F=91=E8=A1=8C=E7=89=88=E5=8F=B7=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E6=9E=84=E5=BB=BA=E6=97=B6=E7=94=9F=E6=88=90=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=B0=BE=E9=83=A8?= =?UTF-8?q?=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/DebPackageConfig.cmake | 19 +++++++++++++++++++ cmake/package-deb.descript | 2 ++ 2 files changed, 21 insertions(+) diff --git a/cmake/DebPackageConfig.cmake b/cmake/DebPackageConfig.cmake index cfba051..ec68fa6 100644 --- a/cmake/DebPackageConfig.cmake +++ b/cmake/DebPackageConfig.cmake @@ -129,6 +129,12 @@ function(set_package_vars _IN_KEY _IN_VAL) message("--> 日历化版本: ${_IN_VAL}") endif(_CalVer EQUAL "0") + find_str("${_IN_KEY}" "OSD" _OSDVer) + if(_OSDVer EQUAL "0") + set(OSDVer "${_IN_VAL}" PARENT_SCOPE) + message("--> 声明发行版号: ${_IN_VAL}") + endif(_OSDVer EQUAL "0") + find_str("${_IN_KEY}" "Architecture" _Architecture) if(_Architecture EQUAL "0") set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE) @@ -264,6 +270,19 @@ function(add_package_descript IN_DES) endif("${CalVer}" STREQUAL "true") + ####################### OS Release ###################### + if("${OSDVer}" STREQUAL "true") + exec_program(lsb_release ARGS -si + OUTPUT_VARIABLE _OSI + ) + exec_program(lsb_release ARGS -sr + OUTPUT_VARIABLE _OSR + ) + if(NOT "${_OSI}" STREQUAL "" AND NOT "${_OSR}" STREQUAL "") + set(PACKAGE_SUFFIX "${PACKAGE_SUFFIX}_${_OSI}${_OSR}") + endif(NOT "${_OSI}" STREQUAL "" AND NOT "${_OSR}" STREQUAL "") + endif("${OSDVer}" STREQUAL "true") + ##################### deb file name ##################### set(_Package "${CPACK_DEBIAN_PACKAGE_NAME}") diff --git a/cmake/package-deb.descript b/cmake/package-deb.descript index be0fa83..c187afe 100644 --- a/cmake/package-deb.descript +++ b/cmake/package-deb.descript @@ -25,6 +25,8 @@ Package: com.hmja.notepad Version: auto # 日历化尾部版本 CalVer: true +# 声明发行版号(类似于 Debian11,Debian为OS标志,11为发行版号) +OSD: 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] -- Gitee From 1d92faf28a613c5f332eabdf792d6490bdb210c9 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 21 Feb 2023 17:56:07 +0800 Subject: [PATCH 056/102] =?UTF-8?q?repo:=20=E5=8F=96=E6=B6=88=E5=AF=B9=20U?= =?UTF-8?q?os=20=E6=89=93=E5=8C=85=E6=97=B6=E7=9A=84=20=5FUos=20=E7=9A=84?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=B0=BE=E5=B7=B4=EF=BC=8C=E5=B9=B6=E5=9F=BA?= =?UTF-8?q?=E4=BA=8E=E5=8A=A8=E6=80=81=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/linux-uos.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/platforms/linux-uos.cmake b/cmake/platforms/linux-uos.cmake index 2a52f2a..9b87979 100644 --- a/cmake/platforms/linux-uos.cmake +++ b/cmake/platforms/linux-uos.cmake @@ -63,7 +63,7 @@ if(USE_LINUX_UOS) # ------------------ 最终打包 deb 部分 ------------------ # # 1. 为即将构建的 Uos 增加 Uos 后缀 - set(PACKAGE_SUFFIX "_Uos") + # set(PACKAGE_SUFFIX "_onlyUos") # 2. 使用同样来自 debian 系列的 deb 构建能力 find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) -- Gitee From 4a463afbb14d64cc2d5419c6153fdd655f349a1f Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 11:33:46 +0800 Subject: [PATCH 057/102] =?UTF-8?q?cmake/modules:=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=20QScintilla=20=E5=BA=93=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E5=AE=8F=E6=8E=A7=E5=88=B6=E5=BD=A2=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 15 +++++++++++++-- cmake/modules/Notepad--.cmake | 27 +++++++++++++++++++++++--- cmake/modules/QScint.cmake | 31 +++++++++++++++++++++++++++--- 3 files changed, 65 insertions(+), 8 deletions(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index 517ea96..2cce600 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -185,6 +185,7 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) target_link_directories(${PLUGIN_VAR} PUBLIC ${NOTEPAD_PLUGIN_LIBDIR}) target_link_libraries(${PLUGIN_VAR} ${NOTEPAD_PLUGIN_CORELIB}) + if(NOTEPAD_BUILD_BY_QT5) target_link_libraries(${PLUGIN_VAR} Qt5::Core Qt5::Widgets) endif(NOTEPAD_BUILD_BY_QT5) @@ -195,7 +196,17 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) # 这是插件实现接口中增加的 NOTEPAD_PLUGIN_MANAGER 宏开关 # 来处理减少 Notepad-- 在编译时不需要,但在插件编译时所需要的模板内容 - target_compile_definitions(${PLUGIN_VAR} PUBLIC NOTEPAD_PLUGIN_MANAGER=) + if(WIN32) + target_compile_definitions(${PLUGIN_VAR} + PUBLIC + NOTEPAD_PLUGIN_MANAGER + QSCINTILLA_DLL # 在 Windows 中使用 QSci 库时应该采用 Q_DECL_IMPORT + # 控制 QSCINTILLA_EXPORT 符号应为 Q_DECL_IMPORT + ) + else() + target_compile_definitions(${PLUGIN_VAR} + PUBLIC NOTEPAD_PLUGIN_MANAGER) + endif(WIN32) endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) @@ -215,4 +226,4 @@ message(" - ${NOTEPAD_PLUGIN_INCLUDEDIR}") message(" - ${NOTEPAD_PLUGIN_LIBDIR}") message(" - ${NOTEPAD_PLUGIN_CORELIB}") message(" - ${NOTEPAD_IMPORTED_CORELIB_PATH}") -message("- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<") \ No newline at end of file +message("- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<") diff --git a/cmake/modules/Notepad--.cmake b/cmake/modules/Notepad--.cmake index 5c61907..b7a79dc 100644 --- a/cmake/modules/Notepad--.cmake +++ b/cmake/modules/Notepad--.cmake @@ -32,10 +32,31 @@ endif(TRUE) # ----------------- Notepad-- 插件支持相关 ----------------- # if(TRUE) - # 开启插件支持 - target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN=0) + # 开启插件支持 - 此处废弃,并由构建宏支持部分处理 + # target_compile_definitions(${PROJECT_NAME} PUBLIC NO_PLUGIN) # 其它有关插件的部分处理... endif(TRUE) -# Notepad-- 目标在构建时依赖了一些其它内容,像先前构建的 QSci 目标、Qt5::XmlPatterns \ No newline at end of file +# Notepad-- 目标在构建时依赖了一些其它内容,像先前构建的 QSci 目标、Qt5::XmlPatterns +# Notepad-- 程序构建...配置 + +# ----------------- Notepad-- 构建宏支持相关 ----------------- # + +if(WIN32) + # 在 Windows 中构建时,需要关注此库的构建形式,QScintilla 应该以何种方式编译 + target_compile_definitions(${PROJECT_NAME} + PRIVATE + NO_PLUGIN # 开启插件支持 + QSCINTILLA_DLL # 目前在 Windows 中使用 QSci 库时应该采用 Q_DECL_IMPORT + # 控制 QSCINTILLA_EXPORT 符号应为 Q_DECL_IMPORT + ) +endif(WIN32) + +if(UNIX) + # 在 Windows 中构建时,需要关注此库的构建形式,QScintilla 应该以何种方式编译 + target_compile_definitions(${PROJECT_NAME} + PRIVATE + NO_PLUGIN # 开启插件支持 + ) +endif(UNIX) diff --git a/cmake/modules/QScint.cmake b/cmake/modules/QScint.cmake index 46df5e3..d5da511 100644 --- a/cmake/modules/QScint.cmake +++ b/cmake/modules/QScint.cmake @@ -19,8 +19,7 @@ if(TRUE) # src/qscint/src/Qsci # FAIL: only *.ui will spark_file_glob(MOC_HEADER ...) ) - spark_add_library(QSci STATIC ${QSciSources} ${MOC_HEADER}) - target_compile_definitions(QSci PRIVATE SCINTILLA_QT SCI_LEXER INCLUDE_DEPRECATED_FEATURES QSCINTILLA_MAKE_DLL) + spark_add_library(QSci STATIC ${QSciSources} ${MOC_HEADER}) target_include_directories(QSci PRIVATE src/qscint/scintilla/boostregex src/qscint/scintilla/lexlib) @@ -36,4 +35,30 @@ endif(TRUE) # QSci 库构建时依赖了一些其它内容,像 PrintSupport,Concurrent 等 -# QSci 库构建... +# QSci 库构建...配置 + +if(WIN32) + # 在 Windows 中构建时,需要关注此库的构建形式,QScintilla 应该以何种方式编译 + target_compile_definitions(QSci + PRIVATE + SCINTILLA_QT # + SCI_LEXER # + INCLUDE_DEPRECATED_FEATURES # + QSCINTILLA_MAKE_DLL # 在 Windows 中构建此库时应该采用 Q_DECL_EXPORT + # 并且在 Windows 中使用此库时应该采用 Q_DECL_IMPORT + # 控制 QSCINTILLA_EXPORT 符号应为: + # 构建时(导出),由外部使用时(导入) + ) +endif(WIN32) + +if(UNIX) + # 在 Linux 中构建时,需要关注此库的构建形式,QScintilla 应该以何种方式编译 + target_compile_definitions(QSci + PRIVATE + SCINTILLA_QT # + SCI_LEXER # + INCLUDE_DEPRECATED_FEATURES # + # QSCINTILLA_MAKE_DLL # 在 Linux 未使用 Q_DECL_EXPORT 、 Q_DECL_IMPORT + # 控制 QSCINTILLA_EXPORT 符号应为留空 + ) +endif(UNIX) -- Gitee From b531ed598c12c0e297a97ba2a0763da27dff1418 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 11:41:13 +0800 Subject: [PATCH 058/102] =?UTF-8?q?repo:=20=E8=B0=83=E6=95=B4=20cmake=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E4=B8=BB=E5=85=A5=E5=8F=A3=E7=9A=84=E9=85=8D?= =?UTF-8?q?=E6=96=B9=E6=8E=92=E5=88=97=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 76 +++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bdc216..fd11dd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ if(WIN32) add_compile_definitions(_UNICODE= UNICODE=) endif() -# ----------------- 构建 QSci 静态库 ----------------- # +# ----------------- 构建 QSci 库 ----------------- # if(TRUE) include(cmake/modules/QScint.cmake) endif(TRUE) @@ -27,7 +27,13 @@ if(TRUE) endif(TRUE) # ----------------- Notepad-- 其它主线构建相关 ----------------- # -option(USE_MACOS_UNIVERSAL "通用 MacOS 平台构建" OFF) +option(USE_WINDOWS_UNIVERSAL "通用 Windows 平台构建" OFF) +option(USE_WINDOWS_MINGW "通用 Windows 平台 MinGW 构建" OFF) +option(USE_WINDOWS_MSVC "通用 Windows 平台 MSVC 构建" OFF) +# +option(WINDOWS_DEPLOY_QT "通用 Windows 平台 Qt 部署" OFF) +option(WINDOWS_DEPLOY_QT5 "通用 Windows 平台指定 Qt5 部署 windeployqt" OFF) +option(WINDOWS_DEPLOY_QT6 "通用 Windows 平台指定 Qt6 部署 windeployqt" OFF) # option(USE_LINUX_UNIVERSAL "通用 Linux 平台构建" OFF) option(USE_LINUX_DEBIAN "通用 Debian Linux 平台构建" OFF) @@ -35,19 +41,34 @@ option(USE_LINUX_APPIMAGE "通用 Appimage Linux 平台构建" OFF) # option(USE_LINUX_UOS "独立 Linux 平台的 Uos 构建" OFF) # -option(USE_WINDOWS_UNIVERSAL "通用 Windows 平台构建" OFF) -option(USE_WINDOWS_MINGW "通用 Windows 平台 MinGW 构建" OFF) -option(USE_WINDOWS_MSVC "通用 Windows 平台 MSVC 构建" OFF) -# -option(WINDOWS_DEPLOY_QT "通用 Windows 平台 Qt 部署" OFF) -option(WINDOWS_DEPLOY_QT5 "通用 Windows 平台指定 Qt5 部署 windeployqt" OFF) -option(WINDOWS_DEPLOY_QT6 "通用 Windows 平台指定 Qt6 部署 windeployqt" OFF) +option(USE_MACOS_UNIVERSAL "通用 MacOS 平台构建" OFF) +# 使用 windows.cmake / linux.cmake / macos.cmake 维护构建. -# 使用 macos.cmake / linux.cmake / windows.cmake 维护构建. -if(APPLE) - # 通用 MacOS 平台的构建(一个无具体实现的空构建) - # include(cmake/platforms/macos.cmake) + # 在 Windows 中此处将由通用构建、MinGW 构建、MSVC 构建组成 +if(WIN32) + + # 通用 Windows 平台构建,一切的起始 + if(USE_WINDOWS_UNIVERSAL) + include(cmake/platforms/windows-universal.cmake) + + # 为 Windows 中构建的应用进行 windeployqt 的配方 + include(cmake/platforms/windows-deployqt.cmake) + + # 通用平台的 Windows MinGW 构建 + if(USE_WINDOWS_MINGW) + # include(cmake/platforms/windows-mingw.cmake) + endif() + + # 通用平台的 Windows MSVC 构建 + if(USE_WINDOWS_MSVC) + # include(cmake/platforms/windows-msvc.cmake) + endif() + + # 其它 Windows 平台的构建 + else() + # include(cmake/platforms/windows-other.cmake) + endif(USE_WINDOWS_UNIVERSAL) # 在 Linux 中此处将由通用构建、Debian 打包构建、Appimage 打包构建、Uos 打包构建组成 elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) @@ -72,34 +93,13 @@ elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) # 其它 Linux 平台的构建 else() - # include(cmake/platforms/linux.cmake) + # include(cmake/platforms/linux-other.cmake) endif(USE_LINUX_UNIVERSAL) - - # 在 Windows 中此处将由通用构建、MinGW 构建、MSVC 构建组成 -elseif(WIN32) - - # 通用 Windows 平台构建,一切的起始 - if(USE_WINDOWS_UNIVERSAL) - include(cmake/platforms/windows-universal.cmake) - - # 为 Windows 中构建的应用进行 windeployqt 的配方 - include(cmake/platforms/windows-deployqt.cmake) - - # 通用平台的 Windows MinGW 构建 - if(USE_WINDOWS_MINGW) - # include(cmake/platforms/windows-mingw.cmake) - endif() - - # 通用平台的 Windows MSVC 构建 - if(USE_WINDOWS_MSVC) - # include(cmake/platforms/windows-msvc.cmake) - endif() - # 其它 Windows 平台的构建 - else() - # include(cmake/platforms/windows-other.cmake) - endif(USE_WINDOWS_UNIVERSAL) + # 通用 MacOS 平台的构建(一个无具体实现的空构建) +elseif(APPLE) + # include(cmake/platforms/macos.cmake) endif() # ----------------- Notepad-- 其它主线构建相关 ----------------- # -- Gitee From fc50cf38a21fbe58c20136ce59e75fce0eb983df Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 14:40:16 +0800 Subject: [PATCH 059/102] =?UTF-8?q?cmake/modules:=20=E5=A2=9E=E5=8A=A0=20N?= =?UTF-8?q?OTEPAD=5FBUILD=5FBY=5FSHARED=20=E6=9E=84=E5=BB=BA=E9=85=8D?= =?UTF-8?q?=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加 utils.cmake 进行获取在不同平台构建时的目标库的名称 --- cmake/NotepadPluginConfig.cmake.in | 13 ++++---- cmake/modules/QScint.cmake | 8 ++++- cmake/platforms/linux-universal.cmake | 7 +++++ cmake/platforms/utils.cmake | 40 +++++++++++++++++++++++++ cmake/platforms/windows-universal.cmake | 6 ++++ 5 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 cmake/platforms/utils.cmake diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index 2cce600..e6bed80 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -18,7 +18,7 @@ set(NOTEPAD_PLUGIN @NOTEPAD_PLUGIN@) set(NOTEPAD_BUILD_BY_QT5 @NOTEPAD_BUILD_BY_QT5@) set(NOTEPAD_BUILD_BY_QT6 @NOTEPAD_BUILD_BY_QT6@) -set(NOTEPAD_BUILD_BY_SHARED FALSE) +set(NOTEPAD_BUILD_BY_SHARED @NOTEPAD_BUILD_BY_SHARED@) set(NOTEPAD_PLUGIN_CORELIB @NOTEPAD_PLUGIN_CORELIB@) # 由插件开发者进行参考的 "Notepad 提供的插件安装目录(位置)" set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY @@ -196,17 +196,18 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) # 这是插件实现接口中增加的 NOTEPAD_PLUGIN_MANAGER 宏开关 # 来处理减少 Notepad-- 在编译时不需要,但在插件编译时所需要的模板内容 - if(WIN32) + + if(WIN32 AND NOTEPAD_BUILD_BY_SHARED) target_compile_definitions(${PLUGIN_VAR} PUBLIC NOTEPAD_PLUGIN_MANAGER - QSCINTILLA_DLL # 在 Windows 中使用 QSci 库时应该采用 Q_DECL_IMPORT - # 控制 QSCINTILLA_EXPORT 符号应为 Q_DECL_IMPORT + # QSCINTILLA_DLL # 废弃,插件构建中不需要明确显式声明此宏 ) else() target_compile_definitions(${PLUGIN_VAR} - PUBLIC NOTEPAD_PLUGIN_MANAGER) - endif(WIN32) + PUBLIC + NOTEPAD_PLUGIN_MANAGER) + endif(WIN32 AND NOTEPAD_BUILD_BY_SHARED) endmacro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) diff --git a/cmake/modules/QScint.cmake b/cmake/modules/QScint.cmake index d5da511..8e20e25 100644 --- a/cmake/modules/QScint.cmake +++ b/cmake/modules/QScint.cmake @@ -4,6 +4,8 @@ # 1. 静态化构建库时产出的目标为 libQSci.a # 2. 在此处可对 QSci 目标进行详细的构建计划 +option(NOTEPAD_BUILD_BY_SHARED "指定 Notepad 将构建为动态库" OFF) + if(TRUE) # add_subdirectory(${PROJECT_SOURCE_DIR}/src/qscint) # file(GLOB MOC_HEADER src/qscint/src/Qsci/*.h) @@ -19,7 +21,11 @@ if(TRUE) # src/qscint/src/Qsci # FAIL: only *.ui will spark_file_glob(MOC_HEADER ...) ) - spark_add_library(QSci STATIC ${QSciSources} ${MOC_HEADER}) + if(NOTEPAD_BUILD_BY_SHARED) + spark_add_library(QSci SHARED ${QSciSources} ${MOC_HEADER}) + else() + spark_add_library(QSci STATIC ${QSciSources} ${MOC_HEADER}) + endif(NOTEPAD_BUILD_BY_SHARED) target_include_directories(QSci PRIVATE src/qscint/scintilla/boostregex src/qscint/scintilla/lexlib) diff --git a/cmake/platforms/linux-universal.cmake b/cmake/platforms/linux-universal.cmake index 2e58419..a7575d2 100644 --- a/cmake/platforms/linux-universal.cmake +++ b/cmake/platforms/linux-universal.cmake @@ -55,6 +55,12 @@ if(CMAKE_HOST_UNIX) # 定义一些扩展内容,主要是提供给 CMake 模块文件填充 set(NOTEPAD_PLUGIN_CORELIB QSci) # QSci 为构建的 QScintllia 库 + # 将当前平台构建的目标转为平台下的库名称 + include(cmake/platforms/utils.cmake) + get_current_platform_lib_name(NOTEPAD_PLUGIN_CORELIB_NAME + ${NOTEPAD_BUILD_BY_SHARED} + QSci) + # 定义在插件开发的 CMake 模块中,Notepad-- 是否是基于 QT5 实现 # 并自动为插件开发层自动开启相关 Qt 依赖组件 # 此部分逻辑将自动提供给 add_notepad_plugin 自行处理 @@ -108,3 +114,4 @@ if(CMAKE_HOST_UNIX) # ------------------ INSTALL PLUGIN CONFIG ------------------ # endif(CMAKE_HOST_UNIX) + diff --git a/cmake/platforms/utils.cmake b/cmake/platforms/utils.cmake new file mode 100644 index 0000000..74fc596 --- /dev/null +++ b/cmake/platforms/utils.cmake @@ -0,0 +1,40 @@ +# utils.cmake + # 定义一些其它工具函数 + +# get_current_platform_lib_name <_VAR> <_IS_IS_SHREAD> <_LIB> + # _VAR 用于存储内容的变量 + # _IS_IS_SHREAD 是否为共享库 + # _LIB 目标名称 +function(get_current_platform_lib_name _VAR _IS_SHREAD _LIB) + set(_LIB_NAME "") + if(WIN32) + set(_LIB_NAME ${_LIB}.lib) + elseif(UNIX AND NOT APPLE) + if(${_IS_SHREAD}) + set(_LIB_NAME lib${_LIB}.so) + else() + set(_LIB_NAME lib${_LIB}.a) + endif(${_IS_SHREAD}) + elseif(APPLE) + if(${_IS_SHREAD}) + set(_LIB_NAME lib${_LIB}.dylib) + else() + set(_LIB_NAME lib${_LIB}.a) + endif(${_IS_SHREAD}) + else() + message("ERROR: Unknow current platform") + set(_LIB_NAME ${_LIB}) + endif() + message("[utils.cmake] get_current_platform_lib_name: ${_LIB}(${_LIB_NAME}) ") + set(${_VAR} ${_LIB_NAME} PARENT_SCOPE) +endfunction(get_current_platform_lib_name _VAR _IS_SHREAD _LIB) +# 获取当前平台的 lib 名称 +# 在 Windows 中 + # 用于编译的静态库与动态库后缀相同: .lib + # 并且不是 lib 开头 +# 在 Linux 中 + # 用于编译的静态库与动态库后缀分别是:.a 与 .so + # 文件名称由 lib 开头 +# 在 MacOS 中 + # 用于编译的静态库与动态库后缀分别是:.a 与 .dylib + # 文件名称由 lib 开头 diff --git a/cmake/platforms/windows-universal.cmake b/cmake/platforms/windows-universal.cmake index 0e9f9ae..e9a3d5e 100644 --- a/cmake/platforms/windows-universal.cmake +++ b/cmake/platforms/windows-universal.cmake @@ -40,6 +40,12 @@ if(CMAKE_HOST_WIN32) # 定义一些扩展内容,主要是提供给 CMake 模块文件填充 set(NOTEPAD_PLUGIN_CORELIB QSci) # QSci 为构建的 QScintllia 库 + # 将当前平台构建的目标转为平台下的库名称 + include(cmake/platforms/utils.cmake) + get_current_platform_lib_name(NOTEPAD_PLUGIN_CORELIB_NAME + ${NOTEPAD_BUILD_BY_SHARED} + QSci) + # 定义在插件开发的 CMake 模块中,Notepad-- 是否是基于 QT5 实现 # 并自动为插件开发层自动开启相关 Qt 依赖组件 # 此部分逻辑将自动提供给 add_notepad_plugin 自行处理 -- Gitee From 4da546af6cf69bc5f3b6f82128c064ea3241abce Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 15:22:32 +0800 Subject: [PATCH 060/102] =?UTF-8?q?repo:=20=E8=A1=A5=E5=85=85=E9=81=97?= =?UTF-8?q?=E6=BC=8F=E7=9A=84=E6=8F=92=E4=BB=B6=E6=A8=A1=E5=9D=97=E6=94=B9?= =?UTF-8?q?=E8=BF=9B=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index e6bed80..7b94017 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -20,6 +20,8 @@ set(NOTEPAD_BUILD_BY_QT5 @NOTEPAD_BUILD_BY_QT5@) set(NOTEPAD_BUILD_BY_QT6 @NOTEPAD_BUILD_BY_QT6@) set(NOTEPAD_BUILD_BY_SHARED @NOTEPAD_BUILD_BY_SHARED@) set(NOTEPAD_PLUGIN_CORELIB @NOTEPAD_PLUGIN_CORELIB@) +set(NOTEPAD_PLUGIN_CORELIB_NAME @NOTEPAD_PLUGIN_CORELIB_NAME@) + # 由插件开发者进行参考的 "Notepad 提供的插件安装目录(位置)" set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY @NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_DIRECTORY@) @@ -74,20 +76,18 @@ if(NOTEPAD_BUILD_BY_QT6) endif(NOTEPAD_BUILD_BY_QT6) if(NOTEPAD_BUILD_BY_SHARED) - set(NOTEPAD_IMPORTED_CORELIB_PATH ${NOTEPAD_PLUGIN_LIBDIR}/lib${NOTEPAD_PLUGIN_CORELIB}.so) add_library(${NOTEPAD_PLUGIN} SHARED IMPORTED) set_target_properties(${${NOTEPAD_PLUGIN}} PROPERTIES IMPORTED_LOCATION - ${NOTEPAD_IMPORTED_CORELIB_PATH} + ${NOTEPAD_PLUGIN_LIBDIR}/${NOTEPAD_PLUGIN_CORELIB_NAME} INCLUDE_DIRECTORIES "${NOTEPAD_PLUGIN_INCLUDEDIR}" ) else() - set(NOTEPAD_IMPORTED_CORELIB_PATH ${NOTEPAD_PLUGIN_LIBDIR}/lib${NOTEPAD_PLUGIN_CORELIB}.a) add_library(${NOTEPAD_PLUGIN} STATIC IMPORTED) set_target_properties(${${NOTEPAD_PLUGIN}} PROPERTIES IMPORTED_LOCATION - ${NOTEPAD_IMPORTED_CORELIB_PATH} + ${NOTEPAD_PLUGIN_LIBDIR}/${NOTEPAD_PLUGIN_CORELIB_NAME} INCLUDE_DIRECTORIES "${NOTEPAD_PLUGIN_INCLUDEDIR}" ) @@ -226,5 +226,5 @@ message(" - ${CMAKE_CURRENT_LIST_FILE}") message(" - ${NOTEPAD_PLUGIN_INCLUDEDIR}") message(" - ${NOTEPAD_PLUGIN_LIBDIR}") message(" - ${NOTEPAD_PLUGIN_CORELIB}") -message(" - ${NOTEPAD_IMPORTED_CORELIB_PATH}") +message(" - ${NOTEPAD_PLUGIN_CORELIB_NAME}") message("- >>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<") -- Gitee From e44e49f614fa5bbdffb17bfe7b794aaebb23cad1 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 15:26:32 +0800 Subject: [PATCH 061/102] =?UTF-8?q?cmake/platforms:=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=20QSci=20=E8=A2=AB=E6=9E=84=E5=BB=BA=E4=B8=BA=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=BA=93=E6=97=B6=20Notepad--=20=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/modules/Notepad--.cmake | 1 + cmake/platforms/windows-deployqt.cmake | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cmake/modules/Notepad--.cmake b/cmake/modules/Notepad--.cmake index b7a79dc..cc0f8c0 100644 --- a/cmake/modules/Notepad--.cmake +++ b/cmake/modules/Notepad--.cmake @@ -26,6 +26,7 @@ if(TRUE) ) # target_link_libraries(${PROJECT_NAME} QSci) target_link_QSci(${PROJECT_NAME}) + target_link_qt5_PrintSupport(${PROJECT_NAME}) target_link_qt5_XmlPatterns(${PROJECT_NAME}) endif(TRUE) diff --git a/cmake/platforms/windows-deployqt.cmake b/cmake/platforms/windows-deployqt.cmake index 8d5bdc4..faa970a 100644 --- a/cmake/platforms/windows-deployqt.cmake +++ b/cmake/platforms/windows-deployqt.cmake @@ -23,8 +23,8 @@ if(WINDOWS_DEPLOY_QT) endif() if (WINDOWS_DEPLOY_QT5 OR WINDOWS_DEPLOY_QT6) - message(" -------- ${CMAKE_INSTALL_PREFIX} ---------- ") - message("${WINDOWS_QT_DIR}/../../../bin/windeployqt") + message("[windows-deployqt.cmake]: find windployqt tool") + message(" ${WINDOWS_QT_DIR}/../../../bin/windeployqt") # install(TARGETS ${PROJECT_NAME} # DESTINATION ${CMAKE_BINARY_DIR}/windows-deployqt) @@ -48,7 +48,22 @@ if(WINDOWS_DEPLOY_QT) # LIBRARY_OUTPUT_DIRECTORY "" # 可执行文件生成目录 RUNTIME_OUTPUT_DIRECTORY ${WINDOWS_APPLICATION_DEPLOY_PATH}) - + + # 如果 QSci 构建为动态库,那么它生成的位置也应该是与 Notepad-- 输出到同一个位置 + # 用于支撑 Notepad-- 的 Debug 运行时 + if(NOTEPAD_BUILD_BY_SHARED) + set_target_properties(QSci + PROPERTIES + # 这是一个 WIN32 程序,即可执行文件不再出现黑窗口,转而使用 WinMain(某种 Windows 内部特性) + WIN32_EXECUTABLE true + # 静态库生成目录 + # ARCHIVE_OUTPUT_DIRECTORY "" + # 动态库生成目录 + # LIBRARY_OUTPUT_DIRECTORY "" + # 可执行文件生成目录 + RUNTIME_OUTPUT_DIRECTORY ${WINDOWS_APPLICATION_DEPLOY_PATH}) + endif(NOTEPAD_BUILD_BY_SHARED) + # 自动化构建 Windows Deploy Qt Application # 参考: windeployqt --qmldir add_custom_command(TARGET ${PROJECT_NAME} -- Gitee From 6e61c0bd2b9841837644e5052b0e45f66648badb Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 15:58:05 +0800 Subject: [PATCH 062/102] =?UTF-8?q?windeployqt:=20=20=E5=A4=84=E7=90=86=20?= =?UTF-8?q?QSci=20=E6=9E=84=E5=BB=BA=E4=B8=BA=E5=8A=A8=E6=80=81=E5=BA=93?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E5=85=B3=E8=81=94=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当 QSci 需要构建为动态库时,就已经开始导致了关联性错误,这个与原始分支上的预期的方案不符 1. 需要处理运行时生成位置,将运行时与 Notepad-- 保持在一个目录下 2. 处理此动态库的依赖问题,将依赖进行导出,由于 windeployqt 未解析出 Notepad-- 间接的动态库依赖 需要以 QSci 为主体进行部署生成缺失的部分 3. 在安装时,依然需要将动态库生成部署生成,这是一个非常让构建者烦恼的问题 --- cmake/platforms/windows-deployqt.cmake | 68 ++++++++++++++++++++------ 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/cmake/platforms/windows-deployqt.cmake b/cmake/platforms/windows-deployqt.cmake index faa970a..675dc12 100644 --- a/cmake/platforms/windows-deployqt.cmake +++ b/cmake/platforms/windows-deployqt.cmake @@ -49,21 +49,6 @@ if(WINDOWS_DEPLOY_QT) # 可执行文件生成目录 RUNTIME_OUTPUT_DIRECTORY ${WINDOWS_APPLICATION_DEPLOY_PATH}) - # 如果 QSci 构建为动态库,那么它生成的位置也应该是与 Notepad-- 输出到同一个位置 - # 用于支撑 Notepad-- 的 Debug 运行时 - if(NOTEPAD_BUILD_BY_SHARED) - set_target_properties(QSci - PROPERTIES - # 这是一个 WIN32 程序,即可执行文件不再出现黑窗口,转而使用 WinMain(某种 Windows 内部特性) - WIN32_EXECUTABLE true - # 静态库生成目录 - # ARCHIVE_OUTPUT_DIRECTORY "" - # 动态库生成目录 - # LIBRARY_OUTPUT_DIRECTORY "" - # 可执行文件生成目录 - RUNTIME_OUTPUT_DIRECTORY ${WINDOWS_APPLICATION_DEPLOY_PATH}) - endif(NOTEPAD_BUILD_BY_SHARED) - # 自动化构建 Windows Deploy Qt Application # 参考: windeployqt --qmldir add_custom_command(TARGET ${PROJECT_NAME} @@ -104,6 +89,59 @@ if(WINDOWS_DEPLOY_QT) --dir ${CMAKE_INSTALL_PREFIX}/bin ) + # ---------------------------------- QSci ---------------------------------- # + + # 当 QSci 需要构建为动态库时,就已经开始导致了关联性错误,这个与原始分支上的预期的方案不符 + # 1. 需要处理运行时生成位置,将运行时与 Notepad-- 保持在一个目录下 + # 2. 处理此动态库的依赖问题,将依赖进行导出,由于 windeployqt 未解析出 Notepad-- 间接的动态库依赖 + # 需要以 QSci 为主体进行部署生成缺失的部分 + # 3. 在安装时,依然需要将动态库生成部署生成,这是一个非常让构建者烦恼的问题 + + if(NOTEPAD_BUILD_BY_SHARED) + # 如果 QSci 构建为动态库,那么它生成的位置也应该是与 Notepad-- 输出到同一个位置 + # 用于支撑 Notepad-- 的 Debug 运行时, 以及安装的续接操作 + set_target_properties(QSci + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${WINDOWS_APPLICATION_DEPLOY_PATH}) + + add_custom_command(TARGET QSci + # 在构建之后计划进行执行以下命令 + POST_BUILD + # 即将在构建目录中 + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + # 执行以下命令进行 windeployqt + COMMAND ${WINDOWS_QT_DIR}/../../../bin/windeployqt + # + ${WINDOWS_APPLICATION_DEPLOY_PATH}/QSci.dll + + # 扫描QML-从目录开始导入。 + --qmlimport ${WINDOWS_QT_DIR}/../../../qml + # 部署编译器运行时(仅限桌面)。 + --compiler-runtime + # 详细级别(0-2) + --verbose 2 + # 部署运行时使用指定的目录 + --dir ${WINDOWS_APPLICATION_DEPLOY_PATH} + ) + + add_custom_target(TARGET windows-deployqt + POST_BUILD + COMMAND ${WINDOWS_QT_DIR}/../../../bin/windeployqt + # + ${WINDOWS_APPLICATION_DEPLOY_PATH}/QSci.dll + + # 扫描QML-从目录开始导入。 + --qmlimport ${WINDOWS_QT_DIR}/../../../qml + # 部署编译器运行时(仅限桌面)。 + --compiler-runtime + # 详细级别(0-2) + --verbose 2 + # 部署运行时使用指定的目录 + --dir ${CMAKE_INSTALL_PREFIX}/bin + ) + + endif(NOTEPAD_BUILD_BY_SHARED) + endif (WINDOWS_DEPLOY_QT5 OR WINDOWS_DEPLOY_QT6) endif(WINDOWS_DEPLOY_QT) \ No newline at end of file -- Gitee From bb2002fbbf4b78e496b053bfca83bad0ea681c84 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 16:06:30 +0800 Subject: [PATCH 063/102] =?UTF-8?q?windeployqt:=20=E5=B0=86=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=97=B6=E8=87=AA=E5=8A=A8=E5=8C=96=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=20target=20=E6=94=B9=E4=B8=BA=20com?= =?UTF-8?q?mand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/windows-deployqt.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/platforms/windows-deployqt.cmake b/cmake/platforms/windows-deployqt.cmake index 675dc12..550af12 100644 --- a/cmake/platforms/windows-deployqt.cmake +++ b/cmake/platforms/windows-deployqt.cmake @@ -124,7 +124,7 @@ if(WINDOWS_DEPLOY_QT) --dir ${WINDOWS_APPLICATION_DEPLOY_PATH} ) - add_custom_target(TARGET windows-deployqt + add_custom_command(TARGET windows-deployqt POST_BUILD COMMAND ${WINDOWS_QT_DIR}/../../../bin/windeployqt # -- Gitee From 700bc7235e72438f139d6de98e27d8af8a93ff51 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 16:41:25 +0800 Subject: [PATCH 064/102] =?UTF-8?q?plugin-cmake:=20=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E8=A2=AB=E9=94=99=E8=AF=AF=E5=BA=9F=E5=BC=83=E7=9A=84=E9=83=A8?= =?UTF-8?q?=E5=88=86=EF=BC=8C=E6=9E=84=E5=BB=BA=E6=8F=92=E4=BB=B6=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=98=8E=E7=A1=AE=E5=A3=B0=E6=98=8E=20QSCINTILLA=5FDL?= =?UTF-8?q?L?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/NotepadPluginConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/NotepadPluginConfig.cmake.in b/cmake/NotepadPluginConfig.cmake.in index 7b94017..6a6e865 100644 --- a/cmake/NotepadPluginConfig.cmake.in +++ b/cmake/NotepadPluginConfig.cmake.in @@ -201,7 +201,7 @@ macro(add_notepad_plugin PLUGIN_VAR PLUGIN_SRC) target_compile_definitions(${PLUGIN_VAR} PUBLIC NOTEPAD_PLUGIN_MANAGER - # QSCINTILLA_DLL # 废弃,插件构建中不需要明确显式声明此宏 + QSCINTILLA_DLL # 取消废弃,一些插件的构建中测试为需要明确显式声明此宏 ) else() target_compile_definitions(${PLUGIN_VAR} -- Gitee From 322d37530619fd35b35047f71c78518d232cdd11 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 22 Feb 2023 17:07:21 +0800 Subject: [PATCH 065/102] =?UTF-8?q?cmake/platforms:=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=8C=BA=E5=88=86=E7=B1=BB=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E5=8E=9F=E5=A7=8B=E5=B9=B3=E5=8F=B0=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/linux.cmake | 113 -------------------------- cmake/platforms/macos-universal.cmake | 5 ++ cmake/platforms/macos.cmake | 0 cmake/platforms/windows.cmake | 80 ------------------ 4 files changed, 5 insertions(+), 193 deletions(-) delete mode 100644 cmake/platforms/linux.cmake create mode 100644 cmake/platforms/macos-universal.cmake delete mode 100644 cmake/platforms/macos.cmake delete mode 100644 cmake/platforms/windows.cmake diff --git a/cmake/platforms/linux.cmake b/cmake/platforms/linux.cmake deleted file mode 100644 index 9a16591..0000000 --- a/cmake/platforms/linux.cmake +++ /dev/null @@ -1,113 +0,0 @@ - -# 可能需要变更为 CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" ?? -# 并使用 Linux.cmake 维护? -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= - # 有关此 %F 参数可查看: https://gitee.com/zinface/z-tools/blob/desktop-dev/src/DesktopGenerater/desktopexecparamdialog.cpp - "notepad-- %F" - # 图标路径: 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}) - - # 完成:如果主线已经将 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 ------------------ # - # ------------------ 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) - # 定义一些扩展内容,主要是提供给 CMake 模块文件填充 - set(NOTEPAD_PLUGIN_CORELIB QSci) # QSci 为构建的 QScintllia 库 - - # 定义在插件开发的 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 "") - - # 这些是在此部分安装时使用,但不被用于填充 NotepadPlugin.cmake.in 的内容 - set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN}) - set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN}) - - - # 将 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) - # 安装开发插件高级功能所需要的内容 - spark_install_directory(${NOTEPAD_PLUGIN_INCLUDEDIR}/qscint - src/qscint/scintilla) - - # 导出 QSci 的头文件(从插件实现层面来看,目前是使用*.h 与 pluginGl.h - # 但从 Qsci 层面来看,*.h 使用的是 #include ,所以此部分不被使用) - # 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 构建 - 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) - -endif(CMAKE_HOST_UNIX) diff --git a/cmake/platforms/macos-universal.cmake b/cmake/platforms/macos-universal.cmake new file mode 100644 index 0000000..fc15ab6 --- /dev/null +++ b/cmake/platforms/macos-universal.cmake @@ -0,0 +1,5 @@ +# macos-universal.cmake + +if(USE_MACOS_UNIVERSAL) + +endif(USE_MACOS_UNIVERSAL) diff --git a/cmake/platforms/macos.cmake b/cmake/platforms/macos.cmake deleted file mode 100644 index e69de29..0000000 diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake deleted file mode 100644 index f3648d8..0000000 --- a/cmake/platforms/windows.cmake +++ /dev/null @@ -1,80 +0,0 @@ - -if(CMAKE_HOST_WIN32) - include(cmake/SparkInstallMacrosConfig.cmake) - # ------------------ INSTALL PLUGIN CONFIG ------------------ # - # ------------------ INSTALL PLUGIN CONFIG ------------------ # - # ------------------ INSTALL PLUGIN CONFIG ------------------ # - include(CMakePackageConfigHelpers) - include(GNUInstallDirs) - - # 定义插件配置安装位置 - # set(CMAKE_INSTALL_PREFIX "/usr") # 仅限 Linux ,Windows 中不使用 - set(NOTEPAD_PLUGIN NotepadPlugin) - - # 定义开发插件时的配置目录与 CMake 模块文件名称 - set(NOTEPAD_PLUGIN_CONFIG ${NOTEPAD_PLUGIN}Config.cmake) - # 定义一些扩展内容,主要是提供给 CMake 模块文件填充 - set(NOTEPAD_PLUGIN_CORELIB QSci) # QSci 为构建的 QScintllia 库 - - # 定义在插件开发的 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 "") - - # 这些是在此部分安装时使用,但不被用于填充 NotepadPlugin.cmake.in 的内容 - set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN}) - set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN}) - - - # 将 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) - # 安装开发插件高级功能所需要的内容 - spark_install_directory(${NOTEPAD_PLUGIN_INCLUDEDIR}/qscint - src/qscint/scintilla) - - # 导出 QSci 的头文件(从插件实现层面来看,目前是使用*.h 与 pluginGl.h - # 但从 Qsci 层面来看,*.h 使用的是 #include ,所以此部分不被使用) - # 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 ------------------ # - - message(" -------- ${CMAKE_INSTALL_PREFIX} ---------- ") - message("${Qt5_DIR}/../../../bin/windeployqt") - - # 1. 在顶层构建中导入 WindowsQtDeploy 的构建 - # 自动化构建 Windows Qt 部署功能 - add_custom_target(windeployqt - COMMAND ${Qt5_DIR}/../../../bin/windeployqt ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.exe --compiler-runtime --verbose 2 --dir ${CMAKE_BINARY_DIR}/winqt/) - -endif(CMAKE_HOST_WIN32) - -- Gitee From 4b1f268d1c62a9abdf7be9209f303994962e2e08 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 23 Feb 2023 10:58:39 +0800 Subject: [PATCH 066/102] =?UTF-8?q?readme:=20=E6=9B=B4=E6=96=B0=20Linux=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d29932f..6c5cbf4 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,65 @@ NDD已初步推出插件编写功能,希望广大的CPP/QT开发者加入我 **CMake工具链编译说明:** -- Ubuntu/Debian - -1. 安装编译环境 `sudo apt-get install g++ make cmake` -1. 安装qt工具和库 `sudo apt-get install qtbase5-dev qt5-qmake qtbase5-dev-tools libqt5printsupport5 libqt5xmlpatterns5-dev ` -1. 配置 `cmake -B build -DCMAKE_BUILD_TYPE=Release` -1. 编译 `cd build && make -j` -1. 打包 `cpack` +- 当前的 Linux 平台构建方案 + + ```shell + Build with the following configuration: + 1. make -f linux-universal.mk + 默认的通用 Linux 平台构建. + 2. make -f linux-debian.mk package + 通用 Linux 平台的 Debian deb 构建. + 3. make -f linux-appimage.mk package + 通用 Linux 平台的 Appimage 构建. + 4. make -f linux-uos.mk package + 独立 Linux 平台的 Uos 构建. + ``` + +- Linux 通用构建系列(*仅适合**配合其它打包方案**操作*) - 基于默认的通用 Linux 平台构建. + + ```shell + # 构建默认的 + make -f linux-universal.mk + # 进入构建目录 + cd build/linux-universal + # 执行 make install 安装到 out 目录,得到一个标准 linux 的目录结构 + make DESTDIR=out install + ``` + +- Ubuntu/Debian - 基于通用 Linux 平台的 Debian deb 构建 + + ```shell + # 安装编译环境 + sudo apt-get install g++ make cmake + # 安装qt工具和库 + sudo apt-get install qtbase5-dev qt5-qmake qtbase5-dev-tools \ + libqt5printsupport5 libqt5xmlpatterns5-dev + # 构建 Linux Debian 通用平台 + make -f linux-debian.mk package + + # 将在 build/linux-debian 目录中产生 deb 文件 + # 其它相关内容将不定期更新说明 + ``` + +- Linux 跨发行版构建 Appimage - 基于通用 Linux 平台的 Appimage 构建 + + ```shell + # 在支持编译 Notepad-- 或 Qt 程序的 Linux 平台中 + make -f linux-appimage.mk package + + # 将在 build/linux-appimage 目录中产生 Appimage 文件 + ``` + +- Linux Uos 发行版构建(仅可在 Uos 中构建) - 基于独立 Linux 平台的 Uos 构建. + + ```shell + # 在支持编译 Notepad-- 或 Qt 程序的 Uos 平台中 + make -f linux-uos.mk package + + # 将在 build/linux-uos 目录中产生 deb 文件 + # 所有的内容将安装到 /opt/apps/com.hmja.notepad + # 仅适用于 Uos 系统构建,切不可使用其它发行版本,原生Qt库版本较低 + ``` - ArchLinux -- Gitee From 3dbda721fce8513e10250f0d864298a774c2308b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=AC=E5=B1=B1=E8=99=8E?= Date: Thu, 23 Feb 2023 03:55:07 +0000 Subject: [PATCH 067/102] update cmake/package-deb.descript. --- cmake/package-deb.descript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/package-deb.descript b/cmake/package-deb.descript index c187afe..0b78a1b 100644 --- a/cmake/package-deb.descript +++ b/cmake/package-deb.descript @@ -36,7 +36,7 @@ Priority: optional # 软件包依赖 Depends: # 软件包维护者(组织或个人) -Maintainer: 尹作为 <757210198@qq.com> +Maintainer: Ndd开源组织 <757210198@qq.com> # 软件包主页 Homepage: https://gitee.com/cxasm/notepad-- # 软件包建议 -- Gitee From cf0ca0504f5922933ebf311e137ab4be7be40626 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 23 Feb 2023 20:53:08 +0800 Subject: [PATCH 068/102] =?UTF-8?q?cmake/appimage:=20=E4=B8=BA=20SparkAppi?= =?UTF-8?q?mageConfig.cmake=20=E8=BF=9B=E8=A1=8C=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/SparkAppimageConfig.cmake | 37 ++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/cmake/SparkAppimageConfig.cmake b/cmake/SparkAppimageConfig.cmake index 7463a48..40649f8 100644 --- a/cmake/SparkAppimageConfig.cmake +++ b/cmake/SparkAppimageConfig.cmake @@ -1,15 +1,28 @@ -# 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 +# SparkAppimageConfig.cmake + +# 1. 在使用时通过准备默认的 icon 与 SparkDesktopConfig.cmake 在生成 desktop 文件 + # 时进行借用 desktop 文件中的基本描述完成 spark-appimage.dekstop 文件的生成, + # 并在使用 add_appimage 时完成所有逻辑判断与目标的定义 + # add_appimage_icon + # add_appimage_desktop + # add_appimage + +# 2. 在 add_appimage 中,我们判断了是否为 cmake 提供了 LINUXDEPLOYQT 宏, + # 并获取此工具的真实路径。并继续判断了 APPIMAGETOOL 宏与该工具的真实路径。 + # 然后,创建一个目录,用于即将进行的 Appimage 打包。 + + # 通过调用 target_linuxdeploy() 来完成 linuxdeploy 的目标创建 + # 通过调用 target_appimage() 来完成 appimage 的目标创建 + +# 3. 对于 linuxdeploy 目标,大致上就是通过执行 linuxdeployqt 命令与 -appimage + # 参数来创建可用于 Appimage 打包的内容结构,并且使用一些参数来处理相关库的依赖。 + # 其次就是,将 spark-appimage.desktop 复制为 default.desktop + # 另一个就是 spark-appimage.png 复制为 default.png + +# 4. 对于 appimage 目标,大致上就是通过执行 appimagetool 命令将准备好打包的目录 + # 结构进行打包为 Appimage 可执行文件,其中为了避免可能缺失的文件,重复了对 + # default.desktop 文件与 default.png 文件的生成。 + # 这是一个依赖的 copy-desktop-appimage 目标,并先行执行 # if () set(APPIMAGE_OUTPUT "${CMAKE_BINARY_DIR}/appimage") -- Gitee From ef7c559ea2221822f9d61c5d8fd09bc2f8def2f3 Mon Sep 17 00:00:00 2001 From: asc Date: Sun, 26 Feb 2023 16:40:45 +0800 Subject: [PATCH 069/102] =?UTF-8?q?window=E4=B8=8Bmingw32-make=20cmake=20m?= =?UTF-8?q?sbuild=20cl=20=E5=B7=A5=E5=85=B7=E9=93=BE=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- win-mingw-make-msbuild.mk | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 win-mingw-make-msbuild.mk diff --git a/win-mingw-make-msbuild.mk b/win-mingw-make-msbuild.mk new file mode 100644 index 0000000..f67c67c --- /dev/null +++ b/win-mingw-make-msbuild.mk @@ -0,0 +1,37 @@ + +# 基于 powershell 环境编写 +# windows 下mingw32-make.exe cmake.exe msbuild.exe cl.exe工具链编译 +# 使用方式 mingw32-make -f win-mingw-make-msbuild.mk + +# 填入cmake程序完整路径 +CMAKE_TOOL:=D:\Soft\mingw64\bin\cmake.exe +# 填入cpack程序完整路径 +CPACK_TOOL:=D:\Soft\mingw64\bin\cpack.exe +# 填入MSVC工具链路径 +# 填入msbuild程序完整路径 +MSBUILD_TOOL:=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe +# 填入cl程序完整路径 +CL_COMPILER:=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe + +# 填入Qt的msvc相关工具安装路径 +# 填入MSVC Qt库查找路径 +Qt_MSVC_PREFIX_PATH:=d:\Soft\Qt\5.15.2\msvc2019_64 + +NUM_LOGICAL_PROCESSOR=$(shell powershell (Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors) + +ifneq ($(shell powershell Test-Path build\bin\plugin), True) + MKDIR:=mkdir -p build\bin\plugin +endif + +all:msvc + +msvc: + ${CMAKE_TOOL} -Bbuild -DCMAKE_BUILD_TYPE=Release -DPLUGIN_EN=on -DCMAKE_PREFIX_PATH=${Qt_MSVC_PREFIX_PATH} . + ${CMAKE_TOOL} --build ./build --config=Release -j${NUM_LOGICAL_PROCESSOR} + $(shell powershell New-Item -ErrorAction SilentlyContinue -Type Directory build\bin\plugin) + $(shell powershell cp -Force build\Release\NotePad--.exe build\bin\) + cd build/bin && ${Qt_MSVC_PREFIX_PATH}\bin\windeployqt.exe --qmldir=${Qt_MSVC_PREFIX_PATH}\bin\qml NotePad--.exe + $(shell powershell cp -r -Force build\src\*\*\Release\*.dll build\bin\plugin) + $(shell powershell cp -r -Force build\src\*\Release\*.lib build\bin\plugin) + cd build && ${CPACK_TOOL} --config CPackConfig.cmake + -- Gitee From 60b2c4eafb48a46f4e5d46eaa0d85dedca828ec9 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 26 Feb 2023 19:56:29 +0800 Subject: [PATCH 070/102] =?UTF-8?q?repo:=20=E7=94=A8=E4=BA=8E=20Windows=20?= =?UTF-8?q?=E4=B8=AD=E4=BD=BF=E7=94=A8=20VSCode=20=E6=9E=84=E5=BB=BA=20Not?= =?UTF-8?q?epad--=20=E7=9A=84=E5=B7=A5=E4=BD=9C=E5=8C=BA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/vscode/README.md | 14 ++++++++++ cmake/vscode/windows-vs-2022-cmake-ninja.json | 28 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 cmake/vscode/README.md create mode 100644 cmake/vscode/windows-vs-2022-cmake-ninja.json diff --git a/cmake/vscode/README.md b/cmake/vscode/README.md new file mode 100644 index 0000000..9a81c94 --- /dev/null +++ b/cmake/vscode/README.md @@ -0,0 +1,14 @@ +# 此处提供 vscode 工作区配置模板 + +> 根据提供的有限配置模板、进行修改可完成在 VSCode 中构建 Notepad-- 的工作 + +- windows-vs-2022-cmake-ninja.json + > 基于 Vistual Studio 2022 生成器安装的 CMake 组件 + + - 适用工具链: + 1. `Visual Studio 生成工具 2022 Release - amd64` + 2. `Visual Studio Community 2022 Release - amd64` + 3. ... + + - 注意: + 1. 工具链架构选择可能与 `msvc2017`、`msvc2017_64` 等路径有关 diff --git a/cmake/vscode/windows-vs-2022-cmake-ninja.json b/cmake/vscode/windows-vs-2022-cmake-ninja.json new file mode 100644 index 0000000..a909eb1 --- /dev/null +++ b/cmake/vscode/windows-vs-2022-cmake-ninja.json @@ -0,0 +1,28 @@ +{ + // 指定使用 Visual Studio Community 安装的 CMake 组件 + "cmake.cmakePath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe", + + // 配置生成器为 Nijia + "cmake.generator": "Ninja", + + // 要在配置时传递给 CMake 的参数 + "cmake.configureArgs": [ + // 为 CMake 指定生成器后使用的构建程序,来源于 CMake 组件 + "-DCMAKE_MAKE_PROGRAM='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja\\ninja.exe'", + // 为 CMake 指定查找 MSVC 构建支持的 Qt 库路径 + "-DCMAKE_PREFIX_PATH=C:\\Qt\\Qt5.14.2\\5.14.2\\msvc2017_64", + // 使用 Windows 通用构建配方 + "-DUSE_WINDOWS_UNIVERSAL=ON", + // 使用 Qt5 自动化 windeployqt + "-DWINDOWS_DEPLOY_QT=ON", + "-DWINDOWS_DEPLOY_QT5=ON", + ], + // 要在生成时传递给 CMake 的参数 + "cmake.buildArgs": [ + "-j20" + ], + // 要在生成时传递给基础生成工具的其他参数 + "cmake.buildToolArgs": [ + + ] +} \ No newline at end of file -- Gitee From 2f0d895230121bc77b1bc8b2d510f57609140bb0 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Feb 2023 00:43:56 +0800 Subject: [PATCH 071/102] =?UTF-8?q?qt5/6:=20=E6=8B=9F=E5=AE=9A=E5=AF=B9=20?= =?UTF-8?q?qt5=20=E4=B8=8E=20qt6=20=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd11dd5..d51a8c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,16 @@ cmake_minimum_required(VERSION 3.22) project(Notepad-- VERSION 1.22.0) +# -------------- Notepad -- 全局构建配置 ------------- # +option(USE_QT6 "使用 Qt6 进行编译本项目与随带所有内容" OFF) + include(cmake/SparkEnvConfig.cmake) include(cmake/SparkMacrosConfig.cmake) -include(cmake/SparkFindQt5Config.cmake) -# include(cmake/SparkFindQt6Config.cmake) +if(USE_QT6) + include(cmake/SparkFindQt6Config.cmake) +else() + include(cmake/SparkFindQt5Config.cmake) +endif(USE_QT6) include(cmake/SparkMacrosExtendConfig.cmake) -- Gitee From 8e977da6a5a52c369a843a996fa659c15996f801 Mon Sep 17 00:00:00 2001 From: zinface Date: Sun, 26 Feb 2023 22:42:28 +0800 Subject: [PATCH 072/102] =?UTF-8?q?cmake-dev:=20=E6=8B=9F=E5=AE=9A?= =?UTF-8?q?=E5=AF=B9=20qt5=20=E4=B8=8E=20qt6=20=E7=9A=84=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7=E6=9E=84=E5=BB=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/modules/Notepad--.cmake | 10 +++++++--- cmake/modules/QScint.cmake | 13 ++++++++++--- cmake/platforms/linux-universal.cmake | 5 +++++ cmake/platforms/windows-deployqt.cmake | 5 +++++ cmake/platforms/windows-universal.cmake | 5 +++++ 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/cmake/modules/Notepad--.cmake b/cmake/modules/Notepad--.cmake index cc0f8c0..daa0859 100644 --- a/cmake/modules/Notepad--.cmake +++ b/cmake/modules/Notepad--.cmake @@ -26,9 +26,13 @@ if(TRUE) ) # target_link_libraries(${PROJECT_NAME} QSci) target_link_QSci(${PROJECT_NAME}) - target_link_qt5_PrintSupport(${PROJECT_NAME}) - target_link_qt5_XmlPatterns(${PROJECT_NAME}) - + if(USE_QT6) + target_link_qt6_PrintSupport(${PROJECT_NAME}) + target_link_qt6_XmlPatterns(${PROJECT_NAME}) + else() + target_link_qt5_PrintSupport(${PROJECT_NAME}) + target_link_qt5_XmlPatterns(${PROJECT_NAME}) + endif(USE_QT6) endif(TRUE) # ----------------- Notepad-- 插件支持相关 ----------------- # diff --git a/cmake/modules/QScint.cmake b/cmake/modules/QScint.cmake index 8e20e25..d8d66c0 100644 --- a/cmake/modules/QScint.cmake +++ b/cmake/modules/QScint.cmake @@ -34,9 +34,16 @@ if(TRUE) 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) + if(USE_QT6) + target_link_qt6(QSci) + target_link_qt6_Core5Compat(QSci) + target_link_qt6_PrintSupport(QSci) + target_link_qt6_Concurrent(QSci) + else() + target_link_qt5(QSci) + target_link_qt5_PrintSupport(QSci) + target_link_qt5_Concurrent(QSci) + endif(USE_QT6) endif(TRUE) diff --git a/cmake/platforms/linux-universal.cmake b/cmake/platforms/linux-universal.cmake index a7575d2..598eddd 100644 --- a/cmake/platforms/linux-universal.cmake +++ b/cmake/platforms/linux-universal.cmake @@ -67,6 +67,11 @@ if(CMAKE_HOST_UNIX) set(NOTEPAD_BUILD_BY_QT5 TRUE) set(NOTEPAD_BUILD_BY_QT6 FALSE) + if(USE_QT6) + set(NOTEPAD_BUILD_BY_QT5 FALSE) + set(NOTEPAD_BUILD_BY_QT6 TRUE) + endif(USE_QT6) + # 定义在平台中插件应该安装的位置(待确定) # 定义在插件开发的 CMake 模块中,Notepad-- 是否将提供 "插件安装目录(位置)" set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY "") diff --git a/cmake/platforms/windows-deployqt.cmake b/cmake/platforms/windows-deployqt.cmake index 550af12..7f96b48 100644 --- a/cmake/platforms/windows-deployqt.cmake +++ b/cmake/platforms/windows-deployqt.cmake @@ -23,6 +23,11 @@ if(WINDOWS_DEPLOY_QT) endif() if (WINDOWS_DEPLOY_QT5 OR WINDOWS_DEPLOY_QT6) + + if(USE_QT6) + set(WINDOWS_QT_DIR "${Qt6_DIR}") + endif(USE_QT6) + message("[windows-deployqt.cmake]: find windployqt tool") message(" ${WINDOWS_QT_DIR}/../../../bin/windeployqt") diff --git a/cmake/platforms/windows-universal.cmake b/cmake/platforms/windows-universal.cmake index e9a3d5e..4c86e5b 100644 --- a/cmake/platforms/windows-universal.cmake +++ b/cmake/platforms/windows-universal.cmake @@ -52,6 +52,11 @@ if(CMAKE_HOST_WIN32) set(NOTEPAD_BUILD_BY_QT5 TRUE) set(NOTEPAD_BUILD_BY_QT6 FALSE) + if(USE_QT6) + set(NOTEPAD_BUILD_BY_QT5 FALSE) + set(NOTEPAD_BUILD_BY_QT6 TRUE) + endif(USE_QT6) + # 定义在平台中插件应该安装的位置(待确定) # 定义在插件开发的 CMake 模块中,Notepad-- 是否将提供 "插件安装目录(位置)" set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY "") -- Gitee From 6a3d4d4b99d0b7437d72ed77dd432cccbfdefe64 Mon Sep 17 00:00:00 2001 From: asc Date: Mon, 27 Feb 2023 20:26:26 +0800 Subject: [PATCH 073/102] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BA=86windows?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=85=8D=E7=BD=AE=E7=BC=96=E8=AF=91=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E7=9A=84=E8=87=AA=E5=8A=A8=E5=8C=96=E6=9E=84=E5=BB=BA?= =?UTF-8?q?bat=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- windows.bat | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 windows.bat diff --git a/CMakeLists.txt b/CMakeLists.txt index fd11dd5..be8b0a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.20) project(Notepad-- VERSION 1.22.0) diff --git a/windows.bat b/windows.bat new file mode 100644 index 0000000..4ae3d0b --- /dev/null +++ b/windows.bat @@ -0,0 +1,73 @@ +@echo off + +set build_dir=build +set source_dir=. +set generator=-G Ninja +set build_type_debug=Debug +set build_type_release=Relase +set build_type=%build_type_debug% +set universal=ON +set qt=ON +set qt5=ON +set qt6=OFF + + + +echo finding vcvars64.bat... +set vcvars= +for %%i in (C: D: E: F: G: H:) do ( + if exist %%i ( + pushd %%i\ + for /r %%j in (*vcvars64.bat) do ( + set vcvars=%%j + popd + goto :find_vcvars + ) + popd + ) +) + +:find_vcvars +if not "%vcvars%"=="" ( + call "%vcvars%" + echo config MSVC environment... +)else ( + echo error: could not find vcvars64.bat MSVC ENV config file. + goto :out +) + +echo finding qt msvc path... +set qt_msvc= +for %%i in (D: D: E: F: G: H:) do ( + if exist %%i ( + pushd %%i\ + for /d /r %%j in (*msvc20*) do ( + echo %%j + if exist %%j\bin ( + if exist %%j\bin\windeployqt.exe ( + if exist %%j\bin\Qt5Core.dll ( + set qt_msvc=%%j + popd + goto :find_qt_msvc + ) + ) + ) + ) + popd + ) +) + +:find_qt_msvc +if not "%qt_msvc%"=="" ( + echo config qt msvc path... +) else ( + echo error: could not find qt msvc path. + goto :out +) + +cmake -B%build_dir% CMAKE_BUILD_TYPE=%build_type% %generator% -DUSE_WINDOWS_UNIVERSAL=%universal% -DWINDOWS_DEPLOY_QT=%qt% -DWINDOWS_DEPLOY_QT5=%qt5% -DWINDOWS_DEPLOY_QT6=%qt6% -DCMAKE_PREFIX_PATH=%qt_msvc% %source_dir% +cmake --build %build_dir% -- +xcopy %build_dir%\windows-deployqt\Notepad--.app\bin\ %build_dir%\bin\ /e + +:out +pause \ No newline at end of file -- Gitee From 1e8c4bce1d914b3f776f192d5584668ff2f3ad18 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 28 Feb 2023 00:23:17 +0800 Subject: [PATCH 074/102] =?UTF-8?q?qt6-link:=20=E5=A4=84=E7=90=86=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=20Qt6=20XmlPatterns=20=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/modules/Notepad--.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/Notepad--.cmake b/cmake/modules/Notepad--.cmake index daa0859..692e7ac 100644 --- a/cmake/modules/Notepad--.cmake +++ b/cmake/modules/Notepad--.cmake @@ -28,7 +28,7 @@ if(TRUE) target_link_QSci(${PROJECT_NAME}) if(USE_QT6) target_link_qt6_PrintSupport(${PROJECT_NAME}) - target_link_qt6_XmlPatterns(${PROJECT_NAME}) + # target_link_qt6_XmlPatterns(${PROJECT_NAME}) # Bug 初期配置时无此依赖要求 else() target_link_qt5_PrintSupport(${PROJECT_NAME}) target_link_qt5_XmlPatterns(${PROJECT_NAME}) -- Gitee From 72c7a78d241b05d5f2b12b522144fa4cb0af65f9 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 28 Feb 2023 00:36:12 +0800 Subject: [PATCH 075/102] =?UTF-8?q?qt5/6:=20=E5=AE=8C=E6=88=90=E5=AF=B9?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=20QSci=20=E7=9A=84=20Qt6=20=E8=BD=AC?= =?UTF-8?q?=E5=8C=96=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/qscint/src/qscilexer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qscint/src/qscilexer.cpp b/src/qscint/src/qscilexer.cpp index 070a4a6..15bf5e8 100755 --- a/src/qscint/src/qscilexer.cpp +++ b/src/qscint/src/qscilexer.cpp @@ -907,7 +907,9 @@ const char* QsciLexer::getUserDefineKeywords() QString userLangFile = QString("notepad/userlang/%1").arg(m_tagName);//自定义语言中不能有.字符,否则可能有错,后续要检查 QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif if (!qs.contains("mz")) { -- Gitee From ac7263ca71e98f5523abf31e3cc249183d24efaa Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 28 Feb 2023 02:18:55 +0800 Subject: [PATCH 076/102] =?UTF-8?q?qt5/6:=20=E5=AE=8C=E6=88=90=E5=AF=B9?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=20Notepad--=20=E7=9A=84=20Qt6=20=E8=BD=AC?= =?UTF-8?q?=E5=8C=96=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/modules/Notepad--.cmake | 1 + src/CmpareMode.cpp | 9 +++++ src/batchfindreplace.cpp | 9 +++++ src/cceditor/ccnotepad.cpp | 34 ++++++++++++++++ src/draglineedit.cpp | 1 + src/encodeconvert.cpp | 1 + src/findresultwin.cpp | 32 +++++++++++++++ src/findwin.cpp | 5 +++ src/langextset.cpp | 5 +++ src/langstyledefine.cpp | 8 ++++ src/nddsetting.cpp | 4 ++ src/qtlangset.cpp | 74 ++++++++++++++++++----------------- src/scintillaeditview.cpp | 16 ++++++++ src/shortcutkeymgr.cpp | 4 ++ src/userlexdef.cpp | 4 ++ 15 files changed, 171 insertions(+), 36 deletions(-) diff --git a/cmake/modules/Notepad--.cmake b/cmake/modules/Notepad--.cmake index 692e7ac..510eb49 100644 --- a/cmake/modules/Notepad--.cmake +++ b/cmake/modules/Notepad--.cmake @@ -27,6 +27,7 @@ if(TRUE) # target_link_libraries(${PROJECT_NAME} QSci) target_link_QSci(${PROJECT_NAME}) if(USE_QT6) + target_link_qt6_Core5Compat(${PROJECT_NAME}) # 兼容性: Qt6 可使用 Core5Compat 少量更改 Qt5 部分 target_link_qt6_PrintSupport(${PROJECT_NAME}) # target_link_qt6_XmlPatterns(${PROJECT_NAME}) # Bug 初期配置时无此依赖要求 else() diff --git a/src/CmpareMode.cpp b/src/CmpareMode.cpp index f0618bd..a3a3051 100755 --- a/src/CmpareMode.cpp +++ b/src/CmpareMode.cpp @@ -10,6 +10,7 @@ #include #include #include +#include CmpareMode::CmpareMode() @@ -281,7 +282,11 @@ quint32 CmpareMode::readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fi else if (mode == 2) { QString temp = lineInfo.unicodeStr; + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8()); + #else + md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8()); + #endif } }; @@ -529,7 +534,11 @@ CODE_ID CmpareMode::readLineFromFile(uchar* m_fileFpr, const int fileLength, con else if (mode == 2) { QString temp = lineInfo.unicodeStr; + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8()); + #else + md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8()); + #endif } }; diff --git a/src/batchfindreplace.cpp b/src/batchfindreplace.cpp index 9dabbfc..1f7a4d2 100755 --- a/src/batchfindreplace.cpp +++ b/src/batchfindreplace.cpp @@ -6,6 +6,7 @@ #include #include +#include BatchFindReplace::BatchFindReplace(QWidget *parent) : QMainWindow(parent), m_curEditWin(nullptr), m_editTabWidget(nullptr) @@ -98,7 +99,11 @@ void BatchFindReplace::appendToFindReplaceTable(QStringList& findKeyword) bool BatchFindReplace::tranInputKeyword(QString& findKeyWord, QStringList& outputKeyWordList) { //把空白字符,空格或者\t \r\n 等字符进行替换为空格 +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QRegExp re("\\s"); +#else + QRegularExpression re("\\s"); +#endif findKeyWord.replace(re, QString(" ")); //再进行空格分隔处理 @@ -266,7 +271,9 @@ void BatchFindReplace::on_export() if (!fileName.isEmpty()) { QSettings setting(fileName, QSettings::IniFormat); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) setting.setIniCodec("UTF-8"); + #endif int rowNums = ui.findReplaceTable->rowCount(); @@ -312,7 +319,9 @@ void BatchFindReplace::on_import() QFileInfo fi(fileNameList[0]); QSettings setting(fi.filePath(), QSettings::IniFormat); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) setting.setIniCodec("UTF-8"); + #endif ui.findKeywordEdit->setPlainText(setting.value("find").toStringList().join(" ")); ui.replaceKeywordEdit->setPlainText(setting.value("replace").toStringList().join(" ")); diff --git a/src/cceditor/ccnotepad.cpp b/src/cceditor/ccnotepad.cpp index 18d491f..0a3cb13 100755 --- a/src/cceditor/ccnotepad.cpp +++ b/src/cceditor/ccnotepad.cpp @@ -535,7 +535,9 @@ void initFileTypeLangMap() //把新语言tagName,和关联ext单独存放起来ext_tag.ini。只读取一个文件就能获取所有,避免遍历慢 QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件 QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); + #endif QStringList keys = qs.allKeys(); //LangType lexId = L_USER_TXT; @@ -4730,7 +4732,11 @@ void CCNotePad::initFileListDockWin() } }); m_dockFileListWin->setAttribute(Qt::WA_DeleteOnClose); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) m_dockFileListWin->layout()->setMargin(0); + #else + m_dockFileListWin->layout()->setContentsMargins(0, 0, 0, 0); + #endif m_dockFileListWin->layout()->setSpacing(0); //暂时不提供关闭,因为关闭后需要同步菜单的check状态 @@ -5150,7 +5156,11 @@ void CCNotePad::saveTabEdit(int tabIndex) if (pEdit != nullptr) { //如果是新建的文件,则弹出保存对话框,进行保存 + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (pEdit->property(Edit_File_New) >= 0) + #else + if (pEdit->property(Edit_File_New).toString().length() >= 0) + #endif { QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)"); QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QString(), filter); @@ -5317,7 +5327,11 @@ void CCNotePad::slot_actionSaveAsFile_toggle(bool /*checked*/) if (pEdit != nullptr) { //如果是新建的文件,则弹出保存对话框,进行保存 + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (pEdit->property(Edit_File_New) >= 0) + #else + if (pEdit->property(Edit_File_New).toString().length() >= 0) + #endif { QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)"); QString fileName = QFileDialog::getSaveFileName(this, tr("Save File As ..."),QString(), filter); @@ -5619,7 +5633,11 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs) //把文件记录到qs中去 //index一定不能重复。n表示新建 //如果是新建的文件 + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (pEdit->property(Edit_File_New) >= 0) + #else + if (pEdit->property(Edit_File_New).toString().length() >= 0) + #endif { //不再保存新建的非脏文件。因为一定是空的,意义不大 //qs.setValue(QString("%1").arg(index), QString("%1|1").arg(fileName)); @@ -5639,7 +5657,11 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs) } //如果是新建的文件 +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (pEdit->property(Edit_File_New) >= 0) +#else + if (pEdit->property(Edit_File_New).toString().length() >= 0) +#endif { QString qsSavePath = qs.fileName(); @@ -5771,7 +5793,9 @@ void CCNotePad::closeAllFileStatic() { QString tempFileList = QString("notepad/temp/list"); QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif QString qsSavePath = qs.fileName(); QFileInfo fi(qsSavePath); QDir saveDir = fi.dir(); @@ -6312,7 +6336,9 @@ int CCNotePad::initFindWindow(FindTabIndex type) //从历史查找记录文件中加载 QString searchHistory = QString("notepad/searchHistory");//历史查找记录 QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); + #endif if (qs.contains("keys")) { @@ -6412,7 +6438,9 @@ void CCNotePad::slot_saveSearchHistory() //从历史查找记录文件中加载 QString searchHistory = QString("notepad/searchHistory");//历史查找记录 QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif if (s_findHistroy.count() > 15) { @@ -6639,7 +6667,11 @@ void CCNotePad::initFindResultDockWin() m_dockSelectTreeWin = new QDockWidget(tr("Find result"), this); connect(m_dockSelectTreeWin, &QDockWidget::dockLocationChanged, this, &CCNotePad::slot_findResultPosChangeed); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) m_dockSelectTreeWin->layout()->setMargin(0); + #else + m_dockSelectTreeWin->layout()->setContentsMargins(0, 0, 0, 0); + #endif m_dockSelectTreeWin->layout()->setSpacing(0); //暂时不提供关闭,因为关闭后需要同步菜单的check状态 @@ -8111,7 +8143,9 @@ int CCNotePad::restoreLastFiles() QString tempFileList = QString("notepad/temp/list"); QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif QStringList fileList = qs.allKeys(); //从小到大排序一下。这里是按照ASCII排序,不得行。 diff --git a/src/draglineedit.cpp b/src/draglineedit.cpp index a5e35ba..c5a14e9 100755 --- a/src/draglineedit.cpp +++ b/src/draglineedit.cpp @@ -1,4 +1,5 @@ #include "draglineedit.h" +#include DragLineEdit::DragLineEdit(QWidget *parent) : QLineEdit(parent) diff --git a/src/encodeconvert.cpp b/src/encodeconvert.cpp index c17022e..106eaea 100755 --- a/src/encodeconvert.cpp +++ b/src/encodeconvert.cpp @@ -11,6 +11,7 @@ #include #include #include +#include const int ITEM_CODE = Qt::UserRole + 1; diff --git a/src/findresultwin.cpp b/src/findresultwin.cpp index 228cba6..aa90574 100755 --- a/src/findresultwin.cpp +++ b/src/findresultwin.cpp @@ -208,12 +208,20 @@ void FindResultWin::slot_selectAll() //遍历下面的子节点 int i = 0; QModelIndex childMi; + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) childMi = sectionItem.child(i, 0); + #else + childMi = sectionItem.model()->index(i, 0); + #endif while (childMi.isValid()) { ++i; ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) childMi = sectionItem.child(i, 0); + #else + childMi = sectionItem.model()->index(i, 0); + #endif } return i+1; }; @@ -226,12 +234,20 @@ void FindResultWin::slot_selectAll() //遍历根节点下面每一个section { int i = 0; + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QModelIndex section = rootItem.child(i, 0); + #else + QModelIndex section = rootItem.model()->index(i, 0); + #endif while (section.isValid() && !section.data(ResultItemEditor).isNull()) { ++i; selectCount += selectSection(section); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) section = firstRootItem.child(i, 0); + #else + section = firstRootItem.model()->index(i, 0); + #endif } } @@ -255,12 +271,20 @@ void FindResultWin::slot_selectSection() //遍历下面的子节点 int i = 0; QModelIndex childMi; + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) childMi = sectionItem.child(i, 0); + #else + childMi = sectionItem.model()->index(i, 0); + #endif while (childMi.isValid()) { ++i; ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) childMi = sectionItem.child(i, 0); + #else + childMi = sectionItem.model()->index(i, 0); + #endif } return i+1; }; @@ -453,7 +477,11 @@ QString FindResultWin::highlightFindText(FindRecord& record) head = QString("%1").arg(head); src = QString("%1").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped()); tail = QString(utf8bytes.mid(tailStart)); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (tail > MAX_TAIL_LENGTH) + #else + if (tail.size() > MAX_TAIL_LENGTH) + #endif { tail = (tail.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped(); } @@ -488,7 +516,11 @@ QString FindResultWin::highlightFindText(FindRecord& record) src = QString("%1").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped()); QString tailContens = QString(utf8bytes.mid(tailStart)); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (tailContens > MAX_TAIL_LENGTH) + #else + if (tailContens.size() > MAX_TAIL_LENGTH) + #endif { tailContens = (tailContens.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped(); } diff --git a/src/findwin.cpp b/src/findwin.cpp index 55d97f6..1e5f228 100755 --- a/src/findwin.cpp +++ b/src/findwin.cpp @@ -621,8 +621,13 @@ bool readBase(const QChar * str, int * value, int base, int size) current = str[i]; if (current >= 'A') { + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) current = current.digitValue() & 0xdf; current = current.digitValue() - ('A' - '0' - 10); + #else + current = QChar(current.digitValue() & 0xdf); + current = QChar(current.digitValue() - ('A' - '0' - 10)); + #endif } else if (current > '9') return false; diff --git a/src/langextset.cpp b/src/langextset.cpp index a1db834..9513b49 100755 --- a/src/langextset.cpp +++ b/src/langextset.cpp @@ -7,6 +7,7 @@ #include #include #include +#include int ITEM_CHANGED = Qt::UserRole; int ITEM_LEX_ID = Qt::UserRole + 1; //对应的语法lexer的 ID @@ -113,7 +114,9 @@ void LangExtSet::slot_save() QString userLangFile = QString("notepad/tag_ext"); QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif for (int i = 0; i < rowNums; ++i) { @@ -180,7 +183,9 @@ void LangExtSet::loadExtRelevanceToMagr() { QString userLangFile = QString("notepad/tag_ext");//自定义语言中不能有.字符,否则可能有错,后续要检查 QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif if (!QFile::exists(qs.fileName())) { diff --git a/src/langstyledefine.cpp b/src/langstyledefine.cpp index 3945159..c9f941d 100755 --- a/src/langstyledefine.cpp +++ b/src/langstyledefine.cpp @@ -30,7 +30,9 @@ bool LangStyleDefine::readLangSetFile(QString langName, bool isLoadToUI) { QString userLangFile = QString("notepad/userlang/%1").arg(langName);//自定义语言中不能有.字符,否则可能有错,后续要检查 QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif qDebug() << qs.fileName(); if (!qs.contains("mz")) @@ -160,7 +162,9 @@ void LangStyleDefine::slot_save() //把新语言tagName,和关联ext单独存放起来。后面只读取一个文件就能获取所有,避免遍历慢 QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件 QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif QStringList extList = ui.extNameLe->text().trimmed().split(" "); extList.append(QString::number(motherLangs)); //最后一个是mother lexer @@ -201,7 +205,9 @@ void LangStyleDefine::slot_delete() { QString userLangFile = QString("notepad/userlang/%1").arg(name);//自定义语言中不能有.字符,否则可能有错,后续要检查 QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); + #endif //删除userlang下面的tag.ini QFile::remove(qs.fileName()); @@ -211,7 +217,9 @@ void LangStyleDefine::slot_delete() //把新语言在ext_tag中的关联文件记录也删除 QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件 QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); + #endif QStringList extList = qs.value(name).toStringList(); //更新当前ExtLexerManager::getInstance()。如果不更新,就要重启软件才能生效 diff --git a/src/nddsetting.cpp b/src/nddsetting.cpp index 9fdc03d..2938c30 100755 --- a/src/nddsetting.cpp +++ b/src/nddsetting.cpp @@ -50,7 +50,9 @@ void NddSetting::init() QString qsSetPath = qs.fileName(); s_nddSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) s_nddSet->setIniCodec("UTF-8"); +#endif bool initOk = true; auto initNddSet = []() { @@ -341,6 +343,8 @@ void NddSetting::winPosInit() QString qsSetPath = qs.fileName(); s_winPosSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir); + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) s_winPosSet->setIniCodec("UTF-8"); + #endif } } diff --git a/src/qtlangset.cpp b/src/qtlangset.cpp index 7262853..7a5ced3 100755 --- a/src/qtlangset.cpp +++ b/src/qtlangset.cpp @@ -382,7 +382,7 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) QsciLexer *pLexer = ScintillaEditView::createLexer(index); if (nullptr != pLexer) { - + switch (flag) { case GLOBAL_FONT: @@ -390,9 +390,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) //非全局修改所有的语法对应样式 if (index != L_GLOBAL) { - for (int i = 0; i <= 255; ++i) - { - if (!pLexer->description(i).isEmpty()) + for (int i = 0; i <= 255; ++i) + { + if (!pLexer->description(i).isEmpty()) { oldfont = pLexer->font(i); oldfont.setFamily(m_curStyleData.font.family()); @@ -423,9 +423,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) //非全局修改所有的语法对应样式 if (index != L_GLOBAL) { - for (int i = 0; i <= 255; ++i) - { - if (!pLexer->description(i).isEmpty()) + for (int i = 0; i <= 255; ++i) + { + if (!pLexer->description(i).isEmpty()) { oldfont = pLexer->font(i); oldfont.setPointSize(m_curStyleData.font.pointSize()); @@ -453,9 +453,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) break; case GLOBAL_FONT_BOLD: { - for (int i = 0; i <= 255; ++i) - { - if (!pLexer->description(i).isEmpty()) + for (int i = 0; i <= 255; ++i) + { + if (!pLexer->description(i).isEmpty()) { oldfont = pLexer->font(i); oldfont.setBold(m_curStyleData.font.bold()); @@ -466,9 +466,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) break; case GLOBAL_FONT_UNDERLINE: { - for (int i = 0; i <= 255; ++i) - { - if (!pLexer->description(i).isEmpty()) + for (int i = 0; i <= 255; ++i) + { + if (!pLexer->description(i).isEmpty()) { oldfont = pLexer->font(i); oldfont.setUnderline(m_curStyleData.font.underline()); @@ -479,9 +479,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) break; case GLOBAL_FONT_ITALIC: { - for (int i = 0; i <= 255; ++i) - { - if (!pLexer->description(i).isEmpty()) + for (int i = 0; i <= 255; ++i) + { + if (!pLexer->description(i).isEmpty()) { oldfont = pLexer->font(i); oldfont.setItalic(m_curStyleData.font.italic()); @@ -504,10 +504,10 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag) break; default: break; - } + } saveLangeSet(pLexer); - } + } delete pLexer; } @@ -558,7 +558,7 @@ void QtLangSet::restoreOriginLangAllStyle() { QFile::remove(qs.fileName()); } - + delete pLexer; pLexer = nullptr; @@ -605,12 +605,12 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag) QsciLexer *pLexer = ScintillaEditView::createLexer(index); QsciLexer *pOriginLexer = ScintillaEditView::createLexer(index,"",true); if (nullptr != pLexer) - { - for (int i = 0; i <= 255; ++i) - { - if (!pLexer->description(i).isEmpty()) - { - + { + for (int i = 0; i <= 255; ++i) + { + if (!pLexer->description(i).isEmpty()) + { + switch (flag) { case GLOBAL_FONT: @@ -666,11 +666,11 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag) break; default: break; - } - } + } + } } saveLangeSet(pLexer); - } + } delete pLexer; delete pOriginLexer; } @@ -826,7 +826,9 @@ bool QtLangSet::readLangSetFile(QString langName,QString &keyword, QString &moth { QString userLangFile = QString("notepad/userlang/%1").arg(langName);//自定义语言中不能有.字符,否则可能有错,后续要检查 QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif //qDebug() << qs.fileName(); if (!qs.contains("mz")) @@ -954,15 +956,15 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item) ExtLexerManager::getInstance()->getExtlistByLangTag(langName, extList); ui.extFileType->setText(extList.join(',')); - for (int i = 0; i <= 255; ++i) - { - QString desc = pLexer->description(i); - if (!desc.isEmpty()) - { + for (int i = 0; i <= 255; ++i) + { + QString desc = pLexer->description(i); + if (!desc.isEmpty()) + { QListWidgetItem *itemtemp = new QListWidgetItem(desc); - itemtemp->setData(Qt::UserRole, i); - ui.styleListWidget->addItem(itemtemp); - } + itemtemp->setData(Qt::UserRole, i); + ui.styleListWidget->addItem(itemtemp); + } } } diff --git a/src/scintillaeditview.cpp b/src/scintillaeditview.cpp index 29fcd7c..96a7983 100755 --- a/src/scintillaeditview.cpp +++ b/src/scintillaeditview.cpp @@ -2607,7 +2607,11 @@ void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString& else if (caseToConvert == TITLECASE_FORCE) strToConvert[i] = strToConvert[i].toLower(); //An exception + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if ((i < 2) ? false : (strToConvert[i - 1] == L'\'' && (strToConvert[i - 2].isLetter()))) + #else + if ((i < 2) ? false : (strToConvert[i - 1] == '\'' && (strToConvert[i - 2].isLetter()))) + #endif strToConvert[i] = strToConvert[i].toLower(); } } @@ -2635,11 +2639,19 @@ void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString& wasEolR = false; wasEolN = false; //An exception + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (strToConvert[i] == L'i' && + #else + if (strToConvert[i] == 'i' && + #endif ((i < 1) ? false : (strToConvert[i - 1].isSpace() || strToConvert[i - 1] == '(' || strToConvert[i - 1] == '"')) && \ ((i + 1 == nbChars) ? false : (strToConvert[i + 1].isSpace() || strToConvert[i + 1] == '\''))) { + #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) strToConvert[i] = L'I'; + #else + strToConvert[i] = 'I'; + #endif } } else if (strToConvert[i] == '.' || strToConvert[i] == '!' || strToConvert[i] == '?') @@ -3308,7 +3320,11 @@ bool isUrlQueryDelimiter(QChar const c) void scanToUrlEnd(QString & text, int textLen, int start, int* distance) { int p = start; +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QChar q = 0; +#else + QChar q(0); +#endif enum { sHostAndPath, sQuery, sQueryAfterDelimiter, sQueryQuotes, sQueryAfterQuotes, sFragment } s = sHostAndPath; while (p < textLen) { diff --git a/src/shortcutkeymgr.cpp b/src/shortcutkeymgr.cpp index 7432644..7d64a32 100755 --- a/src/shortcutkeymgr.cpp +++ b/src/shortcutkeymgr.cpp @@ -139,7 +139,9 @@ void ShortcutKeyMgr::loadUserDefSet() { QString userDefFile = QString("notepad/shortcuttab"); QSettings qs(QSettings::IniFormat, QSettings::UserScope, userDefFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif QStringList keys = qs.allKeys(); @@ -164,7 +166,9 @@ bool ShortcutKeyMgr::ModifyShortCutKey(QString initTag, QString keySeqStr) { QString userDefFile = QString("notepad/shortcuttab"); QSettings qs(QSettings::IniFormat, QSettings::UserScope, userDefFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif if (s_shortcutKeysMap->contains(initTag)) { diff --git a/src/userlexdef.cpp b/src/userlexdef.cpp index a1983a6..78ba379 100755 --- a/src/userlexdef.cpp +++ b/src/userlexdef.cpp @@ -24,7 +24,9 @@ bool UserLexDef::readUserSettings(QString langTagName) QString userLangFile = QString("notepad/userlang/%1").arg(langTagName); QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif if (!qs.contains(QString("mz"))) { @@ -93,7 +95,9 @@ bool UserLexDef::writeUserSettings(QString langTagName) QString userLangFile = QString("notepad/userlang/%1").arg(langTagName); QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setIniCodec("UTF-8"); +#endif qs.clear(); qs.setValue("mz", langTagName); -- Gitee From a6931973636b989ff8779200ecd6d8c0599215cb Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 28 Feb 2023 10:12:18 +0800 Subject: [PATCH 077/102] =?UTF-8?q?qt5/6:=20=E5=A4=84=E7=90=86=20QVariant?= =?UTF-8?q?=20=E7=B1=BB=E5=9E=8B=E7=9A=84=20property=20=E6=9C=AA=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E8=BD=AC=20int=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cceditor/ccnotepad.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cceditor/ccnotepad.cpp b/src/cceditor/ccnotepad.cpp index 0a3cb13..570ef8a 100755 --- a/src/cceditor/ccnotepad.cpp +++ b/src/cceditor/ccnotepad.cpp @@ -5159,7 +5159,7 @@ void CCNotePad::saveTabEdit(int tabIndex) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (pEdit->property(Edit_File_New) >= 0) #else - if (pEdit->property(Edit_File_New).toString().length() >= 0) + if (pEdit->property(Edit_File_New).toInt() >= 0) #endif { QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)"); @@ -5330,7 +5330,7 @@ void CCNotePad::slot_actionSaveAsFile_toggle(bool /*checked*/) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (pEdit->property(Edit_File_New) >= 0) #else - if (pEdit->property(Edit_File_New).toString().length() >= 0) + if (pEdit->property(Edit_File_New).toInt() >= 0) #endif { QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)"); @@ -5636,7 +5636,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (pEdit->property(Edit_File_New) >= 0) #else - if (pEdit->property(Edit_File_New).toString().length() >= 0) + if (pEdit->property(Edit_File_New).toInt() >= 0) #endif { //不再保存新建的非脏文件。因为一定是空的,意义不大 @@ -5660,7 +5660,7 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) if (pEdit->property(Edit_File_New) >= 0) #else - if (pEdit->property(Edit_File_New).toString().length() >= 0) + if (pEdit->property(Edit_File_New).toInt() >= 0) #endif { QString qsSavePath = qs.fileName(); -- Gitee From cc4ec3da2898042ef9786b9ba0aa502ca1c87096 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 28 Feb 2023 16:19:02 +0800 Subject: [PATCH 078/102] =?UTF-8?q?qt5/6:=20=E5=A4=84=E7=90=86=E5=9C=A8=20?= =?UTF-8?q?Windows=20=E4=B8=AD=E7=9A=84=20Qt6=20=E8=BD=AC=E5=8C=96?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cceditor/ccnotepad.cpp | 6 ++++++ src/cceditor/ccnotepad.h | 4 ++++ src/userlexdef.cpp | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/src/cceditor/ccnotepad.cpp b/src/cceditor/ccnotepad.cpp index 570ef8a..c8e9772 100755 --- a/src/cceditor/ccnotepad.cpp +++ b/src/cceditor/ccnotepad.cpp @@ -53,9 +53,11 @@ #include #include #ifdef Q_OS_WIN +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #include #include #endif +#endif #include #include #include @@ -7593,7 +7595,11 @@ bool CCNotePad::nativeOpenfile(QString openFilePath) this->activateWindow(); return true; } +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, long * result) +#else +bool CCNotePad::nativeEvent(const QByteArray & eventType, void * message, qintptr * result) +#endif { MSG *param = static_cast(message); diff --git a/src/cceditor/ccnotepad.h b/src/cceditor/ccnotepad.h index 84ab6e6..0b85943 100755 --- a/src/cceditor/ccnotepad.h +++ b/src/cceditor/ccnotepad.h @@ -196,7 +196,11 @@ protected: void dropEvent(QDropEvent* e) override; bool eventFilter(QObject *watched, QEvent *event)override; #ifdef Q_OS_WIN +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) bool nativeEvent(const QByteArray &eventType, void *message, long *result) override; +#else + bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); +#endif bool nativeOpenfile(QString openFilePath); #endif #ifdef uos diff --git a/src/userlexdef.cpp b/src/userlexdef.cpp index 78ba379..b10a744 100755 --- a/src/userlexdef.cpp +++ b/src/userlexdef.cpp @@ -103,7 +103,11 @@ bool UserLexDef::writeUserSettings(QString langTagName) qs.setValue("mz", langTagName); qs.setValue("mother", m_motherLang); qs.setValue("ext", m_extTypes); +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) qs.setValue("keyword", m_keyword.data()); +#else + qs.setValue("keyword", QString(m_keyword.data())); +#endif return true; } -- Gitee From 08ded5d7edf2fa9a14b7ce0111f57b97ee0a0651 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 28 Feb 2023 16:25:36 +0800 Subject: [PATCH 079/102] =?UTF-8?q?repo:=20=E7=94=A8=E4=BA=8E=20Windows=20?= =?UTF-8?q?=E4=B8=AD=E4=BD=BF=E7=94=A8=20VSCode=20=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E4=BD=9C=E5=8C=BA=E9=85=8D=E7=BD=AE=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=20-=20Qt6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/vscode/README.md | 11 +++++++ .../windows-vs-2022-cmake-ninja-qt6.json | 31 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json diff --git a/cmake/vscode/README.md b/cmake/vscode/README.md index 9a81c94..c83d021 100644 --- a/cmake/vscode/README.md +++ b/cmake/vscode/README.md @@ -12,3 +12,14 @@ - 注意: 1. 工具链架构选择可能与 `msvc2017`、`msvc2017_64` 等路径有关 + +- windows-vs-2022-cmake-ninja-qt6.json + > 基于 Vistual Studio 2022 生成器安装的 CMake 组件 + + - 适用工具链: + 1. `Visual Studio 生成工具 2022 Release - amd64` + 2. `Visual Studio Community 2022 Release - amd64` + 3. ... + + - 注意: + 1. 工具链架构应该为 Qt6 所支持 msvc 构建的 `msvc2019`, `msvc2019_64` diff --git a/cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json b/cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json new file mode 100644 index 0000000..1008e24 --- /dev/null +++ b/cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json @@ -0,0 +1,31 @@ +{ + // 指定使用 Visual Studio Community 安装的 CMake 组件 + "cmake.cmakePath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin\\cmake.exe", + + // 配置生成器为 Nijia + "cmake.generator": "Ninja", + + // 要在配置时传递给 CMake 的参数 + "cmake.configureArgs": [ + // 为 CMake 指定生成器后使用的构建程序,来源于 CMake 组件 + "-DCMAKE_MAKE_PROGRAM='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\Ninja\\ninja.exe'", + // 为 CMake 指定查找 MSVC 构建支持的 Qt 库路径 + // "-DCMAKE_PREFIX_PATH=C:\\Qt\\Qt5.14.2\\5.14.2\\msvc2017_64", + "-DCMAKE_PREFIX_PATH=C:\\Qt\\Qt6.4.2\\6.4.2\\msvc2019_64", + // 使用 Windows 通用构建配方 + "-DUSE_WINDOWS_UNIVERSAL=ON", + // 使用 Qt5 自动化 windeployqt + "-DWINDOWS_DEPLOY_QT=ON", + "-DWINDOWS_DEPLOY_QT5=ON", + // 明确指定为构建 QT6 版本的 Notepad-- + "-DUSE_QT6=ON" + ], + // 要在生成时传递给 CMake 的参数 + "cmake.buildArgs": [ + "-j20" + ], + // 要在生成时传递给基础生成工具的其他参数 + "cmake.buildToolArgs": [ + + ] +} \ No newline at end of file -- Gitee From bb5af11a50ad2f317dc911afeccf21cd6c6f38b1 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Mar 2023 02:35:17 +0800 Subject: [PATCH 080/102] =?UTF-8?q?spark:=20=E5=B0=86=20message=20?= =?UTF-8?q?=E8=BD=AC=E4=B8=BA=20spark=5Fdebug=5Fmessage=20=E6=9D=A5?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E4=B8=8D=E6=89=93=E5=8D=B0=E5=A4=A7=E9=87=8F?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/SparkEnvConfig.cmake | 10 ++++- cmake/SparkFindQt5Config.cmake | 2 +- cmake/SparkFindQt6Config.cmake | 2 +- cmake/SparkMacrosConfig.cmake | 40 +++++++++---------- cmake/SparkMacrosExtendConfig.cmake | 62 ++++++++++++++--------------- 5 files changed, 62 insertions(+), 54 deletions(-) diff --git a/cmake/SparkEnvConfig.cmake b/cmake/SparkEnvConfig.cmake index 3690f1a..9e36ada 100644 --- a/cmake/SparkEnvConfig.cmake +++ b/cmake/SparkEnvConfig.cmake @@ -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") \ No newline at end of file +# 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) diff --git a/cmake/SparkFindQt5Config.cmake b/cmake/SparkFindQt5Config.cmake index ad2db4c..6f021e6 100644 --- a/cmake/SparkFindQt5Config.cmake +++ b/cmake/SparkFindQt5Config.cmake @@ -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) diff --git a/cmake/SparkFindQt6Config.cmake b/cmake/SparkFindQt6Config.cmake index fb2d741..95ba2bd 100644 --- a/cmake/SparkFindQt6Config.cmake +++ b/cmake/SparkFindQt6Config.cmake @@ -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) diff --git a/cmake/SparkMacrosConfig.cmake b/cmake/SparkMacrosConfig.cmake index 4f68ce1..4dd8b23 100644 --- a/cmake/SparkMacrosConfig.cmake +++ b/cmake/SparkMacrosConfig.cmake @@ -6,16 +6,16 @@ cmake_minimum_required(VERSION 3.5.1) # 构建一个库,基于指定的源文件 # 并根据库名生成 target_link_ 函数 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) diff --git a/cmake/SparkMacrosExtendConfig.cmake b/cmake/SparkMacrosExtendConfig.cmake index bd15f0d..09fd6c2 100644 --- a/cmake/SparkMacrosExtendConfig.cmake +++ b/cmake/SparkMacrosExtendConfig.cmake @@ -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 [REVERSE]) # string(SUBSTRING ) # 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) -- Gitee From 5414380422cb6042c4753712de7a69f5f80248d5 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 1 Mar 2023 02:53:30 +0800 Subject: [PATCH 081/102] =?UTF-8?q?qt5/6:=20=E5=A2=9E=E5=8A=A0=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7=E6=9E=84=E5=BB=BA=E6=A3=80=E6=9F=A5=E6=96=B9?= =?UTF-8?q?=E6=A1=88=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=96=87=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=20true=20=E5=B0=86=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?=E5=8F=AF=E5=85=BC=E5=AE=B9=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 10 ++++++++++ cmake/platforms/utils.cmake | 14 ++++++++++++++ cmake/qt5_qt6_compatible_check | 1 + 3 files changed, 25 insertions(+) create mode 100644 cmake/qt5_qt6_compatible_check diff --git a/CMakeLists.txt b/CMakeLists.txt index d51a8c4..f31a8ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,3 +110,13 @@ endif() # ----------------- Notepad-- 其它主线构建相关 ----------------- # +if(USE_QT6) + # Qt5/Qt6 兼容性构建检查文件检查 + include(cmake/platforms/utils.cmake) + qt5_qt6_compatible_check(cmake/qt5_qt6_compatible_check QT56_PASS) + if(NOT QT56_PASS) + message(SEND_ERROR "[${QT56_PASS}] Qt5/Qt6 兼容性检查文件当前未能检查通过,不建议构建 Qt6。") + else() + message(NOTICE "[${QT56_PASS}] Qt5/Qt6 兼容性检查文件当前检查通过。") + endif(NOT QT56_PASS) +endif(USE_QT6) diff --git a/cmake/platforms/utils.cmake b/cmake/platforms/utils.cmake index 74fc596..de5eea8 100644 --- a/cmake/platforms/utils.cmake +++ b/cmake/platforms/utils.cmake @@ -38,3 +38,17 @@ endfunction(get_current_platform_lib_name _VAR _IS_SHREAD _LIB) # 在 MacOS 中 # 用于编译的静态库与动态库后缀分别是:.a 与 .dylib # 文件名称由 lib 开头 + +# qt5_qt6_compatible_check + # Qt5/6 兼容性构建检查方案,如果文件中存在 true 将认为可兼容构建 + # _CHECK_FILE Qt5/Qt6 兼容性检查文件 + # _VAR 检查结果 +function(qt5_qt6_compatible_check _CHECK_FILE _VAR) + set(${_VAR} true PARENT_SCOPE) + file(READ ${_CHECK_FILE} file_content) + string(FIND ${file_content} "true" _index) + if(_index LESS 0) + # -1: It is not checked and passed + set(${_VAR} false PARENT_SCOPE) + endif(_index LESS 0) +endfunction(qt5_qt6_compatible_check _CHECK_FILE _VAR) diff --git a/cmake/qt5_qt6_compatible_check b/cmake/qt5_qt6_compatible_check new file mode 100644 index 0000000..f32a580 --- /dev/null +++ b/cmake/qt5_qt6_compatible_check @@ -0,0 +1 @@ +true \ No newline at end of file -- Gitee From 72c9c82e7df5c00e0f5e4d1d807ce29c572e7001 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 2 Mar 2023 09:35:32 +0800 Subject: [PATCH 082/102] =?UTF-8?q?repo:=20=E5=A4=84=E7=90=86=20v1.23.2=20?= =?UTF-8?q?=E6=97=B6=E6=9C=9F=E7=9A=84=20develop=20=E5=88=86=E6=94=AF?= =?UTF-8?q?=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- cmake/qt5_qt6_compatible_check | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f31a8ba..c760484 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.22) -project(Notepad-- VERSION 1.22.0) +project(Notepad-- VERSION 1.23.2) # -------------- Notepad -- 全局构建配置 ------------- # option(USE_QT6 "使用 Qt6 进行编译本项目与随带所有内容" OFF) diff --git a/cmake/qt5_qt6_compatible_check b/cmake/qt5_qt6_compatible_check index f32a580..02e4a84 100644 --- a/cmake/qt5_qt6_compatible_check +++ b/cmake/qt5_qt6_compatible_check @@ -1 +1 @@ -true \ No newline at end of file +false \ No newline at end of file -- Gitee From a09a3f70cef4df253560b77afeade563529820d2 Mon Sep 17 00:00:00 2001 From: zinface Date: Thu, 9 Mar 2023 18:12:39 +0800 Subject: [PATCH 083/102] =?UTF-8?q?windows-make:=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=20Windows=20=E5=B9=B3=E5=8F=B0=E7=9A=84?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E4=B8=8E=E4=BF=9D=E7=95=99=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=86=85=E5=AE=B9=EF=BC=8C=E5=B9=B6=E6=94=AF=E6=8C=81=E5=AE=9A?= =?UTF-8?q?=E5=88=B6=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 8 + cmake/make-batch-powershell/README.md | 49 ++++++ .../alternative/windows-mingw.mk | 34 +++++ .../alternative/windows-msvc.mk | 45 ++++++ .../alternative/windows-universal.mk | 0 .../alternative/windows.bat | 11 ++ .../alternative/windows.mk | 7 +- .../history/win-mingw-make-msbuild.mk | 0 .../make-batch-powershell/history/win.bat | 0 .../make-batch-powershell/history/win.mk | 0 .../make-batch-powershell/history/windows.bat | 0 .../powershell-msvc-msbuild.mk | 44 ++++++ .../windows-msvc-ninja.bat | 144 ++++++++++++++++++ 13 files changed, 341 insertions(+), 1 deletion(-) create mode 100644 cmake/make-batch-powershell/README.md create mode 100644 cmake/make-batch-powershell/alternative/windows-mingw.mk create mode 100644 cmake/make-batch-powershell/alternative/windows-msvc.mk rename windows-universal.mk => cmake/make-batch-powershell/alternative/windows-universal.mk (100%) create mode 100644 cmake/make-batch-powershell/alternative/windows.bat rename windows.mk => cmake/make-batch-powershell/alternative/windows.mk (31%) rename win-mingw-make-msbuild.mk => cmake/make-batch-powershell/history/win-mingw-make-msbuild.mk (100%) rename win.bat => cmake/make-batch-powershell/history/win.bat (100%) rename win.mk => cmake/make-batch-powershell/history/win.mk (100%) rename windows.bat => cmake/make-batch-powershell/history/windows.bat (100%) create mode 100644 cmake/make-batch-powershell/powershell-msvc-msbuild.mk create mode 100644 cmake/make-batch-powershell/windows-msvc-ninja.bat diff --git a/.gitignore b/.gitignore index 102e7ef..20f6aaf 100644 --- a/.gitignore +++ b/.gitignore @@ -517,3 +517,11 @@ _deps # End of https://www.toptal.com/developers/gitignore/api/cmake !/Makefile + + + +################ Customizable build templates. ################ +# If you copy here and customize the build form, its changes will be ignored. + +# Windows cmd or powershell supported files.. +/windows-msvc-ninja.bat \ No newline at end of file diff --git a/cmake/make-batch-powershell/README.md b/cmake/make-batch-powershell/README.md new file mode 100644 index 0000000..027b34f --- /dev/null +++ b/cmake/make-batch-powershell/README.md @@ -0,0 +1,49 @@ +# 此处提供 Makefile/Batch/PowerShell 配置模板 - 由使用者自定义环境 + +> 使用者将模板拷贝到项目根目录并进行修改。\ +> 由于 .gitignore 中配置了对根目录的 mk 文件过滤,如果需要 git add 添加到暂存,请使用 -f 参数。 + +- 有关此处结构的内容说明 + ``` + make + ├── alternative + │ ├── windows-mingw.mk + │ ├── windows.mk + │ ├── windows-msvc.mk + │ └── windows-universal.mk + ├── history + │ ├── win.bat + │ ├── windows.bat + │ ├── win-mingw-make-msbuild.mk + │ └── win.mk + ├── powershell-msvc-msbuild.mk + ├── README.md + └── windows-msvc-ninja.bat + + 2 directories, 11 files + ``` + +- 来源于 alternative 目录的说明 + + ```batch + :: 被用于保留的构建模板,在无法验证时保留其变化,除非被确定可用 + ``` + +- 来源于 history 目录的说明 + + ```batch + :: 由 fork 用户提供的一系列构建模板,但一般情况下并不可通用 + ``` + +- 来源于 windows-msvc-ninja.bat 文件的说明 + + ```batch + :: 用于直接在 Windows 的 cmd 与 PowerShell 中使用的基于批处理构建的模板 + :: 将此文件复制到源代码根目录,并进行定制,而 .gitignore 已将其忽略,不再进入源代码树 + ``` + +- 来源于 powershell-msvc.mk 文件的说明(暂时保留,无法确认可行) + + ```shell + # 用于直接在 PowerShell 中使用 mingw32-make.exe 的模板 + ``` diff --git a/cmake/make-batch-powershell/alternative/windows-mingw.mk b/cmake/make-batch-powershell/alternative/windows-mingw.mk new file mode 100644 index 0000000..1fe2f08 --- /dev/null +++ b/cmake/make-batch-powershell/alternative/windows-mingw.mk @@ -0,0 +1,34 @@ +# windows-mingw.mk +# Windows MinGW - 通用 Windows 平台 MinGW 构建方案 + +builddir := build/windows-mingw +sourcedir := . +CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_OPTIONS := -DUSE_WINDOWS_MINGW=ON +CMAKE_MINGW_DIR := -DCMAKE_PREFIX_PATH="" +CMAKE_GENERATER := -G"CodeBlocks - MinGW Makefiles" +CMAKE_MINGW_QT := $(CMAKE_OPTIONS) -DWINDOWS_DEPLOY_QT=ON +CMAKE_MINGW_QT5 := $(CMAKE_MINGW_QT) -DWINDOWS_DEPLOY_QT5=ON +CMAKE_MINGW_QT6 := $(CMAKE_MINGW_QT) -DWINDOWS_DEPLOY_QT6=ON + +JOBS=$(shell nproc) + +# mingw32-make.exe +QT_MINGW_PREFIX_DIR := "-DCMAKE_PREFIX_PATH=C:\Qt\Qt5.14.2\5.14.2\mingw73_64" + +windows-mingw: + cmake $(CMAKE_GENERATER) -B$(builddir) $(CMAKE_DEBUG) $(CMAKE_OPTIONS) $(CMAKE_MINGW_DIR) + $(MAKE) -C $(builddir) -j$(JOBS) + +windows-mingw-release: + cmake $(CMAKE_GENERATER) -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_OPTIONS) $(CMAKE_MINGW_DIR) + $(MAKE) -C $(builddir) -j$(JOBS) + +windows-mingw-release-qt5: + cmake $(CMAKE_GENERATER) -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_MINGW_QT5) $(CMAKE_MINGW_DIR) + $(MAKE) -C $(builddir) -j$(JOBS) + +windows-mingw-release-qt6: + cmake $(CMAKE_GENERATER) -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_MINGW_QT6) $(CMAKE_MINGW_DIR) + $(MAKE) -C $(builddir) -j$(JOBS) \ No newline at end of file diff --git a/cmake/make-batch-powershell/alternative/windows-msvc.mk b/cmake/make-batch-powershell/alternative/windows-msvc.mk new file mode 100644 index 0000000..b1e1185 --- /dev/null +++ b/cmake/make-batch-powershell/alternative/windows-msvc.mk @@ -0,0 +1,45 @@ +# windows-msvc.mk +# Windows MSVC - 通用 Windows 平台 MSVC 构建方案 + +# 设定指向用于构建时引用的 MSVC Qt 库位置 +QT_MSVC_PREFIX_DIR := C:\Qt\Qt5.14.2\5.14.2\msvc2017_64 + +CPUS:=$(shell powershell "(Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors") + +builddir := build/windows-msvc +installdir:= $(builddir)/install +sourcedir := . +CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_CXX_FLAGS := -DCMAKE_CXX_FLAGS="/MP$(CPUS)" +CMAKE_OPTIONS := $(CMAKE_CXX_FLAGS) -DUSE_WINDOWS_MSVC=ON +CMAKE_MSVC_DIR := -DCMAKE_PREFIX_PATH=$(QT_MSVC_PREFIX_DIR) +CMAKE_GENERATER := "" +CMAKE_MSVC_QT := $(CMAKE_OPTIONS) -DWINDOWS_DEPLOY_QT=ON +CMAKE_MSVC_QT5 := $(CMAKE_MSVC_QT) -DWINDOWS_DEPLOY_QT5=ON +CMAKE_MSVC_QT6 := $(CMAKE_MSVC_QT) -DWINDOWS_DEPLOY_QT6=ON + + +windows-msvc: + cmake -B$(builddir) $(CMAKE_DEBUG) $(CMAKE_OPTIONS) $(CMAKE_MSVC_DIR) + cmake --build $(builddir) + +windows-msvc-release: + cmake -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_OPTIONS) $(CMAKE_MSVC_DIR) + cmake --build $(builddir) --config Release + +windows-msvc-release-qt5: + cmake -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_MSVC_QT5) $(CMAKE_MSVC_DIR) + cmake --build $(builddir) --config Release + +windows-msvc-release-qt6: + cmake -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_MSVC_QT6) $(CMAKE_MSVC_DIR) + cmake --build $(builddir) --config Release + +windows-msvc-release-qt5-install: windows-msvc-release-qt5 + cmake --install $(installdir) + cmake --build $(builddir) --target windows-deployqt + +windows-msvc-release-qt6-install: windows-msvc-release-qt6 + cmake --install $(installdir) + cmake --build $(builddir) --target windows-deployqt \ No newline at end of file diff --git a/windows-universal.mk b/cmake/make-batch-powershell/alternative/windows-universal.mk similarity index 100% rename from windows-universal.mk rename to cmake/make-batch-powershell/alternative/windows-universal.mk diff --git a/cmake/make-batch-powershell/alternative/windows.bat b/cmake/make-batch-powershell/alternative/windows.bat new file mode 100644 index 0000000..dea65e1 --- /dev/null +++ b/cmake/make-batch-powershell/alternative/windows.bat @@ -0,0 +1,11 @@ +set Msg='Build with the following configuration:' +set One='1. mingw-make32.exe -f windows-universal.mk' +set Two='2. mingw-make32.exe -f windows-mingw.mk' +set Three='3. mingw-make32.exe -f windows-msvc.mk' + + +@echo %Msg% +@echo %One% "\n\tThe default Universal Windows platform build" +@echo %Two% "\n\tThe default Universal Windows Platform MinGW build." +@echo %Three% "\n\tThe default Universal Windows Platform MSVC build." + diff --git a/windows.mk b/cmake/make-batch-powershell/alternative/windows.mk similarity index 31% rename from windows.mk rename to cmake/make-batch-powershell/alternative/windows.mk index 0439019..4ba821c 100644 --- a/windows.mk +++ b/cmake/make-batch-powershell/alternative/windows.mk @@ -1,6 +1,11 @@ Msg := 'Build with the following configuration:' -One := '1. make -f windows-universal.mk' +One := '1. mingw-make32.exe -f windows-universal.mk' +Two := '2. mingw-make32.exe -f windows-mingw.mk' +Three := '3. mingw-make32.exe -f windows-msvc.mk' all: @echo -e $(Msg) @echo -e $(One) "\n\tThe default Universal Windows platform build" + @echo -e $(Two) "\n\tThe default Universal Windows Platform MinGW build." + @echo -e $(Three) "\n\tThe default Universal Windows Platform MSVC build." + diff --git a/win-mingw-make-msbuild.mk b/cmake/make-batch-powershell/history/win-mingw-make-msbuild.mk similarity index 100% rename from win-mingw-make-msbuild.mk rename to cmake/make-batch-powershell/history/win-mingw-make-msbuild.mk diff --git a/win.bat b/cmake/make-batch-powershell/history/win.bat similarity index 100% rename from win.bat rename to cmake/make-batch-powershell/history/win.bat diff --git a/win.mk b/cmake/make-batch-powershell/history/win.mk similarity index 100% rename from win.mk rename to cmake/make-batch-powershell/history/win.mk diff --git a/windows.bat b/cmake/make-batch-powershell/history/windows.bat similarity index 100% rename from windows.bat rename to cmake/make-batch-powershell/history/windows.bat diff --git a/cmake/make-batch-powershell/powershell-msvc-msbuild.mk b/cmake/make-batch-powershell/powershell-msvc-msbuild.mk new file mode 100644 index 0000000..a7de66d --- /dev/null +++ b/cmake/make-batch-powershell/powershell-msvc-msbuild.mk @@ -0,0 +1,44 @@ +# windows-msvc.mk +# Windows MSVC - 通用 Windows 平台 MSVC 构建方案 + +# 设定指向用于构建时引用的 MSVC Qt 库位置 +QT_MSVC_PREFIX_DIR := C:\Qt\Qt5.14.2\5.14.2\msvc2017_64 + +CPUS:=$(shell powershell "(Get-CimInstance -ClassName Win32_Processor).NumberOfLogicalProcessors") + +builddir := build/windows-msvc +installdir:= $(builddir)/install +sourcedir := . +CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_CXX_FLAGS := -DCMAKE_CXX_FLAGS="/MP$(CPUS)" +CMAKE_OPTIONS := $(CMAKE_CXX_FLAGS) -DUSE_WINDOWS_MSVC=ON +CMAKE_MSVC_DIR := -DCMAKE_PREFIX_PATH=$(QT_MSVC_PREFIX_DIR) +CMAKE_GENERATER := "" +CMAKE_MSVC_QT := $(CMAKE_OPTIONS) -DWINDOWS_DEPLOY_QT=ON +CMAKE_MSVC_QT5 := $(CMAKE_MSVC_QT) -DWINDOWS_DEPLOY_QT5=ON +CMAKE_MSVC_QT6 := $(CMAKE_MSVC_QT) -DWINDOWS_DEPLOY_QT6=ON + +windows-msvc: + cmake -B$(builddir) $(CMAKE_DEBUG) $(CMAKE_OPTIONS) $(CMAKE_MSVC_DIR) + cmake --build $(builddir) + +windows-msvc-release: + cmake -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_OPTIONS) $(CMAKE_MSVC_DIR) + cmake --build $(builddir) --config Release + +windows-msvc-release-qt5: + cmake -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_MSVC_QT5) $(CMAKE_MSVC_DIR) + cmake --build $(builddir) --config Release + +windows-msvc-release-qt6: + cmake -B$(builddir) $(CMAKE_RELEASE) $(CMAKE_MSVC_QT6) $(CMAKE_MSVC_DIR) + cmake --build $(builddir) --config Release + +windows-msvc-release-qt5-install: windows-msvc-release-qt5 + cmake --install $(installdir) + cmake --build $(builddir) --target windows-deployqt + +windows-msvc-release-qt6-install: windows-msvc-release-qt6 + cmake --install $(installdir) + cmake --build $(builddir) --target windows-deployqt \ No newline at end of file diff --git a/cmake/make-batch-powershell/windows-msvc-ninja.bat b/cmake/make-batch-powershell/windows-msvc-ninja.bat new file mode 100644 index 0000000..95020cd --- /dev/null +++ b/cmake/make-batch-powershell/windows-msvc-ninja.bat @@ -0,0 +1,144 @@ +:: windows-msvc-ninja.bat + +:: Windows MSVC - ͨ Windows ƽ̨ MSVC +:: ļ GBK 棬 PowerShell + +@echo off + +:: Ԥ̻ +set builddir=build/windows-universal +set installdir=%builddir%/install + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: :: +:: !!! : ָڹʱõ MSVC Qt λ!!! :: +set QT_MSVC_PREFIX_DIR=C:\Qt\Qt5.14.2\5.14.2\msvc2017_64 +:: :: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + + +:: ѡԤ +set CMAKE_OPTIONS= +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -G Ninja +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_PREFIX_PATH=%QT_MSVC_PREFIX_DIR% +@REM set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_BUILD_TYPE=Debug +@REM set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DUSE_WINDOWS_UNIVERSAL=ON +@REM set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT=ON +@REM set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT5=ON +@REM set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT6=ON +@REM set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DUSE_QT6=ON + +:: ʱ installdir ʾҪװ· +set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_INSTALL_PREFIX=%installdir% + + +:: --------------------------------------------------- :: +:: ýղ +if "%1" == "run" ( + :: ˴ \ / ෴ + build\windows-universal\windows-deployqt\Notepad--.app\bin\Notepad--.exe + goto :finish +) +:: --------------------------------------------------- :: + +@echo ---- Notepad-- Ŀ ---- + +:: 1. ѯʹ +@echo 1. Debug(Ĭ), 2. Release +set /p chose=": " + +if "%chose%" == "2" ( + set CMAKE_BUILD_TYPE=Relase + set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_BUILD_TYPE=Relase +) else ( + set CMAKE_BUILD_TYPE=Debug + set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DCMAKE_BUILD_TYPE=Debug +) + +:: 2. ѯ QSci +@echo ---- Ƿָ QScint Ϊ̬? Ĭ(OFF) ---- +set /p useshare=(on): + +if "%useshare%" == "on" ( + set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DNOTEPAD_BUILD_BY_SHARED=ON +) + +:: 3. ѯ USE_WINDOWS_UNIVERSAL +@echo ---- Ƿ USE_WINDOWS_UNIVERSAL? Ĭ(ON) ---- +set /p universal=(n): + +if not "%universal%" == "n" ( + set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DUSE_WINDOWS_UNIVERSAL=ON +) + +:: 4. ѯ WINDOWS_DEPLOY_QT +@echo ---- Ƿ WINDOWS_DEPLOY_QT? Ĭ(ON) ---- +set /p deployqt=(n): + +if not "%deployqt%" == "n" ( + set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT=ON +) + +:: 5. ѯ WINDOWS_DEPLOY_QT5 WINDOWS_DEPLOY_QT6 USE_QT6 +@echo ---- Ƿ WINDOWS_DEPLOY_QT5 汾? Ĭ(5,ѡ6) ---- +set /p deployqt5=(6): + +if not "%deployqt5%" == "6" ( + set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT5=ON +) else ( + set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT6=ON -DUSE_QT6 +) + +:: ------------------------------------------------------------------- :: +@echo ----------------------- ǰԤ --------------------------- +@echo "cmake -B%builddir% %CMAKE_OPTIONS% ." +@echo "cmake --build %builddir% --config %CMAKE_BUILD_TYPE%" +@echo "cmake --install %builddir% --prefix %installdir%" +@echo "cmake --build %builddir% --target windows-deployqt" +:: ------------------------------------------------------------------- :: + + +:: ǰ - ѰӲе msvc +@echo ---- ѰӲе msvc ---- + +set vcvars= +for %%d in (C: D: E: F: G: H:) do ( + if exist %%d ( + @echo ڲӲ %%d е VC û... + pushd %%d\ + for /r %%p in (*vcvars64.bat) do ( + @echo ļ: %%p + set vcvars=%%p + popd + goto :set_vcvars + ) + popd + ) +) + +:set_vcvars +if "%vcvars%" == "" ( + @echo "could not found vcvars64.bat file" + goto :finish +) else ( + @echo "config MSVC environment..." + call "%vcvars%" amd64 +) + + +:: ʽĿáװ +@echo ------------ ׼ ------------ +cmake -B%builddir% %CMAKE_OPTIONS% . +cmake --build %builddir% --config %CMAKE_BUILD_TYPE% +cmake --install %builddir% --prefix %installdir% +cmake --build %builddir% --target windows-deployqt +goto :finish + + +:: 쳣˳Ķλ +:finish +pause + +:: ģ cmd Powershell +:: ģ帴ƵĿĿ¼ƣ Windows ˫ +:: ÿ \ No newline at end of file -- Gitee From a8988fdc1eaa96b2d42d6543f4f0fe820be5e74f Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 10 Mar 2023 11:00:55 +0800 Subject: [PATCH 084/102] =?UTF-8?q?windows-make:=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84=E5=AF=B9=E4=BA=8E=20USE=5F?= =?UTF-8?q?QT6=20=E5=AE=9A=E4=B9=89=E9=83=A8=E5=88=86=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/make-batch-powershell/windows-msvc-ninja.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/make-batch-powershell/windows-msvc-ninja.bat b/cmake/make-batch-powershell/windows-msvc-ninja.bat index 95020cd..41a5508 100644 --- a/cmake/make-batch-powershell/windows-msvc-ninja.bat +++ b/cmake/make-batch-powershell/windows-msvc-ninja.bat @@ -86,7 +86,7 @@ set /p deployqt5= if not "%deployqt5%" == "6" ( set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT5=ON ) else ( - set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT6=ON -DUSE_QT6 + set CMAKE_OPTIONS=%CMAKE_OPTIONS% -DWINDOWS_DEPLOY_QT6=ON -DUSE_QT6=ON ) :: ------------------------------------------------------------------- :: -- Gitee From e393f8e4c5d37d04225c7aca9e04ea71fdeb86ab Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 10 Mar 2023 11:03:15 +0800 Subject: [PATCH 085/102] =?UTF-8?q?windows-make:=20=E5=9C=A8=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=A8=A1=E6=9D=BF=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E5=8F=82=E8=80=83=E5=BC=95=E7=94=A8=20Qt6=20=E7=9A=84=20msvc?= =?UTF-8?q?=20=E6=94=AF=E6=8C=81=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/make-batch-powershell/windows-msvc-ninja.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/make-batch-powershell/windows-msvc-ninja.bat b/cmake/make-batch-powershell/windows-msvc-ninja.bat index 41a5508..3d74b03 100644 --- a/cmake/make-batch-powershell/windows-msvc-ninja.bat +++ b/cmake/make-batch-powershell/windows-msvc-ninja.bat @@ -13,6 +13,7 @@ set installdir=%builddir%/install :: :: :: !!! : ָڹʱõ MSVC Qt λ!!! :: set QT_MSVC_PREFIX_DIR=C:\Qt\Qt5.14.2\5.14.2\msvc2017_64 +:: set QT_MSVC_PREFIX_DIR=C:\Qt\Qt6.4.2\6.4.2\msvc2019_64 :: :: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -- Gitee From 12b1a0717c0c792b675c72b8b7be2af9624cd1b0 Mon Sep 17 00:00:00 2001 From: zinface Date: Fri, 10 Mar 2023 11:10:44 +0800 Subject: [PATCH 086/102] =?UTF-8?q?windows-make:=20=E7=A1=AE=E4=BF=9D=20No?= =?UTF-8?q?tepadPluginConfig.cmake=20=E7=9A=84=E7=94=9F=E6=88=90=E6=97=B6?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/windows-universal.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/platforms/windows-universal.cmake b/cmake/platforms/windows-universal.cmake index 4c86e5b..922392f 100644 --- a/cmake/platforms/windows-universal.cmake +++ b/cmake/platforms/windows-universal.cmake @@ -69,7 +69,7 @@ if(CMAKE_HOST_WIN32) # 将 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}) + INSTALL_DESTINATION ${NOTEPAD_PLUGIN_LIBDIR}/cmake/${NOTEPAD_PLUGIN}) # 安装 cmake 文件 spark_install_file(${CMAKE_INSTALL_LIBDIR}/cmake/${NOTEPAD_PLUGIN} ${CMAKE_BINARY_DIR}/${NOTEPAD_PLUGIN_CONFIG}) -- Gitee From 029cf14a10554ebcf1ef3a5d18183b909d597dc7 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Mar 2023 18:09:25 +0800 Subject: [PATCH 087/102] =?UTF-8?q?windows-universal:=20=E5=9C=A8=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=97=B6=E7=A7=BB=E9=99=A4=20CMAKE=5FINSTALL=5FPREFIX?= =?UTF-8?q?=20=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/windows-universal.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/platforms/windows-universal.cmake b/cmake/platforms/windows-universal.cmake index 922392f..4032091 100644 --- a/cmake/platforms/windows-universal.cmake +++ b/cmake/platforms/windows-universal.cmake @@ -62,10 +62,10 @@ if(CMAKE_HOST_WIN32) set(NOTEPAD_PLUGIN_EXTERNAL_PLUGIN_INSTALL_DIRECTORY "") # 这些是在此部分安装时使用,但不被用于填充 NotepadPlugin.cmake.in 的内容 - set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN}) - set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN}) - + set(NOTEPAD_PLUGIN_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/${NOTEPAD_PLUGIN}) + set(NOTEPAD_PLUGIN_LIBDIR ${CMAKE_INSTALL_LIBDIR}/${NOTEPAD_PLUGIN}) + # 将 NOTEPAD_PLUGIN_INCLUDEDIR NOTEPAD_PLUGIN_LIBDIR 填充到 cmake 文件 configure_package_config_file(cmake/NotepadPluginConfig.cmake.in ${CMAKE_BINARY_DIR}/${NOTEPAD_PLUGIN_CONFIG} -- Gitee From 3325f2cfc58cdac69cd995d107638266512afdda Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Mar 2023 18:10:41 +0800 Subject: [PATCH 088/102] =?UTF-8?q?windows-deployqt:=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=9C=A8=E4=B8=8D=E5=90=8C=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=AD=E6=98=AF=E5=90=A6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20WIN32=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/windows-deployqt.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/platforms/windows-deployqt.cmake b/cmake/platforms/windows-deployqt.cmake index 7f96b48..3d95858 100644 --- a/cmake/platforms/windows-deployqt.cmake +++ b/cmake/platforms/windows-deployqt.cmake @@ -46,7 +46,7 @@ if(WINDOWS_DEPLOY_QT) set_target_properties(${PROJECT_NAME} PROPERTIES # 这是一个 WIN32 程序,即可执行文件不再出现黑窗口,转而使用 WinMain(某种 Windows 内部特性) - WIN32_EXECUTABLE true + WIN32_EXECUTABLE $<$:FALSE>$<$:TRUE> # 静态库生成目录 # ARCHIVE_OUTPUT_DIRECTORY "" # 动态库生成目录 -- Gitee From 833a155f98cab67dea75f91c7d48d5a27be415ae Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Mar 2023 18:33:43 +0800 Subject: [PATCH 089/102] =?UTF-8?q?windows-deployqt:=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=98=BE=E5=BC=8F=E7=9A=84=20windows-deployqt=20=E7=9B=AE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TODO: 需要对 QScint 编译为 SHARED 进行相同的处理 --- cmake/platforms/windows-deployqt.cmake | 70 +++++++++++++++++++++----- 1 file changed, 57 insertions(+), 13 deletions(-) diff --git a/cmake/platforms/windows-deployqt.cmake b/cmake/platforms/windows-deployqt.cmake index 3d95858..97b02a1 100644 --- a/cmake/platforms/windows-deployqt.cmake +++ b/cmake/platforms/windows-deployqt.cmake @@ -79,21 +79,65 @@ if(WINDOWS_DEPLOY_QT) # 此部分为创建一个 windows-deployqt 的虚拟目标,用于对执行安装后的应用进行 windeployqt # 手动化构建 Windows Deploy Qt Application # 参考: windeployqt --qmldir - add_custom_target(windows-deployqt - COMMAND ${WINDOWS_QT_DIR}/../../../bin/windeployqt - # - ${WINDOWS_APPLICATION_DEPLOY_PATH}/${PROJECT_NAME}.exe - - # 扫描QML-从目录开始导入。 - --qmlimport ${WINDOWS_QT_DIR}/../../../qml - # 部署编译器运行时(仅限桌面)。 - --compiler-runtime - # 详细级别(0-2) - --verbose 2 - # 部署运行时使用指定的目录 - --dir ${CMAKE_INSTALL_PREFIX}/bin + # add_custom_target(windows-deployqt + # COMMAND ${WINDOWS_QT_DIR}/../../../bin/windeployqt + # # + # ${WINDOWS_APPLICATION_DEPLOY_PATH}/${PROJECT_NAME}.exe + + # # 扫描QML-从目录开始导入。 + # --qmlimport ${WINDOWS_QT_DIR}/../../../qml + # # 部署编译器运行时(仅限桌面)。 + # --compiler-runtime + # # 详细级别(0-2) + # --verbose 2 + # # 部署运行时使用指定的目录 + # --dir ${CMAKE_INSTALL_PREFIX}/bin + # ) + # 以上为被废除的内容,不再定义 windows-deployqt 为安装后的目标进行配置 windeployqt + # 并转为以下部分处理 + + + # ---------- Windeployqt With Install Target ---------- # + # + set(WINDEPLOYQT_EXECUTABLE "${WINDOWS_QT_DIR}/../../../bin/windeployqt") + # + file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_PATH" + CONTENT "$" ) + install(CODE + " + file(READ \"${CMAKE_BINARY_DIR}/${PROJECT_NAME}_PATH\" _file) + execute_process( + COMMAND \"${WINDEPLOYQT_EXECUTABLE}\" + # 虚假的运行 windeployqt 而不复制任何内容 + --dry-run + # 扫描QML-从目录开始导入。 + --qmlimport ${WINDOWS_QT_DIR}/../../../qml + # 部署编译器运行时(仅限桌面)。 + --compiler-runtime + # 以源 目标的输出形成映射关系,以便用于解析内容 + --list mapping + \${_file} + OUTPUT_VARIABLE _output + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + # 将内容转为一个列表,使用 WINDOWS_COMMAND 类型的处理方式 + separate_arguments(_files WINDOWS_COMMAND \${_output}) + + while(_files) + list(GET _files 0 _src) + list(GET _files 1 _dest) + execute_process( + COMMAND \"\${CMAKE_COMMAND}\" -E + copy_if_different \${_src} \"\${CMAKE_INSTALL_PREFIX}/bin/\${_dest}\" + ) + message(\"COPY \${_src} \${CMAKE_INSTALL_PREFIX}/bin/\${_dest}\") + list(REMOVE_AT _files 0 1) + endwhile(_files) + " + ) + # ---------------------------------- QSci ---------------------------------- # # 当 QSci 需要构建为动态库时,就已经开始导致了关联性错误,这个与原始分支上的预期的方案不符 -- Gitee From 12a494e74d088c72cf059d31c82611ab81093d9d Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Mar 2023 18:35:13 +0800 Subject: [PATCH 090/102] =?UTF-8?q?windows-vscode:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=20Windows=20=E4=B8=AD=E4=BD=BF=E7=94=A8=20VS?= =?UTF-8?q?Code=20=E6=9E=84=E5=BB=BA=E7=9A=84=E5=B7=A5=E4=BD=9C=E5=8C=BA?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json | 4 +++- cmake/vscode/windows-vs-2022-cmake-ninja.json | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json b/cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json index 1008e24..d8dbd66 100644 --- a/cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json +++ b/cmake/vscode/windows-vs-2022-cmake-ninja-qt6.json @@ -27,5 +27,7 @@ // 要在生成时传递给基础生成工具的其他参数 "cmake.buildToolArgs": [ - ] + ], + // 使用 install 时,安装到 build/install 目录 + "cmake.installPrefix": "${workspaceFolder}/build/install" } \ No newline at end of file diff --git a/cmake/vscode/windows-vs-2022-cmake-ninja.json b/cmake/vscode/windows-vs-2022-cmake-ninja.json index a909eb1..29cc81a 100644 --- a/cmake/vscode/windows-vs-2022-cmake-ninja.json +++ b/cmake/vscode/windows-vs-2022-cmake-ninja.json @@ -24,5 +24,7 @@ // 要在生成时传递给基础生成工具的其他参数 "cmake.buildToolArgs": [ - ] + ], + // 使用 install 时,安装到 build/install 目录 + "cmake.installPrefix": "${workspaceFolder}/build/install" } \ No newline at end of file -- Gitee From 3a0278aa31bd92df3697c658c71a56095b8e550e Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Mar 2023 18:36:02 +0800 Subject: [PATCH 091/102] =?UTF-8?q?gitignore:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=20Visual=20Studio=20=E7=9A=84=20out=20=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=9A=84=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 20f6aaf..c7b13de 100644 --- a/.gitignore +++ b/.gitignore @@ -519,6 +519,8 @@ _deps !/Makefile +#################### Visual Studio 2022 #################### +/out ################ Customizable build templates. ################ # If you copy here and customize the build form, its changes will be ignored. -- Gitee From ea264998efd050278799539995d5f79e0d8a8c23 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Mar 2023 19:09:20 +0800 Subject: [PATCH 092/102] =?UTF-8?q?repo:=20=E7=94=A8=E4=BA=8E=20Windows=20?= =?UTF-8?q?=E4=B8=AD=E4=BD=BF=E7=94=A8=20Visual=20Studio=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=20CMake=20=E8=AE=BE=E7=BD=AE=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/visualstudio/CMakeSettings.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cmake/visualstudio/CMakeSettings.json diff --git a/cmake/visualstudio/CMakeSettings.json b/cmake/visualstudio/CMakeSettings.json new file mode 100644 index 0000000..74a3181 --- /dev/null +++ b/cmake/visualstudio/CMakeSettings.json @@ -0,0 +1,26 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\Debug\\${name}", + "installRoot": "${projectDir}\\out\\install\\Debug\\${name}", + "cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=C:\\Qt\\Qt5.14.2\\5.14.2\\msvc2017_64 -DUSE_WINDOWS_UNIVERSAL=ON -DWINDOWS_DEPLOY_QT=ON -DWINDOWS_DEPLOY_QT5=ON", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "Release", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\Release\\${name}", + "installRoot": "${projectDir}\\out\\install\\Release\\${name}", + "cmakeCommandArgs": "-DCMAKE_PREFIX_PATH=C:\\Qt\\Qt5.14.2\\5.14.2\\msvc2017_64 -DUSE_WINDOWS_UNIVERSAL=ON -DWINDOWS_DEPLOY_QT=ON -DWINDOWS_DEPLOY_QT5=ON", + "buildCommandArgs": "", + "ctestCommandArgs": "" + } + ] +} \ No newline at end of file -- Gitee From ca73cc24b8ebfbfe8fb868e0f8d233d601bc4d05 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 13 Mar 2023 19:14:36 +0800 Subject: [PATCH 093/102] =?UTF-8?q?windows-make:=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=BA=9F=E5=BC=83=E7=9A=84=20windows-deployqt=20=E7=9B=AE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/make-batch-powershell/windows-msvc-ninja.bat | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/make-batch-powershell/windows-msvc-ninja.bat b/cmake/make-batch-powershell/windows-msvc-ninja.bat index 3d74b03..9490728 100644 --- a/cmake/make-batch-powershell/windows-msvc-ninja.bat +++ b/cmake/make-batch-powershell/windows-msvc-ninja.bat @@ -132,7 +132,8 @@ if "%vcvars%" == "" ( cmake -B%builddir% %CMAKE_OPTIONS% . cmake --build %builddir% --config %CMAKE_BUILD_TYPE% cmake --install %builddir% --prefix %installdir% -cmake --build %builddir% --target windows-deployqt +:: ʹõIJ֣ install Զõ windeployqt Ѿ +@REM cmake --build %builddir% --target windows-deployqt goto :finish -- Gitee From 1c261198f96198370f8f9efd9f4e1ba1e887e823 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 21 Mar 2023 00:17:45 +0800 Subject: [PATCH 094/102] =?UTF-8?q?=20windows-deployqt:=20=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=9E=84=E5=BB=BA=E5=8A=A8=E6=80=81=20QSci=20?= =?UTF-8?q?=E5=BA=93=E6=97=B6=E7=9A=84=E8=87=AA=E5=8A=A8=20windeployqt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/platforms/utils.cmake | 49 ++++++++++++++++++++ cmake/platforms/windows-deployqt.cmake | 62 +++----------------------- 2 files changed, 55 insertions(+), 56 deletions(-) diff --git a/cmake/platforms/utils.cmake b/cmake/platforms/utils.cmake index de5eea8..0b4613a 100644 --- a/cmake/platforms/utils.cmake +++ b/cmake/platforms/utils.cmake @@ -52,3 +52,52 @@ function(qt5_qt6_compatible_check _CHECK_FILE _VAR) set(${_VAR} false PARENT_SCOPE) endif(_index LESS 0) endfunction(qt5_qt6_compatible_check _CHECK_FILE _VAR) + + +# windeployqt_install + # Windows 在 install 目标时进行 windeployqt 的自动化 + # 根据 + # https://blog.nathanosman.com/2017/11/24/using-windeployqt-with-cpack.html +function(windeployqt_install TARGET) + # string(TOLOWER "${ALIAS}_file" _file) + # string(TOLOWER "${ALIAS}_output" _output) + + set(WINDEPLOYQT_EXECUTABLE "${WINDOWS_QT_DIR}/../../../bin/windeployqt") + # + file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/${TARGET}_PATH" + CONTENT "$" + ) + install(CODE + " + file(READ \"${CMAKE_BINARY_DIR}/${TARGET}_PATH\" _file) + execute_process( + COMMAND \"${WINDEPLOYQT_EXECUTABLE}\" + # 虚假的运行 windeployqt 而不复制任何内容 + --dry-run + # 扫描QML-从目录开始导入。 + --qmlimport ${WINDOWS_QT_DIR}/../../../qml + # 部署编译器运行时(仅限桌面)。 + --compiler-runtime + # 以源 目标的输出形成映射关系,以便用于解析内容 + --list mapping + \${_file} + OUTPUT_VARIABLE _output + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # 将内容转为一个列表,使用 WINDOWS_COMMAND 类型的处理方式 + separate_arguments(_files WINDOWS_COMMAND \${_output}) + + while(_files) + list(GET _files 0 _src) + list(GET _files 1 _dest) + execute_process( + COMMAND \"\${CMAKE_COMMAND}\" -E + copy_if_different \${_src} \"\${CMAKE_INSTALL_PREFIX}/bin/\${_dest}\" + ) + message(\"COPY \${_src} \${CMAKE_INSTALL_PREFIX}/bin/\${_dest}\") + list(REMOVE_AT _files 0 1) + endwhile(_files) + " + ) +endfunction(windeployqt_install TARGET) diff --git a/cmake/platforms/windows-deployqt.cmake b/cmake/platforms/windows-deployqt.cmake index 97b02a1..4594e89 100644 --- a/cmake/platforms/windows-deployqt.cmake +++ b/cmake/platforms/windows-deployqt.cmake @@ -98,46 +98,9 @@ if(WINDOWS_DEPLOY_QT) # ---------- Windeployqt With Install Target ---------- # - # - set(WINDEPLOYQT_EXECUTABLE "${WINDOWS_QT_DIR}/../../../bin/windeployqt") - # - file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_PATH" - CONTENT "$" - ) - install(CODE - " - file(READ \"${CMAKE_BINARY_DIR}/${PROJECT_NAME}_PATH\" _file) - execute_process( - COMMAND \"${WINDEPLOYQT_EXECUTABLE}\" - # 虚假的运行 windeployqt 而不复制任何内容 - --dry-run - # 扫描QML-从目录开始导入。 - --qmlimport ${WINDOWS_QT_DIR}/../../../qml - # 部署编译器运行时(仅限桌面)。 - --compiler-runtime - # 以源 目标的输出形成映射关系,以便用于解析内容 - --list mapping - \${_file} - OUTPUT_VARIABLE _output - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - # 将内容转为一个列表,使用 WINDOWS_COMMAND 类型的处理方式 - separate_arguments(_files WINDOWS_COMMAND \${_output}) - - while(_files) - list(GET _files 0 _src) - list(GET _files 1 _dest) - execute_process( - COMMAND \"\${CMAKE_COMMAND}\" -E - copy_if_different \${_src} \"\${CMAKE_INSTALL_PREFIX}/bin/\${_dest}\" - ) - message(\"COPY \${_src} \${CMAKE_INSTALL_PREFIX}/bin/\${_dest}\") - list(REMOVE_AT _files 0 1) - endwhile(_files) - " - ) - + include(cmake/platforms/utils.cmake) + windeployqt_install(${PROJECT_NAME}) + # ---------------------------------- QSci ---------------------------------- # # 当 QSci 需要构建为动态库时,就已经开始导致了关联性错误,这个与原始分支上的预期的方案不符 @@ -172,22 +135,9 @@ if(WINDOWS_DEPLOY_QT) # 部署运行时使用指定的目录 --dir ${WINDOWS_APPLICATION_DEPLOY_PATH} ) - - add_custom_command(TARGET windows-deployqt - POST_BUILD - COMMAND ${WINDOWS_QT_DIR}/../../../bin/windeployqt - # - ${WINDOWS_APPLICATION_DEPLOY_PATH}/QSci.dll - - # 扫描QML-从目录开始导入。 - --qmlimport ${WINDOWS_QT_DIR}/../../../qml - # 部署编译器运行时(仅限桌面)。 - --compiler-runtime - # 详细级别(0-2) - --verbose 2 - # 部署运行时使用指定的目录 - --dir ${CMAKE_INSTALL_PREFIX}/bin - ) + + # ---------- Windeployqt With Install Target ---------- # + windeployqt_install(QSci) endif(NOTEPAD_BUILD_BY_SHARED) -- Gitee From b8786b0218728dcb8201d3556b7a0ad4a749fc31 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 21 Mar 2023 11:22:40 +0800 Subject: [PATCH 095/102] =?UTF-8?q?readme:=20=E6=9B=B4=E6=96=B0=20ArchLinu?= =?UTF-8?q?x=20=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2cdb56d..706f957 100644 --- a/README.md +++ b/README.md @@ -95,14 +95,40 @@ NDD已初步推出插件编写功能,希望广大的CPP/QT开发者加入我 - ArchLinux -1. 安装编译环境 `sudo pacman -S gcc cmake make ninja` -1. 安装 qt 工具和库 `sudo pacman -S qt5-tools qt5-base qt5-xmlpatterns` -1. 配置 `cmake -S . -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -W no-dev` -1. 编译 `ninja -C build && ninja -C build install` -1. 打包: 使用 [AUR/notepad---git](https://aur.archlinux.org/packages/notepad---git) `yay -S notepad---git` -1. 安装: - - 预编译包添加 [ArchLinuxCN/notepad---git](https://github.com/archlinuxcn/repo) 镜像 `yay -S archlinuxcn/notepad---git` - - 预编译包 [Debuginfod/notepad---git-debug](https://wiki.archlinux.org/title/Debuginfod) 包 `yay -S archlinuxcn/notepad---git-debug` + ```shell + # 此部分使用 AUR 中提供的 notepad---git 软件包 + # https://aur.archlinux.org/packages/notepad---git + + # 查看 notepad---git 中提供的 PKGBUILD + curl https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=notepad---git + + # 或克隆仓库以查看 PKGBUILD + git clone https://aur.archlinux.org/notepad---git.git + cd notepad---git + cat PKGBUILD + + # 使用 makepkg 即可进行基于源代码构建软件包 + # 构建工具: gcc cmake make ninja + # 软件包运行时: qt5-tools qt5-base qt5-xmlpatterns + + # 以上是基于源代码构建软件,而安装预编译的二进制则可以使用 archlinuxcn 仓库 + # 查看使用说明 https://www.archlinuxcn.org/archlinux-cn-repo-and-mirror + [archlinuxcn] + Server = https://repo.archlinuxcn.org/$arch + # ArchLinuxCN 明确说明在 ArchLinux 衍生版本中使用时出现问题时不进行任何处理 + + # 以上是基于源代码构建或配置预编译软件仓库进行安装现有的二进制软件包 + # 另外,可使用 yay 来下载并编译或安装软件包 + # + yay -S notepad---git # 将从 AUR 中安装该软件包 + # + yay -S archlinuxcn/notepad---git + # 将从 archlinuxcn 源,下载并安装 notepad---git 软件包 + # + yay -S archlinuxcn/notepad---git-debug + # 注: 这是一个调试符号表包,旨在调试 notepad---git 时使用 + # 有关说明可查看: https://wiki.archlinux.org/title/Debuginfod + ``` - openSUSE Tumbleweed -- Gitee From 56cae8fd57f90982eeb5a4ad6a504610248ecbd4 Mon Sep 17 00:00:00 2001 From: zinface Date: Wed, 24 May 2023 10:20:47 +0800 Subject: [PATCH 096/102] =?UTF-8?q?repo:=20=E5=A4=84=E7=90=86=20v2.0.0=20?= =?UTF-8?q?=E6=97=B6=E6=9C=9F=E7=9A=84=20master=20=E5=88=86=E6=94=AF?= =?UTF-8?q?=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 4 +++- src/cceditor/ccnotepad.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aabed9f..779e1e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) -project(Notepad-- VERSION 1.23.2) +project(Notepad-- VERSION 2.0.0) # -------------- Notepad -- 全局构建配置 ------------- # option(USE_QT6 "使用 Qt6 进行编译本项目与随带所有内容" OFF) @@ -20,6 +20,8 @@ include(cmake/SparkMacrosExtendConfig.cmake) if(WIN32) add_compile_definitions(_UNICODE= UNICODE=) endif() +# 符合 2.0.0 代码预期的版本处理 +add_compile_definitions(TEST_PRE) # ----------------- 构建 QSci 库 ----------------- # if(TRUE) diff --git a/src/cceditor/ccnotepad.cpp b/src/cceditor/ccnotepad.cpp index 692c866..f958601 100755 --- a/src/cceditor/ccnotepad.cpp +++ b/src/cceditor/ccnotepad.cpp @@ -5355,7 +5355,7 @@ void hide_file(const QString& szFile) //isBakWrite 是否写保护swp文件,默认true。只有新文件时不需要,因为新文件不存在覆盖写的问题 //isStatic 是否静默:不弹出对话框,在外部批量查找替换文件夹时使用,避免弹窗中断。默认false //isClearSwpFile:是否回收swp交换文件,在外部批量查找替换文件夹时使用,替换后直接删除swp文件。默认false -bool CCNotePad::saveFile(QString fileName, ScintillaEditView* pEdit, bool isBakWrite, bool isStatic,bool /*isClearSwpFile*/) +bool CCNotePad::saveFile(QString fileName, ScintillaEditView* pEdit, bool isBakWrite, bool isStatic,bool isClearSwpFile) { QFile srcfile(fileName); -- Gitee From 9be36a85a021390bf887aeea01cfd117aaaf80c1 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 20 Nov 2023 22:47:33 +0800 Subject: [PATCH 097/102] =?UTF-8?q?repo:=20=E5=A4=84=E7=90=86=20=E6=A0=B8?= =?UTF-8?q?=E5=BF=83=E7=BC=96=E8=BE=91=E5=99=A8=E7=BB=84=E4=BB=B6=202.11?= =?UTF-8?q?=20=E6=97=B6=E6=9C=9F=E7=9A=84=20master=20=E5=88=86=E6=94=AF?= =?UTF-8?q?=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/rcglobal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 779e1e4..c86b87e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ include(cmake/SparkMacrosExtendConfig.cmake) if(WIN32) add_compile_definitions(_UNICODE= UNICODE=) endif() -# 符合 2.0.0 代码预期的版本处理 +# 符合 2.0.0 代码预期的版本处理, 核心编辑器组件 2.11 add_compile_definitions(TEST_PRE) # ----------------- 构建 QSci 库 ----------------- # diff --git a/src/rcglobal.h b/src/rcglobal.h index 2edb7e6..87f2f53 100755 --- a/src/rcglobal.h +++ b/src/rcglobal.h @@ -8,7 +8,7 @@ //#define TEST_PRE #ifdef TEST_PRE -static const char* VersionStr = u8"(内部测试非稳定) v2.0.0"; +static const char* VersionStr = u8"(内部测试非稳定) v2.0.0, 核心编辑器组件 2.11"; #else static const char* VersionStr = "v2.0.0"; -- Gitee From 98a49ef22a92689a2b5007bb5bac0d8b9ac66e95 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 11 Dec 2023 03:05:49 +0800 Subject: [PATCH 098/102] =?UTF-8?q?cmake/platforms:=20=E5=AF=B9=20MacOS=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA=E7=AE=80=E5=8D=95=E6=94=AF?= =?UTF-8?q?=E6=8C=81(CPack)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 14 ++- cmake/modules/QScint.cmake | 8 ++ cmake/platforms/macos-deployqt.cmake | 78 ++++++++++++ cmake/platforms/macos-universal.cmake | 24 +++- cmake/platforms/macos/cpack/Info.plist | 161 +++++++++++++++++++++++++ cmake/platforms/utils.cmake | 36 +++++- macos.mk | 20 +++ 7 files changed, 333 insertions(+), 8 deletions(-) create mode 100644 cmake/platforms/macos-deployqt.cmake create mode 100644 cmake/platforms/macos/cpack/Info.plist diff --git a/CMakeLists.txt b/CMakeLists.txt index c86b87e..5cd6b86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,16 +46,15 @@ option(WINDOWS_DEPLOY_QT6 "通用 Windows 平台指定 Qt6 部署 windeployqt option(USE_LINUX_UNIVERSAL "通用 Linux 平台构建" OFF) option(USE_LINUX_DEBIAN "通用 Debian Linux 平台构建" OFF) option(USE_LINUX_APPIMAGE "通用 Appimage Linux 平台构建" OFF) -# option(USE_LINUX_UOS "独立 Linux 平台的 Uos 构建" OFF) # -option(USE_MACOS_UNIVERSAL "通用 MacOS 平台构建" OFF) +option(USE_MACOSX_UNIVERSAL "通用 MacOSX 平台构建" OFF) # 使用 windows.cmake / linux.cmake / macos.cmake 维护构建. # 在 Windows 中此处将由通用构建、MinGW 构建、MSVC 构建组成 if(WIN32) - + # 通用 Windows 平台构建,一切的起始 if(USE_WINDOWS_UNIVERSAL) include(cmake/platforms/windows-universal.cmake) @@ -104,10 +103,15 @@ elseif(UNIX AND NOT APPLE AND NOT WIN32 AND NOT ANDROID) # include(cmake/platforms/linux-other.cmake) endif(USE_LINUX_UNIVERSAL) - # 通用 MacOS 平台的构建(一个无具体实现的空构建) + # 通用 MacOSX 平台的构建 elseif(APPLE) - # include(cmake/platforms/macos.cmake) + # 通用 MacOSX 平台构建,一切的起始 + if(USE_MACOSX_UNIVERSAL) + include(cmake/platforms/macos-universal.cmake) + + endif(USE_MACOSX_UNIVERSAL) + endif() # ----------------- Notepad-- 其它主线构建相关 ----------------- # diff --git a/cmake/modules/QScint.cmake b/cmake/modules/QScint.cmake index d8d66c0..6bca66f 100644 --- a/cmake/modules/QScint.cmake +++ b/cmake/modules/QScint.cmake @@ -39,10 +39,18 @@ if(TRUE) target_link_qt6_Core5Compat(QSci) target_link_qt6_PrintSupport(QSci) target_link_qt6_Concurrent(QSci) + if(APPLE) + # Is there anything missing? + # MacExtras? + endif(APPLE) else() target_link_qt5(QSci) target_link_qt5_PrintSupport(QSci) target_link_qt5_Concurrent(QSci) + if(APPLE) + find_package(Qt5 COMPONENTS MacExtras) + target_link_libraries(QSci Qt5::MacExtras) + endif(APPLE) endif(USE_QT6) endif(TRUE) diff --git a/cmake/platforms/macos-deployqt.cmake b/cmake/platforms/macos-deployqt.cmake new file mode 100644 index 0000000..eb43d76 --- /dev/null +++ b/cmake/platforms/macos-deployqt.cmake @@ -0,0 +1,78 @@ +# macos-deployqt.cmake + +# NOTE: 未提供可用性判断 + +# option(MACOSX_DEPLOY_QT "为 MacOS 中构建的应用进行 macdeployqt" OFF) +# option(MACOSX_DEPLOY_QT5 "为 MacOS 中构建的 QT5 应用进行 macdeployqt" OFF) +# option(MACOSX_DEPLOY_QT6 "为 MacOS 中构建的 QT6 应用进行 macdeployqt" OFF) + +# if(USE_MACOSX_DEPLOY_QT) +# if(MACOSX_DEPLOY_QT5) +# # 当使用 MACOSX_DEPLOY_QT5 配方时,将使用来源于 Qt5 中提供的路径 +# set(MACOSX_QT_DIR "${Qt5_DIR}") +# elseif(MACOSX_DEPLOY_QT6) +# # 当使用 MACOSX_DEPLOY_QT6 配方时,将使用来源于 Qt6 中提供的路径 +# set(MACOSX_QT_DIR "${Qt6_DIR}") +# endif() + +# if (MACOSX_DEPLOY_QT5 OR MACOSX_DEPLOY_QT6) + +# if(USE_QT6) +# set(MACOSX_QT_DIR "${Qt6_DIR}") +# endif(USE_QT6) + +# #/opt/homebrew/Cellar/qt@5/5.15.10_1/bin/macdeployqt +# set(MACOS_APPLICATION_DEPLOY_PATH +# ${CMAKE_BINARY_DIR}/macos-deployqt) + +# set(MACOS_APPLICATION_BUNDLE_PATH +# ${MACOS_APPLICATION_DEPLOY_PATH}/${PROJECT_NAME}.app) + +# # set_target_properties(${PROJECT_NAME} +# # PROPERTIES +# # 可执行文件生成目录 +# # MACOSX_BUNDLE TRUE +# # RUNTIME_OUTPUT_DIRECTORY ${MACOS_APPLICATION_DEPLOY_PATH}) +# # RUNTIME_OUTPUT_DIRECTORY ${MACOS_APPLICATION_DEPLOY_PATH}/Contents/MacOS) + +# message("MACOS_QT_DIR: ${MACOS_QT_DIR}") + + +# # install(FILES src/mac.icns +# # DESTINATION +# # ${MACOS_APPLICATION_DEPLOY_PATH}/Contents/Resources) + +# # add_custom_command(TARGET ${PROJECT_NAME} +# # # 在构建之后计划进行执行以下命令 +# # POST_BUILD +# # # 即将在构建目录中 +# # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +# # # COMMAND ${CMAKE_COMMAND} -E make_directory +# # # ${MACOS_APPLICATION_BUNDLE_PATH}/Contents/Resources/ +# # # COMMAND ${CMAKE_COMMAND} -E copy +# # # ${CMAKE_SOURCE_DIR}/src/mac.icns +# # # ${MACOS_APPLICATION_BUNDLE_PATH}/Contents/Resources/ +# # # 执行以下命令进行 windeployqt +# # COMMAND ${MACOS_QT_DIR}/../../../bin/macdeployqt +# # # +# # ${MACOS_APPLICATION_BUNDLE_PATH} + +# # # 扫描QML-从目录开始导入。 +# # #--qmlimport=${MACOS_QT_DIR}/../../../qml +# # # 部署编译器运行时(仅限桌面)。 +# # #--compiler-runtime +# # # 详细级别(0-2) +# # #--verbose=2 +# # # 部署运行时使用指定的目录 +# # # --dir ${MACOS_APPLICATION_DEPLOY_PATH} +# # ) + +# if(USE_MAC_DEPLOYQT) +# include(cmake/platforms/utils.cmake) +# macdeployqt_install(${PROJECT_NAME}) +# endif(USE_MAC_DEPLOYQT) + +# include(CPack) + +# endif(MACOSX_DEPLOY_QT5 OR MACOSX_DEPLOY_QT6) +# endif(USE_MACOSX_DEPLOY_QT) diff --git a/cmake/platforms/macos-universal.cmake b/cmake/platforms/macos-universal.cmake index fc15ab6..bb6a24a 100644 --- a/cmake/platforms/macos-universal.cmake +++ b/cmake/platforms/macos-universal.cmake @@ -1,5 +1,25 @@ # macos-universal.cmake -if(USE_MACOS_UNIVERSAL) +# 此构建表示,在 MacOSX 中以通用平台的构建方式进行构建此内容 +# 为 Notepad-- 通用构建的设计安装结构 +# +# Contents/ 在 MacOSX 中标准的包目录 +# MacOS/ +# Notepad-- 在 MacOSX 中标准的程序位置 +# +# Resources/ +# ... -endif(USE_MACOS_UNIVERSAL) +if(CMAKE_HOST_APPLE) + + set(CPACK_GENERATOR "Bundle") + set(CPACK_BUNDLE_NAME ${PROJECT_NAME}) + set(CPACK_BUNDLE_ICON ${CMAKE_SOURCE_DIR}/src/mac.icns) + set(CPACK_BUNDLE_PLIST ${CMAKE_SOURCE_DIR}/cmake/platforms/macos/cpack/Info.plist) + + # 程序安装位置 + install(TARGETS ${PROJECT_NAME} DESTINATION ../MacOS) + # 安装 themes + install(DIRECTORY src/themes DESTINATION ../MacOS) + +endif(CMAKE_HOST_APPLE) diff --git a/cmake/platforms/macos/cpack/Info.plist b/cmake/platforms/macos/cpack/Info.plist new file mode 100644 index 0000000..433737b --- /dev/null +++ b/cmake/platforms/macos/cpack/Info.plist @@ -0,0 +1,161 @@ + + + + + CFBundleExecutable + Notepad-- + CFBundleGetInfoString + Created by zuoweiyin + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + txt + + CFBundleTypeIconFile + txt.png + CFBundleTypeName + abc file + CFBundleTypeRole + Editor + LSTypeIsPackage + + NSPersistentStoreTypeKey + XML + + + CFBundleTypeExtensions + + cpp + + CFBundleTypeIconFile + cpp.png + CFBundleTypeName + cpp file + CFBundleTypeRole + Editor + LSTypeIsPackage + + NSPersistentStoreTypeKey + xml + + + CFBundleTypeExtensions + + c + + CFBundleTypeIconFile + c.png + CFBundleTypeName + c file + CFBundleTypeRole + Editor + LSTypeIsPackage + + NSPersistentStoreTypeKey + xml + + + CFBundleTypeExtensions + + h + + CFBundleTypeIconFile + h.png + CFBundleTypeName + h file + CFBundleTypeRole + Editor + LSTypeIsPackage + + NSPersistentStoreTypeKey + XML + + + CFBundleTypeExtensions + + html + + CFBundleTypeIconFile + html.png + CFBundleTypeName + html file + CFBundleTypeRole + Editor + LSTypeIsPackage + + NSPersistentStoreTypeKey + XML + + + CFBundleTypeExtensions + + ini + go + java + js + json + xml + pro + pri + php + asp + bat + asm + html + yml + js + sh + log + csv + json + + CFBundleTypeIconFile + *.png + CFBundleTypeName + * file + CFBundleTypeRole + Editor + LSTypeIsPackage + + NSPersistentStoreTypeKey + XML + + + CFBundleTypeExtensions + + html + + CFBundleTypeIconFile + html.png + CFBundleTypeName + html file + CFBundleTypeRole + Editor + LSTypeIsPackage + + NSPersistentStoreTypeKey + XML + + + CFBundleIconFile + Notepad--.icns + CFBundleIdentifier + www.itdp.cn.Notepad-- + CFBundlePackageType + APPL + CFBundleSignature + ???? + LSMinimumSystemVersion + 14.1 + NOTE + This file was generated by Qt/QMake. + NSPrincipalClass + NSApplication + NSSupportsAutomaticGraphicsSwitching + + NSRequiresAquaSystemAppearance + + + diff --git a/cmake/platforms/utils.cmake b/cmake/platforms/utils.cmake index 0b4613a..829e147 100644 --- a/cmake/platforms/utils.cmake +++ b/cmake/platforms/utils.cmake @@ -5,7 +5,7 @@ # _VAR 用于存储内容的变量 # _IS_IS_SHREAD 是否为共享库 # _LIB 目标名称 -function(get_current_platform_lib_name _VAR _IS_SHREAD _LIB) + function(get_current_platform_lib_name _VAR _IS_SHREAD _LIB) set(_LIB_NAME "") if(WIN32) set(_LIB_NAME ${_LIB}.lib) @@ -101,3 +101,37 @@ function(windeployqt_install TARGET) " ) endfunction(windeployqt_install TARGET) + +# +# [UnTested]macdeployqt_install + # MacOSX 在 install 目标时进行 macdeployqt 的自动化 + # 由于 +function(macdeployqt_install _target) + set(MACDEPLOYQT_EXECUTABLE "${MACOS_QT_DIR}/../../../bin/macdeployqt") + # + file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/${_target}_PATH" + # CONTENT "$" + CONTENT "${CMAKE_BINARY_DIR}/_CPack_Packages/Darwin/Bundle/${_target}-${PROJECT_VERSION}-Darwin/${_target}.app" + ) + install(CODE + " + file(READ \"${CMAKE_BINARY_DIR}/${_target}_PATH\" _file) + execute_process( + COMMAND \"${MACDEPLOYQT_EXECUTABLE}\" + # 虚假的运行 macdeployqt 而不复制任何内容 + --dry-run + # 扫描QML-从目录开始导入。 + #--qmlimport=${MACOS_QT_DIR}/../../../qml + # 部署编译器运行时(仅限桌面)。 + #--compiler-runtime + # 以源 目标的输出形成映射关系,以便用于解析内容 + #--list mapping + #-no-plugins + #-timestamp + \${_file} + OUTPUT_VARIABLE _output + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + " + ) +endfunction(macdeployqt_install _target) diff --git a/macos.mk b/macos.mk index 8a0c07a..cc7237e 100644 --- a/macos.mk +++ b/macos.mk @@ -1,4 +1,24 @@ Msg := 'Build with the following configuration:' +One := '1. make macosx-universal' +Two := '1. make macosx-universal-release' all: @echo $(Msg) + @echo $(One) "\n\t默认的通用 MacOSX 平台构建(Debug)." + @echo $(Two) "\n\t默认的通用 MacOSX 平台构建(Release)." + +builddir := build/macosx-universal +sourcedir := . +CMAKE_DEBUG := -DCMAKE_BUILD_TYPE=Debug +CMAKE_RELEASE := -DCMAKE_BUILD_TYPE=Release +CMAKE_OPTIONS := -DUSE_MACOSX_UNIVERSAL=ON + +CPUS=8 + +macosx-universal: + cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_DEBUG) + cmake --build $(builddir) -- -j$(CPUS) + +macosx-universal-release: + cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_RELEASE) + cmake --build $(builddir) -- -j$(CPUS) -- Gitee From 9be0c45bd1f40696920dd94e63e52b992f1057f6 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 11 Dec 2023 03:14:56 +0800 Subject: [PATCH 099/102] =?UTF-8?q?readme:=20=E6=9B=B4=E6=96=B0=20Windows?= =?UTF-8?q?=20=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 289273d..6b29c8b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,25 @@ NDD 具备插件编写功能,如果您愿意开发插件,还请提交给我 **CMake工具链编译说明:** +- Windows 系统通用构建 - 基于 Batch 脚本进行构建 + + ```batch + ;; 将 Batch 脚本复制到项目目录 + copy cmake/make-batch-powershell/windows-msvc-ninja.bat . + + ;; 使用脚本进行构建,它将会询问如何进行构建 + windows-msvc-ninja.bat + ``` + +- Windows 系统 VSCode 构建 - 基于 VSCode 配置模板进行调整构建 + + ```batch + ;; 拷贝一份 cmake/vscode/windows-vs-2022-cmake-ninja.json 作为你的 .vscode/settings.json + ;; 修改配置中的 -DCMAKE_PREFIX_PATH 部分为你的 Qt 路径,或你自行编译的 Qt 路径, + ;; 例如: + ;; "-DCMAKE_PREFIX_PATH=C:\\Qt\\Qt5.14.2\\5.14.2\\msvc2017_64", + ``` + - 当前的 Linux 平台构建方案 ```shell -- Gitee From 599fb3a5cdcd4f2cfcf65c5ff5bf3b3463a87a81 Mon Sep 17 00:00:00 2001 From: zinface Date: Mon, 11 Dec 2023 03:16:12 +0800 Subject: [PATCH 100/102] =?UTF-8?q?readme:=20=E6=9B=B4=E6=96=B0=20MacOS=20?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E6=9E=84=E5=BB=BA=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++++++++++++ macos.mk | 12 +++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6b29c8b..159727d 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,23 @@ NDD 具备插件编写功能,如果您愿意开发插件,还请提交给我 ;; "-DCMAKE_PREFIX_PATH=C:\\Qt\\Qt5.14.2\\5.14.2\\msvc2017_64", ``` +- MacOSX 平台构建方案 + + ```shell + Build with the following configuration: + 1. make macosx-universal + 通用 MacOSX 平台构建(Debug). + 2. make macosx-universal-release + 通用 MacOSX 平台构建(Release). + 3. make package + 通用 MacOSX 平台构建 CPack 打包. + + # 由 CPack 驱动的打包: + # 将在 build/macosx-universal 目录中产生 dmg 文件 + # 可在 CPack 的生成目录尝试进行手动 macdeployqt 处理 + # 注:目前M1平台使用原生Qt执行此操作会损坏此包,将需要开发者签证 + ``` + - 当前的 Linux 平台构建方案 ```shell diff --git a/macos.mk b/macos.mk index cc7237e..8d7fbc4 100644 --- a/macos.mk +++ b/macos.mk @@ -1,11 +1,13 @@ Msg := 'Build with the following configuration:' One := '1. make macosx-universal' -Two := '1. make macosx-universal-release' +Two := '2. make macosx-universal-release' +Three := '3. make package' all: @echo $(Msg) - @echo $(One) "\n\t默认的通用 MacOSX 平台构建(Debug)." - @echo $(Two) "\n\t默认的通用 MacOSX 平台构建(Release)." + @echo $(One) "\n\t通用 MacOSX 平台构建(Debug)." + @echo $(Two) "\n\t通用 MacOSX 平台构建(Release)." + @echo $(Three) "\n\t通用 MacOSX 平台构建 CPack 打包." builddir := build/macosx-universal sourcedir := . @@ -22,3 +24,7 @@ macosx-universal: macosx-universal-release: cmake -B$(builddir) $(CMAKE_OPTIONS) $(CMAKE_RELEASE) cmake --build $(builddir) -- -j$(CPUS) + + +package: macosx-universal-release + make -C $(builddir) package \ No newline at end of file -- Gitee From 1da49440b64a71904f1ef3750d422b2c175cb9d2 Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 19 Dec 2023 00:56:50 +0800 Subject: [PATCH 101/102] =?UTF-8?q?spark:=20=E5=85=A8=E9=87=8F=E7=BA=A7?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=A8=A1=E6=9D=BF=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/spark.png | Bin 4959 -> 8822 bytes cmake/SparkAppimageConfig.cmake | 154 ++++--- cmake/SparkBuildGraphviz.cmake | 8 + ...nfig.cmake => SparkDebPackageConfig.cmake} | 40 +- cmake/SparkDesktopMacros.cmake | 44 +- cmake/SparkEnvConfig.cmake | 10 +- cmake/SparkFindDtkConfig.cmake | 11 + cmake/SparkFindLibraries.cmake | 7 + cmake/SparkMacrosConfig.cmake | 285 +++++++++++-- cmake/SparkMacrosExtendConfig.cmake | 398 +++++++++++------- cmake/SparkTranslatorConfig.cmake | 48 +++ cmake/linuxdeployqt-help | 48 +++ cmake/platforms/linux-appimage.cmake | 2 +- cmake/platforms/linux-debian.cmake | 4 +- cmake/platforms/linux-uos.cmake | 4 +- cmake/spark-appimage.desktop.in.txt | 9 + ...eb.descript => spark-deb-package.descript} | 8 +- ...esktop.in => spark-desktop.desktop.in.txt} | 3 +- 18 files changed, 799 insertions(+), 284 deletions(-) create mode 100644 cmake/SparkBuildGraphviz.cmake rename cmake/{DebPackageConfig.cmake => SparkDebPackageConfig.cmake} (90%) create mode 100644 cmake/SparkFindDtkConfig.cmake create mode 100644 cmake/SparkFindLibraries.cmake create mode 100644 cmake/SparkTranslatorConfig.cmake create mode 100644 cmake/linuxdeployqt-help create mode 100644 cmake/spark-appimage.desktop.in.txt rename cmake/{package-deb.descript => spark-deb-package.descript} (92%) rename cmake/{spark-desktop.desktop.in => spark-desktop.desktop.in.txt} (99%) diff --git a/assets/spark.png b/assets/spark.png index 544e2c7cff5f70894e27a7a717d4a62120630b7a..bac324f1a8a025c65ea260274ebf078f6f52ce39 100644 GIT binary patch literal 8822 zcmX9^2RK{r7dB(mUZq0SrdladTkTaNwivagVzfqVwJBO^6QV|iwu(ya+M9~nwOc!4 z)TXrl@%uk{ZtnBk``vTT_nvd!bH4N41c-qaE%hyGA|fJM9c^`E!ny4Fpac;9{n+%j z2`7N#V=Z+eVj?dhBP4(|o^XZgxi-|7i0D4w^+6n1`pBPfk-|?$UxQ+UhJu9rhJX5} zNWvu!KMhMiwP&85E?#~_YCbLwelE^D0d9Uzd9-x&Ar_HzH;IUNh;-CdOao_kP;PJd z*TUA{o(@-hOu^xB1splt>-I8IJeo`-acVsFZpU0)0YzO*j=LOxDq2(I4ud5R7wDh4nwcXk%*+WtSHl)Y zGGeuHvs}Z!2UiMvS66IMtC8Y1q#YR%MY}9TDH*c&cSqy7)9HNE>B_H2e&Nz;PtJVb z4GQh6VsPVXhjVc_s}&2nnLlB00j_Lzz!N@GJ6~EN@|N&s*KY@bni6s?mX)Fv+R+SqyAFZ+O%*Jke0xX zePXNd{Li;b_Y2K*OHsB5@b_mr4%@GRk9X5v(#|oW#7z1#RE-dNrPki+2wztOmF|<;Y>|UGajWUV!F_6*AlR=->qZAN2bxs;~r!qF_3(C{#lye zF`I^AW0}!FL`6)nt420!N zu63Zd%5Zeq$U8gK55~Txwbg8(y%nP%g}=$qmdi?MAF&6mtcub%%qSHEhj_>=N7x9` zxHl@l*?YMiBc&i=-cwLnjp$-d)*$|SCWqIM9UDWkjKo|WpvsBQZS2RspLd>d9&bXE z&^3B@hFB84?1Nu$z{GEmW)855(y}bIO6?^1CiOK8%hr&S%Q>-jR_N$RCD7#|~P2LSs#IJE^ezRP3PbLE7s+uPJ&J$kvXSsq& zP%?JkA*K$^cyjA8d zP*$z3oLcLNz&BC&i@C?cX*|NjX+ANNH(}ke?>FUYG(H`T-Q(Hnbr?J?QPTmxXi26`ez6EZcy=63h*C&TY&qDWeidm&1X%S4H zRKTd)nc57N1GVfBA{f&pm^jyl7%1Fhq@e0O0lsU%n|6DZ6_L(Yr8ZpeZZs|+ltcX3 zLRWP|c+?m4GOj8z7Q8C)b<%1w5zDfNz%@~%)q`vZ&P8Wl6-FQtP z_FljGtxH`8LbW9_RN3Y=-(R#?AI%>e7k(vmL9(q|OnL7TfDP{`{$qi-9Mt9Rqe7mG((Wkic zOM;*;qhR4vfKQ_R+uL4Xwc!JLqfK4n{5jUPcZmg8mDWcd&V^D7?c1Hy1cW;>aX}ud z2R{we{Hkatz&@nIdSU>ljr6~m(wkU8|HvShSAPG z*}g4Jx|>Rs% zw+=`I;m#=>ieQSQ8dNF|?Yh_8K9hnm)$`X+m4Lu~sm;S3!xf_N)-f7z>{)(=$vsnN z6nOJoyi0TB4?s7{3-s-N<#PJac!L6}H`pH&xs`;`d<`{4tgTex{qB?$odlm6QiM9bT{bv+y|;| z;W2`zF-g^WaAIzJgqYDrzbA9_2@1)ub6*xq!GEyVmpcGVgf@cVO<TBu}34dP~O1yIpvvKgI$2hl;JDF6>;dEuO~8Odhy#R}oTMauxksv(e36LvWAtWGQ%o`kI;aPYC zW9jRe@#!0?67}j?qSx?k*#cAq1xW{FmLD{(9yH#?RtKmzuQcUGk-V;jh05sH`Kwg)2}FxoN{df`=3v7!K7rfXs8H!QO37H8G|Vbh-(LmxfIvSHHh0 zF{^eDbdZzR4U;~iYWQF$$pFuKt|H=BOXM}z%0pm`D+aS*CRO`6V4Oo;c=)B#Rmi>| z>#%aAF!0%TAyW&Z!=9hzGd5Gu=z_Lvr-X#^v2iO9A|0u);YqAF$wzi|n5#T$E?sRhHXsK^9N6q-px!l;(3C+{)+yde}_ z*uMUCWodYv72ZTeovA(rEvXt8QoM4S*qnh+ag@sp0d%{K-Vh!Oa+4KhPrcOfZ=#*=BFk=_>%dgyRQ4ZYX5YTTtj) zBvHIF$=KvDotpXFa{OsoIQw0x_X6E@I9!^;-b1l+V03gNMF?2ujcD+0idB7RGgN4& zx2*qlNgN<;SvVt#w-@1ds{P#z9=s?ItGJdJ$`veFtUcn7!B+YSG`{seeT;>pI1LOGN?MhHJ*FblFQR8t{D9QQ}g0!9>!4EgP3o) zb3FYf297_kM9|E^{^5GQZ?B2?%cZ{EEoGb08P97UE0G35?L^I^1Ig!6dfD188XWiV z)I%EY(aOvn;RO<_a49_fas5(HheFqL(Hq`%d5EdPjQ}4pZ<&fC4!H%2D>&^V^<4wr%D@IsM5Zf){WjqjP#D3X z4W@9``R+3$Q@%al6C@@k#9AIwgUqRygX}x$!*>X`bvWgG@|@fhlWdG=Gxrlnz%A00 zXhQu#`ZoRG`(b^T*2qbXfz?Q=q=}4=hNP-X=oaJl2Y9@vo6QM};!uPQ^ne*}9oj`Y_Au=+sFl*)Bb%IY?x) z(pro_E>TK?8+}U=f`8-~?XQWf>i=RUK>7p^D!e5&k^Geo9L@lTXFaLPLx@JY67u2s zU&8z{E7I>*x^(E>V7ikkt6!XmEK{|05B7qT)nMgnH-=lvVD8Wj%~r~-WV|NsO?kP| zc&d>7oMS~v4c=*a2>;zdi_ycZC*v5S zsR6~x7X)KOt%UKO3P8Ex|BU>~an2|MJaF%KyokqRAabGD;BwC z$QE0?F26j%DRWvdj(IZm9u8oeuE_)N@d;qdjWIT%Mj-u2&(F!vo|}$h%0hOJYp|h4 zJ!6_|4il?ev)yMg$Aw;J3&y7aHY;fCdG83_@AND)nZC8IcT>9AUk3!(=> z$L+3|7!v@lRjvOr4A^_Xp(ByNM(f`AEw9$*O4JXQa*XydMIRzt1y z5lf0k^aIdP=du->#%(Ru(Q*c%np)Rd@!ESi$T4taOk_cRl6WmdiZsccWAoMdtRQ`h zO#KaTEJTK9z;=L;_z%~fjHWY@MCXEX1d=!R4<-LvVVco})=(I`yCIf%?qErR9qw&z zbT}hyf(h+u&PK$&F36t)-5WaX(QKECLbgjNt$Qe1*zLwvX6;uGiRj*vEDMz>1La^S-$#BsL_CDiU?KQ)0N% z8Rbw^c4kk4c8m1g#lL6N^$spSKi^RuX1`v}SCs#HpPu5d)Qa!0JT)}f|9;rxHO?H< z{zYtQ38dep%Rb`4kRS(UW+IoQX9HDWPPc7$ymYm3KFCm5VTva75HR zX?IF_6cPV62sq$OgBFR=dHK@RQG#dGJ*8mS8CAr%;a}*QZ)}-GZZ7qETbjG?W?QJZ zFtOOjn$#@PmqStciaQ2X?>1oa`i7^`IB7i1YnhLNqI_Dz@6;VO0m}Sej|P2Zf~R+? z@7+(l+WM22)Yqif+?oVUD)_<~vg^n+9zMlEeQovJawACro$u75np#@F<*Od0kk$hu z++IfW*AG5eP?ozdFD<5U^tEKA7RC&P33qe2!0B{Z;OGeJWMF%e_}k81e4qWT*M=J< zWZJ#o4-ZM2^haE4umwqyA13%?cm#}CrVkoU7o7qR&ePesIVzs79rVuB`wd{;NaCfT!S%eeOT3B;q)Sl32FB z5TOa;i z8b3P9L!6lA8+`<)GsPC+B7j}>cJi^-$qUqZ`(r`M!P|PvGHAse091^+ z`9v=Eb4!VR)54QxYwa2W6CTq>Tk&%Oe$~({x(oJnKxkv8gw`VW5()Y z8M3ZxkGFd)iho^EUo4~*wffD@M}GbY3yAtX1q@PTjS;yH$7idS%f6B0=|ovB;BRux1dtO3 zzY|Pu#QuSfpDFNo(nRK9CeO-ewUrxBX*e}AJUjkuYR2q3D0{|XV}^0Bk)$#cPS33CdH}K32W|Mtvkh91-^`Gf!6ANC~V3QLiX(q&8<3#}m1%Ie_U#u!Y5_e?} z08;e6Q!{SC4+rJs1r6xIdt0pF$16>Rfw;Ae=W`1I5!OWYT`GE~=y+K?q4a8=D=K?i zfpJ>i27{e4REIwP`0T4S*>ImoRW*_lsSQ?O8>#xz%KOnhjd|kZU-e);qm7 zn&N065!&9&$TnR)7X^a4% zW%DZVe?;Cx2z_w*{?=h&D>4sj?{KV#53p?5m1v z6LS6~MfbWse#UiM|LvECc|W%GVL2D*tom!^0YaedP9S55>Zl-8GS7kR@-#oP0(~DO zMzWAUkX33xcG-P>lyY_0p>W?|-DpCr-zV_tt^f3S>lR-?@KNP~83de(#FFMEJ;_BI z@2f)agGh)R}6FpG>+5SB%j&sp(O1K@7yv7Ma@y@ z#o5z8x#pYDRK#p%r7c|=av+eVP3BR+5+T#~3H35-2c!}7L(|dh5TAr`zoe%unv$8+ z4|tNuQu2}%f?$56)JA7Bu$@$qfdO)OH>>XU896_p77i-r;osqJCOf;T?5;Eg@0WV&vo}~;(23D+Hw~#k>XX53aGp6|w zUSBThIUeM$LT5{r%0#qJMotbwJpi>dQPX(*EK0ZooP89tP@>cA#LGg-pS(BIaBB!daN<2=))YV>e5n0rtT8>g^21axc zza}*mWY;!oUp*Vh6#KUoAgDuOEg&F|+a10C>}W+%G%u9OQq*~GJEpg?ap5bcea5Ee1cSIb+@!M z?p>3&P+nNt?PvPQ`=3?QKj#2J z#0;X#!sD+?#x%BPIQnd*X;$LGqS-krUzKdNT$a0D_s?oe)IQSF3~onj9#v!`#vn%N z3^EJt?f>K>7o_FAzJ@G$%;^GMh+p=I7*i##k#t@C4P*^J@w&D5*O3F0B&tW({~%&2 zsf2f88kb(sDwnn8g8E_xmup=AOX$AezQI4uZ#t1~43r5JuRa9yrII>qP*SuLw4%!J zz4VhvX}jzrzpOePmkAJvk8+%RRZ^UPz1Cxv%{oh~n#X8PiNr@CV-o*JfT{IDiM4k( zoAzZT&~110Q?#g?3&w{6+IOZm|Dwf7_}3v3HUX_U)O#(sa~ z!oDAR+Z`P_quz1(n4=a)0brEwkBP|7e4VMyJI@$zuA}qJ5=$tVbVxYcg&tEYg>X&p41xs}i6$Yp)oRiR7#u9wDa*7H>- zX}MmZ<^HFFWGfqI)4XU|Z&O}_qD{bk@yg|{0a=>@I~8 z=3S?+U&Z$*P#h#97!yo8S~Kc6KNHJKmZqm7qZP~-ACAoJ>l;6`obT@fc|t_Lnf!3G zvJIIkhKb<6h++)vt}|DOzR5UZmG6T5!Ai8^LgK5$gk_>~Jrybyb0cr1mRFMLzByJl zYELAImcL8gI=a+N7U2GXo3HPe3roNt;7!9F0MH9eKS)5<)H>C{?qR@5pKvU{$@B5< z)h)maCBnwrj7EiPlKsP~cWz|3Ml(Ah&rolxcj)O)egycdfk zu^hO$pVz2y=^^^MF_VU+i$$vRSMUyZu#$OtfweP=c1d#*$MvrqI(S#)dDjBA!Aq)+ zmruhafv|f+)78FK3cmF7p|e=Gcq39?edpw$>vzP#_#R<7xo}fIuW+5OwH&vb+6Rc) zpYd)fb8l%QX~E4uHc5#@K52iXU-r4WAQ~(7hJjs}UeR!(xa`7gy0w2s3T(R~2@;Hv z1|t^syy8|ImAyEOhSd$2pxB+N_k4) z*AdCeIXfdL+eRipchcM2f&8`sdLP#*T9ZhZjNMiy?7?UgeB}OUI)i1F?Vy|+xQ(zn zPrvsbdTV;&ZcOg28Mfh$Fj9e&LkDOMbZ9x-#4SJ1wp|y^Lt`2t4>3EsWX>)i+s&!& zmwRtv!VOpQ`J?w|DDORv()XxZ#s^|>!gc--49Q@qU}FiDsE>JTQ2M~crEvCj2?5Ub zQXxn#V(ivLXjvLE`E1^MA*`?aTqI2Eg?_gYy5l(_h*0TZe|63?P5DymVdo?u)}!gs zgzb$lcfiuG@rz7b-V6V>?1AL=A{Omcu$#Y=a6#XyTnOXLjzZOW>wX;j5V}$6NMI(# zQ?7=aKY|L|v|fDbGh!kyW%+cd)(Csx&E4p!;3R{s@#x9!Fo<}im73lqSgqo9&4 zBkkzT^{ncwyHjAueZ}y!rDNqqy#gX>hdH2WG1-R>^-mn6rs>4fVdj_Ql!xOtUBhdc zw1_PS*?#X=j5F*QWSDaZiz|+>_J(UaMCLwxDkk`Ad$N?d>`_kGQ%C;f{)8(i9HINpK#hV`Xtk2fv|`=tO(0FYCg5{OA4oIZ`_lHs_P_Yo zrG5R=SNNrWdu_FJVIr)L?R%b|^k2+wS0#%Z|H~Whfvz$26cn*!#rrQCJ~LH1ySluR Wz1WyJE+u>pLZqW%pkAqJAN4<3s|e5l literal 4959 zcmZ9Qc|26n`^T?!hOvx&4Pz%{EZLPYvTq^E5@pRcGGvX$AW~VT?0YC8CHu}WL)I*j zCA+d^OJw_v@Avn|@AZ4V?z!iAo%_7*bMCpH^W6J>;>=8R>1nxX0RW)a*F)YU^_YtW zrY4=^DWIpMj{2UVE)p04)_~)Bx;9qQ2n|Z_wm$&K2wgO?prUJmq(Kl`-&hB=G~+P>c2E7|m)F7F$6%61XMsolUg0zXycp@v@GZ1K>rt9xd?C!>%*+W7 z%C&esu?1QvJQKjm(&8q^?oTJ)%8V0?)|OjY&d?Gr6jy6+xCM5i6!*6NB4P1KRCNm^ zm+NR*M%4c-!-n9r0lIJ!D)W+&T9oD)Dem^7SRik@V(WfPQ@fFKyaf2lH?CLvA5uka za&warZ&7cj6r);vpGc6CZ?~=95k;2K+aF*1m@^PTnvH2@U9bunlhI3nmsfK^BZU;4=_*3}V}PoZ zEP*COH$^QdyIwzO=Shp{b@@LAC7u=@nYJ8)oEoIduWITqMn>MScBnM|V;V8ajW%>c z2|9_!;}u5SRyWpkQzR8giy|l$Ivq`@U%TZM4}hv^OUIk_s0z#=s!u~04W3Iv&C;FbL%51jwmUPHQ@0l~qZwrDUlHbTaRh}I7O zg75zlU9YVkytJ~+#_*>+av3b*ZLbM`=lrm(GyKlhzDKd&-~YS-XuB{i6aEdZrmT8V z5=&CIeIGmv+apvfRY7`h1Zf4_L_-7KYf+zDaL#{K)Hw61>q|2q>%TNiMk|sXtmY*1 z`E77tq7vBO#3uo(t!jj^QMa-dh___m=cxM&AL^ zdT&14OSgK$%!-|9_M)?`i4B)w7eegd!IoH)mWyyhiqc1~EPAqoCCYEgl(hFM{^Ftj z%GS_$^uT6K)$jtUK69tc1oS-cV3H( zyzVwJW(p>4KWuO@dx-z65M|t#j~xmYkY<&V$cV9IcL@+9-%Akb(9C^=$km21|8lq_ za=b^e+n~SA!s?z86LD4&0RU2Vl|bwCrvOB*uG>-oaP+AaCy?IW;MZ7A&oS_=puC#x zTSjKS2X}HZv)}oKicKX7<~q>8hy|~*HpzV*Y^DRSBNNv-=R$KtX-5a5FE!_Wj#!o0njA z8JkG4+{e@({dOMVP51|1y`CGI?{rMiLdMQTV)8ojeNwqrgP)*5q}hq9`jG=rE*1L0 z=0gY)xu5I$L0nYIwuM<@k7MqNbid7Ko1mz?Wtyzjo`jUhJJU|J`Jq_(fZ+l%ogp5Y zIDI`mBjycCE3h-oAO06y%KHv_U0fWu7`0F)$u5yL6u~KnhuEC++z(})gQ{w9X}O1^ ziig+EPJfUA4&ecpZ?0Sc06XsoNMjeO3Wcj3%MW32I2nYaNKiwF#jknm8fO-R8aEHO zS;P_Zcdx7H>7UoVjHFijGh;WVUGy??)C=6c|6BJ?%amgTP(}HCU2Z0Y^Sx|AO%6>B z7k8KD-1)Kga0b7Xt>)Jmz><_Svi*-IB6_0ky0@X$d%1Z$EAcD*>w~VW$*SRrQOa6E z)cKJdzv;DO-USxsZnV8sfR>g0;TF*eXKlHEv~kBDQlVHocet}SvAsdI1E^G1doNa$er}pksd?U1pF|_rB zSIJIEOQLI~-J9cO}P)Oz~yJ4z~jwPCIW7GR>tKG}oJGSkdoz};#7?(Sg>_x?Y_Q?4k zZ$BO!ta2Sdt}R&N@%WDQoxFGNn8p;VW$7qF|8D7og^|0?JUW*}Y|jx!#LUqPlwg=m zRt9aEBD1%*_tO_~T=|(R%DbCN?p_VFK+vzERN1}RWAZ6OAYYD(J}CcnVj9+as%G)o z;NJXAE1<2%q6D=&D&c&^K7J$1uCL+uS>u|xgNGNU%c~o5r72Q`D?M*NaI@;bFQ#CT zV0IV|1Ll4vb*8mCG70}W_>J!pbL`q(Mk#Luq5Ho-?sljN6JfW)-Tyt?3`DZ%L z>1cfFaA%b9aDM4sjzPiuCSI52j;PmRFq03dvd{@)=@Z9{wG$dz~4@#t3rj;1m%CZ{=~k9~XcBC6v7NckqV@1WVYQ<43f3{9(XPWS>EN{EO~*-CK*bt;ZS;!OLuY z87ft)RVyp(Cw{BC?#*W-X}?E8n+mG`{Ikbd@Mf3BkFQ_T3aIyS+g0*qIBMqV83`?o zX*3SoyLQT=V65w9M3)n><3cpp4wMiSNQ6I0WTSfL@yq6O5RJ^;rpPEzOSf?<#OEal z#JE8?_%;i?y7A-hXB(+R7p{hi!m)9NPT7A;G|icpHm~wS^k`I({`l+|qO9g~*i~G*9imYv^HH~-3PeB-S_xwv+Y2l=g6>lXZk|B1v+dn| zeA>r~Z}f3>@rByy3Q&w80&#K>pvR%5geJnqq z#YL_Lw5jl$vkg7ZRPvcNku1Nz{`lM2`2I+BH-`3Ba?R1ny-~VYe z9l%0>oH`pOV?m#)LN)yxXMS#M>?$?Ja6PLFE);UCNl#M06nrh>lc`K1PMyM&Ka>tI zyKVLSSwJ-z2RXNRh*UcPO%t2{i@X_0uuwJ6@h;-=Qef3g6X8cFUHPoCZIv{}R78rZ%99agCe;SpR z2&R5q?E=vp9E`14e_L9iWfefrys(&*EXOenhi}(uR8D%;1^v32tF*i$meYY6!3~@Q zv5OSB5c`O2eYdLw^yThU*z33iu!U)sm(UUi!Yh5@S`weCs{BaFFDP7dWAap2{nG=s zg+-P;PwqQ+?wHvS{X^xRx~)ampA>1zW`P2@zwfa|>{ z(Zt?9q>hUSNyY-w8WjF3)S{^{Y;7-zeNdEWXCYNlYE#WdCdLmAQQa{ib}eB{46!Vm zo13!fMtVj@*A05r-xRqe1O+nR=OyKWG>u1mlD&rJ7WUEOHCORSf`H4G9m&D*U>eu{ zLp6o#gU{59h79h}@mqyQxAYnwjZ3|e)+cm~c9C*PmcN-nJ13-pb9}j+aMZB3eWbuU z(aP`J@@Js(3eo*K%?H@(M#W~b(~+qW`F;+iobQ&M*W>{=WjBNNZqtpbh4N5N(I2dG z-RX`fI|JPp?}OI)XaR2iVs;j=E!yAobeUouDw>}0b0z1W+MTAGY0eJ{GDB$rxn+Jx zijgtNgG}Ip-xgzR(6Yw>ce#I{RXF)m?YpDnSx1P z-qxP|)1Pe80-2Yo{|kjzD-b|ra*a%GbQ-JEf zY4Ef^R`Uo`;5%GzqsAjSR8OWeT$^xkT*!`awX@U|_Abd2Kni%MHCjtQr!HimpSd78 zqrPOZv^3?zweIu9Gt!GTOD19I)$#R&XHcKG{N6t4Uzm)% z_&ik-;lla8ao5f-XCXafQiDpVG*V0{N!aCZPn=1CN`%)rVO5b3-l1<&5Rm>dgqG6& zi6I?9NDN#D1uh~vl;mU=49d2IlV^tnzNl6O2YpihPema^^jse;K;WdUa}|$oaghqg z(6Awt@Duo-@b4d^62bJ31eGM@W)0Qd@X!Ndd;7ddj(j^*YY2nz}q(w%?j=RPLP@eEF|B$PQ2KtCtcE0TG0n}qx$Q0g;>#Q zXb4R~mYm3CJ1RdzfK4TCyeNO)4km{6`QK7Rtf74G7sV*O8|HzS0B>>4yF}W2o(lp* zM{UWrv+Ba@vnVNI88u6!KF%=Wbx&cqT*am6q30wD#F98KVc5!5oJkm|LweHam10~r zX@~3#%zVK@yDeBv6!qOETx37pSa`UBTxI#cHI-Sl3=?)E1K4yNsZ5YEKwM8qGV1Vn zk8qYSbHYB+UTkQmS t;Jjx^&~6n@&egfT2m_h_UkqA5Co_+SJESY3=}2`iKwrlMS%GlG{15vgE&>1m diff --git a/cmake/SparkAppimageConfig.cmake b/cmake/SparkAppimageConfig.cmake index 40649f8..7384b47 100644 --- a/cmake/SparkAppimageConfig.cmake +++ b/cmake/SparkAppimageConfig.cmake @@ -24,52 +24,76 @@ # default.desktop 文件与 default.png 文件的生成。 # 这是一个依赖的 copy-desktop-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) +# 要求: + # LINUXDEPLOYQT 提供的外部参数,一般指 linuxdeployqt 程序路径 + # APPIMAGETOOL 提供的外部参数,一般指 appimagetool 程序路径 + +option(USE_APPIMAGE_NEW_GLIBC "允许在打包过程中使用较新版本的 glibc 库" ON) + +set(APPIMAGE_OUTPUT "${CMAKE_BINARY_DIR}/appimage") +set(APPIMAGE_OUTPUT_ICON "${APPIMAGE_OUTPUT}/default.png") +set(APPIMAGE_OUTPUT_DESTKOP "${APPIMAGE_OUTPUT}/default.desktop") + +# 1. 添加一个可以用于 Appimage 使用的图标文件 +function(add_appimage_icon _icon) + if(CMAKE_VERSION VERSION_LESS 3.21) + message("> cmake version is less than 3.21") + configure_file(${_icon} ${APPIMAGE_OUTPUT_ICON} COPYONLY) + else() + file(MAKE_DIRECTORY ${APPIMAGE_OUTPUT}) + file(COPY_FILE ${_icon} ${APPIMAGE_OUTPUT_ICON}) + endif(CMAKE_VERSION VERSION_LESS 3.21) +endfunction(add_appimage_icon _icon) + +# 2. 基于 SparkDesktopMacros.cmake 提供的宏来定义 desktop 内容说明 + # 使用与自身的 desktop.in 模板进行生成 +function(add_appimage_desktop) + configure_file(cmake/spark-appimage.desktop.in.txt + ${APPIMAGE_OUTPUT_DESTKOP} @ONLY) +endfunction(add_appimage_desktop) + +function(target_linuxdeploy _target) + + if(USE_APPIMAGE_NEW_GLIBC) + message("Use New glibc") + add_custom_target(linuxdeploy pwd + BYPRODUCTS appimage + COMMAND "${LINUXDEPLOYQT}" $ -appimage -unsupported-allow-new-glibc -verbose=3 -no-strip || true + WORKING_DIRECTORY "${APPIMAGE_OUTPUT}") + else() + message("Un Use New glibc") + add_custom_target(linuxdeploy pwd + BYPRODUCTS appimage + COMMAND "${LINUXDEPLOYQT}" $ -appimage -verbose=3 -no-strip || true + WORKING_DIRECTORY "${APPIMAGE_OUTPUT}") + endif(USE_APPIMAGE_NEW_GLIBC) + +endfunction(target_linuxdeploy _target) 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) + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") endfunction(target_appimage) -function(add_appimage) +# 3. 添加对目标的 Appimage 构建,Appimage 在一个项目中只能构建一个目标 +function(add_appimage_target _target) # 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}) + if(CMAKE_VERSION VERSION_LESS 3.19) message("> cmake version is less than 3.19") - message(WARNING "!Relative paths are not supported!") + if(CMAKE_VERSION VERSION_GREATER 3.4) + get_filename_component(LINUXDEPLOYQT_REAL_PATH ${LINUXDEPLOYQT} REALPATH) + else() + message("> cmake version is less than 3.4") + message(WARNING "!Relative paths are not supported!") + endif(CMAKE_VERSION VERSION_GREATER 3.4) else() file(REAL_PATH ${LINUXDEPLOYQT} LINUXDEPLOYQT_REAL_PATH) - endif(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) + endif(CMAKE_VERSION VERSION_LESS 3.19) message("AppImage> Found LINUXDEPLOYQT Variable: ${LINUXDEPLOYQT_REAL_PATH}") # check appimagetool @@ -77,47 +101,58 @@ function(add_appimage) message("AppImage> Not Found APPIMAGETOOL Variable!") return() endif(NOT DEFINED APPIMAGETOOL) - if(CMAKE_VERSION VERSION_LESS 3.19 AND NOT EXISTS ${LINUXDEPLOYQT}) + if(CMAKE_VERSION VERSION_LESS 3.19) # 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!") + if(CMAKE_VERSION VERSION_GREATER 3.4) + get_filename_component(APPIMAGETOOL_REAL_PATH ${APPIMAGETOOL} REALPATH) + else() + message("> cmake version is less than 3.4") + message(WARNING "!Relative paths are not supported!") + endif(CMAKE_VERSION VERSION_GREATER 3.4) 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}") + endif(CMAKE_VERSION VERSION_LESS 3.19) + message("AppImage> Found APPIMAGETOOL Variable: ${APPIMAGETOOL}") # do add_custome_target make_directory(${APPIMAGE_OUTPUT}) - target_linuxdeploy() + target_linuxdeploy(${_target}) 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) + # 重设目标输出的目录 + set_target_properties(${_target} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${APPIMAGE_OUTPUT}") -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) + # 为解决在不使用 -unsupported-allow-new-glibc 参数时, + # 可能不会生成 AppRun 软链接的问题 + if(NOT USE_APPIMAGE_NEW_GLIBC) + set_target_properties(${_target} + PROPERTIES + RUNTIME_OUTPUT_NAME "AppRun") + endif(NOT USE_APPIMAGE_NEW_GLIBC) +endfunction(add_appimage_target _target) -# 如果glic>=2.27,你就需要加上参数 -unsupported-allow-new-glibc (意思就是不再低版本发行版使用了) -# 或 -unsupported-bundle-everything(大概的意思是尝试兼容,实际测试,到其他发行版直接用不了了,有可能是发行版的原因,还是建议用前者,虽然放弃了低版本) +# 如果 glic>=2.27, 你就需要加上参数 -unsupported-allow-new-glibc 意思就是不再低版本发行版使用了 +# 或 -unsupported-bundle-everything +# 大概的意思是尝试兼容,实际测试,到其他发行版直接用不了了,有可能是发行版的原因,还是建议用前者,虽然放弃了低版本 # -unsupported-bundle-everything - # 捆绑所有依赖库,包括 ld-linux.so 加载器和 glibc。这将允许构建在较新系统上的应用程序在较旧的目标系统上运行,但不建议这样做,因为它会导致捆绑包超出所需的大小(并且可能到其他发行版无法使用) + # 捆绑所有依赖库,包括 ld-linux.so 加载器和 glibc。 + # 这将允许构建在较新系统上的应用程序在较旧的目标系统上运行, + # 但不建议这样做,因为它会导致捆绑包超出所需的大小(并且可能到其他发行版无法使用) # -unsupported-allow-new-glibc - # 允许 linuxdeployqt 在比仍受支持的最旧 Ubuntu LTS 版本更新的发行版上运行。这将导致 AppImage无法在所有仍受支持的发行版上运行,既不推荐也不测试或支持 + # 允许 linuxdeployqt 在比仍受支持的最旧 Ubuntu LTS 版本更新的发行版上运行。 + # 这将导致 AppImage无法在所有仍受支持的发行版上运行,既不推荐也不测试或支持 -# ./linuxdeployqt-7-x86_64.AppImage 程序目录/程序 -appimage -unsupported-allow-new-glibc -# ./linuxdeployqt-7-x86_64.AppImage 程序目录/程序 -appimage -unsupported-bundle-everything +# 对 linuxdeployqt 的使用 +# ./linuxdeployqt-7-x86_64.AppImage + # 程序目录/程序 -appimage -unsupported-allow-new-glibc +# ./linuxdeployqt-7-x86_64.AppImage + # 程序目录/程序 -appimage -unsupported-bundle-everything @@ -126,7 +161,7 @@ endfunction(add_appimage_icon _ICON_PATH) # 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 的构建 +# add_appimage_target(${PROJECT_NAME}) # 添加到 Appimage 中的默认目标,应用对 Appimage 的构建 # 2. 在 Makefile 进行构建目标构建 Appimage 的构建流 -- # 在 Makefile 进行构建目标构建 Appimage (要求提供工具的绝对路径,然后可依次进行linuxdeployqt, genrate-appimage) @@ -150,3 +185,8 @@ endfunction(add_appimage_icon _ICON_PATH) # genrate-appimage: # cd build && cmake .. -DLINUXDEPLOYQT=$(LINUXDEPLOYQT) -DAPPIMAGETOOL=$(APPIMAGETOOL) # cd build && make appimage + + + +# NOTE: +# 如果使用的库不存在于系统路径,则需要配置 export LD_LIBRARY_PATH=<路径> 以便 linuxdeployqt 可搜索到库的位置 diff --git a/cmake/SparkBuildGraphviz.cmake b/cmake/SparkBuildGraphviz.cmake new file mode 100644 index 0000000..ce9dbc3 --- /dev/null +++ b/cmake/SparkBuildGraphviz.cmake @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.5.1) + +# 添加构建项目依赖图目标: make builddeps +add_custom_target(builddeps + COMMAND "${CMAKE_COMMAND}" "--graphviz=graphviz/builddeps.dot" . + COMMAND dot -Tpng graphviz/builddeps.dot -o builddeps.png + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" +) \ No newline at end of file diff --git a/cmake/DebPackageConfig.cmake b/cmake/SparkDebPackageConfig.cmake similarity index 90% rename from cmake/DebPackageConfig.cmake rename to cmake/SparkDebPackageConfig.cmake index ec68fa6..fe275e1 100644 --- a/cmake/DebPackageConfig.cmake +++ b/cmake/SparkDebPackageConfig.cmake @@ -1,7 +1,7 @@ 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) @@ -119,7 +119,7 @@ function(set_package_vars _IN_KEY _IN_VAL) else() set(CPACK_DEBIAN_PACKAGE_VERSION "${_IN_VAL}" PARENT_SCOPE) endif(_IN_VAL STREQUAL "auto") - + message("--> 软件版本: ${_IN_VAL}") endif(_Version EQUAL "0") @@ -137,7 +137,7 @@ function(set_package_vars _IN_KEY _IN_VAL) find_str("${_IN_KEY}" "Architecture" _Architecture) if(_Architecture EQUAL "0") - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE) + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${_IN_VAL}" PARENT_SCOPE) if(_IN_VAL STREQUAL "auto") execute_process( COMMAND dpkg --print-architecture @@ -148,7 +148,7 @@ function(set_package_vars _IN_KEY _IN_VAL) 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) @@ -179,6 +179,12 @@ function(set_package_vars _IN_KEY _IN_VAL) message("--> 软件建议: ${_IN_VAL}") endif(_Recommends EQUAL "0") + find_str("${_IN_KEY}" "Conflicts" _Conflicts) + if(_Conflicts EQUAL "0") + set(CPACK_DEBIAN_PACKAGE_CONFLICTS "${_IN_VAL}" PARENT_SCOPE) + message("--> 软件冲突: ${_IN_VAL}") + endif(_Conflicts EQUAL "0") + endfunction(set_package_vars _IN_KEY _IN_VAL) # 定义一个自定义(add_package_descript)函数 @@ -194,7 +200,7 @@ function(add_package_descript IN_DES) 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) @@ -244,7 +250,12 @@ function(add_package_descript IN_DES) set(PREV_DES_LINE "") while(NOT PREV_DES_LINE STREQUAL DES_LINE) if(NOT PREV_DES_LINE STREQUAL "") - set(Descrition "${Descrition}\n${DES_LINE}") + if ("${CMAKE_VERSION}" VERSION_LESS "3.15") + set(Descrition "${Descrition}\n${DES_LINE}") + else() + string(STRIP "${DES_LINE}" STRIP_DES_LINE) + set(Descrition "${Descrition}\n${STRIP_DES_LINE}") + endif("${CMAKE_VERSION}" VERSION_LESS "3.15") endif(NOT PREV_DES_LINE STREQUAL "") set(PREV_DES_LINE "${DES_LINE}") sub_next(${DES_CONTENT} NEXT_INDEX DES_LINE DES_CONTENT) @@ -284,16 +295,28 @@ function(add_package_descript IN_DES) endif("${OSDVer}" 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 + set(_DebFileName "${_Package}_${_Version}_${_Architecture}${PACKAGE_SUFFIX}.deb" ) set(CPACK_DEBIAN_FILE_NAME ${_DebFileName}) + # 标识: spark-deb-package + if(NOT "${PACKAGE_SUFFIX}" STREQUAL "") + # eg: remove '_' of '_Debian' + string(SUBSTRING "${PACKAGE_SUFFIX}" 1 -1 DISTRIBUTION) + if ("${CMAKE_VERSION}" VERSION_LESS "3.15") + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${Descrition}\n .\n Build for ${DISTRIBUTION} through spark-deb-build.") + else() + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${Descrition} "\n.\nBuild for ${DISTRIBUTION} through spark-deb-build.") + endif("${CMAKE_VERSION}" VERSION_LESS "3.15") + + endif(NOT "${PACKAGE_SUFFIX}" STREQUAL "") # set(CPACK_DEBIAN_PACKAGE_NAME "${Package}") # set(CPACK_DEBIAN_PACKAGE_VERSION "${Version}") @@ -326,7 +349,7 @@ endfunction(add_package_descript IN_DES) # CPACK_DEBIAN_FILE_NAME - n # CPACK_DEBIAN_PACKAGE_NAME - y # CPACK_DEBIAN_PACKAGE_VERSION - y -# CPACK_DEBIAN_PACKAGE_ARCHITECTURE - y(auto) +# CPACK_DEBIAN_PACKAGE_ARCHITECTURE - y(auto) -> dpkg --print-architecture # CPACK_DEBIAN_PACKAGE_DEPENDS - y # CPACK_DEBIAN_PACKAGE_PRIORITY - y # CPACK_DEBIAN_PACKAGE_MAINTAINER - y @@ -339,4 +362,5 @@ endfunction(add_package_descript IN_DES) # set(ARCHITECTURE "arm64") # endif() + # string(TIMESTAMP BUILD_TIME "%Y%m%d") diff --git a/cmake/SparkDesktopMacros.cmake b/cmake/SparkDesktopMacros.cmake index c1447c5..bea9da8 100644 --- a/cmake/SparkDesktopMacros.cmake +++ b/cmake/SparkDesktopMacros.cmake @@ -1,17 +1,19 @@ +# SparkDesktopMacros.cmake -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 +macro(spark_desktop_macros) + set(APP_NAME ${ARGV0}) + set(APP_NAME_ZH_CN ${ARGV1}) + set(APP_COMMENT ${ARGV2}) + set(APP_TYPE ${ARGV3}) + set(APP_EXECUTE_PATH ${ARGV4}) + set(APP_EXECUTE_ICON_PATH ${ARGV5}) + set(APP_CATEGORIES ${ARGV6}) + set(APP_MIME_TYPE ${ARGV7}) + configure_file(cmake/spark-desktop.desktop.in.txt + ${CMAKE_BINARY_DIR}/${ARGV0}.desktop ) - set(SPARK_DESKTOP_FILE ${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) + set(SPARK_DESKTOP_FILE ${CMAKE_BINARY_DIR}/${ARGV0}.desktop) +endmacro(spark_desktop_macros) # include(cmake/SparkDesktopMacros.cmake) # 内容默认应用名称: Name= 应与项目名称相同 @@ -22,15 +24,27 @@ endmacro(spark_desktop_macros _APP_NAME _APP_NAME_ZH_CN _APP_COMMENT _APP_TYPE _ # 应用类型: Type= # 执行程序: Exec= # 图标路径: Icon= - # 应用分类: Category= + # 应用分类: Categories= + # MIME类型: MimeType= # ) +# TODO 安装位置:INSTALL(将自动实现 install 文件,如 /usr/share/applications) + +# install(FILES ${APP_NAME}.desktop +# DESTINATION /usr/share/applications +# ) + # 或者 +# install(FILES ${SPARK_DESKTOP_FILE} +# DESTINATION /usr/share/applications +# ) + +# 基于 configure_file 填充内容配置 # configure_file( # [NO_SOURCE_PERMISSIONS | USE_SOURCE_PERMISSIONS | # FILE_PERMISSIONS ...] # [COPYONLY] [ESCAPE_QUOTES] [@ONLY] # [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ]) -# install(FILES ${APP_NAME}.desktop +# install(FILES ${SPARK_DESKTOP_FILE}.desktop # DESTINATION /usr/share/applications -# ) \ No newline at end of file +# ) diff --git a/cmake/SparkEnvConfig.cmake b/cmake/SparkEnvConfig.cmake index 9e36ada..cbc334c 100644 --- a/cmake/SparkEnvConfig.cmake +++ b/cmake/SparkEnvConfig.cmake @@ -1,16 +1,22 @@ cmake_minimum_required(VERSION 3.5.1) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -# set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) # set(CMAKE_BUILD_TYPE "Debug") option(SPARK_DEBUG_MESSAGE "CMake Spark Module Debug Message." OFF) +set(SPAKK_DEBUG_LOGFILE "${CMAKE_BINARY_DIR}/spark_debug.log" CACHE STRING "Spark Build Debug logfile." FORCE) +file(WRITE ${SPAKK_DEBUG_LOGFILE}) macro(spark_debug_message) if(SPARK_DEBUG_MESSAGE) - message(${ARGN}) + set(SPARK_ONECE_LOG ${ARGN}) + message("[SPARK_MESSAGE]: " ${SPARK_ONECE_LOG}) + file(APPEND ${SPAKK_DEBUG_LOGFILE} ${SPARK_ONECE_LOG} "\n") + unset(SPARK_ONECE_LOG) endif(SPARK_DEBUG_MESSAGE) endmacro(spark_debug_message) + diff --git a/cmake/SparkFindDtkConfig.cmake b/cmake/SparkFindDtkConfig.cmake new file mode 100644 index 0000000..278d0d1 --- /dev/null +++ b/cmake/SparkFindDtkConfig.cmake @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.5.1) + +# include(SparkFindQt5Config.cmake) +find_package(Dtk COMPONENTS Core Widget Gui) + +function(target_link_dtk NAME) + target_link_libraries(${NAME} + ${DtkCore_LIBRARIES} + ${DtkWidget_LIBRARIES} + ${DtkGui_LIBRARIES}) +endfunction(target_link_dtk NAME) \ No newline at end of file diff --git a/cmake/SparkFindLibraries.cmake b/cmake/SparkFindLibraries.cmake new file mode 100644 index 0000000..a1b936c --- /dev/null +++ b/cmake/SparkFindLibraries.cmake @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.5.1) + +# spark_find_library(notify libnotify) + +# function(target_link_${_prefix} TARGET) +# target_link_libraries(${TARGET} ${_prefix}) +# endfunction(target_link_${_prefix} TARGET) \ No newline at end of file diff --git a/cmake/SparkMacrosConfig.cmake b/cmake/SparkMacrosConfig.cmake index 4dd8b23..7a353ca 100644 --- a/cmake/SparkMacrosConfig.cmake +++ b/cmake/SparkMacrosConfig.cmake @@ -2,6 +2,48 @@ cmake_minimum_required(VERSION 3.5.1) # 定义一些 macro 用于自动生成构建结构 +# spark_aux_source_directory outvar invar [skip] +# 获取目录下的所有源代码 +macro(spark_aux_source_directory OUTVAR INVAR) + # iv: internal_variable + set(iv_args ${ARGN}) + list(LENGTH iv_args iv_arglen) + + file(GLOB iv_SOURCE_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${INVAR}/*.c ${INVAR}/*.cpp) + file(GLOB iv_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${INVAR}/*.h ${INVAR}/*.hpp) + file(GLOB iv_QT_UI_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${INVAR}/*.ui ${INVAR}/*.qrc) + + if(iv_arglen EQUAL 1) + list(APPEND ${OUTVAR} ${iv_SOURCE_LIST} ${iv_HEADER_LIST} ${iv_QT_UI_LIST}) + else() + set(${OUTVAR} ${iv_SOURCE_LIST} ${iv_HEADER_LIST} ${iv_QT_UI_LIST}) + endif(iv_arglen EQUAL 1) + + unset(iv_args) + unset(iv_arglen) + unset(iv_SOURCE_LIST) + unset(iv_HEADER_LIST) + unset(iv_QT_UI_LIST) + +endmacro(spark_aux_source_directory OUTVAR INVAR) + +# spark_aux_source_directories outvar invar [...] +# 获取目录列表下的所有源代码 + # spark_aux_source_directory 的扩展,支持多个 invar 与追加参数 +macro(spark_aux_source_directories OUTVAR INVAR) + set(iv_aux_directories ${ARGN}) + + spark_aux_source_directory(${OUTVAR} ${INVAR}) + + foreach(iv_directory IN LISTS iv_aux_directories) + spark_aux_source_directory(${OUTVAR} ${iv_directory} SKIP) + endforeach(iv_directory IN LISTS iv_aux_directories) + + unset(iv_aux_directories) + +endmacro(spark_aux_source_directories OUTVAR INVAR) + + # spark_add_library [files]... # 构建一个库,基于指定的源文件 # 并根据库名生成 target_link_ 函数 @@ -27,44 +69,124 @@ endmacro(spark_add_library _lib_name) # 函数内增加以 头文件搜索路径 macro(spark_add_library_path _lib_name _lib_path) - set(${_lib_name}_SOURCE_PATH ${_lib_path}) + # 0. 建立初始变量体系 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_MESSAGE "STATIC(Default)") + set(${_lib_name}_ARGN ${ARGN}) + + # 1. 判断 _lib_path 是否是 SHARED 或 STATIC + if(${_lib_path} STREQUAL SHARED OR ${_lib_path} STREQUAL STATIC) set(${_lib_name}_TYPE ${_lib_path}) - spark_debug_message("_lib_path: ${${_lib_name}_SOURCE_PATH}(${ARGV2})[${${_lib_name}_TYPE}]") + set(${_lib_name}_TYPE_MESSAGE ${${_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) + else() + # 如没有则将 _lib_path 加入到 ARGN + list(APPEND ${_lib_name}_ARGN ${_lib_path}) + endif(${_lib_path} STREQUAL SHARED OR ${_lib_path} STREQUAL STATIC) - aux_source_directory(${${_lib_name}_SOURCE_PATH} ${_lib_name}_SOURCES) + # 1. 处理由 spark_add_library_realpaths 构建转本构建时的清洗机制 + spark_debug_message("> Building: ${_lib_name}, type: ${${_lib_name}_TYPE_MESSAGE}") + set(${_lib_name}_ARGN_REF ${${_lib_name}_ARGN}) + unset(${_lib_name}_ARGN) + foreach(_old IN LISTS ${_lib_name}_ARGN_REF) + set(_new ${_old}) + string(FIND "${_old}" "+" _plus_index) + if(${_plus_index} GREATER 0) + string(SUBSTRING "${_old}" 0 ${_plus_index} _new) + spark_debug_message(" [CONVERT] ${_new} <- ${_old}") + endif(${_plus_index} GREATER 0) + list(APPEND ${_lib_name}_ARGN ${_new}) + endforeach(_old IN LISTS ${_lib_name}_ARGN_REF) + - # 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}) - spark_debug_message("${_lib_name}_SOURCES: ${${_lib_name}_SOURCES}, ${${_lib_name}_SOURCE_PATH}") - foreach(item IN LISTS ${_lib_name}_SOURCES) - spark_debug_message(" -> ${item}") - endforeach(item IN LISTS ${_lib_name}_SOURCES) + # 2.目标参数项分析出子项 + # 拆分出源代码、路径、未知项等 + set(${_lib_name}_ARGN_SOURCES) + set(${_lib_name}_ARGN_APPEND_PATHS) + set(${_lib_name}_ARGN_UNKNOW) + foreach(item IN LISTS ${_lib_name}_ARGN) + spark_debug_message(" [ARGN] check:" ${item}) + if(NOT EXISTS ${item}) + set(item ${CMAKE_CURRENT_LIST_DIR}/${item}) + endif() + if(EXISTS ${item}) + # spark_debug_message(" exists: true") + file(REAL_PATH ${item} ${_lib_name}_ARGN_item) + if(IS_DIRECTORY ${${_lib_name}_ARGN_item}) + list(APPEND ${_lib_name}_ARGN_APPEND_PATHS ${item}) + else() + list(APPEND ${_lib_name}_ARGN_SOURCES ${item}) + endif(IS_DIRECTORY ${${_lib_name}_ARGN_item}) + else() + list(APPEND ${_lib_name}_ARGN_UNKNOW ${item}) + spark_debug_message(" exists: false") + endif() + endforeach() + + list(LENGTH ${_lib_name}_ARGN_SOURCES ${_lib_name}_ARGN_SOURCES_LENGTH) + list(LENGTH ${_lib_name}_ARGN_APPEND_PATHS ${_lib_name}_ARGN_APPEND_PATHS_LENGTH) + list(LENGTH ${_lib_name}_ARGN_UNKNOW ${_lib_name}_ARGN_UNKNOW_LENGTH) + spark_debug_message(" result: files(${${_lib_name}_ARGN_SOURCES_LENGTH}), paths(${${_lib_name}_ARGN_APPEND_PATHS_LENGTH}), unknow(${${_lib_name}_ARGN_UNKNOW_LENGTH})" ${item}) + # 3. 获取所以源代码为 any_files + spark_debug_message(" files:") + set(any_files ${${_lib_name}_ARGN_SOURCES}) + foreach(item IN LISTS ${_lib_name}_ARGN_APPEND_PATHS) + spark_aux_source_directory(item_files ${item}) + list(APPEND any_files ${item_files}) + foreach(item_file IN LISTS item_files) + spark_debug_message(" ${item_file}") + endforeach(item_file IN LISTS item_files) + endforeach(item IN LISTS ${_lib_name}_ARGN_APPEND_PATHS) + + # 4. 构建目标库 + add_library(${_lib_name} ${${_lib_name}_TYPE} + ${${_lib_name}_ARGN_SOURCES} + ${any_files}) + + # 5. 建立引用点 + # target_link_<_lib_name> 函数 + # target_include_<_lib_name> 函数 + + # target_<_lib_name>_include 函数 + # target_<_lib_name>_link 函数 + + function(target_${_lib_name}_include _include) + spark_debug_message("添加引用: ${_lib_name} <- ${_include} ${${_lib_name}_INCLUDE_ARGN}") + target_include_directories(${_lib_name} PRIVATE ${_include}) + endfunction(target_${_lib_name}_include _include) + + function(target_${_lib_name}_link _library) + spark_debug_message("添加链接: ${_lib_name} <- ${_library} ${${_lib_name}_LINK_ARGN}") + target_link_libraries(${_lib_name} ${_library}) + endfunction(target_${_lib_name}_link _library) + function(target_link_${_lib_name} TARGET) - # spark_debug_message("target_link_${_lib_name}") - spark_debug_message(" -> (include): ${${_lib_name}_SOURCE_PATH}") - target_include_directories(${TARGET} PUBLIC "${${_lib_name}_SOURCE_PATH}") + spark_debug_message("链接引用: ${TARGET} <- ${_lib_name}") + target_include_directories(${TARGET} PRIVATE + "${${_lib_name}_SOURCE_PATH}" ${${_lib_name}_ARGN_APPEND_PATHS}) target_link_libraries(${TARGET} ${_lib_name}) endfunction(target_link_${_lib_name} TARGET) function(target_include_${_lib_name} TARGET) - # 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}) + spark_debug_message("引入引用: ${TARGET} <- ${_lib_name}") + target_include_directories(${TARGET} PUBLIC + "${${_lib_name}_SOURCE_PATH}" ${${_lib_name}_ARGN_APPEND_PATHS}) 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_include_directories(${_lib_name} PRIVATE + "${${_lib_name}_ARGN_APPEND_PATHS}") + + # 输出 includes + spark_debug_message(" ${_lib_name}_ARGN_APPEND_PATHS: ") + foreach(item IN LISTS ${_lib_name}_ARGN_APPEND_PATHS) + string(REPLACE "${CMAKE_SOURCE_DIR}/" "" item_var "${item}") + spark_debug_message(" ${item_var}") + endforeach(item IN LISTS ${_lib_name}_ARGN_APPEND_PATHS) # 如果想用以下操作手动实现 target_link_include_directories # 请注意对 LIST 类型使用 "" 进行包围 @@ -88,29 +210,105 @@ endmacro(spark_add_library_path _lib_name _lib_path) # Qt编译时源文件包括很多类型,需要指定 *.h/*.cpp/*.qrc/*.qm/... 等 macro(spark_add_executable _exec_name) - spark_debug_message("================ ${_exec_name} Executable ================") + set(${_exec_name}_TYPE_MESSAGE "可执行程序") + spark_debug_message("> Building: ${_exec_name}, type: ${${_exec_name}_TYPE_MESSAGE}") + add_executable(${_exec_name} ${ARGN}) endmacro(spark_add_executable _exec_name) +# spark_add_executable_path [files ... paths] +# 构建一个可执行程序,基于指定的路径 macro(spark_add_executable_path _exec_name _exec_path) - aux_source_directory(${_exec_path} ${_exec_name}_SOURCES) + spark_add_executable(${_exec_name}) - 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) - spark_debug_message(" -> ${item}") - endforeach(item IN LISTS ${_exec_name}_SOURCES) + # 0. 建立初始变量体系 + # set(${_exec_name}_TYPE) + # set(${_exec_name}_TYPE_MESSAGE "可执行程序") + set(${_exec_name}_ARGN ${ARGN}) + + # 1. 处理由 spark_add_executable_realpaths 构建转本构建时的清洗机制 + # spark_debug_message("> Building: ${_exec_name}, type: ${${_exec_name}_TYPE_MESSAGE}") + set(${_exec_name}_ARGN_REF ${${_exec_name}_ARGN}) + unset(${_exec_name}_ARGN) + foreach(_old IN LISTS ${_exec_name}_ARGN_REF) + set(_new ${_old}) + string(FIND "${_old}" "+" _plus_index) + if(${_plus_index} GREATER 0) + string(SUBSTRING "${_old}" 0 ${_plus_index} _new) + spark_debug_message(" [CONVERT] ${_new} <- ${_old}") + endif(${_plus_index} GREATER 0) + list(APPEND ${_exec_name}_ARGN ${_new}) + endforeach(_old IN LISTS ${_exec_name}_ARGN_REF) + + # 1.目标参数项分析出子项 + # 拆分出源代码、路径、未知项等 + # spark_debug_message("> Building: ${_exec_name}, type: ${${_exec_name}_TYPE_MESSAGE}") + set(${_exec_name}_ARGN_SOURCES) + set(${_exec_name}_ARGN_APPEND_PATHS ${_exec_path}) + set(${_exec_name}_ARGN_UNKNOW) + foreach(item IN LISTS ${_exec_name}_ARGN) + spark_debug_message(" [ARGN] check:" ${item}) + if(NOT EXISTS ${item}) + set(item ${CMAKE_CURRENT_LIST_DIR}/${item}) + endif() + if(EXISTS ${item}) + # spark_debug_message(" exists: true") + file(REAL_PATH ${item} ${_exec_name}_ARGN_item) + if(IS_DIRECTORY ${${_exec_name}_ARGN_item}) + list(APPEND ${_exec_name}_ARGN_APPEND_PATHS ${item}) + else() + list(APPEND ${_exec_name}_ARGN_SOURCES ${item}) + endif(IS_DIRECTORY ${${_exec_name}_ARGN_item}) + else() + list(APPEND ${_exec_name}_ARGN_UNKNOW ${item}) + spark_debug_message(" exists: false") + endif() + endforeach() + + list(LENGTH ${_exec_name}_ARGN_SOURCES ${_exec_name}_ARGN_SOURCES_LENGTH) + list(LENGTH ${_exec_name}_ARGN_APPEND_PATHS ${_exec_name}_ARGN_APPEND_PATHS_LENGTH) + list(LENGTH ${_exec_name}_ARGN_UNKNOW ${_exec_name}_ARGN_UNKNOW_LENGTH) + spark_debug_message(" result: files(${${_exec_name}_ARGN_SOURCES_LENGTH}), paths(${${_exec_name}_ARGN_APPEND_PATHS_LENGTH}), unknow(${${_exec_name}_ARGN_UNKNOW_LENGTH})" ${item}) + + + # 2. 获取所以源代码为 any_files + spark_debug_message(" files:") + set(any_files ${${_exec_name}_ARGN_SOURCES}) + foreach(item IN LISTS ${_exec_name}_ARGN_APPEND_PATHS) + spark_aux_source_directory(item_files ${item}) + list(APPEND any_files ${item_files}) + foreach(item_file IN LISTS item_files) + spark_debug_message(" ${item_file}") + endforeach(item_file IN LISTS item_files) + endforeach(item IN LISTS ${_exec_name}_ARGN_APPEND_PATHS) + + # 3. 构建可执行目标所需要的文件 + # add_executable(${_exec_name} + # ${${_exec_name}_ARGN_SOURCES} + # ${any_files}) + + target_sources(${_exec_name} PRIVATE + ${${_exec_name}_ARGN_SOURCES} + ${any_files}) - # function(target_link_${_exec_name} TARGET) - # 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) - # target_link_${_exec_name}(${_exec_name}) + # 4. 建立引用点 + # target_<_exec_name>_include 函数 + # target_<_exec_name>_link 函数 + function(target_${_exec_name}_include _include) + spark_debug_message("添加引用: ${_exec_name} <- ${_include} ${${_exec_name}_INCLUDE_ARGN}") + target_include_directories(${_exec_name} PRIVATE ${_include}) + endfunction(target_${_exec_name}_include _include) + function(target_${_exec_name}_link _library) + spark_debug_message("添加链接: ${_exec_name} <- ${_library} ${${_exec_name}_LINK_ARGN}") + target_link_libraries(${_exec_name} ${_library}) + endfunction(target_${_exec_name}_link _library) + + target_include_directories(${_exec_name} PRIVATE + ${_exec_path}) + spark_debug_message(" include: ${_exec_path}\n") + endmacro(spark_add_executable_path _exec_name _exec_path) # spark_find_library @@ -152,10 +350,11 @@ endmacro(spark_add_executable_paths _prefix_path) # ARGN: 此宏剩余的参数列表 # 在使用 target_link_ 时 # _NAME: 用于此 fucntion 中的要求参数: <_NAME>目标将要连接此库 -macro(spark_add_link _IN_NAME) - function(target_link_${_IN_NAME} _NAME) - spark_debug_message("LINK ${_NAME} ${ARGN}") - target_link_libraries(${_NAME} +macro(spark_add_link _name) + function(target_link_${_name} _link) + spark_debug_message("> Linking: ${_link}") + spark_debug_message(" <- ${ARGN}\n") + target_link_libraries(${_link} ${ARGN}) - endfunction(target_link_${_IN_NAME} _NAME) -endmacro(spark_add_link _IN_NAME) + endfunction(target_link_${_name} _link) +endmacro(spark_add_link _name) diff --git a/cmake/SparkMacrosExtendConfig.cmake b/cmake/SparkMacrosExtendConfig.cmake index 09fd6c2..6426cef 100644 --- a/cmake/SparkMacrosExtendConfig.cmake +++ b/cmake/SparkMacrosExtendConfig.cmake @@ -4,171 +4,164 @@ 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) - spark_debug_message("--> 传入的 INVAL: --> 内容: ${INVAL}") - spark_debug_message("--> 传入的 INVAL: --> 长度: ${INVALLEN}") - spark_debug_message("--> 传入的 INVAL: --> +位置: ${RIGHT_PLUS}") - - # 判断是否有右侧 + 号 - if(RIGHT_PLUS LESS 0) - spark_debug_message("--> 传入的 INVAL: --> 无需计算新的+位置") - # spark_debug_message("--> 计算新的 + 位置: ${_PLUSINDEX}") - list(APPEND _tmps ${INVAL}) - else() - math(EXPR _PLUSINDEX "${RIGHT_PLUS}+1") - spark_debug_message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX}") - - string(SUBSTRING "${INVAL}" ${_PLUSINDEX} ${INVALLEN} NewVal) - spark_debug_message("--> 传入的 INVAL: --> 需计算+位置 --> 右移: ${_PLUSINDEX} -> 内容: ${NewVal}") - # string(REPLACE "+" ";" _tmps "${NewVal}") - # list(LENGTH FFFFL FFFFLEN) - - # spark_debug_message("--> 计算新的 + 位置: ${_PLUSINDEX} --> 后面的 NewVal: ${NewVal}") - - # find_plus(${NewVal} _NextPlus) - # if(_NextPlus LESS 0) - # list(APPEND _tmps ${NewVal}) - # spark_debug_message("--> 追加新的 + 位置: ${_PLUSINDEX} --> 后面的") - # else() - # spark_debug_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) -# spark_debug_message("--------> ${FFF}: -> ${FFLEN}") +function(find_plus_v INVAL OUTVAL) + string(FIND "${${INVAL}}" "+" plus_index) + set(${OUTVAL} ${plus_index} PARENT_SCOPE) +endfunction(find_plus_v INVAL OUTVAL) + +function(find_colon INVAL OUTVAL) + string(FIND "${INVAL}" ":" colon_index) + set(${OUTVAL} ${colon_index} PARENT_SCOPE) +endfunction(find_colon INVAL OUTVAL) + +function(find_colon_v INVAL OUTVAL) + string(FIND "${${INVAL}}" ":" colon_index) + set(${OUTVAL} ${colon_index} PARENT_SCOPE) +endfunction(find_colon_v INVAL OUTVAL) + +function(find_dir INVAL OUTVAL) + string(FIND "${INVAL}" "/" _STR ${ARGN}) + set(${OUTVAL} ${_STR} PARENT_SCOPE) +endfunction(find_dir INVAL OUTVAL) + +function(find_dir_v INVAL OUTVAL) + string(FIND "${${INVAL}}" "/" _STR ${ARGN}) + set(${OUTVAL} ${_STR} PARENT_SCOPE) +endfunction(find_dir_v INVAL OUTVAL) + +# +function(str_left INVAL INDEX OUTVAL) + set(LEFT_INDEX ${INDEX}) + string(SUBSTRING "${INVAL}" 0 ${LEFT_INDEX} _LEFT_V) + set(${OUTVAL} ${_LEFT_V} PARENT_SCOPE) +endfunction(str_left INVAL INDEX OUTVAL) + +function(str_right INVAL INDEX OUTVAL) + math(EXPR RIGHT_INDEX ${INDEX}+1) + string(SUBSTRING "${INVAL}" ${RIGHT_INDEX} -1 _RIGHT_V) + set(${OUTVAL} ${_RIGHT_V} PARENT_SCOPE) +endfunction(str_right INVAL INDEX OUTVAL) + +function(str_left_v INVAL INDEX OUTVAL) + set(LEFT_INDEX ${${INDEX}}) + string(SUBSTRING "${${INVAL}}" 0 ${LEFT_INDEX} _LEFT_V) + set(${OUTVAL} ${_LEFT_V} PARENT_SCOPE) +endfunction(str_left_v INVAL INDEX OUTVAL) + +function(str_right_v INVAL INDEX OUTVAL) + math(EXPR RIGHT_INDEX ${${INDEX}}+1) + string(SUBSTRING "${${INVAL}}" ${RIGHT_INDEX} -1 _RIGHT_V) + set(${OUTVAL} ${_RIGHT_V} PARENT_SCOPE) +endfunction(str_right_v INVAL INDEX OUTVAL) + +# +function(find_colon_plus INVAL OUTVAL) + find_colon(${INVAL} COLON_INDEX) + str_right(${INVAL} ${COLON_INDEX} COLON_RIGHT) + find_plus_v(COLON_RIGHT PLUS_INDEX) + str_left_v(COLON_RIGHT PLUS_INDEX COLON_RIGHT_LEFT_PLUS) + + set(${OUTVAL} ${COLON_RIGHT_LEFT_PLUS} PARENT_SCOPE) +endfunction(find_colon_plus INVAL OUTVAL) + +function(find_colon_plus_v INVAL OUTVAL) + find_colon_v(${INVAL} COLON_INDEX) + str_right_v(${INVAL} COLON_INDEX COLON_RIGHT) + find_plus_v(COLON_RIGHT PLUS_INDEX) + str_left_v(COLON_RIGHT PLUS_INDEX COLON_RIGHT_LEFT_PLUS) + + set(${OUTVAL} ${COLON_RIGHT_LEFT_PLUS} PARENT_SCOPE) +endfunction(find_colon_plus_v INVAL OUTVAL) + +function(find_dir_plus INVAL OUTVAL) + # t:*/*+d + # ^ + find_dir("${INVAL}" SLASH_INDEX REVERSE) + str_right("${INVAL}" ${SLASH_INDEX} SLASH_RIGHT) + find_plus_v(SLASH_RIGHT PLUS_INDEX) + str_left_v(SLASH_RIGHT PLUS_INDEX SLASH_RIGHT_LEFT_PLUS) + + set(${OUTVAL} ${SLASH_RIGHT_LEFT_PLUS} PARENT_SCOPE) +endfunction(find_dir_plus INVAL OUTVAL) + +function(find_dir_plus_v INVAL OUTVAL) + # t:*/*+d + # ^ + find_dir("${${INVAL}}" SLASH_INDEX REVERSE) + str_right("${${INVAL}}" ${SLASH_INDEX} SLASH_RIGHT) + find_plus_v(SLASH_RIGHT PLUS_INDEX) + str_left_v(SLASH_RIGHT PLUS_INDEX SLASH_RIGHT_LEFT_PLUS) + + set(${OUTVAL} ${SLASH_RIGHT_LEFT_PLUS} PARENT_SCOPE) +endfunction(find_dir_plus_v INVAL OUTVAL) + + +# spark_add_library_source ... +# 扩展 一行一可执行目标 的构建的扩展宏 +# 在构建时将会另外加入这些资源 +macro(spark_add_library_source target) + set(${target}_ADD_SOURCE ${ARGN}) +endmacro(spark_add_library_source target) + +# 冗余的 target_link_qt5 或 qt6 的处理逻辑 +macro(_handle_spark_target_link_qt_macro _target) + if(SPARK_FIND_QT5) + target_link_qt5(${_target}) + endif(SPARK_FIND_QT5) + + if(SPARK_FIND_QT6) + target_link_qt6(${_target}) + endif(SPARK_FIND_QT6) +endmacro(_handle_spark_target_link_qt_macro _target) # spark_add_library_realpaths # 基于传入的项进行构建 # 可接受的值为: 路径列表 # 可接受的值为: 路径列表+依赖库A+依赖库B macro(spark_add_library_realpaths) - spark_debug_message("---> 基于传入的项进行构建 <---") - # spark_debug_message("--> src/unclassified/ItemDelegates/NdStyledItemDelegate") - # string(FIND [REVERSE]) - # string(SUBSTRING ) - # math(EXPR value "100 * 0xA" OUTPUT_FORMAT DECIMAL) # value is set to "1000" set(REALPATHS ${ARGN}) foreach(REALPATH IN LISTS REALPATHS) - spark_debug_message("---> 传入路径: ${REALPATH} <--- ") - string(LENGTH "${REALPATH}" REALPATH_LENGTH) - spark_debug_message("---> 计算传入路径长度: --> 长度: ${REALPATH_LENGTH}") - - string(FIND "${REALPATH}" "/" LASTINDEX REVERSE) - spark_debug_message("---> 计算传入路径末尾/位置: --> 长度: ${LASTINDEX}") - math(EXPR LASTINDEX "${LASTINDEX}+1") - spark_debug_message("---> 计算传入路径末尾/右移: --> 长度: ${LASTINDEX}") - string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALPATH_LENGTH} REALNAME_Dependency) + # # 找 : 号下标,这是找:号的函数 + # find_colon(${REALPATH} COLON_INDEX) + # 找 / 号下标,这是找/号的函数 + find_dir_v(REALPATH SLASH_INDEX REVERSE) # 找 + 号下标,这是找+号的函数 - find_plus(${REALPATH} RIGHT_PLUS) - - # 判断是否有找到 + 号下标,值为 -1 或 正整数 - if(RIGHT_PLUS LESS 0) # 小于0: 不存在 + 号 - set(REALNAME "${REALNAME_Dependency}") - spark_debug_message("---> 传入路径末尾/右移部分: --> ${REALNAME} <-- 无依赖+") - - spark_debug_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) - + find_plus_v(REALPATH PLUS_INDEX) + + # + + if(PLUS_INDEX LESS 0) + # 完全没有 + 的情况下,它就是一个基于目录的构建 + set(dir ${REALPATH}) + str_right_v(REALPATH SLASH_INDEX target) + + spark_add_library_path(${target} + ${dir} + ${${target}_ADD_SOURCE} + ) + # 使用 spark_add_library_realpaths 构建的依赖将允许直接引用库头文件 + target_include_directories(${target} PUBLIC ${dir}) + _handle_spark_target_link_qt_macro(${target}) else() - spark_debug_message("---> 传入路径末尾/右移部分: --> ${REALNAME_Dependency} <-- 依赖+") - - # 存在+号,将截取从 / 到 + 号之间的内容作为目标名称 - # 例如 src/unclassified/widgets/DocTypeListView+JsonDeploy - # ^(LASTINDEX) ^(RIGHT_PLUS) - # 将 RIGHT_PLUS - LASTINDEX 计算出 DocTypeListView 字符长度 - math(EXPR REALNAME_LENGTH "${RIGHT_PLUS}-${LASTINDEX}") - - spark_debug_message("---> 计算传入路径末尾/右移部分: --> 位置: ${RIGHT_PLUS}") - # spark_debug_message("---> 计算传入路径末尾/右移部分: --> 长度: ${REALNAME_Dependency}") - - # 目标名称为 DocTypeListView - # 依赖为 JsonDeploy - # set(REALNAME "") - string(SUBSTRING "${REALPATH}" 0 ${RIGHT_PLUS} _REALPATH_DIR) - string(SUBSTRING "${REALPATH}" ${LASTINDEX} ${REALNAME_LENGTH} REALNAME) - - spark_debug_message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME}") - - string(SUBSTRING "${REALPATH}" ${RIGHT_PLUS} ${REALPATH_LENGTH} Dependency) - spark_debug_message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency}") - - # plus_list(${Dependency} dependencies dependencies_len) - string(REPLACE "+" ";" dependencies "${Dependency}") - spark_debug_message("---> 计算传入路径末尾/右移部分: --> 库名: ${REALNAME} --> +部分: ${Dependency} --> 列表: ${dependencies} <-- ") - - - spark_debug_message("---> 构建 ${REALNAME} -> ${REALNAME} ${_REALPATH_DIR}") + # 有 + 的情况下,获取 + 号下标右侧所有内容为 target_depends_str 并转为列表 + str_right_v(REALPATH PLUS_INDEX target_depends_str) + string(REPLACE "+" ";" target_depends "${target_depends_str}") + + find_dir_plus_v(REALPATH target) + str_left_v(REALPATH PLUS_INDEX dir) + + spark_add_library_path(${target} + ${dir} + ${${target}_ADD_SOURCE} + ) + spark_debug_message(" [INCLUDE_DIRS]: ${dir} ${dir}/.. \n") + target_include_directories(${target} PUBLIC ${dir} ${dir}/..) + target_link_libraries(${target} ${target_depends}) + endif(PLUS_INDEX LESS 0) - 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) @@ -188,6 +181,7 @@ macro(spark_aux_source_paths AUX_VAR) endmacro(spark_aux_source_paths AUX_VAR) # spark_file_glob +# 使用用 file(GLOB) 的匹配规则,并一次可匹配多个规则 # macro(spark_file_glob FGLOB_VAR) set(${FGLOB_VAR} "") @@ -235,3 +229,107 @@ macro(spark_add_source_paths SOURCE_VAR) endforeach(ui_src IN LISTS UI_SRCS) endforeach(source_path IN LISTS ${SOURCE_VAR}_PATHS) endmacro(spark_add_source_paths SOURCE_VAR) + + +# spark_add_library_file_glob + # +macro(spark_add_library_file_glob _lib_name) + spark_file_glob(${_lib_name}_SOURCES ${ARGN}) + spark_add_library(${_lib_name} ${${_lib_name}_SOURCES}) +endmacro(spark_add_library_file_glob _lib_name) + + + +# spark_add_executable_source ... +# 扩展 一行一可执行目标 的构建的扩展宏 +# 在构建时将会另外加入这些资源 +macro(spark_add_executable_source target) + set(${target}_ADD_SOURCE ${ARGN}) +endmacro(spark_add_executable_source target) + +# 冗余的 spark_add_executable_realpaths 的 dir 处理逻辑 +macro(_handle_spark_add_executable_realpaths_if_dir_empty_macro) + if("${dir}" STREQUAL "") + spark_add_executable(${target} + ${${target}_ADD_SOURCE} + ) + else() + spark_add_executable_path(${target} + ${dir} + ${${target}_ADD_SOURCE} + ) + endif("${dir}" STREQUAL "") +endmacro(_handle_spark_add_executable_realpaths_if_dir_empty_macro) + +# spark_add_executable_realpaths +# 基于传入的项进行构建 +# 可接受的值为: 可执行目标:路径列表 +# 可接受的值为: 可执行目标:路径列表+依赖库A+依赖库B +macro(spark_add_executable_realpaths) + + set(REALPATHS ${ARGN}) + foreach(REALPATH IN LISTS REALPATHS) + + # 找 : 号下标,这是找:号的函数 + find_colon(${REALPATH} COLON_INDEX) + + if(COLON_INDEX LESS 0) + # do not anything + else() + # 找到 : 号,将截取 target 名称 + # string(SUBSTRING "${REALPATH}" 0 ${COLON_INDEX} REALTARGET) + find_colon_v(REALPATH COLON_INDEX) + str_left_v(REALPATH COLON_INDEX target) + str_right_v(REALPATH COLON_INDEX COLON_REMAIN) + # message(FATAL_ERROR "构建一个: ${target}") # 已验证 + + endif(COLON_INDEX LESS 0) + + # 找 + 号下标,这是找+号的函数 + find_plus_v(REALPATH PLUS_INDEX) + + if(PLUS_INDEX LESS 0) + # 完全没有 + 的情况下,它就是一个基于目录的构建 + set(dir ${COLON_REMAIN}) + # spark_add_executable_path(${target} + # ${dir} + # ${${target}_ADD_SOURCE} + # ) + _handle_spark_add_executable_realpaths_if_dir_empty_macro() + _handle_spark_target_link_qt_macro(${target}) + else() + # 有 + 的情况下,获取 + 号下标右侧所有内容为 target_depends_str 并转为列表 + str_right_v(REALPATH PLUS_INDEX target_depends_str) + string(REPLACE "+" ";" target_depends "${target_depends_str}") + + # 再从主要内容中获取 dir ,以及 + find_colon_plus_v(REALPATH dir) + # spark_add_executable_path(${target} + # ${dir} + # ${${target}_ADD_SOURCE} + # ) + _handle_spark_add_executable_realpaths_if_dir_empty_macro() + target_include_directories(${target} PUBLIC ${dir} ${dir}/..) + target_link_libraries(${target} ${target_depends}) + endif(PLUS_INDEX LESS 0) + endforeach(REALPATH IN LISTS REALPATHS) + +endmacro(spark_add_executable_realpaths) + + +# 一行一库概念构建 +# 1.构建一个库,基于指定的目录路径进行构建 +# src/widgets/DocTypeListView +# ^目录将被用于制作的目标名称 +# 目录下的所有文件将被用于制作此库的源代码文件 +# +# 2.构建一个库,基于指定的目录路径进行构建,并依赖其后面所列出的依赖项 +# src/widgets/MaintainerInfoView+DocTypeListView+... +# ^此库将被用于 MaintainerInfoView 库的依赖 +# ^此符号'+'将被视为依赖项列表的分隔符 + +# 一行一可执行目标概念 +# 1.构建一个可执行目标,基于指定的目录路径进行构建(行不通,可执行目标很少为一个目录) +# 2.构建一个可执行目标,基于指定的文件路径进行构建(也许可以) +# 3.构建一个可执行目标,基于指定的文件名称进行构建() +# 4.构建一个可执行目标,基于指定命名规则(target:dir:dir+depend+depend...) diff --git a/cmake/SparkTranslatorConfig.cmake b/cmake/SparkTranslatorConfig.cmake new file mode 100644 index 0000000..33eec6f --- /dev/null +++ b/cmake/SparkTranslatorConfig.cmake @@ -0,0 +1,48 @@ +cmake_minimum_required(VERSION 3.5.1) + +# translator_qt5 _qmvar [... *.ts] +macro(translator_qt5 _qmvar) + # set(SPARK_TRANSLATIONS_ARGN ${ARGN}) + # file(GLOB SPARK_TRANSLATIONS ${SPARK_TRANSLATIONS_ARGN}) + # qt5_add_translation(SPARK_QM_TRANSLATIONS + # ${SPARK_TRANSLATIONS}) + + set(${_qmvar}_ARNG ${ARGN}) + file(GLOB ${_qmvar}_TS_FILES ${${_qmvar}_ARNG}) + find_package(Qt5LinguistTools) + + qt5_add_translation(${_qmvar} + ${${_qmvar}_TS_FILES}) + + set(SPARK_QM_TRANSLATIONS ${_qmvar}) + + # 注意,必须将 SPARK_QM_TRANSLATIONS 或 ${_qmvar} 加入到 add_executable 参数中才能在编译时生成只有原文的ts文件 + + # qt5_create_translation + # ts文件会在 make clean 或重新编译的时候一并被删除,再编译的时候生成全新的ts(原有的翻译会丢失,万分注意!!) + + # qt5_add_translation + # 此宏比较稳定 +endmacro(translator_qt5 _qmvar) + + +# translator_qt6 _qmvar [... *.ts] +macro(translator_qt6 _qmvar) + # todo +endmacro(translator_qt6 _qmvar) + +# 冗余的 translator_qt5 或 qt6 的处理逻辑 +macro(_handle_spark_translator_qt_macro _outvar) + if(SPARK_FIND_QT5) + translator_qt5(${_outvar} ${ARGN}) + endif(SPARK_FIND_QT5) + + if(SPARK_FIND_QT6) + translator_qt6(${_outvar} ${ARGN}) + endif(SPARK_FIND_QT6) +endmacro(_handle_spark_translator_qt_macro _outvar) + +# translator_qt _qmvar [... *.ts | match] +macro(translator_qt) + _handle_spark_translator_qt_macro(${ARGN}) +endmacro(translator_qt) diff --git a/cmake/linuxdeployqt-help b/cmake/linuxdeployqt-help new file mode 100644 index 0000000..1b72fda --- /dev/null +++ b/cmake/linuxdeployqt-help @@ -0,0 +1,48 @@ +linuxdeployqt (commit 5fa79fa), build 36 built on 2022-08-21 12:36:03 UTC +WARNING: Not checking glibc on the host system. + The resulting AppDir or AppImage may not run on older systems. + This mode is unsupported and discouraged. + For more information, please see + https://github.com/probonopd/linuxdeployqt/issues/340 + +Usage: linuxdeployqt [options] + +Options: + -always-overwrite : Copy files even if the target file exists. + -appimage : Create an AppImage (implies -bundle-non-qt-libs). + -bundle-non-qt-libs : Also bundle non-core, non-Qt libraries. + -exclude-libs= : List of libraries which should be excluded, + separated by comma. + -ignore-glob= : Glob pattern relative to appdir to ignore when + searching for libraries. + -executable= : Let the given executable use the deployed libraries + too + -extra-plugins= : List of extra plugins which should be deployed, + separated by comma. + -no-copy-copyright-files : Skip deployment of copyright files. + -no-plugins : Skip plugin deployment. + -no-strip : Don't run 'strip' on the binaries. + -no-translations : Skip deployment of translations. + -qmake= : The qmake executable to use. + -qmldir= : Scan for QML imports in the given path. + -qmlimport= : Add the given path to QML module search locations. + -show-exclude-libs : Print exclude libraries list. + -verbose=<0-3> : 0 = no output, 1 = error/warning (default), + 2 = normal, 3 = debug. + -updateinformation= : Embed update information STRING; if zsyncmake is installed, generate zsync file + -qtlibinfix= : Adapt the .so search if your Qt distribution has infix. + -version : Print version statement and exit. + +linuxdeployqt takes an application as input and makes it +self-contained by copying in the Qt libraries and plugins that +the application uses. + +By default it deploys the Qt instance that qmake on the $PATH points to. +The '-qmake' option can be used to point to the qmake executable +to be used instead. + +Plugins related to a Qt library are copied in with the library. + +See the "Deploying Applications on Linux" topic in the +documentation for more information about deployment on Linux. +zinface@zinface-PC:/tmp/tmp.5gmZKUqn9s$ \ No newline at end of file diff --git a/cmake/platforms/linux-appimage.cmake b/cmake/platforms/linux-appimage.cmake index 02f7f25..f3b2d14 100644 --- a/cmake/platforms/linux-appimage.cmake +++ b/cmake/platforms/linux-appimage.cmake @@ -43,6 +43,6 @@ if(USE_LINUX_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 的构建 + add_appimage_target(${PROJECT_NAME}) # 应用对 Appimage 的构建 endif(USE_LINUX_APPIMAGE) diff --git a/cmake/platforms/linux-debian.cmake b/cmake/platforms/linux-debian.cmake index 29e2426..9e0848f 100644 --- a/cmake/platforms/linux-debian.cmake +++ b/cmake/platforms/linux-debian.cmake @@ -9,8 +9,8 @@ option(USE_LINUX_DEBIAN "为 Linux 生成 deb 软件包" OFF) if(USE_LINUX_DEBIAN) - find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) - add_package_descript(cmake/package-deb.descript) + find_package(SparkDebPackage PATHS ${CMAKE_SOURCE_DIR}) + add_package_descript(cmake/spark-deb-package.descript) endif(USE_LINUX_DEBIAN) diff --git a/cmake/platforms/linux-uos.cmake b/cmake/platforms/linux-uos.cmake index 9b87979..e1603d6 100644 --- a/cmake/platforms/linux-uos.cmake +++ b/cmake/platforms/linux-uos.cmake @@ -66,7 +66,7 @@ if(USE_LINUX_UOS) # set(PACKAGE_SUFFIX "_onlyUos") # 2. 使用同样来自 debian 系列的 deb 构建能力 - find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) - add_package_descript(cmake/package-deb.descript) + find_package(SparkDebPackage PATHS ${CMAKE_SOURCE_DIR}) + add_package_descript(cmake/spark-deb-package.descript) endif(USE_LINUX_UOS) diff --git a/cmake/spark-appimage.desktop.in.txt b/cmake/spark-appimage.desktop.in.txt new file mode 100644 index 0000000..491716d --- /dev/null +++ b/cmake/spark-appimage.desktop.in.txt @@ -0,0 +1,9 @@ +[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@; \ No newline at end of file diff --git a/cmake/package-deb.descript b/cmake/spark-deb-package.descript similarity index 92% rename from cmake/package-deb.descript rename to cmake/spark-deb-package.descript index 0b78a1b..e7bc6af 100644 --- a/cmake/package-deb.descript +++ b/cmake/spark-deb-package.descript @@ -1,6 +1,6 @@ # 注释行(使用方式) -# find_package(DebPackage PATHS ${CMAKE_SOURCE_DIR}) -# add_package_descript(cmake/package-deb.descript) +# find_package(SparkDebPackage PATHS ${CMAKE_SOURCE_DIR}) +# add_package_descript(cmake/spark-deb-package.descript) # 打包后的文件名称 # FileName: 待定 @@ -40,7 +40,9 @@ Maintainer: Ndd开源组织 <757210198@qq.com> # 软件包主页 Homepage: https://gitee.com/cxasm/notepad-- # 软件包建议 -Recommends: +Recommends: +# 软件冲突 +Conflicts: # 软件包描述信息 Descrition: Notepad--是一个国产跨平台、简单的文本编辑器。 Notepad--是一个国产跨平台、简单的文本编辑器,是替换notepad++的一种选择。 diff --git a/cmake/spark-desktop.desktop.in b/cmake/spark-desktop.desktop.in.txt similarity index 99% rename from cmake/spark-desktop.desktop.in rename to cmake/spark-desktop.desktop.in.txt index e33c74e..6eb46c3 100644 --- a/cmake/spark-desktop.desktop.in +++ b/cmake/spark-desktop.desktop.in.txt @@ -9,4 +9,5 @@ Icon=@APP_EXECUTE_ICON_PATH@ Categories=@APP_CATEGORIES@ 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 +# Generated from the DesktopGenerater component of the z-Tools toolkit + -- Gitee From 284d976858f19eb8d87d6d38f3de60b7f98bcacf Mon Sep 17 00:00:00 2001 From: zinface Date: Tue, 19 Dec 2023 17:49:54 +0800 Subject: [PATCH 102/102] =?UTF-8?q?cmake/modules:=20=E5=AF=B9=20Notepad--?= =?UTF-8?q?=20=E7=9A=84=E6=9E=84=E5=BB=BA=E8=BF=9B=E8=A1=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E4=BB=A5=E9=80=82=E7=94=A8=E4=BA=8E=20Qt=20C?= =?UTF-8?q?reator=20=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/modules/Notepad--.cmake | 10 +++++----- src/ndstyleditemdelegate.h | 19 ------------------- 2 files changed, 5 insertions(+), 24 deletions(-) delete mode 100755 src/ndstyleditemdelegate.h diff --git a/cmake/modules/Notepad--.cmake b/cmake/modules/Notepad--.cmake index 510eb49..d0d1455 100644 --- a/cmake/modules/Notepad--.cmake +++ b/cmake/modules/Notepad--.cmake @@ -8,11 +8,11 @@ if(TRUE) # 准备构建 Notepad-- 主程序 set(QRC_SOURCES src/RealCompare.qrc) - spark_aux_source_paths(CCEditorSources - src - src/cceditor - ) - spark_add_executable(${PROJECT_NAME} ${CCEditorSources} ${QRC_SOURCES}) + spark_add_executable_path(${PROJECT_NAME} + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_SOURCE_DIR}/src/cceditor + ${QRC_SOURCES}) + target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/src/cceditor diff --git a/src/ndstyleditemdelegate.h b/src/ndstyleditemdelegate.h deleted file mode 100755 index d1708d2..0000000 --- a/src/ndstyleditemdelegate.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include - -class NdStyledItemDelegate : public QStyledItemDelegate -{ - Q_OBJECT - -public: - NdStyledItemDelegate(QObject *parent); - virtual ~NdStyledItemDelegate(); - void setFontSize(int size); - -protected: - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; - -private: - int m_defaultFontSize; -}; -- Gitee