1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCPackGeneratorFactory.cxx,v $
6 Date: $Date: 2009-01-22 17:12:44 $
7 Version: $Revision: 1.4 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. 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 #include "cmCPackGeneratorFactory.h"
20 #include "cmCPackGenerator.h"
21 #include "cmCPackTGZGenerator.h"
22 #include "cmCPackTarBZip2Generator.h"
23 #include "cmCPackTarCompressGenerator.h"
24 #include "cmCPackZIPGenerator.h"
25 #include "cmCPackSTGZGenerator.h"
26 #include "cmCPackNSISGenerator.h"
28 # include "cmCPackDragNDropGenerator.h"
29 # include "cmCPackBundleGenerator.h"
30 # include "cmCPackPackageMakerGenerator.h"
31 # include "cmCPackOSXX11Generator.h"
35 # include "cmCPackCygwinBinaryGenerator.h"
36 # include "cmCPackCygwinSourceGenerator.h"
39 #if !defined(_WIN32) && !defined(__APPLE__) \
40 && !defined(__QNXNTO__) && !defined(__BEOS__)
41 # include "cmCPackDebGenerator.h"
42 # include "cmCPackRPMGenerator.h"
46 #include "cmCPackLog.h"
48 //----------------------------------------------------------------------
49 cmCPackGeneratorFactory::cmCPackGeneratorFactory()
51 this->RegisterGenerator("TGZ", "Tar GZip compression",
52 cmCPackTGZGenerator::CreateGenerator
);
53 this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
54 cmCPackSTGZGenerator::CreateGenerator
);
55 this->RegisterGenerator("NSIS", "Null Soft Installer",
56 cmCPackNSISGenerator::CreateGenerator
);
58 this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
59 cmCPackCygwinBinaryGenerator::CreateGenerator
);
60 this->RegisterGenerator("CygwinSource", "Cygwin Source Installer",
61 cmCPackCygwinSourceGenerator::CreateGenerator
);
64 this->RegisterGenerator("ZIP", "ZIP file format",
65 cmCPackZIPGenerator::CreateGenerator
);
66 this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
67 cmCPackTarBZip2Generator::CreateGenerator
);
68 this->RegisterGenerator("TZ", "Tar Compress compression",
69 cmCPackTarCompressGenerator::CreateGenerator
);
71 this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop",
72 cmCPackDragNDropGenerator::CreateGenerator
);
73 this->RegisterGenerator("Bundle", "Mac OSX bundle",
74 cmCPackBundleGenerator::CreateGenerator
);
75 this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer",
76 cmCPackPackageMakerGenerator::CreateGenerator
);
77 this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle",
78 cmCPackOSXX11Generator::CreateGenerator
);
80 #if !defined(_WIN32) && !defined(__APPLE__) \
81 && !defined(__QNXNTO__) && !defined(__BEOS__)
82 this->RegisterGenerator("DEB", "Debian packages",
83 cmCPackDebGenerator::CreateGenerator
);
84 this->RegisterGenerator("RPM", "RPM packages",
85 cmCPackRPMGenerator::CreateGenerator
);
89 //----------------------------------------------------------------------
90 cmCPackGeneratorFactory::~cmCPackGeneratorFactory()
92 std::vector
<cmCPackGenerator
*>::iterator it
;
93 for ( it
= this->Generators
.begin(); it
!= this->Generators
.end(); ++ it
)
99 //----------------------------------------------------------------------
100 cmCPackGenerator
* cmCPackGeneratorFactory::NewGenerator(const char* name
)
102 cmCPackGenerator
* gen
= this->NewGeneratorInternal(name
);
107 this->Generators
.push_back(gen
);
108 gen
->SetLogger(this->Logger
);
112 //----------------------------------------------------------------------
113 cmCPackGenerator
* cmCPackGeneratorFactory::NewGeneratorInternal(
120 cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it
121 = this->GeneratorCreators
.find(name
);
122 if ( it
== this->GeneratorCreators
.end() )
126 return (it
->second
)();
129 //----------------------------------------------------------------------
130 void cmCPackGeneratorFactory::RegisterGenerator(const char* name
,
131 const char* generatorDescription
,
132 CreateGeneratorCall
* createGenerator
)
134 if ( !name
|| !createGenerator
)
136 cmCPack_Log(this->Logger
, cmCPackLog::LOG_ERROR
,
137 "Cannot register generator" << std::endl
);
140 this->GeneratorCreators
[name
] = createGenerator
;
141 this->GeneratorDescriptions
[name
] = generatorDescription
;