repo: 通用 Linux 平台的 Appimage 构建

This commit is contained in:
zinface 2023-02-17 00:45:30 +08:00
parent 7a3ee61a91
commit f92b3a859c
4 changed files with 100 additions and 3 deletions

View File

@ -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

View File

@ -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)

47
linux-appimage.mk Normal file
View File

@ -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 通用版本构建

View File

@ -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 构建."