cmCPackIFWGenerator.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 <CPack/cmCPackGenerator.h>
  13. #include "cmCPackIFWInstaller.h"
  14. #include "cmCPackIFWPackage.h"
  15. #include "cmCPackIFWRepository.h"
  16. class cmXMLWriter;
  17. /** \class cmCPackIFWGenerator
  18. * \brief A generator for Qt Installer Framework tools
  19. *
  20. * http://qt-project.org/doc/qtinstallerframework/index.html
  21. */
  22. class cmCPackIFWGenerator : public cmCPackGenerator
  23. {
  24. public:
  25. cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
  26. typedef std::map<std::string, cmCPackIFWPackage> PackagesMap;
  27. typedef std::map<std::string, cmCPackIFWRepository> RepositoriesMap;
  28. typedef std::map<std::string, cmCPackComponent> ComponentsMap;
  29. typedef std::map<std::string, cmCPackComponentGroup> ComponentGoupsMap;
  30. typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
  31. DependenceMap;
  32. /**
  33. * Construct IFW generator
  34. */
  35. cmCPackIFWGenerator();
  36. /**
  37. * Destruct IFW generator
  38. */
  39. virtual ~cmCPackIFWGenerator();
  40. /**
  41. * Compare \a version with QtIFW framework version
  42. */
  43. bool IsVersionLess(const char* version);
  44. /**
  45. * Compare \a version with QtIFW framework version
  46. */
  47. bool IsVersionGreater(const char* version);
  48. /**
  49. * Compare \a version with QtIFW framework version
  50. */
  51. bool IsVersionEqual(const char* version);
  52. protected:
  53. // cmCPackGenerator reimplementation
  54. /**
  55. * @brief Initialize generator
  56. * @return 0 on failure
  57. */
  58. virtual int InitializeInternal();
  59. virtual int PackageFiles();
  60. virtual const char* GetPackagingInstallPrefix();
  61. /**
  62. * @brief Extension of binary installer
  63. * @return Executable suffix or value from default implementation
  64. */
  65. virtual const char* GetOutputExtension();
  66. virtual std::string GetComponentInstallDirNameSuffix(
  67. const std::string& componentName);
  68. /**
  69. * @brief Get Component
  70. * @param projectName Project name
  71. * @param componentName Component name
  72. *
  73. * This method calls the base implementation.
  74. *
  75. * @return Pointer to component
  76. */
  77. virtual cmCPackComponent* GetComponent(const std::string& projectName,
  78. const std::string& componentName);
  79. /**
  80. * @brief Get group of component
  81. * @param projectName Project name
  82. * @param groupName Component group name
  83. *
  84. * This method calls the base implementation.
  85. *
  86. * @return Pointer to component group
  87. */
  88. virtual cmCPackComponentGroup* GetComponentGroup(
  89. const std::string& projectName, const std::string& groupName);
  90. enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
  91. virtual bool SupportsAbsoluteDestination() const;
  92. virtual bool SupportsComponentInstallation() const;
  93. protected:
  94. // Methods
  95. bool IsOnePackage() const;
  96. std::string GetRootPackageName();
  97. std::string GetGroupPackageName(cmCPackComponentGroup* group) const;
  98. std::string GetComponentPackageName(cmCPackComponent* component) const;
  99. cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup* group) const;
  100. cmCPackIFWPackage* GetComponentPackage(cmCPackComponent* component) const;
  101. cmCPackIFWRepository* GetRepository(const std::string& repositoryName);
  102. void WriteGeneratedByToStrim(cmXMLWriter& xout);
  103. protected:
  104. // Data
  105. friend class cmCPackIFWPackage;
  106. friend class cmCPackIFWInstaller;
  107. friend class cmCPackIFWRepository;
  108. // Installer
  109. cmCPackIFWInstaller Installer;
  110. // Repository
  111. cmCPackIFWRepository Repository;
  112. // Collection of packages
  113. PackagesMap Packages;
  114. // Collection of repositories
  115. RepositoriesMap Repositories;
  116. // Collection of binary packages
  117. std::set<cmCPackIFWPackage*> BinaryPackages;
  118. // Collection of downloaded packages
  119. std::set<cmCPackIFWPackage*> DownloadedPackages;
  120. // Dependent packages
  121. DependenceMap DependentPackages;
  122. std::map<cmCPackComponent*, cmCPackIFWPackage*> ComponentPackages;
  123. std::map<cmCPackComponentGroup*, cmCPackIFWPackage*> GroupPackages;
  124. private:
  125. std::string RepoGen;
  126. std::string BinCreator;
  127. std::string FrameworkVersion;
  128. std::string ExecutableSuffix;
  129. bool OnlineOnly;
  130. bool ResolveDuplicateNames;
  131. std::vector<std::string> PkgsDirsVector;
  132. };
  133. #endif