cmCPackPKGGenerator.h 3.2 KB

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