/src/CMake/Source/cmRulePlaceholderExpander.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 | | |
4 | | #pragma once |
5 | | |
6 | | #include "cmConfigure.h" // IWYU pragma: keep |
7 | | |
8 | | #include <map> |
9 | | #include <string> |
10 | | |
11 | | #include "cmGeneratorOptions.h" |
12 | | #include "cmPlaceholderExpander.h" |
13 | | |
14 | | class cmOutputConverter; |
15 | | |
16 | | class cmRulePlaceholderExpander : public cmPlaceholderExpander |
17 | | { |
18 | | public: |
19 | | cmRulePlaceholderExpander( |
20 | | cmBuildStep buildStep, std::map<std::string, std::string> compilers, |
21 | | std::map<std::string, std::string> variableMappings, |
22 | | std::string compilerSysroot, std::string linkerSysroot); |
23 | | |
24 | | void SetTargetImpLib(std::string const& targetImpLib) |
25 | 0 | { |
26 | 0 | this->TargetImpLib = targetImpLib; |
27 | 0 | } |
28 | | |
29 | | // Create a struct to hold the variables passed into |
30 | | // ExpandRuleVariables |
31 | | struct RuleVariables |
32 | | { |
33 | | char const* CMTargetName = nullptr; |
34 | | char const* CMTargetType = nullptr; |
35 | | char const* TargetPDB = nullptr; |
36 | | char const* TargetCompilePDB = nullptr; |
37 | | char const* TargetVersionMajor = nullptr; |
38 | | char const* TargetVersionMinor = nullptr; |
39 | | char const* Language = nullptr; |
40 | | char const* AIXExports = nullptr; |
41 | | char const* Objects = nullptr; |
42 | | char const* Target = nullptr; |
43 | | char const* LinkLibraries = nullptr; |
44 | | char const* Source = nullptr; |
45 | | char const* AssemblySource = nullptr; |
46 | | char const* PreprocessedSource = nullptr; |
47 | | char const* DynDepFile = nullptr; |
48 | | char const* Output = nullptr; |
49 | | char const* Object = nullptr; |
50 | | char const* TargetSupportDir = nullptr; |
51 | | char const* ObjectDir = nullptr; |
52 | | char const* ObjectFileDir = nullptr; |
53 | | char const* Flags = nullptr; |
54 | | char const* ObjectsQuoted = nullptr; |
55 | | char const* SONameFlag = nullptr; |
56 | | char const* TargetSOName = nullptr; |
57 | | char const* TargetInstallNameDir = nullptr; |
58 | | char const* Linker = nullptr; |
59 | | char const* LinkFlags = nullptr; |
60 | | char const* Manifests = nullptr; |
61 | | char const* LanguageCompileFlags = nullptr; |
62 | | char const* Defines = nullptr; |
63 | | char const* Includes = nullptr; |
64 | | char const* DependencyFile = nullptr; |
65 | | char const* DependencyTarget = nullptr; |
66 | | char const* FilterPrefix = nullptr; |
67 | | char const* SwiftLibraryName = nullptr; |
68 | | char const* SwiftModule = nullptr; |
69 | | char const* SwiftModuleName = nullptr; |
70 | | char const* SwiftOutputFileMapOption = nullptr; |
71 | | char const* SwiftSources = nullptr; |
72 | | char const* RustSources = nullptr; |
73 | | char const* RustObjectDeps = nullptr; |
74 | | char const* ISPCHeader = nullptr; |
75 | | char const* CudaCompileMode = nullptr; |
76 | | char const* Fatbinary = nullptr; |
77 | | char const* RegisterFile = nullptr; |
78 | | char const* Launcher = nullptr; |
79 | | char const* Role = nullptr; |
80 | | char const* Config = nullptr; |
81 | | }; |
82 | | |
83 | | // Expand rule variables in CMake of the type found in language rules |
84 | | void ExpandRuleVariables(cmOutputConverter* outputConverter, |
85 | | std::string& string, |
86 | | RuleVariables const& replaceValues); |
87 | | |
88 | | private: |
89 | | std::string ExpandVariable(std::string const& variable) override; |
90 | | |
91 | | std::string TargetImpLib; |
92 | | |
93 | | cmBuildStep BuildStep = cmBuildStep::Compile; |
94 | | std::map<std::string, std::string> Compilers; |
95 | | std::map<std::string, std::string> VariableMappings; |
96 | | std::string CompilerSysroot; |
97 | | std::string LinkerSysroot; |
98 | | |
99 | | cmOutputConverter* OutputConverter = nullptr; |
100 | | RuleVariables const* ReplaceValues = nullptr; |
101 | | }; |