cmCPackComponentGroup.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 cmCPackComponentGroup_h
  4. #define cmCPackComponentGroup_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. class cmCPackComponentGroup;
  9. /** \class cmCPackInstallationType
  10. * \brief A certain type of installation, which encompasses a
  11. * set of components.
  12. */
  13. class cmCPackInstallationType
  14. {
  15. public:
  16. /// The name of the installation type (used to reference this
  17. /// installation type).
  18. std::string Name;
  19. /// The name of the installation type as displayed to the user.
  20. std::string DisplayName;
  21. /// The index number of the installation type. This is an arbitrary
  22. /// numbering from 1 to the number of installation types.
  23. unsigned Index;
  24. };
  25. /** \class cmCPackComponent
  26. * \brief A single component to be installed by CPack.
  27. */
  28. class cmCPackComponent
  29. {
  30. public:
  31. cmCPackComponent()
  32. : Group(nullptr)
  33. , IsRequired(true)
  34. , IsHidden(false)
  35. , IsDisabledByDefault(false)
  36. , IsDownloaded(false)
  37. , TotalSize(0)
  38. {
  39. }
  40. /// The name of the component (used to reference the component).
  41. std::string Name;
  42. /// The name of the component as displayed to the user.
  43. std::string DisplayName;
  44. /// The component group that contains this component (if any).
  45. cmCPackComponentGroup* Group;
  46. /// Whether this component group must always be installed.
  47. bool IsRequired : 1;
  48. /// Whether this component group is hidden. A hidden component group
  49. /// is always installed. However, it may still be shown to the user.
  50. bool IsHidden : 1;
  51. /// Whether this component defaults to "disabled".
  52. bool IsDisabledByDefault : 1;
  53. /// Whether this component should be downloaded on-the-fly. If false,
  54. /// the component will be a part of the installation package.
  55. bool IsDownloaded : 1;
  56. /// A description of this component.
  57. std::string Description;
  58. /// The installation types that this component is a part of.
  59. std::vector<cmCPackInstallationType*> InstallationTypes;
  60. /// If IsDownloaded is true, the name of the archive file that
  61. /// contains the files that are part of this component.
  62. std::string ArchiveFile;
  63. /// The file to pass to --component-plist when using the
  64. /// productbuild generator.
  65. std::string Plist;
  66. /// The components that this component depends on.
  67. std::vector<cmCPackComponent*> Dependencies;
  68. /// The components that depend on this component.
  69. std::vector<cmCPackComponent*> ReverseDependencies;
  70. /// The list of installed files that are part of this component.
  71. std::vector<std::string> Files;
  72. /// The list of installed directories that are part of this component.
  73. std::vector<std::string> Directories;
  74. /// Get the total installed size of all of the files in this
  75. /// component, in bytes. installDir is the directory into which the
  76. /// component was installed.
  77. unsigned long GetInstalledSize(const std::string& installDir) const;
  78. /// Identical to GetInstalledSize, but returns the result in
  79. /// kilobytes.
  80. unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const;
  81. private:
  82. mutable unsigned long TotalSize;
  83. };
  84. /** \class cmCPackComponentGroup
  85. * \brief A component group to be installed by CPack.
  86. */
  87. class cmCPackComponentGroup
  88. {
  89. public:
  90. cmCPackComponentGroup()
  91. : ParentGroup(nullptr)
  92. {
  93. }
  94. /// The name of the group (used to reference the group).
  95. std::string Name;
  96. /// The name of the component as displayed to the user.
  97. std::string DisplayName;
  98. /// The description of this component group.
  99. std::string Description;
  100. /// Whether the name of the component will be shown in bold.
  101. bool IsBold : 1;
  102. /// Whether the section should be expanded by default
  103. bool IsExpandedByDefault : 1;
  104. /// The components within this group.
  105. std::vector<cmCPackComponent*> Components;
  106. /// The parent group of this component group (if any).
  107. cmCPackComponentGroup* ParentGroup;
  108. /// The subgroups of this group.
  109. std::vector<cmCPackComponentGroup*> Subgroups;
  110. };
  111. #endif