Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Source/CPack/cmCPackAppImageGenerator.h
4998 views
1
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2
file LICENSE.rst or https://cmake.org/licensing for details. */
3
#pragma once
4
5
#include <string>
6
#include <unordered_map>
7
8
#include <cm/optional>
9
10
#include "cmCPackGenerator.h"
11
12
/** \class cmCPackAppImageGenerator
13
* \brief A generator for creating AppImages with CPack
14
*/
15
class cmCPackAppImageGenerator : public cmCPackGenerator
16
{
17
public:
18
cmCPackTypeMacro(cmCPackAppImageGenerator, cmCPackGenerator);
19
20
char const* GetOutputExtension() override { return ".AppImage"; }
21
22
cmCPackAppImageGenerator();
23
~cmCPackAppImageGenerator() override;
24
25
protected:
26
/**
27
* @brief Initializes the CPack engine with our defaults
28
*/
29
int InitializeInternal() override;
30
31
/**
32
* @brief AppImages are for single applications
33
*/
34
bool SupportsComponentInstallation() const override { return false; }
35
36
/**
37
* Main Packaging step
38
*/
39
int PackageFiles() override;
40
41
private:
42
/**
43
* @brief Finds the first installed file by it's name
44
*/
45
cm::optional<std::string> FindFile(std::string const& filename) const;
46
47
/**
48
* @brief AppImage format requires a desktop file
49
*/
50
cm::optional<std::string> FindDesktopFile() const;
51
52
/**
53
* @brief Parses a desktop file [Desktop Entry]
54
*/
55
std::unordered_map<std::string, std::string> ParseDesktopFile(
56
std::string const& filePath) const;
57
58
/**
59
* @brief changes the RPATH so that AppImage can find it's libraries
60
*/
61
bool ChangeRPath();
62
63
bool PatchElfSetRPath(std::string const& file,
64
std::string const& rpath) const;
65
66
std::string AppimagetoolPath;
67
std::string PatchElfPath;
68
};
69
70