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. */
|
2007-06-08 15:57:16 +00:00
|
|
|
#ifndef cmExternalMakefileProjectGenerator_h
|
|
|
|
#define cmExternalMakefileProjectGenerator_h
|
|
|
|
|
2016-09-01 18:59:28 +00:00
|
|
|
#include <cmConfigure.h> // IWYU pragma: keep
|
2016-09-01 18:05:48 +00:00
|
|
|
|
2016-09-01 18:59:28 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2007-06-08 15:57:16 +00:00
|
|
|
|
|
|
|
class cmGlobalGenerator;
|
2016-09-01 18:59:28 +00:00
|
|
|
class cmMakefile;
|
2007-06-08 15:57:16 +00:00
|
|
|
|
|
|
|
/** \class cmExternalMakefileProjectGenerator
|
|
|
|
* \brief Base class for generators for "External Makefile based IDE projects".
|
|
|
|
*
|
|
|
|
* cmExternalMakefileProjectGenerator is a base class for generators
|
2012-08-13 17:42:58 +00:00
|
|
|
* for "external makefile based projects", i.e. IDE projects which work
|
2007-06-08 15:57:16 +00:00
|
|
|
* an already existing makefiles.
|
|
|
|
* See cmGlobalKdevelopGenerator as an example.
|
2012-08-13 17:42:58 +00:00
|
|
|
* After the makefiles have been generated by one of the Makefile
|
2007-06-08 15:57:16 +00:00
|
|
|
* generators, the Generate() method is called and this generator
|
2012-08-13 17:42:58 +00:00
|
|
|
* can iterate over the local generators and/or projects to produce the
|
2007-06-08 15:57:16 +00:00
|
|
|
* project files for the IDE.
|
|
|
|
*/
|
|
|
|
class cmExternalMakefileProjectGenerator
|
|
|
|
{
|
|
|
|
public:
|
2007-06-08 16:42:29 +00:00
|
|
|
virtual ~cmExternalMakefileProjectGenerator() {}
|
|
|
|
|
2013-08-29 18:43:54 +00:00
|
|
|
virtual void EnableLanguage(std::vector<std::string> const& languages,
|
2016-05-16 14:34:04 +00:00
|
|
|
cmMakefile*, bool optional);
|
2007-06-08 15:57:16 +00:00
|
|
|
|
|
|
|
///! set the global generator which will generate the makefiles
|
|
|
|
virtual void SetGlobalGenerator(cmGlobalGenerator* generator)
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
|
|
|
this->GlobalGenerator = generator;
|
|
|
|
}
|
2007-06-08 15:57:16 +00:00
|
|
|
|
|
|
|
///! Return the list of global generators supported by this extra generator
|
2012-08-13 17:42:58 +00:00
|
|
|
const std::vector<std::string>& GetSupportedGlobalGenerators() const
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
|
|
|
return this->SupportedGlobalGenerators;
|
|
|
|
}
|
2007-06-08 15:57:16 +00:00
|
|
|
|
|
|
|
/** Create a full name from the given global generator name and the
|
|
|
|
* extra generator name
|
|
|
|
*/
|
2014-02-24 22:36:27 +00:00
|
|
|
static std::string CreateFullGeneratorName(
|
2016-05-16 14:34:04 +00:00
|
|
|
const std::string& globalGenerator, const std::string& extraGenerator);
|
2007-06-08 15:57:16 +00:00
|
|
|
|
|
|
|
///! Generate the project files, the Makefiles have already been generated
|
|
|
|
virtual void Generate() = 0;
|
2016-05-16 14:34:04 +00:00
|
|
|
|
2016-07-20 16:28:39 +00:00
|
|
|
void SetName(const std::string& n) { Name = n; }
|
|
|
|
std::string GetName() const { return Name; }
|
|
|
|
|
2007-06-08 15:57:16 +00:00
|
|
|
protected:
|
|
|
|
///! Contains the names of the global generators support by this generator.
|
|
|
|
std::vector<std::string> SupportedGlobalGenerators;
|
|
|
|
///! the global generator which creates the makefiles
|
|
|
|
const cmGlobalGenerator* GlobalGenerator;
|
2016-07-20 16:28:39 +00:00
|
|
|
|
|
|
|
std::string Name;
|
|
|
|
};
|
|
|
|
|
|
|
|
class cmExternalMakefileProjectGeneratorFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmExternalMakefileProjectGeneratorFactory(const std::string& n,
|
|
|
|
const std::string& doc);
|
|
|
|
virtual ~cmExternalMakefileProjectGeneratorFactory();
|
|
|
|
|
|
|
|
std::string GetName() const;
|
|
|
|
std::string GetDocumentation() const;
|
|
|
|
std::vector<std::string> GetSupportedGlobalGenerators() const;
|
|
|
|
std::vector<std::string> Aliases;
|
|
|
|
|
|
|
|
virtual cmExternalMakefileProjectGenerator*
|
|
|
|
CreateExternalMakefileProjectGenerator() const = 0;
|
|
|
|
|
|
|
|
void AddSupportedGlobalGenerator(const std::string& base);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string Name;
|
|
|
|
std::string Documentation;
|
|
|
|
std::vector<std::string> SupportedGlobalGenerators;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
class cmExternalMakefileProjectGeneratorSimpleFactory
|
|
|
|
: public cmExternalMakefileProjectGeneratorFactory
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmExternalMakefileProjectGeneratorSimpleFactory(const std::string& n,
|
|
|
|
const std::string& doc)
|
|
|
|
: cmExternalMakefileProjectGeneratorFactory(n, doc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
cmExternalMakefileProjectGenerator* CreateExternalMakefileProjectGenerator()
|
2016-09-16 11:08:14 +00:00
|
|
|
const CM_OVERRIDE
|
2016-07-20 16:28:39 +00:00
|
|
|
{
|
|
|
|
T* p = new T;
|
|
|
|
p->SetName(GetName());
|
|
|
|
return p;
|
|
|
|
}
|
2007-06-08 15:57:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|