cmCPackComponentGroup.h 4.6 KB

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