cmCPackPKGGenerator.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 cmCPackPKGGenerator_h
  4. #define cmCPackPKGGenerator_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <set>
  7. #include <sstream>
  8. #include <string>
  9. #include <cm/string_view>
  10. #include "cmCPackComponentGroup.h"
  11. #include "cmCPackGenerator.h"
  12. class cmXMLWriter;
  13. /** \class cmCPackPKGGenerator
  14. * \brief A generator for pkg files
  15. *
  16. */
  17. class cmCPackPKGGenerator : public cmCPackGenerator
  18. {
  19. public:
  20. cmCPackTypeMacro(cmCPackPKGGenerator, cmCPackGenerator);
  21. /**
  22. * Construct generator
  23. */
  24. cmCPackPKGGenerator();
  25. ~cmCPackPKGGenerator() override;
  26. bool SupportsComponentInstallation() const override;
  27. protected:
  28. int InitializeInternal() override;
  29. const char* GetOutputPostfix() override { return "darwin"; }
  30. // Copies or creates the resource file with the given name to the
  31. // package or package staging directory dirName. The variable
  32. // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased
  33. // version of name) specifies the input file to use for this file,
  34. // which will be configured via ConfigureFile.
  35. bool CopyCreateResourceFile(const std::string& name,
  36. const std::string& dirName);
  37. bool CopyResourcePlistFile(const std::string& name, const char* outName = 0);
  38. int CopyInstallScript(const std::string& resdir, const std::string& script,
  39. const std::string& name);
  40. // Retrieve the name of package file that will be generated for this
  41. // component. The name is just the file name with extension, and
  42. // does not include the subdirectory.
  43. std::string GetPackageName(const cmCPackComponent& component);
  44. // Writes a distribution.dist file, which turns a metapackage into a
  45. // full-fledged distribution. This file is used to describe
  46. // inter-component dependencies. metapackageFile is the name of the
  47. // metapackage for the distribution. Only valid for a
  48. // component-based install.
  49. void WriteDistributionFile(const char* metapackageFile, const char* genName);
  50. // Subroutine of WriteDistributionFile that writes out the
  51. // dependency attributes for inter-component dependencies.
  52. void AddDependencyAttributes(const cmCPackComponent& component,
  53. std::set<const cmCPackComponent*>& visited,
  54. std::ostringstream& out);
  55. // Subroutine of WriteDistributionFile that writes out the
  56. // reverse dependency attributes for inter-component dependencies.
  57. void AddReverseDependencyAttributes(
  58. const cmCPackComponent& component,
  59. std::set<const cmCPackComponent*>& visited, std::ostringstream& out);
  60. // Generates XML that encodes the hierarchy of component groups and
  61. // their components in a form that can be used by distribution
  62. // metapackages.
  63. void CreateChoiceOutline(const cmCPackComponentGroup& group,
  64. cmXMLWriter& xout);
  65. /// Create the "choice" XML element to describe a component group
  66. /// for the installer GUI.
  67. void CreateChoice(const cmCPackComponentGroup& group, cmXMLWriter& xout);
  68. /// Create the "choice" XML element to describe a component for the
  69. /// installer GUI.
  70. void CreateChoice(const cmCPackComponent& component, cmXMLWriter& xout);
  71. /// Creates a background in the distribution XML.
  72. void CreateBackground(const char* themeName, const char* metapackageFile,
  73. cm::string_view genName, cmXMLWriter& xout);
  74. // The PostFlight component when creating a metapackage
  75. cmCPackComponent PostFlightComponent;
  76. };
  77. #endif