cmCPackNSISGenerator.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmCPackNSISGenerator_h
  4. #define cmCPackNSISGenerator_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include "cmCPackGenerator.h"
  7. #include <iosfwd>
  8. #include <set>
  9. #include <string>
  10. #include <vector>
  11. class cmCPackComponent;
  12. class cmCPackComponentGroup;
  13. /** \class cmCPackNSISGenerator
  14. * \brief A generator for NSIS files
  15. *
  16. * http://people.freebsd.org/~kientzle/libarchive/
  17. */
  18. class cmCPackNSISGenerator : public cmCPackGenerator
  19. {
  20. public:
  21. cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
  22. static cmCPackGenerator* CreateGenerator64()
  23. {
  24. return new cmCPackNSISGenerator(true);
  25. }
  26. /**
  27. * Construct generator
  28. */
  29. cmCPackNSISGenerator(bool nsis64 = false);
  30. ~cmCPackNSISGenerator() override;
  31. protected:
  32. int InitializeInternal() override;
  33. void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr);
  34. int PackageFiles() override;
  35. const char* GetOutputExtension() override { return ".exe"; }
  36. const char* GetOutputPostfix() override { return "win32"; }
  37. bool GetListOfSubdirectories(const char* dir,
  38. std::vector<std::string>& dirs);
  39. enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir()
  40. const override;
  41. bool SupportsAbsoluteDestination() const override;
  42. bool SupportsComponentInstallation() const override;
  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::ostream& 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::ostream& macrosOut);
  61. /// Returns the custom install directory if available for the specified
  62. /// component, otherwise $INSTDIR is returned.
  63. std::string CustomComponentInstallDirectory(
  64. const std::string& componentName);
  65. /// Translations any newlines found in the string into \\r\\n, so that the
  66. /// resulting string can be used within NSIS.
  67. static std::string TranslateNewlines(std::string str);
  68. bool Nsis64;
  69. };
  70. #endif