cmake/Source/cmRulePlaceholderExpander.h

91 lines
3.0 KiB
C
Raw Normal View History

2017-04-14 19:02:05 +02:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2017-04-14 19:02:05 +02:00
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2017-04-14 19:02:05 +02:00
#include <map>
#include <string>
class cmOutputConverter;
class cmRulePlaceholderExpander
{
public:
cmRulePlaceholderExpander(
2019-11-11 23:01:05 +01:00
std::map<std::string, std::string> compilers,
std::map<std::string, std::string> variableMappings,
std::string compilerSysroot, std::string linkerSysroot);
2017-04-14 19:02:05 +02:00
void SetTargetImpLib(std::string const& targetImpLib)
{
this->TargetImpLib = targetImpLib;
}
2018-08-09 18:06:22 +02:00
// Create a struct to hold the variables passed into
2017-04-14 19:02:05 +02:00
// ExpandRuleVariables
struct RuleVariables
{
2021-09-14 00:13:48 +02:00
const char* CMTargetName = nullptr;
const char* CMTargetType = nullptr;
const char* TargetPDB = nullptr;
const char* TargetCompilePDB = nullptr;
const char* TargetVersionMajor = nullptr;
const char* TargetVersionMinor = nullptr;
const char* Language = nullptr;
const char* AIXExports = nullptr;
const char* Objects = nullptr;
const char* Target = nullptr;
const char* LinkLibraries = nullptr;
const char* Source = nullptr;
const char* AssemblySource = nullptr;
const char* PreprocessedSource = nullptr;
const char* DynDepFile = nullptr;
const char* Output = nullptr;
const char* Object = nullptr;
const char* ObjectDir = nullptr;
const char* ObjectFileDir = nullptr;
const char* Flags = nullptr;
const char* ObjectsQuoted = nullptr;
const char* SONameFlag = nullptr;
const char* TargetSOName = nullptr;
const char* TargetInstallNameDir = nullptr;
const char* LinkFlags = nullptr;
const char* Manifests = nullptr;
const char* LanguageCompileFlags = nullptr;
const char* Defines = nullptr;
const char* Includes = nullptr;
const char* DependencyFile = nullptr;
const char* DependencyTarget = nullptr;
const char* FilterPrefix = nullptr;
const char* SwiftLibraryName = nullptr;
const char* SwiftModule = nullptr;
const char* SwiftModuleName = nullptr;
const char* SwiftOutputFileMap = nullptr;
const char* SwiftSources = nullptr;
const char* ISPCHeader = nullptr;
const char* Fatbinary = nullptr;
const char* RegisterFile = nullptr;
const char* Launcher = nullptr;
2017-04-14 19:02:05 +02:00
};
// Expand rule variables in CMake of the type found in language rules
void ExpandRuleVariables(cmOutputConverter* outputConverter,
std::string& string,
const RuleVariables& replaceValues);
// Expand rule variables in a single string
std::string ExpandRuleVariable(cmOutputConverter* outputConverter,
std::string const& variable,
const RuleVariables& replaceValues);
private:
std::string TargetImpLib;
std::map<std::string, std::string> Compilers;
std::map<std::string, std::string> VariableMappings;
std::string CompilerSysroot;
2017-07-20 19:35:53 +02:00
std::string LinkerSysroot;
2017-04-14 19:02:05 +02:00
};