1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPackGenerator.h,v $
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
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) \
35 cmOStringStream cmCPackLog_msg; \
36 cmCPackLog_msg << msg; \
37 this->Logger->Log(logType, __FILE__, __LINE__,\
38 cmCPackLog_msg.str().c_str());\
44 #define cerr no_cerr_use_cmCPack_Log
49 #define cout no_cout_use_cmCPack_Log
54 /** \class cmCPackGenerator
55 * \brief A superclass of all CPack Generators
58 class cmCPackGenerator
: public cmObject
61 cmTypeMacro(cmCPackGenerator
, cmObject
);
63 * If verbose then more informaiton is printed out
65 void SetVerbose(bool val
) { this->GeneratorVerbose
= val
; }
68 * Do the actual processing. Subclass has to override it.
71 virtual int DoPackage();
74 * Initialize generator
76 int Initialize(const char* name
, cmMakefile
* mf
);
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
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
);
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
,
132 virtual cmCPackComponent
* GetComponent(const char *projectName
,
134 virtual cmCPackComponentGroup
* GetComponentGroup(const char *projectName
,
137 bool GeneratorVerbose
;
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
;
152 cmMakefile
* MakefileMap
;