Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Source/CPack/cmCPackNSISGenerator.h
5000 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 "cmConfigure.h" // IWYU pragma: keep
6
7
#include <iosfwd>
8
#include <set>
9
#include <string>
10
#include <vector>
11
12
#include <cm/string_view>
13
14
#include "cmCPackGenerator.h"
15
16
class cmCPackComponent;
17
class cmCPackComponentGroup;
18
19
/** \class cmCPackNSISGenerator
20
* \brief A generator for NSIS files
21
*
22
* http://people.freebsd.org/~kientzle/libarchive/
23
*/
24
class cmCPackNSISGenerator : public cmCPackGenerator
25
{
26
public:
27
cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
28
29
static cmCPackGenerator* CreateGenerator64()
30
{
31
return new cmCPackNSISGenerator(true);
32
}
33
34
/**
35
* Construct generator
36
*/
37
cmCPackNSISGenerator(bool nsis64 = false);
38
~cmCPackNSISGenerator() override;
39
40
protected:
41
int InitializeInternal() override;
42
void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr);
43
int PackageFiles() override;
44
char const* GetOutputExtension() override { return ".exe"; }
45
char const* GetOutputPostfix() override { return "win32"; }
46
47
bool GetListOfSubdirectories(char const* dir,
48
std::vector<std::string>& dirs);
49
50
enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
51
const override;
52
bool SupportsAbsoluteDestination() const override;
53
bool SupportsComponentInstallation() const override;
54
55
/// Produce a string that contains the NSIS code to describe a
56
/// particular component. Any added macros will be emitted via
57
/// macrosOut.
58
std::string CreateComponentDescription(cmCPackComponent* component,
59
std::ostream& macrosOut);
60
61
/// Produce NSIS code that selects all of the components that this component
62
/// depends on, recursively.
63
std::string CreateSelectionDependenciesDescription(
64
cmCPackComponent* component, std::set<cmCPackComponent*>& visited);
65
66
/// Produce NSIS code that de-selects all of the components that are
67
/// dependent on this component, recursively.
68
std::string CreateDeselectionDependenciesDescription(
69
cmCPackComponent* component, std::set<cmCPackComponent*>& visited);
70
71
/// Produce a string that contains the NSIS code to describe a
72
/// particular component group, including its components. Any
73
/// added macros will be emitted via macrosOut.
74
std::string CreateComponentGroupDescription(cmCPackComponentGroup* group,
75
std::ostream& macrosOut);
76
77
/// Returns the custom install directory if available for the specified
78
/// component, otherwise $INSTDIR is returned.
79
std::string CustomComponentInstallDirectory(cm::string_view componentName);
80
81
/// Translations any newlines found in the string into \\r\\n, so that the
82
/// resulting string can be used within NSIS.
83
static std::string TranslateNewlines(std::string str);
84
85
bool Nsis64;
86
};
87
88