Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Source / CPack / cmCPackNSISGenerator.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc.
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12
13 #ifndef cmCPackNSISGenerator_h
14 #define cmCPackNSISGenerator_h
15
16
17 #include "cmCPackGenerator.h"
18 #include <set>
19
20 /** \class cmCPackNSISGenerator
21  * \brief A generator for NSIS files
22  *
23  * http://people.freebsd.org/~kientzle/libarchive/
24  */
25 class cmCPackNSISGenerator : public cmCPackGenerator
26 {
27 public:
28   cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
29
30   /**
31    * Construct generator
32    */
33   cmCPackNSISGenerator();
34   virtual ~cmCPackNSISGenerator();
35
36 protected:
37   virtual int InitializeInternal();
38   void CreateMenuLinks( cmOStringStream& str,
39                         cmOStringStream& deleteStr);
40   int PackageFiles();
41   virtual const char* GetOutputExtension() { return ".exe"; }
42   virtual const char* GetOutputPostfix() { return "win32"; }
43
44   bool GetListOfSubdirectories(const char* dir,
45     std::vector<std::string>& dirs);
46
47   enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
48   virtual bool SupportsAbsoluteDestination() const;
49   virtual bool SupportsComponentInstallation() const;
50
51   /// Produce a string that contains the NSIS code to describe a
52   /// particular component. Any added macros will be emitted via
53   /// macrosOut.
54   std::string
55   CreateComponentDescription(cmCPackComponent *component,
56                              cmOStringStream& macrosOut);
57
58   /// Produce NSIS code that selects all of the components that this component
59   /// depends on, recursively.
60   std::string CreateSelectionDependenciesDescription
61                 (cmCPackComponent *component,
62                  std::set<cmCPackComponent *>& visited);
63
64   /// Produce NSIS code that de-selects all of the components that are
65   /// dependent on this component, recursively.
66   std::string CreateDeselectionDependenciesDescription
67                 (cmCPackComponent *component,
68                  std::set<cmCPackComponent *>& visited);
69
70   /// Produce a string that contains the NSIS code to describe a
71   /// particular component group, including its components. Any
72   /// added macros will be emitted via macrosOut.
73   std::string
74   CreateComponentGroupDescription(cmCPackComponentGroup *group,
75                                   cmOStringStream& macrosOut);
76
77   /// Translations any newlines found in the string into \\r\\n, so that the
78   /// resulting string can be used within NSIS.
79   static std::string TranslateNewlines(std::string str);
80 };
81
82 #endif