cmCPackIFWGenerator.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmCPackIFWGenerator_h
  11. #define cmCPackIFWGenerator_h
  12. #include <cmGeneratedFileStream.h>
  13. #include <CPack/cmCPackGenerator.h>
  14. #include "cmCPackIFWPackage.h"
  15. #include "cmCPackIFWInstaller.h"
  16. /** \class cmCPackIFWGenerator
  17. * \brief A generator for Qt Installer Framework tools
  18. *
  19. * http://qt-project.org/doc/qtinstallerframework/index.html
  20. */
  21. class cmCPackIFWGenerator : public cmCPackGenerator
  22. {
  23. public:
  24. cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
  25. typedef std::map<std::string, cmCPackIFWPackage> PackagesMap;
  26. typedef std::map<std::string, cmCPackComponent> ComponentsMap;
  27. typedef std::map<std::string, cmCPackComponentGroup> ComponentGoupsMap;
  28. typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
  29. DependenceMap;
  30. /**
  31. * Construct IFW generator
  32. */
  33. cmCPackIFWGenerator();
  34. /**
  35. * Destruct IFW generator
  36. */
  37. virtual ~cmCPackIFWGenerator();
  38. /**
  39. * Compare \a version with QtIFW framework version
  40. */
  41. bool IsVersionLess(const char *version);
  42. /**
  43. * Compare \a version with QtIFW framework version
  44. */
  45. bool IsVersionGreater(const char *version);
  46. /**
  47. * Compare \a version with QtIFW framework version
  48. */
  49. bool IsVersionEqual(const char *version);
  50. protected: // cmCPackGenerator reimplementation
  51. /**
  52. * @brief Initialize generator
  53. * @return 0 on failure
  54. */
  55. virtual int InitializeInternal();
  56. virtual int PackageFiles();
  57. virtual const char* GetPackagingInstallPrefix();
  58. /**
  59. * @brief Extension of binary installer
  60. * @return Executable suffix or value from default implementation
  61. */
  62. virtual const char* GetOutputExtension();
  63. virtual std::string GetComponentInstallDirNameSuffix(
  64. const std::string& componentName);
  65. /**
  66. * @brief Get Component
  67. * @param projectName Project name
  68. * @param componentName Component name
  69. *
  70. * This method calls the base implementation.
  71. *
  72. * @return Pointer to component
  73. */
  74. virtual cmCPackComponent* GetComponent(
  75. const std::string& projectName,
  76. const std::string& componentName);
  77. /**
  78. * @brief Get group of component
  79. * @param projectName Project name
  80. * @param groupName Component group name
  81. *
  82. * This method calls the base implementation.
  83. *
  84. * @return Pointer to component group
  85. */
  86. virtual cmCPackComponentGroup* GetComponentGroup(
  87. const std::string& projectName,
  88. const std::string& groupName);
  89. enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
  90. virtual bool SupportsAbsoluteDestination() const;
  91. virtual bool SupportsComponentInstallation() const;
  92. protected: // Methods
  93. bool IsOnePackage() const;
  94. std::string GetRootPackageName();
  95. std::string GetGroupPackageName(cmCPackComponentGroup *group) const;
  96. std::string GetComponentPackageName(cmCPackComponent *component) const;
  97. cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup *group) const;
  98. cmCPackIFWPackage* GetComponentPackage(cmCPackComponent *component) const;
  99. void WriteGeneratedByToStrim(cmGeneratedFileStream& xout);
  100. protected: // Data
  101. friend class cmCPackIFWPackage;
  102. friend class cmCPackIFWInstaller;
  103. // Installer
  104. cmCPackIFWInstaller Installer;
  105. // Collection of packages
  106. PackagesMap Packages;
  107. // Collection of binary packages
  108. std::set<cmCPackIFWPackage*> BinaryPackages;
  109. // Collection of downloaded packages
  110. std::set<cmCPackIFWPackage*> DownloadedPackages;
  111. // Dependent packages
  112. DependenceMap DependentPackages;
  113. std::map<cmCPackComponent*, cmCPackIFWPackage*> ComponentPackages;
  114. std::map<cmCPackComponentGroup*, cmCPackIFWPackage*> GroupPackages;
  115. private:
  116. std::string RepoGen;
  117. std::string BinCreator;
  118. std::string FrameworkVersion;
  119. std::string ExecutableSuffix;
  120. bool OnlineOnly;
  121. bool ResolveDuplicateNames;
  122. std::vector<std::string> PkgsDirsVector;
  123. };
  124. #endif