cmCPackArchiveGenerator.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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>
  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() CM_OVERRIDE;
  26. // Used to add a header to the archive
  27. virtual int GenerateHeader(std::ostream* os);
  28. // component support
  29. bool SupportsComponentInstallation() const CM_OVERRIDE;
  30. protected:
  31. int InitializeInternal() CM_OVERRIDE;
  32. /**
  33. * Add the files belonging to the specified component
  34. * to the provided (already opened) archive.
  35. * @param[in,out] archive the archive object
  36. * @param[in] component the component whose file will be added to archive
  37. */
  38. int addOneComponentToArchive(cmArchiveWrite& archive,
  39. cmCPackComponent* component);
  40. /**
  41. * The main package file method.
  42. * If component install was required this
  43. * method will call either PackageComponents or
  44. * PackageComponentsAllInOne.
  45. */
  46. int PackageFiles() CM_OVERRIDE;
  47. /**
  48. * The method used to package files when component
  49. * install is used. This will create one
  50. * archive for each component group.
  51. */
  52. int PackageComponents(bool ignoreGroup);
  53. /**
  54. * Special case of component install where all
  55. * components will be put in a single installer.
  56. */
  57. int PackageComponentsAllInOne();
  58. const char* GetOutputExtension() CM_OVERRIDE = 0;
  59. cmArchiveWrite::Compress Compress;
  60. std::string ArchiveFormat;
  61. };
  62. #endif