cmake/Source/CPack/cmCPackArchiveGenerator.h

99 lines
2.8 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2010-06-23 01:18:35 +03:00
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2010-06-23 01:18:35 +03:00
2016-10-30 18:24:19 +01:00
#include <iosfwd>
#include <string>
2020-02-01 23:06:01 +01:00
#include "cmArchiveWrite.h"
#include "cmCPackGenerator.h"
2016-10-30 18:24:19 +01:00
class cmCPackComponent;
2010-06-23 01:18:35 +03:00
/** \class cmCPackArchiveGenerator
2010-11-13 01:00:53 +02:00
* \brief A generator base for libarchive generation.
* The generator itself uses the libarchive wrapper
* \ref cmArchiveWrite.
2010-06-23 01:18:35 +03:00
*
*/
class cmCPackArchiveGenerator : public cmCPackGenerator
2016-07-09 11:21:54 +02:00
{
2010-06-23 01:18:35 +03:00
public:
2020-02-01 23:06:01 +01:00
using Superclass = cmCPackGenerator;
static cmCPackGenerator* Create7ZGenerator();
static cmCPackGenerator* CreateTBZ2Generator();
static cmCPackGenerator* CreateTGZGenerator();
static cmCPackGenerator* CreateTXZGenerator();
static cmCPackGenerator* CreateTZGenerator();
static cmCPackGenerator* CreateTZSTGenerator();
static cmCPackGenerator* CreateZIPGenerator();
2010-06-23 01:18:35 +03:00
/**
* Construct generator
*/
2020-02-01 23:06:01 +01:00
cmCPackArchiveGenerator(cmArchiveWrite::Compress t, std::string format,
std::string extension);
2018-01-26 17:06:56 +01:00
~cmCPackArchiveGenerator() override;
2013-03-16 19:13:01 +02:00
// Used to add a header to the archive
2010-06-23 01:18:35 +03:00
virtual int GenerateHeader(std::ostream* os);
2010-11-13 01:00:53 +02:00
// component support
2018-01-26 17:06:56 +01:00
bool SupportsComponentInstallation() const override;
2016-07-09 11:21:54 +02:00
2017-07-20 19:35:53 +02:00
private:
// get archive component filename
std::string GetArchiveComponentFileName(const std::string& component,
bool isGroupName);
2024-04-14 22:45:38 +02:00
class Deduplicator;
2010-06-23 01:18:35 +03:00
protected:
2018-01-26 17:06:56 +01:00
int InitializeInternal() override;
2010-11-13 01:00:53 +02:00
/**
* Add the files belonging to the specified component
* to the provided (already opened) archive.
* @param[in,out] archive the archive object
* @param[in] component the component whose file will be added to archive
2024-04-14 22:45:38 +02:00
* @param[in] deduplicator file deduplicator utility.
2010-11-13 01:00:53 +02:00
*/
int addOneComponentToArchive(cmArchiveWrite& archive,
2024-04-14 22:45:38 +02:00
cmCPackComponent* component,
Deduplicator* deduplicator);
2010-11-13 01:00:53 +02:00
/**
* The main package file method.
* If component install was required this
* method will call either PackageComponents or
* PackageComponentsAllInOne.
*/
2018-01-26 17:06:56 +01:00
int PackageFiles() override;
2010-11-13 01:00:53 +02:00
/**
* The method used to package files when component
* install is used. This will create one
* archive for each component group.
*/
2011-01-16 11:35:12 +01:00
int PackageComponents(bool ignoreGroup);
2010-11-13 01:00:53 +02:00
/**
* Special case of component install where all
* components will be put in a single installer.
*/
2011-06-19 15:41:06 +03:00
int PackageComponentsAllInOne();
2020-02-01 23:06:01 +01:00
private:
const char* GetNameOfClass() override { return "cmCPackArchiveGenerator"; }
const char* GetOutputExtension() override
{
return this->OutputExtension.c_str();
}
2021-09-14 00:13:48 +02:00
int GetThreadCount() const;
2020-08-30 11:54:41 +02:00
2020-02-01 23:06:01 +01:00
private:
2010-11-13 01:00:53 +02:00
cmArchiveWrite::Compress Compress;
2015-08-17 11:37:30 +02:00
std::string ArchiveFormat;
2020-02-01 23:06:01 +01:00
std::string OutputExtension;
2016-07-09 11:21:54 +02:00
};