/src/CMake/Source/cmExternalMakefileProjectGenerator.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <memory> |
8 | | #include <string> |
9 | | #include <vector> |
10 | | |
11 | | class cmGlobalGenerator; |
12 | | class cmMakefile; |
13 | | |
14 | | /** \class cmExternalMakefileProjectGenerator |
15 | | * \brief Base class for generators for "External Makefile based IDE projects". |
16 | | * |
17 | | * cmExternalMakefileProjectGenerator is a base class for generators |
18 | | * for "external makefile based projects", i.e. IDE projects which work |
19 | | * an already existing makefiles. |
20 | | * See cmExtraEclipseCDT4Generator as an example. |
21 | | * After the makefiles have been generated by one of the Makefile |
22 | | * generators, the Generate() method is called and this generator |
23 | | * can iterate over the local generators and/or projects to produce the |
24 | | * project files for the IDE. |
25 | | */ |
26 | | class cmExternalMakefileProjectGenerator |
27 | | { |
28 | | public: |
29 | 0 | virtual ~cmExternalMakefileProjectGenerator() = default; |
30 | | |
31 | | virtual void EnableLanguage(std::vector<std::string> const& languages, |
32 | | cmMakefile*, bool optional); |
33 | | |
34 | | //! set the global generator which will generate the makefiles |
35 | | virtual void SetGlobalGenerator(cmGlobalGenerator* generator) |
36 | 0 | { |
37 | 0 | this->GlobalGenerator = generator; |
38 | 0 | } |
39 | | |
40 | | //! Return the list of global generators supported by this extra generator |
41 | | std::vector<std::string> const& GetSupportedGlobalGenerators() const |
42 | 0 | { |
43 | 0 | return this->SupportedGlobalGenerators; |
44 | 0 | } |
45 | | |
46 | | /** Create a full name from the given global generator name and the |
47 | | * extra generator name |
48 | | */ |
49 | | static std::string CreateFullGeneratorName( |
50 | | std::string const& globalGenerator, std::string const& extraGenerator); |
51 | | |
52 | | //! Generate the project files, the Makefiles have already been generated |
53 | | virtual void Generate() = 0; |
54 | | |
55 | 0 | void SetName(std::string const& n) { this->Name = n; } |
56 | 0 | std::string GetName() const { return this->Name; } |
57 | | |
58 | | virtual bool Open(std::string const& bindir, std::string const& projectName, |
59 | | bool dryRun); |
60 | | |
61 | | protected: |
62 | | //! Contains the names of the global generators support by this generator. |
63 | | std::vector<std::string> SupportedGlobalGenerators; |
64 | | //! the global generator which creates the makefiles |
65 | | cmGlobalGenerator const* GlobalGenerator = nullptr; |
66 | | |
67 | | std::string Name; |
68 | | }; |
69 | | |
70 | | class cmExternalMakefileProjectGeneratorFactory |
71 | | { |
72 | | public: |
73 | | cmExternalMakefileProjectGeneratorFactory(std::string n, std::string doc); |
74 | | virtual ~cmExternalMakefileProjectGeneratorFactory(); |
75 | | |
76 | | std::string GetName() const; |
77 | | std::string GetDocumentation() const; |
78 | | std::vector<std::string> GetSupportedGlobalGenerators() const; |
79 | | std::vector<std::string> Aliases; |
80 | | |
81 | | virtual std::unique_ptr<cmExternalMakefileProjectGenerator> |
82 | | CreateExternalMakefileProjectGenerator() const = 0; |
83 | | |
84 | | void AddSupportedGlobalGenerator(std::string const& base); |
85 | | |
86 | | private: |
87 | | std::string Name; |
88 | | std::string Documentation; |
89 | | std::vector<std::string> SupportedGlobalGenerators; |
90 | | }; |
91 | | |
92 | | template <class T> |
93 | | class cmExternalMakefileProjectGeneratorSimpleFactory |
94 | | : public cmExternalMakefileProjectGeneratorFactory |
95 | | { |
96 | | public: |
97 | | cmExternalMakefileProjectGeneratorSimpleFactory(std::string const& n, |
98 | | std::string const& doc) |
99 | 5 | : cmExternalMakefileProjectGeneratorFactory(n, doc) |
100 | 5 | { |
101 | 5 | } cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraCodeBlocksGenerator>::cmExternalMakefileProjectGeneratorSimpleFactory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 99 | 1 | : cmExternalMakefileProjectGeneratorFactory(n, doc) | 100 | 1 | { | 101 | 1 | } |
cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraCodeLiteGenerator>::cmExternalMakefileProjectGeneratorSimpleFactory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 99 | 1 | : cmExternalMakefileProjectGeneratorFactory(n, doc) | 100 | 1 | { | 101 | 1 | } |
cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraEclipseCDT4Generator>::cmExternalMakefileProjectGeneratorSimpleFactory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 99 | 1 | : cmExternalMakefileProjectGeneratorFactory(n, doc) | 100 | 1 | { | 101 | 1 | } |
cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraKateGenerator>::cmExternalMakefileProjectGeneratorSimpleFactory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 99 | 1 | : cmExternalMakefileProjectGeneratorFactory(n, doc) | 100 | 1 | { | 101 | 1 | } |
cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraSublimeTextGenerator>::cmExternalMakefileProjectGeneratorSimpleFactory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Line | Count | Source | 99 | 1 | : cmExternalMakefileProjectGeneratorFactory(n, doc) | 100 | 1 | { | 101 | 1 | } |
|
102 | | |
103 | | std::unique_ptr<cmExternalMakefileProjectGenerator> |
104 | | CreateExternalMakefileProjectGenerator() const override |
105 | 0 | { |
106 | 0 | std::unique_ptr<cmExternalMakefileProjectGenerator> p(new T); |
107 | 0 | p->SetName(this->GetName()); |
108 | 0 | return p; |
109 | 0 | } Unexecuted instantiation: cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraCodeBlocksGenerator>::CreateExternalMakefileProjectGenerator() const Unexecuted instantiation: cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraCodeLiteGenerator>::CreateExternalMakefileProjectGenerator() const Unexecuted instantiation: cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraEclipseCDT4Generator>::CreateExternalMakefileProjectGenerator() const Unexecuted instantiation: cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraKateGenerator>::CreateExternalMakefileProjectGenerator() const Unexecuted instantiation: cmExternalMakefileProjectGeneratorSimpleFactory<cmExtraSublimeTextGenerator>::CreateExternalMakefileProjectGenerator() const |
110 | | }; |