cmCPackNSISGenerator.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. virtual ~cmCPackNSISGenerator();
  32. protected:
  33. virtual int InitializeInternal();
  34. void CreateMenuLinks(std::ostringstream& str, std::ostringstream& deleteStr);
  35. int PackageFiles();
  36. virtual const char* GetOutputExtension() { return ".exe"; }
  37. virtual const char* GetOutputPostfix() { return "win32"; }
  38. bool GetListOfSubdirectories(const char* dir,
  39. std::vector<std::string>& dirs);
  40. enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
  41. virtual bool SupportsAbsoluteDestination() const;
  42. virtual bool SupportsComponentInstallation() const;
  43. /// Produce a string that contains the NSIS code to describe a
  44. /// particular component. Any added macros will be emitted via
  45. /// macrosOut.
  46. std::string CreateComponentDescription(cmCPackComponent* component,
  47. std::ostringstream& macrosOut);
  48. /// Produce NSIS code that selects all of the components that this component
  49. /// depends on, recursively.
  50. std::string CreateSelectionDependenciesDescription(
  51. cmCPackComponent* component, std::set<cmCPackComponent*>& visited);
  52. /// Produce NSIS code that de-selects all of the components that are
  53. /// dependent on this component, recursively.
  54. std::string CreateDeselectionDependenciesDescription(
  55. cmCPackComponent* component, std::set<cmCPackComponent*>& visited);
  56. /// Produce a string that contains the NSIS code to describe a
  57. /// particular component group, including its components. Any
  58. /// added macros will be emitted via macrosOut.
  59. std::string CreateComponentGroupDescription(cmCPackComponentGroup* group,
  60. std::ostringstream& macrosOut);
  61. /// Translations any newlines found in the string into \\r\\n, so that the
  62. /// resulting string can be used within NSIS.
  63. static std::string TranslateNewlines(std::string str);
  64. bool Nsis64;
  65. };
  66. #endif