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
10 #include "cmArchiveWrite.h"
11 #include "cmCPackGenerator.h"
13 class cmCPackComponent
;
15 /** \class cmCPackArchiveGenerator
16 * \brief A generator base for libarchive generation.
17 * The generator itself uses the libarchive wrapper
18 * \ref cmArchiveWrite.
21 class cmCPackArchiveGenerator
: public cmCPackGenerator
24 using Superclass
= cmCPackGenerator
;
26 static cmCPackGenerator
* Create7ZGenerator();
27 static cmCPackGenerator
* CreateTBZ2Generator();
28 static cmCPackGenerator
* CreateTGZGenerator();
29 static cmCPackGenerator
* CreateTXZGenerator();
30 static cmCPackGenerator
* CreateTZGenerator();
31 static cmCPackGenerator
* CreateTZSTGenerator();
32 static cmCPackGenerator
* CreateZIPGenerator();
37 cmCPackArchiveGenerator(cmArchiveWrite::Compress t
, std::string format
,
38 std::string extension
);
39 ~cmCPackArchiveGenerator() override
;
40 // Used to add a header to the archive
41 virtual int GenerateHeader(std::ostream
* os
);
43 bool SupportsComponentInstallation() const override
;
46 // get archive component filename
47 std::string
GetArchiveComponentFileName(const std::string
& component
,
53 int InitializeInternal() override
;
55 * Add the files belonging to the specified component
56 * to the provided (already opened) archive.
57 * @param[in,out] archive the archive object
58 * @param[in] component the component whose file will be added to archive
59 * @param[in] deduplicator file deduplicator utility.
61 int addOneComponentToArchive(cmArchiveWrite
& archive
,
62 cmCPackComponent
* component
,
63 Deduplicator
* deduplicator
);
66 * The main package file method.
67 * If component install was required this
68 * method will call either PackageComponents or
69 * PackageComponentsAllInOne.
71 int PackageFiles() override
;
73 * The method used to package files when component
74 * install is used. This will create one
75 * archive for each component group.
77 int PackageComponents(bool ignoreGroup
);
79 * Special case of component install where all
80 * components will be put in a single installer.
82 int PackageComponentsAllInOne();
85 const char* GetNameOfClass() override
{ return "cmCPackArchiveGenerator"; }
87 const char* GetOutputExtension() override
89 return this->OutputExtension
.c_str();
92 int GetThreadCount() const;
95 cmArchiveWrite::Compress Compress
;
96 std::string ArchiveFormat
;
97 std::string OutputExtension
;