Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / CPack / cmCPackGenerator.h
blob50c2f36bef216673bdbb6929d25121d075c5bd9f
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPackGenerator.h,v $
5 Language: C++
6 Date: $Date: 2008-10-01 13:04:27 $
7 Version: $Revision: 1.7 $
9 Copyright (c) 2002 Kitware, Inc. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
18 #ifndef cmCPackGenerator_h
19 #define cmCPackGenerator_h
21 #include "cmObject.h"
22 #include <map>
23 #include <vector>
25 #include "cmCPackComponentGroup.h" // cmCPackComponent and friends
26 // Forward declarations are insufficient since we use them in
27 // std::map data members below...
29 #define cmCPackTypeMacro(class, superclass) \
30 cmTypeMacro(class, superclass); \
31 static cmCPackGenerator* CreateGenerator() { return new class; }
33 #define cmCPackLogger(logType, msg) \
34 do { \
35 cmOStringStream cmCPackLog_msg; \
36 cmCPackLog_msg << msg; \
37 this->Logger->Log(logType, __FILE__, __LINE__,\
38 cmCPackLog_msg.str().c_str());\
39 } while ( 0 )
41 #ifdef cerr
42 # undef cerr
43 #endif
44 #define cerr no_cerr_use_cmCPack_Log
46 #ifdef cout
47 # undef cout
48 #endif
49 #define cout no_cout_use_cmCPack_Log
51 class cmMakefile;
52 class cmCPackLog;
54 /** \class cmCPackGenerator
55 * \brief A superclass of all CPack Generators
58 class cmCPackGenerator : public cmObject
60 public:
61 cmTypeMacro(cmCPackGenerator, cmObject);
62 /**
63 * If verbose then more informaiton is printed out
65 void SetVerbose(bool val) { this->GeneratorVerbose = val; }
67 /**
68 * Do the actual processing. Subclass has to override it.
69 * Return 0 if error.
71 virtual int DoPackage();
73 /**
74 * Initialize generator
76 int Initialize(const char* name, cmMakefile* mf);
78 /**
79 * Construct generator
81 cmCPackGenerator();
82 virtual ~cmCPackGenerator();
84 //! Set and get the options
85 void SetOption(const char* op, const char* value);
86 void SetOptionIfNotSet(const char* op, const char* value);
87 const char* GetOption(const char* op);
88 bool IsSet(const char* name) const;
90 //! Set all the variables
91 int SetCMakeRoot();
93 //! Set the logger
94 void SetLogger(cmCPackLog* log) { this->Logger = log; }
96 //! Display verbose information via logger
97 void DisplayVerboseOutput(const char* msg, float progress);
99 bool ReadListFile(const char* moduleName);
101 protected:
102 int PrepareNames();
103 int InstallProject();
104 int CleanTemporaryDirectory();
105 virtual const char* GetOutputExtension() { return ".cpack"; }
106 virtual const char* GetOutputPostfix() { return 0; }
107 virtual int CompressFiles(const char* outFileName, const char* toplevel,
108 const std::vector<std::string>& files);
109 virtual const char* GetInstallPath();
110 virtual const char* GetPackagingInstallPrefix();
112 virtual std::string FindTemplate(const char* name);
113 virtual bool ConfigureFile(const char* inName, const char* outName,
114 bool copyOnly = false);
115 virtual bool ConfigureString(const std::string& input, std::string& output);
116 virtual int InitializeInternal();
119 //! Run install commands if specified
120 virtual int InstallProjectViaInstallCommands(
121 bool setDestDir, const char* tempInstallDirectory);
122 virtual int InstallProjectViaInstallScript(
123 bool setDestDir, const char* tempInstallDirectory);
124 virtual int InstallProjectViaInstalledDirectories(
125 bool setDestDir, const char* tempInstallDirectory);
126 virtual int InstallProjectViaInstallCMakeProjects(
127 bool setDestDir, const char* tempInstallDirectory);
129 virtual bool SupportsComponentInstallation() const;
130 virtual cmCPackInstallationType* GetInstallationType(const char *projectName,
131 const char* name);
132 virtual cmCPackComponent* GetComponent(const char *projectName,
133 const char* name);
134 virtual cmCPackComponentGroup* GetComponentGroup(const char *projectName,
135 const char* name);
137 bool GeneratorVerbose;
138 std::string Name;
140 std::string InstallPath;
142 std::string CPackSelf;
143 std::string CMakeSelf;
144 std::string CMakeRoot;
146 std::map<std::string, cmCPackInstallationType> InstallationTypes;
147 std::map<std::string, cmCPackComponent> Components;
148 std::map<std::string, cmCPackComponentGroup> ComponentGroups;
150 cmCPackLog* Logger;
151 private:
152 cmMakefile* MakefileMap;
155 #endif