Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Source/CPack/cmCPackInnoSetupGenerator.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
4
#pragma once
5
6
#include <map>
7
#include <string>
8
#include <vector>
9
10
#include "cmCPackGenerator.h"
11
#include "cmValue.h"
12
13
using cmCPackInnoSetupKeyValuePairs = std::map<std::string, std::string>;
14
15
class cmCPackComponentGroup;
16
class cmCPackComponent;
17
18
/** \class cmCPackInnoSetupGenerator
19
* \brief A generator for Inno Setup
20
*
21
* https://jrsoftware.org/isinfo.php
22
*/
23
class cmCPackInnoSetupGenerator : public cmCPackGenerator
24
{
25
public:
26
cmCPackTypeMacro(cmCPackInnoSetupGenerator, cmCPackGenerator);
27
28
/**
29
* Construct generator
30
*/
31
cmCPackInnoSetupGenerator();
32
~cmCPackInnoSetupGenerator() override;
33
34
static bool CanGenerate();
35
36
protected:
37
int InitializeInternal() override;
38
int PackageFiles() override;
39
40
inline char const* GetOutputExtension() override { return ".exe"; }
41
42
inline cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
43
const override
44
{
45
return cmCPackGenerator::SETDESTDIR_UNSUPPORTED;
46
}
47
48
inline bool SupportsAbsoluteDestination() const override { return false; }
49
inline bool SupportsComponentInstallation() const override { return true; }
50
51
private:
52
enum class PathType
53
{
54
Windows,
55
Native,
56
};
57
58
bool ProcessSetupSection();
59
bool ProcessFiles();
60
bool ProcessComponents();
61
62
bool ConfigureISScript();
63
bool Compile();
64
65
bool BuildDownloadedComponentArchive(cmCPackComponent* component,
66
std::string const& uploadDirectory,
67
std::string* hash);
68
69
/**
70
* Returns the option's value or an empty string if the option isn't set.
71
*/
72
cmValue RequireOption(std::string const& key);
73
74
std::string CustomComponentInstallDirectory(
75
cmCPackComponent const* component);
76
77
/**
78
* Translates boolean expressions into "yes" or "no", as required in
79
* Inno Setup (only if "CPACK_INNOSETUP_USE_CMAKE_BOOL_FORMAT" is on).
80
*/
81
std::string TranslateBool(std::string const& value);
82
83
/**
84
* Creates a typical line of key and value pairs using the given map.
85
*
86
* (e.g.: Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}";
87
* GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked)
88
*/
89
std::string ISKeyValueLine(cmCPackInnoSetupKeyValuePairs const& params);
90
91
std::string CreateRecursiveComponentPath(cmCPackComponentGroup* group,
92
std::string const& path = "");
93
94
void CreateRecursiveComponentGroups(cmCPackComponentGroup* group);
95
96
/**
97
* These functions add quotes if the given value hasn't already quotes.
98
* Paths are converted into the format used by Windows before.
99
*/
100
std::string Quote(std::string const& string);
101
std::string QuotePath(std::string const& path,
102
PathType type = PathType::Windows);
103
104
/**
105
* This function replaces the following 5 characters with their %-encoding:
106
* '|' '}' ',' '%' '"'
107
* Required for Inno Setup constants like {cm:...}
108
*/
109
std::string PrepareForConstant(std::string const& string);
110
111
std::vector<std::string> includeDirectives;
112
cmCPackInnoSetupKeyValuePairs setupDirectives;
113
bool toplevelProgramFolder;
114
std::vector<std::string> languageInstructions;
115
std::vector<std::string> fileInstructions;
116
std::vector<std::string> dirInstructions;
117
std::vector<std::string> typeInstructions;
118
std::vector<std::string> componentInstructions;
119
std::vector<std::string> iconInstructions;
120
std::vector<std::string> desktopIconComponents;
121
std::vector<std::string> runInstructions;
122
std::vector<std::string> codeIncludes;
123
};
124
125