cmCPackNSISGenerator.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc.
  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 cmCPackNSISGenerator_h
  11. #define cmCPackNSISGenerator_h
  12. #include "cmCPackGenerator.h"
  13. #include <set>
  14. /** \class cmCPackNSISGenerator
  15. * \brief A generator for NSIS files
  16. *
  17. * http://people.freebsd.org/~kientzle/libarchive/
  18. */
  19. class cmCPackNSISGenerator : public cmCPackGenerator
  20. {
  21. public:
  22. cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
  23. static cmCPackGenerator* CreateGenerator64()
  24. {
  25. return new cmCPackNSISGenerator(true);
  26. }
  27. /**
  28. * Construct generator
  29. */
  30. cmCPackNSISGenerator(bool nsis64 = false);
  31. ~cmCPackNSISGenerator() CM_OVERRIDE;
  32. protected:
  33. int InitializeInternal() CM_OVERRIDE;
  34. void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr);
  35. int PackageFiles() CM_OVERRIDE;
  36. const char* GetOutputExtension() CM_OVERRIDE { return ".exe"; }
  37. const char* GetOutputPostfix() CM_OVERRIDE { return "win32"; }
  38. bool GetListOfSubdirectories(const char* dir,
  39. std::vector<std::string>& dirs);
  40. enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const
  41. CM_OVERRIDE;
  42. bool SupportsAbsoluteDestination() const CM_OVERRIDE;
  43. bool SupportsComponentInstallation() const CM_OVERRIDE;
  44. /// Produce a string that contains the NSIS code to describe a
  45. /// particular component. Any added macros will be emitted via
  46. /// macrosOut.
  47. std::string CreateComponentDescription(cmCPackComponent* component,
  48. std::ostream& macrosOut);
  49. /// Produce NSIS code that selects all of the components that this component
  50. /// depends on, recursively.
  51. std::string CreateSelectionDependenciesDescription(
  52. cmCPackComponent* component, std::set<cmCPackComponent*>& visited);
  53. /// Produce NSIS code that de-selects all of the components that are
  54. /// dependent on this component, recursively.
  55. std::string CreateDeselectionDependenciesDescription(
  56. cmCPackComponent* component, std::set<cmCPackComponent*>& visited);
  57. /// Produce a string that contains the NSIS code to describe a
  58. /// particular component group, including its components. Any
  59. /// added macros will be emitted via macrosOut.
  60. std::string CreateComponentGroupDescription(cmCPackComponentGroup* group,
  61. std::ostream& macrosOut);
  62. /// Translations any newlines found in the string into \\r\\n, so that the
  63. /// resulting string can be used within NSIS.
  64. static std::string TranslateNewlines(std::string str);
  65. bool Nsis64;
  66. };
  67. #endif