cmCPackIFWPackage.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 <map>
  6. #include <set>
  7. #include <string>
  8. #include <vector>
  9. #include "cmCPackIFWCommon.h"
  10. class cmCPackComponent;
  11. class cmCPackComponentGroup;
  12. class cmCPackIFWInstaller;
  13. /** \class cmCPackIFWPackage
  14. * \brief A single component to be installed by CPack IFW generator
  15. */
  16. class cmCPackIFWPackage : public cmCPackIFWCommon
  17. {
  18. public:
  19. // Types
  20. enum CompareTypes
  21. {
  22. CompareNone = 0x0,
  23. CompareEqual = 0x1,
  24. CompareLess = 0x2,
  25. CompareLessOrEqual = 0x3,
  26. CompareGreater = 0x4,
  27. CompareGreaterOrEqual = 0x5
  28. };
  29. struct CompareStruct
  30. {
  31. CompareStruct();
  32. unsigned int Type;
  33. std::string Value;
  34. };
  35. struct DependenceStruct
  36. {
  37. DependenceStruct();
  38. explicit DependenceStruct(std::string const& dependence);
  39. std::string Name;
  40. CompareStruct Compare;
  41. std::string NameWithCompare() const;
  42. bool operator<(DependenceStruct const& other) const
  43. {
  44. return this->Name < other.Name;
  45. }
  46. };
  47. public:
  48. // [Con|De]structor
  49. /**
  50. * Construct package
  51. */
  52. cmCPackIFWPackage();
  53. public:
  54. // Configuration
  55. /// Human-readable name of the component
  56. std::map<std::string, std::string> DisplayName;
  57. /// Human-readable description of the component
  58. std::map<std::string, std::string> Description;
  59. /// Version number of the component
  60. std::string Version;
  61. /// Date when this component version was released
  62. std::string ReleaseDate;
  63. /// Domain-like identification for this component
  64. std::string Name;
  65. /// File name of a script being loaded
  66. std::string Script;
  67. /// List of license agreements to be accepted by the installing user
  68. std::vector<std::string> Licenses;
  69. /// List of pages to load
  70. std::vector<std::string> UserInterfaces;
  71. /// List of translation files to load
  72. std::vector<std::string> Translations;
  73. /// Priority of the component in the tree
  74. std::string SortingPriority;
  75. /// Description added to the component description
  76. std::string UpdateText;
  77. /// Set to true to preselect the component in the installer
  78. std::string Default;
  79. /// Marks the package as essential to force a restart of the MaintenanceTool
  80. std::string Essential;
  81. /// Set to true to hide the component from the installer
  82. std::string Virtual;
  83. /// Determines that the package must always be installed
  84. std::string ForcedInstallation;
  85. /// List of components to replace
  86. std::vector<std::string> Replaces;
  87. /// Package needs to be installed with elevated permissions
  88. std::string RequiresAdminRights;
  89. /// Set to false if you want to hide the checkbox for an item
  90. std::string Checkable;
  91. public:
  92. // Internal implementation
  93. std::string GetComponentName(cmCPackComponent* component);
  94. void DefaultConfiguration();
  95. int ConfigureFromOptions();
  96. int ConfigureFromComponent(cmCPackComponent* component);
  97. int ConfigureFromGroup(cmCPackComponentGroup* group);
  98. int ConfigureFromGroup(std::string const& groupName);
  99. int ConfigureFromPrefix(std::string const& prefix);
  100. void GeneratePackageFile();
  101. // Pointer to installer
  102. cmCPackIFWInstaller* Installer;
  103. // Collection of dependencies
  104. std::set<cmCPackIFWPackage*> Dependencies;
  105. // Collection of unresolved dependencies
  106. std::set<DependenceStruct*> AlienDependencies;
  107. // Collection of unresolved automatic dependency on
  108. std::set<DependenceStruct*> AlienAutoDependOn;
  109. // Patch to package directory
  110. std::string Directory;
  111. };