cmCPackComponentGroup.h 4.6 KB

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