1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
12 #include "cmCPackGenerator.h"
14 class cmGeneratedFileStream
;
17 /** \class cmCPackDragNDropGenerator
18 * \brief A generator for OSX drag-n-drop installs
20 class cmCPackDragNDropGenerator
: public cmCPackGenerator
23 cmCPackTypeMacro(cmCPackDragNDropGenerator
, cmCPackGenerator
);
25 cmCPackDragNDropGenerator();
26 ~cmCPackDragNDropGenerator() override
;
29 int InitializeInternal() override
;
30 const char* GetOutputExtension() override
;
31 int PackageFiles() override
;
32 bool SupportsComponentInstallation() const override
;
34 bool CopyFile(std::ostringstream
& source
, std::ostringstream
& target
);
35 bool CreateEmptyFile(std::ostringstream
& target
, size_t size
);
36 bool RunCommand(std::string
const& command
, std::string
* output
= nullptr);
38 std::string
GetComponentInstallSuffix(
39 const std::string
& componentName
) override
;
40 std::string
GetComponentInstallDirNameSuffix(
41 const std::string
& componentName
) override
;
43 int CreateDMG(const std::string
& src_dir
, const std::string
& output_file
);
46 std::string slaDirectory
;
53 std::vector
<unsigned char> Data
;
59 std::vector
<RezDict
> Entries
;
64 RezArray LPic
= { "LPic", {} };
65 RezArray Menu
= { "STR#", {} };
66 RezArray Text
= { "TEXT", {} };
67 RezArray RTF
= { "RTF ", {} };
70 void WriteRezXML(std::string
const& file
, RezDoc
const& rez
);
71 void WriteRezArray(cmXMLWriter
& xml
, RezArray
const& array
);
72 void WriteRezDict(cmXMLWriter
& xml
, RezDict
const& dict
);
74 bool WriteLicense(RezDoc
& rez
, size_t licenseNumber
,
75 std::string licenseLanguage
,
76 const std::string
& licenseFile
, std::string
* error
);
77 void EncodeLicense(RezDict
& dict
, std::vector
<std::string
> const& lines
);
78 void EncodeMenu(RezDict
& dict
, std::vector
<std::string
> const& lines
);
79 bool ReadFile(std::string
const& file
, std::vector
<std::string
>& lines
,
81 bool BreakLongLine(const std::string
& line
, std::vector
<std::string
>& lines
,