diff options
author | Brad King <brad.king@kitware.com> | 2020-07-03 15:11:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-07-07 12:08:21 (GMT) |
commit | 1ace607329a679b79f60a1a939dccbc97fb25766 (patch) | |
tree | 34534cde000201167eb68030176c855b84b2bb82 /Source/CPack/cmCPackDragNDropGenerator.h | |
parent | 98e0cbd8eb6a09b35542cf321755cefcbb942d10 (diff) | |
download | CMake-1ace607329a679b79f60a1a939dccbc97fb25766.zip CMake-1ace607329a679b79f60a1a939dccbc97fb25766.tar.gz CMake-1ace607329a679b79f60a1a939dccbc97fb25766.tar.bz2 |
CPack/DragNDrop: Re-implement SLA attachment to avoid deprecated tools
The `Rez` tool has been deprecated since Xcode 6. The `hdiutil flatten`
and `hdiutil unflatten` tools have been deprecated since macOS 10.15 and
are removed in macOS 11. Instead use `hdiutil udifrez` to attach the
SLA resources to disk images. This tool accepts XML input files, so
convert our resource file generation to produce that format.
Fixes: #20889
Diffstat (limited to 'Source/CPack/cmCPackDragNDropGenerator.h')
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index f8c86c0..dbd190c 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -14,6 +14,7 @@ #include "cmCPackGenerator.h" class cmGeneratedFileStream; +class cmXMLWriter; /** \class cmCPackDragNDropGenerator * \brief A generator for OSX drag-n-drop installs @@ -45,12 +46,40 @@ private: std::string slaDirectory; bool singleLicense; - bool WriteLicense(cmGeneratedFileStream& outputStream, int licenseNumber, + struct RezDict + { + std::string Name; + size_t ID; + std::vector<unsigned char> Data; + }; + + struct RezArray + { + std::string Key; + std::vector<RezDict> Entries; + }; + + struct RezDoc + { + RezArray LPic = { "LPic", {} }; + RezArray Menu = { "STR#", {} }; + RezArray Text = { "TEXT", {} }; + RezArray RTF = { "RTF ", {} }; + }; + + void WriteRezXML(std::string const& file, RezDoc const& rez); + void WriteRezArray(cmXMLWriter& xml, RezArray const& array); + void WriteRezDict(cmXMLWriter& xml, RezDict const& dict); + + bool WriteLicense(RezDoc& rez, size_t licenseNumber, std::string licenseLanguage, const std::string& licenseFile, std::string* error); + void EncodeLicense(RezDict& dict, std::vector<std::string> const& lines); + void EncodeMenu(RezDict& dict, std::vector<std::string> const& lines); + bool ReadFile(std::string const& file, std::vector<std::string>& lines, + std::string* error); bool BreakLongLine(const std::string& line, std::vector<std::string>& lines, std::string* error); - void EscapeQuotesAndBackslashes(std::string& line); }; #endif |