mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-24 09:09:43 -05:00
CPack/AppImage: Add support for a custom AppRun file
Allow the users to install a custom AppRun file. Otherwise create a default one. Fixes: #27478
This commit is contained in:
@@ -40,6 +40,13 @@ application links to and copy them to the install location.
|
|||||||
endforeach()
|
endforeach()
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
The CPack AppImage generator will generate a default `AppRun`_ based on the
|
||||||
|
provided ``.desktop`` entry. Alternatively, if a custom ``AppRun`` is
|
||||||
|
installed, e.g., via the :command:`install` command, it will be used instead
|
||||||
|
of the generated one.
|
||||||
|
|
||||||
|
.. _`AppRun`: https://docs.appimage.org/introduction/software-overview.html#apprun
|
||||||
|
|
||||||
For Qt-based projects, it is recommended to call
|
For Qt-based projects, it is recommended to call
|
||||||
``qt_generate_deploy_app_script()`` or ``qt_generate_deploy_qml_app_script()``
|
``qt_generate_deploy_app_script()`` or ``qt_generate_deploy_qml_app_script()``
|
||||||
and install the files generated by the script. This will install the
|
and install the files generated by the script. This will install the
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
#include "cmELF.h"
|
#include "cmELF.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
|
#include "cmStringAlgorithms.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmValue.h"
|
#include "cmValue.h"
|
||||||
|
|
||||||
@@ -182,8 +183,18 @@ int cmCPackAppImageGenerator::PackageFiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string const appRunFile = this->toplevel + "/AppRun";
|
std::string const appRunFile = this->toplevel + "/AppRun";
|
||||||
{
|
if (cmSystemTools::PathExists(appRunFile)) {
|
||||||
// AppRun script will run our application
|
// User provided an AppRun file
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||||
|
cmStrCat("Found AppRun file: \"", appRunFile, '"')
|
||||||
|
<< std::endl);
|
||||||
|
} else {
|
||||||
|
// Generate a default AppRun script that will run our application
|
||||||
|
cmCPackLogger(
|
||||||
|
cmCPackLog::LOG_OUTPUT,
|
||||||
|
cmStrCat("No AppRun found, generating a default one that will run: \"",
|
||||||
|
application, '"')
|
||||||
|
<< std::endl);
|
||||||
cmGeneratedFileStream appRun(appRunFile);
|
cmGeneratedFileStream appRun(appRunFile);
|
||||||
appRun << R"sh(#! /usr/bin/env bash
|
appRun << R"sh(#! /usr/bin/env bash
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ CPack: Found Desktop file: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1
|
|||||||
CPack: Desktop file destination: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/com\.example\.app\.desktop"
|
CPack: Desktop file destination: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/com\.example\.app\.desktop"
|
||||||
CPack: Icon file: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/share/icons/hicolor/64x64/apps/ApplicationIcon\.png"
|
CPack: Icon file: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/share/icons/hicolor/64x64/apps/ApplicationIcon\.png"
|
||||||
CPack: Icon link destination: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/ApplicationIcon\.png"
|
CPack: Icon link destination: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/ApplicationIcon\.png"
|
||||||
|
CPack: No AppRun found, generating a default one that will run: "bin/app"
|
||||||
CPack: Running AppImageTool: "[^"]*" "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux" "\.\./GeneratorTest-1\.2\.3-Linux\.AppImage" "--runtime-file" "[^"]*"
|
CPack: Running AppImageTool: "[^"]*" "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux" "\.\./GeneratorTest-1\.2\.3-Linux\.AppImage" "--runtime-file" "[^"]*"
|
||||||
[^
|
[^
|
||||||
]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux should be packaged as \.\./GeneratorTest-1\.2\.3-Linux\.AppImage
|
]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux should be packaged as \.\./GeneratorTest-1\.2\.3-Linux\.AppImage
|
||||||
|
|||||||
Reference in New Issue
Block a user