2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2012-11-19 14:48:33 +00:00
|
|
|
#ifndef cmGlobalGeneratorFactory_h
|
|
|
|
#define cmGlobalGeneratorFactory_h
|
|
|
|
|
2016-09-01 18:05:48 +00:00
|
|
|
#include <cmConfigure.h>
|
|
|
|
|
2016-11-05 20:40:14 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2012-11-19 14:48:33 +00:00
|
|
|
|
|
|
|
class cmGlobalGenerator;
|
2016-11-05 20:40:14 +00:00
|
|
|
class cmake;
|
2012-11-19 14:48:33 +00:00
|
|
|
struct cmDocumentationEntry;
|
|
|
|
|
|
|
|
/** \class cmGlobalGeneratorFactory
|
|
|
|
* \brief Responable for creating cmGlobalGenerator instances
|
|
|
|
*
|
|
|
|
* Subclasses of this class generate instances of cmGlobalGenerator.
|
|
|
|
*/
|
|
|
|
class cmGlobalGeneratorFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~cmGlobalGeneratorFactory() {}
|
|
|
|
|
|
|
|
/** Create a GlobalGenerator */
|
2016-05-16 14:34:04 +00:00
|
|
|
virtual cmGlobalGenerator* CreateGlobalGenerator(const std::string& n,
|
|
|
|
cmake* cm) const = 0;
|
2012-11-19 14:48:33 +00:00
|
|
|
|
|
|
|
/** Get the documentation entry for this factory */
|
|
|
|
virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
|
2012-11-19 14:52:46 +00:00
|
|
|
|
|
|
|
/** Get the names of the current registered generators */
|
|
|
|
virtual void GetGenerators(std::vector<std::string>& names) const = 0;
|
2015-02-15 19:17:54 +00:00
|
|
|
|
|
|
|
/** Determine whether or not this generator supports toolsets */
|
|
|
|
virtual bool SupportsToolset() const = 0;
|
2016-07-11 13:44:37 +00:00
|
|
|
|
|
|
|
/** Determine whether or not this generator supports platforms */
|
|
|
|
virtual bool SupportsPlatform() const = 0;
|
2012-11-19 14:48:33 +00:00
|
|
|
};
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
template <class T>
|
2012-11-19 14:48:33 +00:00
|
|
|
class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Create a GlobalGenerator */
|
2016-06-27 19:25:27 +00:00
|
|
|
cmGlobalGenerator* CreateGlobalGenerator(const std::string& name,
|
|
|
|
cmake* cm) const CM_OVERRIDE
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
2016-06-11 07:49:00 +00:00
|
|
|
if (name != T::GetActualName()) {
|
2016-06-27 20:44:16 +00:00
|
|
|
return CM_NULLPTR;
|
2016-06-11 07:49:00 +00:00
|
|
|
}
|
2016-05-16 14:34:04 +00:00
|
|
|
return new T(cm);
|
|
|
|
}
|
2012-11-19 14:48:33 +00:00
|
|
|
|
|
|
|
/** Get the documentation entry for this factory */
|
2016-06-27 19:25:27 +00:00
|
|
|
void GetDocumentation(cmDocumentationEntry& entry) const CM_OVERRIDE
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
|
|
|
T::GetDocumentation(entry);
|
|
|
|
}
|
2012-11-19 14:52:46 +00:00
|
|
|
|
|
|
|
/** Get the names of the current registered generators */
|
2016-06-27 19:25:27 +00:00
|
|
|
void GetGenerators(std::vector<std::string>& names) const CM_OVERRIDE
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
|
|
|
names.push_back(T::GetActualName());
|
|
|
|
}
|
2015-02-15 19:17:54 +00:00
|
|
|
|
|
|
|
/** Determine whether or not this generator supports toolsets */
|
2016-06-27 19:25:27 +00:00
|
|
|
bool SupportsToolset() const CM_OVERRIDE { return T::SupportsToolset(); }
|
2016-07-11 13:44:37 +00:00
|
|
|
|
|
|
|
/** Determine whether or not this generator supports platforms */
|
|
|
|
bool SupportsPlatform() const CM_OVERRIDE { return T::SupportsPlatform(); }
|
2012-11-19 14:48:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|