Resync.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / CPack / cmCPackGenerator.h
blob2cef3d91f69b9f82b63caf824fa719c3a26d5572
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPackGenerator.h,v $
5 Language: C++
6 Date: $Date: 2007/11/06 13:28:26 $
7 Version: $Revision: 1.2 $
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"
23 #define cmCPackTypeMacro(class, superclass) \
24 cmTypeMacro(class, superclass); \
25 static cmCPackGenerator* CreateGenerator() { return new class; }
27 #define cmCPackLogger(logType, msg) \
28 do { \
29 cmOStringStream cmCPackLog_msg; \
30 cmCPackLog_msg << msg; \
31 this->Logger->Log(logType, __FILE__, __LINE__,\
32 cmCPackLog_msg.str().c_str());\
33 } while ( 0 )
35 #ifdef cerr
36 # undef cerr
37 #endif
38 #define cerr no_cerr_use_cmCPack_Log
40 #ifdef cout
41 # undef cout
42 #endif
43 #define cout no_cout_use_cmCPack_Log
45 class cmMakefile;
46 class cmCPackLog;
48 /** \class cmCPackGenerator
49 * \brief A superclass of all CPack Generators
52 class cmCPackGenerator : public cmObject
54 public:
55 cmTypeMacro(cmCPackGenerator, cmObject);
56 /**
57 * If verbose then more informaiton is printed out
59 void SetVerbose(bool val) { this->GeneratorVerbose = val; }
61 /**
62 * Do the actual processing. Subclass has to override it.
63 * Return 0 if error.
65 virtual int DoPackage();
67 /**
68 * Initialize generator
70 int Initialize(const char* name, cmMakefile* mf, const char* argv0);
72 /**
73 * Construct generator
75 cmCPackGenerator();
76 virtual ~cmCPackGenerator();
78 //! Set and get the options
79 void SetOption(const char* op, const char* value);
80 void SetOptionIfNotSet(const char* op, const char* value);
81 const char* GetOption(const char* op);
82 bool IsSet(const char* name) const;
84 //! Set all the variables
85 int FindRunningCMake(const char* arg0);
87 //! Set the logger
88 void SetLogger(cmCPackLog* log) { this->Logger = log; }
90 //! Display verbose information via logger
91 void DisplayVerboseOutput(const char* msg, float progress);
93 bool ReadListFile(const char* moduleName);
95 protected:
96 int PrepareNames();
97 int InstallProject();
98 int CleanTemporaryDirectory();
99 virtual const char* GetOutputExtension() { return ".cpack"; }
100 virtual const char* GetOutputPostfix() { return 0; }
101 virtual int CompressFiles(const char* outFileName, const char* toplevel,
102 const std::vector<std::string>& files);
103 virtual const char* GetInstallPath();
104 virtual const char* GetPackagingInstallPrefix();
106 virtual std::string FindTemplate(const char* name);
107 virtual bool ConfigureFile(const char* inName, const char* outName,
108 bool copyOnly = false);
109 virtual bool ConfigureString(const std::string& input, std::string& output);
110 virtual int InitializeInternal();
113 //! Run install commands if specified
114 virtual int InstallProjectViaInstallCommands(
115 bool setDestDir, const char* tempInstallDirectory);
116 virtual int InstallProjectViaInstallScript(
117 bool setDestDir, const char* tempInstallDirectory);
118 virtual int InstallProjectViaInstalledDirectories(
119 bool setDestDir, const char* tempInstallDirectory);
120 virtual int InstallProjectViaInstallCMakeProjects(
121 bool setDestDir, const char* tempInstallDirectory);
123 bool GeneratorVerbose;
124 std::string Name;
126 std::string InstallPath;
128 std::string CPackSelf;
129 std::string CMakeSelf;
130 std::string CMakeRoot;
132 cmCPackLog* Logger;
133 private:
134 cmMakefile* MakefileMap;
137 #endif