2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2007-11-06 00:33:19 +03:00
|
|
|
#include "cmCPackGeneratorFactory.h"
|
2006-01-02 07:21:05 +03:00
|
|
|
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "IFW/cmCPackIFWGenerator.h"
|
|
|
|
#include "cmCPack7zGenerator.h"
|
2007-11-06 00:55:45 +03:00
|
|
|
#include "cmCPackGenerator.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmCPackNSISGenerator.h"
|
|
|
|
#include "cmCPackSTGZGenerator.h"
|
2006-01-02 07:21:05 +03:00
|
|
|
#include "cmCPackTGZGenerator.h"
|
2014-07-10 02:21:36 +04:00
|
|
|
#include "cmCPackTXZGenerator.h"
|
2006-05-04 05:42:51 +04:00
|
|
|
#include "cmCPackTarBZip2Generator.h"
|
2006-05-03 01:07:16 +04:00
|
|
|
#include "cmCPackTarCompressGenerator.h"
|
2006-04-02 19:20:58 +04:00
|
|
|
#include "cmCPackZIPGenerator.h"
|
2012-10-03 18:08:49 +04:00
|
|
|
|
2007-01-10 23:30:26 +03:00
|
|
|
#ifdef __APPLE__
|
2016-05-16 17:34:04 +03:00
|
|
|
#include "cmCPackBundleGenerator.h"
|
|
|
|
#include "cmCPackDragNDropGenerator.h"
|
|
|
|
#include "cmCPackOSXX11Generator.h"
|
|
|
|
#include "cmCPackPackageMakerGenerator.h"
|
2013-11-02 20:24:53 +04:00
|
|
|
#include "cmCPackProductBuildGenerator.h"
|
2007-01-10 23:30:26 +03:00
|
|
|
#endif
|
2006-01-02 07:21:05 +03:00
|
|
|
|
2007-02-02 22:40:26 +03:00
|
|
|
#ifdef __CYGWIN__
|
2016-05-16 17:34:04 +03:00
|
|
|
#include "cmCPackCygwinBinaryGenerator.h"
|
|
|
|
#include "cmCPackCygwinSourceGenerator.h"
|
2007-02-02 22:40:26 +03:00
|
|
|
#endif
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
#if !defined(_WIN32) && !defined(__QNXNTO__) && !defined(__BEOS__) && \
|
|
|
|
!defined(__HAIKU__)
|
|
|
|
#include "cmCPackDebGenerator.h"
|
|
|
|
#include "cmCPackRPMGenerator.h"
|
2007-07-25 18:57:33 +04:00
|
|
|
#endif
|
|
|
|
|
2012-10-03 18:08:49 +04:00
|
|
|
#ifdef _WIN32
|
2016-05-16 17:34:04 +03:00
|
|
|
#include "WiX/cmCPackWIXGenerator.h"
|
2012-10-03 18:08:49 +04:00
|
|
|
#endif
|
2007-07-25 18:57:33 +04:00
|
|
|
|
2015-02-10 23:50:16 +03:00
|
|
|
#include "cmAlgorithms.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmCPackLog.h"
|
2006-01-03 00:14:21 +03:00
|
|
|
|
2016-09-07 01:21:35 +03:00
|
|
|
#include <ostream>
|
|
|
|
#include <utility>
|
|
|
|
|
2007-11-06 00:33:19 +03:00
|
|
|
cmCPackGeneratorFactory::cmCPackGeneratorFactory()
|
2006-01-02 07:21:05 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (cmCPackTGZGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("TGZ", "Tar GZip compression",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackTGZGenerator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPackTXZGenerator::CanGenerate()) {
|
2014-07-10 02:21:36 +04:00
|
|
|
this->RegisterGenerator("TXZ", "Tar XZ compression",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackTXZGenerator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPackSTGZGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackSTGZGenerator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPackNSISGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("NSIS", "Null Soft Installer",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackNSISGenerator::CreateGenerator);
|
2012-05-09 23:33:44 +04:00
|
|
|
this->RegisterGenerator("NSIS64", "Null Soft Installer (64-bit)",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackNSISGenerator::CreateGenerator64);
|
|
|
|
}
|
|
|
|
if (cmCPackIFWGenerator::CanGenerate()) {
|
2014-07-23 11:01:59 +04:00
|
|
|
this->RegisterGenerator("IFW", "Qt Installer Framework",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackIFWGenerator::CreateGenerator);
|
|
|
|
}
|
2007-02-02 22:40:26 +03:00
|
|
|
#ifdef __CYGWIN__
|
2016-05-16 17:34:04 +03:00
|
|
|
if (cmCPackCygwinBinaryGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
|
|
|
|
cmCPackCygwinBinaryGenerator::CreateGenerator);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (cmCPackCygwinSourceGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("CygwinSource", "Cygwin Source Installer",
|
|
|
|
cmCPackCygwinSourceGenerator::CreateGenerator);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2007-02-02 22:40:26 +03:00
|
|
|
#endif
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (cmCPackZIPGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("ZIP", "ZIP file format",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackZIPGenerator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPack7zGenerator::CanGenerate()) {
|
2014-07-10 02:21:36 +04:00
|
|
|
this->RegisterGenerator("7Z", "7-Zip file format",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPack7zGenerator::CreateGenerator);
|
|
|
|
}
|
2012-10-03 18:08:49 +04:00
|
|
|
#ifdef _WIN32
|
2016-05-16 17:34:04 +03:00
|
|
|
if (cmCPackWIXGenerator::CanGenerate()) {
|
2012-10-03 18:08:49 +04:00
|
|
|
this->RegisterGenerator("WIX", "MSI file format via WiX tools",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackWIXGenerator::CreateGenerator);
|
|
|
|
}
|
2012-10-03 18:08:49 +04:00
|
|
|
#endif
|
2016-05-16 17:34:04 +03:00
|
|
|
if (cmCPackTarBZip2Generator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackTarBZip2Generator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPackTarCompressGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("TZ", "Tar Compress compression",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackTarCompressGenerator::CreateGenerator);
|
|
|
|
}
|
2006-05-03 01:52:22 +04:00
|
|
|
#ifdef __APPLE__
|
2016-05-16 17:34:04 +03:00
|
|
|
if (cmCPackDragNDropGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackDragNDropGenerator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPackBundleGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("Bundle", "Mac OSX bundle",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackBundleGenerator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPackPackageMakerGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("PackageMaker", "Mac OSX Package Maker installer",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackPackageMakerGenerator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPackOSXX11Generator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("OSXX11", "Mac OSX X11 bundle",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackOSXX11Generator::CreateGenerator);
|
|
|
|
}
|
2013-11-02 20:24:53 +04:00
|
|
|
if (cmCPackProductBuildGenerator::CanGenerate()) {
|
|
|
|
this->RegisterGenerator("productbuild", "Mac OSX pkg",
|
2016-06-07 15:39:45 +03:00
|
|
|
cmCPackProductBuildGenerator::CreateGenerator);
|
2013-11-02 20:24:53 +04:00
|
|
|
}
|
2006-05-03 01:52:22 +04:00
|
|
|
#endif
|
2016-05-16 17:34:04 +03:00
|
|
|
#if !defined(_WIN32) && !defined(__QNXNTO__) && !defined(__BEOS__) && \
|
|
|
|
!defined(__HAIKU__)
|
|
|
|
if (cmCPackDebGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("DEB", "Debian packages",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackDebGenerator::CreateGenerator);
|
|
|
|
}
|
|
|
|
if (cmCPackRPMGenerator::CanGenerate()) {
|
2012-03-30 19:07:06 +04:00
|
|
|
this->RegisterGenerator("RPM", "RPM packages",
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackRPMGenerator::CreateGenerator);
|
|
|
|
}
|
2007-07-25 18:57:33 +04:00
|
|
|
#endif
|
2006-01-02 07:21:05 +03:00
|
|
|
}
|
|
|
|
|
2007-11-06 00:33:19 +03:00
|
|
|
cmCPackGeneratorFactory::~cmCPackGeneratorFactory()
|
2006-01-02 07:21:05 +03:00
|
|
|
{
|
2015-01-04 15:33:16 +03:00
|
|
|
cmDeleteAll(this->Generators);
|
2006-01-02 07:21:05 +03:00
|
|
|
}
|
|
|
|
|
2014-02-04 06:04:22 +04:00
|
|
|
cmCPackGenerator* cmCPackGeneratorFactory::NewGenerator(
|
2016-05-16 17:34:04 +03:00
|
|
|
const std::string& name)
|
2006-01-02 07:21:05 +03:00
|
|
|
{
|
2007-11-06 00:55:45 +03:00
|
|
|
cmCPackGenerator* gen = this->NewGeneratorInternal(name);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!gen) {
|
2016-06-27 23:44:16 +03:00
|
|
|
return CM_NULLPTR;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2006-03-10 21:06:26 +03:00
|
|
|
this->Generators.push_back(gen);
|
|
|
|
gen->SetLogger(this->Logger);
|
2006-01-02 07:21:05 +03:00
|
|
|
return gen;
|
|
|
|
}
|
|
|
|
|
2007-11-06 00:55:45 +03:00
|
|
|
cmCPackGenerator* cmCPackGeneratorFactory::NewGeneratorInternal(
|
2014-02-04 06:04:22 +04:00
|
|
|
const std::string& name)
|
2006-01-02 07:21:05 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
cmCPackGeneratorFactory::t_GeneratorCreatorsMap::iterator it =
|
|
|
|
this->GeneratorCreators.find(name);
|
|
|
|
if (it == this->GeneratorCreators.end()) {
|
2016-06-27 23:44:16 +03:00
|
|
|
return CM_NULLPTR;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2006-01-02 07:21:05 +03:00
|
|
|
return (it->second)();
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmCPackGeneratorFactory::RegisterGenerator(
|
|
|
|
const std::string& name, const char* generatorDescription,
|
2006-03-09 00:33:39 +03:00
|
|
|
CreateGeneratorCall* createGenerator)
|
2006-01-02 07:21:05 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!createGenerator) {
|
2006-03-10 21:06:26 +03:00
|
|
|
cmCPack_Log(this->Logger, cmCPackLog::LOG_ERROR,
|
2016-05-16 17:34:04 +03:00
|
|
|
"Cannot register generator" << std::endl);
|
2006-01-02 07:21:05 +03:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2006-03-10 21:06:26 +03:00
|
|
|
this->GeneratorCreators[name] = createGenerator;
|
2006-05-03 01:52:22 +04:00
|
|
|
this->GeneratorDescriptions[name] = generatorDescription;
|
2006-01-02 07:21:05 +03:00
|
|
|
}
|