/src/CMake/Source/cmCustomCommandGenerator.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 <functional> |
8 | | #include <set> |
9 | | #include <string> |
10 | | #include <utility> |
11 | | #include <vector> |
12 | | |
13 | | #include <cm/optional> |
14 | | |
15 | | #include "cmCustomCommandLines.h" |
16 | | #include "cmListFileCache.h" |
17 | | |
18 | | class cmCustomCommand; |
19 | | class cmLocalGenerator; |
20 | | |
21 | | class cmCustomCommandGenerator |
22 | | { |
23 | | std::string GetInternalDepfileName(std::string const&, |
24 | | std::string const&) const; |
25 | | |
26 | | cmCustomCommand const* CC; |
27 | | std::string OutputConfig; |
28 | | std::string CommandConfig; |
29 | | std::string Target; |
30 | | cmLocalGenerator* LG; |
31 | | bool OldStyle; |
32 | | bool MakeVars; |
33 | | cmCustomCommandLines CommandLines; |
34 | | std::vector<std::vector<std::string>> EmulatorsWithArguments; |
35 | | std::vector<std::string> Outputs; |
36 | | std::vector<std::string> Byproducts; |
37 | | std::vector<std::string> Depends; |
38 | | std::string WorkingDirectory; |
39 | | std::set<BT<std::pair<std::string, bool>>> Utilities; |
40 | | std::function<std::string(std::string const&, std::string const&)> |
41 | | ComputeInternalDepfile; |
42 | | |
43 | | void FillEmulatorsWithArguments(); |
44 | | std::vector<std::string> GetCrossCompilingEmulator(unsigned int c) const; |
45 | | char const* GetArgv0Location(unsigned int c) const; |
46 | | |
47 | | public: |
48 | | cmCustomCommandGenerator( |
49 | | cmCustomCommand const& cc, std::string config, cmLocalGenerator* lg, |
50 | | bool transformDepfile = true, cm::optional<std::string> crossConfig = {}, |
51 | | std::function<std::string(std::string const&, std::string const&)> |
52 | | computeInternalDepfile = {}); |
53 | | cmCustomCommandGenerator(cmCustomCommandGenerator const&) = delete; |
54 | 0 | cmCustomCommandGenerator(cmCustomCommandGenerator&&) = default; |
55 | | cmCustomCommandGenerator& operator=(cmCustomCommandGenerator const&) = |
56 | | delete; |
57 | 0 | cmCustomCommandGenerator& operator=(cmCustomCommandGenerator&&) = default; |
58 | 0 | cmCustomCommand const& GetCC() const { return *(this->CC); } |
59 | | unsigned int GetNumberOfCommands() const; |
60 | | std::string GetCommand(unsigned int c) const; |
61 | | void AppendArguments(unsigned int c, std::string& cmd) const; |
62 | | cm::optional<std::string> GetComment() const; |
63 | | std::string GetWorkingDirectory() const; |
64 | | std::vector<std::string> const& GetOutputs() const; |
65 | | std::vector<std::string> const& GetByproducts() const; |
66 | | std::vector<std::string> const& GetDepends() const; |
67 | | std::set<BT<std::pair<std::string, bool>>> const& GetUtilities() const; |
68 | | bool HasOnlyEmptyCommandLines() const; |
69 | | std::string GetDepfile() const; |
70 | | std::string GetFullDepfile() const; |
71 | | std::string GetInternalDepfile() const; |
72 | | |
73 | 0 | std::string const& GetOutputConfig() const { return this->OutputConfig; } |
74 | 0 | std::string const& GetCommandConfig() const { return this->CommandConfig; } |
75 | | }; |