cmCPackPKGGenerator.h 3.3 KB

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