cmCPackArchiveGenerator.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmCPackArchiveGenerator_h
  4. #define cmCPackArchiveGenerator_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include "cmArchiveWrite.h"
  7. #include "cmCPackGenerator.h"
  8. #include <iosfwd>
  9. #include <string>
  10. class cmCPackComponent;
  11. /** \class cmCPackArchiveGenerator
  12. * \brief A generator base for libarchive generation.
  13. * The generator itself uses the libarchive wrapper
  14. * \ref cmArchiveWrite.
  15. *
  16. */
  17. class cmCPackArchiveGenerator : public cmCPackGenerator
  18. {
  19. public:
  20. typedef cmCPackGenerator Superclass;
  21. /**
  22. * Construct generator
  23. */
  24. cmCPackArchiveGenerator(cmArchiveWrite::Compress, std::string const& format);
  25. ~cmCPackArchiveGenerator() override;
  26. // Used to add a header to the archive
  27. virtual int GenerateHeader(std::ostream* os);
  28. // component support
  29. bool SupportsComponentInstallation() const override;
  30. private:
  31. // get archive component filename
  32. std::string GetArchiveComponentFileName(const std::string& component,
  33. bool isGroupName);
  34. protected:
  35. int InitializeInternal() override;
  36. /**
  37. * Add the files belonging to the specified component
  38. * to the provided (already opened) archive.
  39. * @param[in,out] archive the archive object
  40. * @param[in] component the component whose file will be added to archive
  41. */
  42. int addOneComponentToArchive(cmArchiveWrite& archive,
  43. cmCPackComponent* component);
  44. /**
  45. * The main package file method.
  46. * If component install was required this
  47. * method will call either PackageComponents or
  48. * PackageComponentsAllInOne.
  49. */
  50. int PackageFiles() override;
  51. /**
  52. * The method used to package files when component
  53. * install is used. This will create one
  54. * archive for each component group.
  55. */
  56. int PackageComponents(bool ignoreGroup);
  57. /**
  58. * Special case of component install where all
  59. * components will be put in a single installer.
  60. */
  61. int PackageComponentsAllInOne();
  62. const char* GetOutputExtension() override = 0;
  63. cmArchiveWrite::Compress Compress;
  64. std::string ArchiveFormat;
  65. };
  66. #endif