Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Source/CPack/cmCPackPKGGenerator.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 <set>
8
#include <sstream>
9
#include <string>
10
11
#include <cm/string_view>
12
13
#include "cmCPackComponentGroup.h"
14
#include "cmCPackGenerator.h"
15
16
class cmXMLWriter;
17
18
/** \class cmCPackPKGGenerator
19
* \brief A generator for pkg files
20
*
21
*/
22
class cmCPackPKGGenerator : public cmCPackGenerator
23
{
24
public:
25
cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator);
26
27
/**
28
* Construct generator
29
*/
30
cmCPackPKGGenerator();
31
~cmCPackPKGGenerator() override;
32
33
bool SupportsComponentInstallation() const override;
34
35
protected:
36
int InitializeInternal() override;
37
char const* GetOutputPostfix() override { return "darwin"; }
38
39
// Copies or creates the resource file with the given name to the
40
// package or package staging directory dirName. The variable
41
// CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
42
// version of name) specifies the input file to use for this file,
43
// which will be configured via ConfigureFile.
44
bool CopyCreateResourceFile(std::string const& name,
45
std::string const& dirName);
46
bool CopyResourcePlistFile(std::string const& name,
47
char const* outName = nullptr);
48
49
int CopyInstallScript(std::string const& resdir, std::string const& script,
50
std::string const& name);
51
52
// Retrieve the name of package file that will be generated for this
53
// component. The name is just the file name with extension, and
54
// does not include the subdirectory.
55
std::string GetPackageName(cmCPackComponent const& component);
56
57
// Writes a distribution.dist file, which turns a metapackage into a
58
// full-fledged distribution. This file is used to describe
59
// inter-component dependencies. metapackageFile is the name of the
60
// metapackage for the distribution. Only valid for a
61
// component-based install.
62
void WriteDistributionFile(char const* metapackageFile, char const* genName);
63
64
// Subroutine of WriteDistributionFile that writes out the
65
// dependency attributes for inter-component dependencies.
66
void AddDependencyAttributes(cmCPackComponent const& component,
67
std::set<cmCPackComponent const*>& visited,
68
std::ostringstream& out);
69
70
// Subroutine of WriteDistributionFile that writes out the
71
// reverse dependency attributes for inter-component dependencies.
72
void AddReverseDependencyAttributes(
73
cmCPackComponent const& component,
74
std::set<cmCPackComponent const*>& visited, std::ostringstream& out);
75
76
// Generates XML that encodes the hierarchy of component groups and
77
// their components in a form that can be used by distribution
78
// metapackages.
79
void CreateChoiceOutline(cmCPackComponentGroup const& group,
80
cmXMLWriter& xout);
81
82
/// Create the "choice" XML element to describe a component group
83
/// for the installer GUI.
84
void CreateChoice(cmCPackComponentGroup const& group, cmXMLWriter& xout);
85
86
/// Create the "choice" XML element to describe a component for the
87
/// installer GUI.
88
void CreateChoice(cmCPackComponent const& component, cmXMLWriter& xout);
89
90
/// Creates a background in the distribution XML.
91
void CreateBackground(char const* themeName, char const* metapackageFile,
92
cm::string_view genName, cmXMLWriter& xout);
93
94
/// Create the "domains" XML element to indicate where the product can
95
/// be installed
96
void CreateDomains(cmXMLWriter& xout);
97
98
// The PostFlight component when creating a metapackage
99
cmCPackComponent PostFlightComponent;
100
};
101
102