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
|
|
|
|
|
2017-08-25 18:39:02 +00:00
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
2016-09-01 18:05:48 +00:00
|
|
|
|
2016-11-05 20:40:14 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2012-11-19 14:48:33 +00:00
|
|
|
|
2020-01-02 16:07:09 +00:00
|
|
|
#include <cm/memory>
|
|
|
|
|
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:
|
2019-01-22 22:44:50 +00:00
|
|
|
virtual ~cmGlobalGeneratorFactory() = default;
|
2012-11-19 14:48:33 +00:00
|
|
|
|
|
|
|
/** Create a GlobalGenerator */
|
2020-01-02 16:07:09 +00:00
|
|
|
virtual std::unique_ptr<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 */
|
2019-01-18 16:08:45 +00:00
|
|
|
virtual std::vector<std::string> GetGeneratorNames() const = 0;
|
|
|
|
virtual std::vector<std::string> GetGeneratorNamesWithPlatform() 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;
|
2019-01-18 15:13:55 +00:00
|
|
|
|
|
|
|
/** Get the list of supported platforms name for this generator */
|
|
|
|
virtual std::vector<std::string> GetKnownPlatforms() const = 0;
|
2019-01-18 16:45:33 +00:00
|
|
|
|
|
|
|
/** If the generator suports platforms, get its default. */
|
|
|
|
virtual std::string GetDefaultPlatformName() 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 */
|
2020-01-02 16:07:09 +00:00
|
|
|
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
|
|
|
const std::string& name, cmake* cm) const override
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
2016-06-11 07:49:00 +00:00
|
|
|
if (name != T::GetActualName()) {
|
2020-01-02 16:07:09 +00:00
|
|
|
return std::unique_ptr<cmGlobalGenerator>();
|
2016-06-11 07:49:00 +00:00
|
|
|
}
|
2020-01-02 16:07:09 +00:00
|
|
|
return std::unique_ptr<cmGlobalGenerator>(cm::make_unique<T>(cm));
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2012-11-19 14:48:33 +00:00
|
|
|
|
|
|
|
/** Get the documentation entry for this factory */
|
2017-09-15 13:56:26 +00:00
|
|
|
void GetDocumentation(cmDocumentationEntry& entry) const 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 */
|
2019-01-18 16:08:45 +00:00
|
|
|
std::vector<std::string> GetGeneratorNames() const override
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
2019-01-18 16:08:45 +00:00
|
|
|
std::vector<std::string> names;
|
2016-05-16 14:34:04 +00:00
|
|
|
names.push_back(T::GetActualName());
|
2019-01-18 16:08:45 +00:00
|
|
|
return names;
|
|
|
|
}
|
|
|
|
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
|
|
|
|
{
|
|
|
|
return std::vector<std::string>();
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2015-02-15 19:17:54 +00:00
|
|
|
|
|
|
|
/** Determine whether or not this generator supports toolsets */
|
2017-09-15 13:56:26 +00:00
|
|
|
bool SupportsToolset() const override { return T::SupportsToolset(); }
|
2016-07-11 13:44:37 +00:00
|
|
|
|
|
|
|
/** Determine whether or not this generator supports platforms */
|
2017-09-15 13:56:26 +00:00
|
|
|
bool SupportsPlatform() const override { return T::SupportsPlatform(); }
|
2019-01-18 15:13:55 +00:00
|
|
|
|
|
|
|
/** Get the list of supported platforms name for this generator */
|
|
|
|
std::vector<std::string> GetKnownPlatforms() const override
|
|
|
|
{
|
|
|
|
// default is no platform supported
|
|
|
|
return std::vector<std::string>();
|
|
|
|
}
|
2019-01-18 16:45:33 +00:00
|
|
|
|
|
|
|
std::string GetDefaultPlatformName() const override { return std::string(); }
|
2012-11-19 14:48:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|