mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
GenEx: Consolidate target property evaluation context arguments
This commit is contained in:
@@ -110,12 +110,12 @@ TdiSourceInfo CollationInformationSources(cmGeneratorTarget const* gt,
|
||||
auto fileEntries = file_set->CompileFileEntries();
|
||||
auto directoryEntries = file_set->CompileDirectoryEntries();
|
||||
|
||||
auto directories = file_set->EvaluateDirectoryEntries(
|
||||
directoryEntries, context.LG, context.Config, gt);
|
||||
auto directories =
|
||||
file_set->EvaluateDirectoryEntries(directoryEntries, context, gt);
|
||||
std::map<std::string, std::vector<std::string>> files_per_dirs;
|
||||
for (auto const& entry : fileEntries) {
|
||||
file_set->EvaluateFileEntry(directories, files_per_dirs, entry,
|
||||
context.LG, context.Config, gt);
|
||||
file_set->EvaluateFileEntry(directories, files_per_dirs, entry, context,
|
||||
gt);
|
||||
}
|
||||
|
||||
Json::Value fs_dest = Json::nullValue;
|
||||
|
||||
@@ -21,14 +21,12 @@ EvaluatedTargetPropertyEntry::EvaluatedTargetPropertyEntry(
|
||||
}
|
||||
|
||||
EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget::TargetPropertyEntry& entry)
|
||||
{
|
||||
EvaluatedTargetPropertyEntry ee(entry.LinkImplItem, entry.GetBacktrace());
|
||||
cmExpandList(entry.Evaluate(thisTarget->GetLocalGenerator(), config,
|
||||
thisTarget, dagChecker, lang),
|
||||
ee.Values);
|
||||
cmExpandList(entry.Evaluate(context, thisTarget, dagChecker), ee.Values);
|
||||
if (entry.GetHadContextSensitiveCondition()) {
|
||||
ee.ContextDependent = true;
|
||||
}
|
||||
@@ -36,24 +34,24 @@ EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
|
||||
}
|
||||
|
||||
EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>> const&
|
||||
in)
|
||||
{
|
||||
EvaluatedTargetPropertyEntries out;
|
||||
out.Entries.reserve(in.size());
|
||||
for (auto const& entry : in) {
|
||||
out.Entries.emplace_back(EvaluateTargetPropertyEntry(
|
||||
thisTarget, config, lang, dagChecker, *entry));
|
||||
out.Entries.emplace_back(
|
||||
EvaluateTargetPropertyEntry(thisTarget, context, dagChecker, *entry));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
namespace {
|
||||
void addInterfaceEntry(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config, std::string const& prop,
|
||||
std::string const& lang,
|
||||
std::string const& prop,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
cmGeneratorTarget::UseTo usage,
|
||||
@@ -65,9 +63,8 @@ void addInterfaceEntry(cmGeneratorTarget const* headTarget,
|
||||
// Pretend $<TARGET_PROPERTY:lib.Target,prop> appeared in our
|
||||
// caller's property and hand-evaluate it as if it were compiled.
|
||||
// Create a context as cmCompiledGeneratorExpression::Evaluate does.
|
||||
cm::GenEx::Evaluation eval(
|
||||
cm::GenEx::Context(headTarget->GetLocalGenerator(), config, lang),
|
||||
false, headTarget, headTarget, true, lib.Backtrace);
|
||||
cm::GenEx::Evaluation eval(context, false, headTarget, headTarget, true,
|
||||
lib.Backtrace);
|
||||
cmExpandList(
|
||||
lib.Target->EvaluateInterfaceProperty(prop, &eval, dagChecker, usage),
|
||||
ee.Values);
|
||||
@@ -79,8 +76,8 @@ void addInterfaceEntry(cmGeneratorTarget const* headTarget,
|
||||
}
|
||||
|
||||
void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config, std::string const& prop,
|
||||
std::string const& lang,
|
||||
std::string const& prop,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
IncludeRuntimeInterface searchRuntime,
|
||||
@@ -88,25 +85,26 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
|
||||
{
|
||||
if (searchRuntime == IncludeRuntimeInterface::Yes) {
|
||||
if (cmLinkImplementation const* impl =
|
||||
headTarget->GetLinkImplementation(config, usage)) {
|
||||
headTarget->GetLinkImplementation(context.Config, usage)) {
|
||||
entries.HadContextSensitiveCondition =
|
||||
impl->HadContextSensitiveCondition;
|
||||
|
||||
auto runtimeLibIt = impl->LanguageRuntimeLibraries.find(lang);
|
||||
auto runtimeLibIt =
|
||||
impl->LanguageRuntimeLibraries.find(context.Language);
|
||||
if (runtimeLibIt != impl->LanguageRuntimeLibraries.end()) {
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
addInterfaceEntry(headTarget, prop, context, dagChecker, entries,
|
||||
usage, runtimeLibIt->second);
|
||||
}
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
usage, impl->Libraries);
|
||||
addInterfaceEntry(headTarget, prop, context, dagChecker, entries, usage,
|
||||
impl->Libraries);
|
||||
}
|
||||
} else {
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
headTarget->GetLinkImplementationLibraries(config, usage)) {
|
||||
headTarget->GetLinkImplementationLibraries(context.Config, usage)) {
|
||||
entries.HadContextSensitiveCondition =
|
||||
impl->HadContextSensitiveCondition;
|
||||
addInterfaceEntry(headTarget, config, prop, lang, dagChecker, entries,
|
||||
usage, impl->Libraries);
|
||||
addInterfaceEntry(headTarget, prop, context, dagChecker, entries, usage,
|
||||
impl->Libraries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmListFileCache.h"
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmLinkImplItem;
|
||||
struct cmGeneratorExpressionDAGChecker;
|
||||
|
||||
@@ -34,8 +40,8 @@ struct EvaluatedTargetPropertyEntry
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget::TargetPropertyEntry& entry);
|
||||
|
||||
struct EvaluatedTargetPropertyEntries
|
||||
@@ -45,8 +51,8 @@ struct EvaluatedTargetPropertyEntries
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries(
|
||||
cmGeneratorTarget const* thisTarget, std::string const& config,
|
||||
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* thisTarget, cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>> const&
|
||||
in);
|
||||
|
||||
@@ -71,8 +77,8 @@ enum class IncludeRuntimeInterface
|
||||
};
|
||||
|
||||
void AddInterfaceEntries(
|
||||
cmGeneratorTarget const* headTarget, std::string const& config,
|
||||
std::string const& prop, std::string const& lang,
|
||||
cmGeneratorTarget const* headTarget, std::string const& prop,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries,
|
||||
IncludeRuntimeInterface searchRuntime,
|
||||
|
||||
@@ -178,8 +178,8 @@ std::string cmExportBuildCMakeConfigGenerator::GetFileSetDirectories(
|
||||
|
||||
for (auto const& config : configs) {
|
||||
cm::GenEx::Context context(gte->LocalGenerator, config);
|
||||
auto directories = fileSet->EvaluateDirectoryEntries(
|
||||
directoryEntries, context.LG, context.Config, gte);
|
||||
auto directories =
|
||||
fileSet->EvaluateDirectoryEntries(directoryEntries, context, gte);
|
||||
|
||||
bool const contextSensitive =
|
||||
std::any_of(directoryEntries.begin(), directoryEntries.end(),
|
||||
@@ -229,13 +229,12 @@ std::string cmExportBuildCMakeConfigGenerator::GetFileSetFiles(
|
||||
|
||||
for (auto const& config : configs) {
|
||||
cm::GenEx::Context context(gte->LocalGenerator, config);
|
||||
auto directories = fileSet->EvaluateDirectoryEntries(
|
||||
directoryEntries, context.LG, context.Config, gte);
|
||||
auto directories =
|
||||
fileSet->EvaluateDirectoryEntries(directoryEntries, context, gte);
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files;
|
||||
for (auto const& entry : fileEntries) {
|
||||
fileSet->EvaluateFileEntry(directories, files, entry, context.LG,
|
||||
context.Config, gte);
|
||||
fileSet->EvaluateFileEntry(directories, files, entry, context, gte);
|
||||
}
|
||||
|
||||
bool const contextSensitive =
|
||||
|
||||
@@ -341,13 +341,12 @@ std::string cmExportInstallCMakeConfigGenerator::GetFileSetFiles(
|
||||
|
||||
for (auto const& config : configs) {
|
||||
cm::GenEx::Context context(gte->LocalGenerator, config);
|
||||
auto directories = fileSet->EvaluateDirectoryEntries(
|
||||
directoryEntries, context.LG, context.Config, gte);
|
||||
auto directories =
|
||||
fileSet->EvaluateDirectoryEntries(directoryEntries, context, gte);
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files;
|
||||
for (auto const& entry : fileEntries) {
|
||||
fileSet->EvaluateFileEntry(directories, files, entry, context.LG,
|
||||
context.Config, gte);
|
||||
fileSet->EvaluateFileEntry(directories, files, entry, context, gte);
|
||||
}
|
||||
auto unescapedDest = destCge->Evaluate(gte->LocalGenerator, config, gte);
|
||||
auto dest =
|
||||
|
||||
@@ -100,8 +100,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
|
||||
|
||||
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
|
||||
|
||||
std::string result = cge->Evaluate(context.LG, context.Config, &gDummyHead,
|
||||
&dagChecker, tgt, context.Language);
|
||||
std::string result = cge->Evaluate(context, &dagChecker, &gDummyHead, tgt);
|
||||
|
||||
std::set<cmGeneratorTarget const*> const& allTargets =
|
||||
cge->GetAllTargetsSeen();
|
||||
|
||||
@@ -1084,14 +1084,12 @@ Json::Value DirectoryObject::DumpInstaller(cmInstallGenerator* gen)
|
||||
cm::GenEx::Context context(target->LocalGenerator, this->Config);
|
||||
|
||||
auto dirCges = fileSet->CompileDirectoryEntries();
|
||||
auto dirs = fileSet->EvaluateDirectoryEntries(dirCges, context.LG,
|
||||
context.Config, target);
|
||||
auto dirs = fileSet->EvaluateDirectoryEntries(dirCges, context, target);
|
||||
|
||||
auto entryCges = fileSet->CompileFileEntries();
|
||||
std::map<std::string, std::vector<std::string>> entries;
|
||||
for (auto const& entryCge : entryCges) {
|
||||
fileSet->EvaluateFileEntry(dirs, entries, entryCge, context.LG,
|
||||
context.Config, target);
|
||||
fileSet->EvaluateFileEntry(dirs, entries, entryCge, context, target);
|
||||
}
|
||||
|
||||
Json::Value files = Json::arrayValue;
|
||||
@@ -1615,15 +1613,15 @@ std::pair<Json::Value, Target::FileSetDatabase> Target::DumpFileSets()
|
||||
auto fileEntries = fs->CompileFileEntries();
|
||||
auto directoryEntries = fs->CompileDirectoryEntries();
|
||||
|
||||
auto directories = fs->EvaluateDirectoryEntries(
|
||||
directoryEntries, context.LG, context.Config, this->GT);
|
||||
auto directories =
|
||||
fs->EvaluateDirectoryEntries(directoryEntries, context, this->GT);
|
||||
|
||||
fsJson.append(this->DumpFileSet(fs, directories));
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files_per_dirs;
|
||||
for (auto const& entry : fileEntries) {
|
||||
fs->EvaluateFileEntry(directories, files_per_dirs, entry, context.LG,
|
||||
context.Config, this->GT);
|
||||
fs->EvaluateFileEntry(directories, files_per_dirs, entry, context,
|
||||
this->GT);
|
||||
}
|
||||
|
||||
for (auto const& files_per_dir : files_per_dirs) {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "cmsys/RegularExpression.hxx"
|
||||
|
||||
#include "cmGenExContext.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
@@ -156,8 +157,7 @@ cmFileSet::CompileDirectoryEntries() const
|
||||
|
||||
std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
|
||||
std::vector<std::unique_ptr<cmCompiledGeneratorExpression>> const& cges,
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* target,
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const
|
||||
{
|
||||
struct DirCacheEntry
|
||||
@@ -169,11 +169,11 @@ std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
|
||||
std::unordered_map<std::string, DirCacheEntry> dirCache;
|
||||
std::vector<std::string> result;
|
||||
for (auto const& cge : cges) {
|
||||
auto entry = cge->Evaluate(lg, config, target, dagChecker);
|
||||
auto entry = cge->Evaluate(context, dagChecker, target);
|
||||
cmList dirs{ entry };
|
||||
for (std::string dir : dirs) {
|
||||
if (!cmSystemTools::FileIsFullPath(dir)) {
|
||||
dir = cmStrCat(lg->GetCurrentSourceDirectory(), '/', dir);
|
||||
dir = cmStrCat(context.LG->GetCurrentSourceDirectory(), '/', dir);
|
||||
}
|
||||
|
||||
auto dirCacheResult = dirCache.emplace(dir, DirCacheEntry());
|
||||
@@ -198,7 +198,7 @@ std::vector<std::string> cmFileSet::EvaluateDirectoryEntries(
|
||||
priorDirCacheEntry.collapsedDir) ||
|
||||
cmSystemTools::IsSubDirectory(priorDirCacheEntry.collapsedDir,
|
||||
dirCacheEntry.collapsedDir))) {
|
||||
lg->GetCMakeInstance()->IssueMessage(
|
||||
context.LG->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::FATAL_ERROR,
|
||||
cmStrCat(
|
||||
"Base directories in file set cannot be subdirectories of each "
|
||||
@@ -218,14 +218,13 @@ void cmFileSet::EvaluateFileEntry(
|
||||
std::vector<std::string> const& dirs,
|
||||
std::map<std::string, std::vector<std::string>>& filesPerDir,
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> const& cge,
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* target,
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const
|
||||
{
|
||||
auto files = cge->Evaluate(lg, config, target, dagChecker);
|
||||
auto files = cge->Evaluate(context, dagChecker, target);
|
||||
for (std::string file : cmList{ files }) {
|
||||
if (!cmSystemTools::FileIsFullPath(file)) {
|
||||
file = cmStrCat(lg->GetCurrentSourceDirectory(), '/', file);
|
||||
file = cmStrCat(context.LG->GetCurrentSourceDirectory(), '/', file);
|
||||
}
|
||||
auto collapsedFile = cmSystemTools::CollapseFullPath(file);
|
||||
bool found = false;
|
||||
@@ -246,8 +245,8 @@ void cmFileSet::EvaluateFileEntry(
|
||||
for (auto const& dir : dirs) {
|
||||
e << "\n " << dir;
|
||||
}
|
||||
lg->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str(),
|
||||
cge->GetBacktrace());
|
||||
context.LG->GetCMakeInstance()->IssueMessage(
|
||||
MessageType::FATAL_ERROR, e.str(), cge->GetBacktrace());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,15 @@
|
||||
|
||||
#include "cmListFileCache.h"
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmCompiledGeneratorExpression;
|
||||
struct cmGeneratorExpressionDAGChecker;
|
||||
class cmGeneratorTarget;
|
||||
class cmLocalGenerator;
|
||||
class cmMakefile;
|
||||
class cmake;
|
||||
|
||||
@@ -67,16 +72,14 @@ public:
|
||||
|
||||
std::vector<std::string> EvaluateDirectoryEntries(
|
||||
std::vector<std::unique_ptr<cmCompiledGeneratorExpression>> const& cges,
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* target,
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const;
|
||||
|
||||
void EvaluateFileEntry(
|
||||
std::vector<std::string> const& dirs,
|
||||
std::map<std::string, std::vector<std::string>>& filesPerDir,
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> const& cge,
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* target,
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* target,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker = nullptr) const;
|
||||
|
||||
static bool IsValidName(std::string const& name);
|
||||
|
||||
@@ -55,22 +55,29 @@ std::string cmGeneratorExpression::Evaluate(
|
||||
"genex_compile_eval", input);
|
||||
#endif
|
||||
|
||||
cm::GenEx::Context context(lg, config, language);
|
||||
cmCompiledGeneratorExpression cge(*lg->GetCMakeInstance(),
|
||||
cmListFileBacktrace(), std::move(input));
|
||||
return cge.Evaluate(lg, config, headTarget, dagChecker, currentTarget,
|
||||
language);
|
||||
return cge.Evaluate(context, dagChecker, headTarget, currentTarget);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
std::string const& cmCompiledGeneratorExpression::Evaluate(
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* currentTarget, std::string const& language) const
|
||||
cmGeneratorTarget const* headTarget) const
|
||||
{
|
||||
cm::GenEx::Evaluation eval(cm::GenEx::Context(lg, config, language),
|
||||
this->Quiet, headTarget,
|
||||
cm::GenEx::Context context(lg, config);
|
||||
return this->Evaluate(context, nullptr, headTarget);
|
||||
}
|
||||
|
||||
std::string const& cmCompiledGeneratorExpression::Evaluate(
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorTarget const* currentTarget) const
|
||||
{
|
||||
cm::GenEx::Evaluation eval(context, this->Quiet, headTarget,
|
||||
currentTarget ? currentTarget : headTarget,
|
||||
this->EvaluateForBuildsystem, this->Backtrace);
|
||||
|
||||
@@ -466,7 +473,6 @@ std::string const& cmGeneratorExpressionInterpreter::Evaluate(
|
||||
context,
|
||||
};
|
||||
|
||||
return this->CompiledGeneratorExpression->Evaluate(
|
||||
context.LG, context.Config, this->HeadTarget, &dagChecker, nullptr,
|
||||
context.Language);
|
||||
return this->CompiledGeneratorExpression->Evaluate(context, &dagChecker,
|
||||
this->HeadTarget);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
#include "cmListFileCache.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmake;
|
||||
class cmCompiledGeneratorExpression;
|
||||
class cmGeneratorTarget;
|
||||
@@ -104,10 +110,13 @@ public:
|
||||
|
||||
std::string const& Evaluate(
|
||||
cmLocalGenerator const* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget = nullptr) const;
|
||||
|
||||
std::string const& Evaluate(
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmGeneratorTarget const* headTarget = nullptr,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker = nullptr,
|
||||
cmGeneratorTarget const* currentTarget = nullptr,
|
||||
std::string const& language = std::string()) const;
|
||||
cmGeneratorTarget const* currentTarget = nullptr) const;
|
||||
|
||||
/** Get set of targets found during evaluations. */
|
||||
std::set<cmGeneratorTarget*> const& GetTargets() const
|
||||
|
||||
@@ -44,8 +44,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(
|
||||
std::string rawCondition = this->Condition->GetInput();
|
||||
cmGeneratorTarget* target = lg->FindGeneratorTargetToUse(this->Target);
|
||||
if (!rawCondition.empty()) {
|
||||
std::string condResult = this->Condition->Evaluate(
|
||||
context.LG, context.Config, target, nullptr, nullptr, context.Language);
|
||||
std::string condResult =
|
||||
this->Condition->Evaluate(context, nullptr, target);
|
||||
if (condResult == "0") {
|
||||
return;
|
||||
}
|
||||
@@ -60,10 +60,9 @@ void cmGeneratorExpressionEvaluationFile::Generate(
|
||||
}
|
||||
}
|
||||
|
||||
std::string const outputFileName = this->GetOutputFileName(
|
||||
context.LG, target, context.Config, context.Language);
|
||||
std::string const& outputContent = inputExpression->Evaluate(
|
||||
context.LG, context.Config, target, nullptr, nullptr, context.Language);
|
||||
std::string const outputFileName = this->GetOutputFileName(context, target);
|
||||
std::string const& outputContent =
|
||||
inputExpression->Evaluate(context, nullptr, target);
|
||||
|
||||
auto it = outputFiles.find(outputFileName);
|
||||
|
||||
@@ -125,8 +124,9 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
|
||||
cmGeneratorTarget* target = lg->FindGeneratorTargetToUse(this->Target);
|
||||
gg->GetEnabledLanguages(enabledLanguages);
|
||||
|
||||
for (std::string const& le : enabledLanguages) {
|
||||
std::string const name = this->GetOutputFileName(lg, target, config, le);
|
||||
for (std::string const& lang : enabledLanguages) {
|
||||
cm::GenEx::Context context(lg, config, lang);
|
||||
std::string const name = this->GetOutputFileName(context, target);
|
||||
cmSourceFile* sf = lg->GetMakefile()->GetOrCreateGeneratedSource(name);
|
||||
|
||||
// Tell the build system generators that there is no build rule
|
||||
@@ -206,12 +206,10 @@ std::string cmGeneratorExpressionEvaluationFile::GetInputFileName(
|
||||
}
|
||||
|
||||
std::string cmGeneratorExpressionEvaluationFile::GetOutputFileName(
|
||||
cmLocalGenerator const* lg, cmGeneratorTarget* target,
|
||||
std::string const& config, std::string const& lang)
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget* target)
|
||||
{
|
||||
cm::GenEx::Context context(lg, config, lang);
|
||||
std::string outputFileName = this->OutputFileExpr->Evaluate(
|
||||
context.LG, context.Config, target, nullptr, nullptr, context.Language);
|
||||
std::string outputFileName =
|
||||
this->OutputFileExpr->Evaluate(context, nullptr, target);
|
||||
|
||||
if (cmSystemTools::FileIsFullPath(outputFileName)) {
|
||||
outputFileName = cmSystemTools::CollapseFullPath(outputFileName);
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmPolicies.h"
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmGeneratorTarget;
|
||||
class cmLocalGenerator;
|
||||
|
||||
@@ -40,10 +46,8 @@ private:
|
||||
std::map<std::string, std::string>& outputFiles, mode_t perm);
|
||||
|
||||
std::string GetInputFileName(cmLocalGenerator const* lg);
|
||||
std::string GetOutputFileName(cmLocalGenerator const* lg,
|
||||
cmGeneratorTarget* target,
|
||||
std::string const& config,
|
||||
std::string const& lang);
|
||||
std::string GetOutputFileName(cm::GenEx::Context const& context,
|
||||
cmGeneratorTarget* target);
|
||||
enum PathRole
|
||||
{
|
||||
PathForInput,
|
||||
|
||||
@@ -64,8 +64,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
|
||||
cge->SetEvaluateForBuildsystem(eval->EvaluateForBuildsystem);
|
||||
cge->SetQuiet(eval->Quiet);
|
||||
std::string result =
|
||||
cge->Evaluate(eval->Context.LG, eval->Context.Config, headTarget,
|
||||
dagChecker, currentTarget, eval->Context.Language);
|
||||
cge->Evaluate(eval->Context, dagChecker, headTarget, currentTarget);
|
||||
if (cge->GetHadContextSensitiveCondition()) {
|
||||
eval->HadContextSensitiveCondition = true;
|
||||
}
|
||||
|
||||
@@ -5445,16 +5445,15 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
|
||||
cmMakefile::GeneratorConfigQuery::IncludeEmptyConfig)) {
|
||||
cm::GenEx::Context context(this->LocalGenerator, config);
|
||||
if (first || dirCgesContextSensitive) {
|
||||
dirs = fileSet->EvaluateDirectoryEntries(dirCges, context.LG,
|
||||
context.Config, this);
|
||||
dirs = fileSet->EvaluateDirectoryEntries(dirCges, context, this);
|
||||
dirCgesContextSensitive =
|
||||
std::any_of(dirCges.begin(), dirCges.end(), contextSensitive);
|
||||
}
|
||||
if (first || fileCgesContextSensitive) {
|
||||
filesPerDir.clear();
|
||||
for (auto const& fileCge : fileCges) {
|
||||
fileSet->EvaluateFileEntry(dirs, filesPerDir, fileCge, context.LG,
|
||||
context.Config, this);
|
||||
fileSet->EvaluateFileEntry(dirs, filesPerDir, fileCge, context,
|
||||
this);
|
||||
if (fileCge->GetHadContextSensitiveCondition()) {
|
||||
fileCgesContextSensitive = true;
|
||||
}
|
||||
@@ -5989,13 +5988,12 @@ void cmGeneratorTarget::BuildFileSetInfoCache(std::string const& config) const
|
||||
|
||||
auto fileEntries = file_set->CompileFileEntries();
|
||||
auto directoryEntries = file_set->CompileDirectoryEntries();
|
||||
auto directories = file_set->EvaluateDirectoryEntries(
|
||||
directoryEntries, context.LG, context.Config, this);
|
||||
auto directories =
|
||||
file_set->EvaluateDirectoryEntries(directoryEntries, context, this);
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files;
|
||||
for (auto const& entry : fileEntries) {
|
||||
file_set->EvaluateFileEntry(directories, files, entry, context.LG,
|
||||
context.Config, this);
|
||||
file_set->EvaluateFileEntry(directories, files, entry, context, this);
|
||||
}
|
||||
|
||||
for (auto const& it : files) {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
struct Evaluation;
|
||||
}
|
||||
}
|
||||
@@ -1543,10 +1544,8 @@ public:
|
||||
cmFileSet const* fileSet, cmLinkImplItem const& item = NoLinkImplItem);
|
||||
|
||||
virtual std::string const& Evaluate(
|
||||
cmLocalGenerator* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::string const& language) const = 0;
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const = 0;
|
||||
|
||||
virtual cmListFileBacktrace GetBacktrace() const = 0;
|
||||
virtual std::string const& GetInput() const = 0;
|
||||
|
||||
@@ -237,8 +237,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
|
||||
this->DebugIncludesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context.Config, context.Language, &dagChecker,
|
||||
this->IncludeDirectoriesEntries);
|
||||
this, context, &dagChecker, this->IncludeDirectoriesEntries);
|
||||
|
||||
if (lang == "Swift") {
|
||||
AddLangSpecificImplicitIncludeDirectories(
|
||||
@@ -265,9 +264,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
|
||||
entries);
|
||||
}
|
||||
|
||||
AddInterfaceEntries(this, context.Config, "INTERFACE_INCLUDE_DIRECTORIES",
|
||||
context.Language, &dagChecker, entries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(this, "INTERFACE_INCLUDE_DIRECTORIES", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
processIncludeDirectories(this, entries, includes, uniqueIncludes,
|
||||
debugIncludes);
|
||||
|
||||
@@ -567,8 +567,7 @@ void cmGeneratorTarget::ExpandLinkItems(std::string const& prop,
|
||||
entry.Backtrace);
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(entry.Value);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
cmList libs{ cge->Evaluate(context.LG, context.Config, headTarget,
|
||||
&dagChecker, this, context.Language) };
|
||||
cmList libs{ cge->Evaluate(context, &dagChecker, headTarget, this) };
|
||||
|
||||
auto linkFeature = cmLinkItem::DEFAULT;
|
||||
for (auto const& lib : libs) {
|
||||
@@ -1170,9 +1169,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> const cge =
|
||||
ge.Parse(entry.Value);
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
std::string const& evaluated =
|
||||
cge->Evaluate(context.LG, context.Config, this, &dagChecker, nullptr,
|
||||
context.Language);
|
||||
std::string const& evaluated = cge->Evaluate(context, &dagChecker, this);
|
||||
cmList llibs(evaluated);
|
||||
if (cge->GetHadHeadSensitiveCondition()) {
|
||||
impl.HadHeadSensitiveCondition = true;
|
||||
|
||||
@@ -136,13 +136,13 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
|
||||
this->DebugLinkDirectoriesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, config, language, &dagChecker, this->LinkDirectoriesEntries);
|
||||
this, context, &dagChecker, this->LinkDirectoriesEntries);
|
||||
|
||||
AddInterfaceEntries(
|
||||
this, context.Config, "INTERFACE_LINK_DIRECTORIES", context.Language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW ? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_DIRECTORIES", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
processLinkDirectories(this, entries, result, uniqueDirectories,
|
||||
debugDirectories);
|
||||
|
||||
@@ -244,13 +244,11 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
|
||||
|
||||
this->DebugCompileOptionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries =
|
||||
EvaluateTargetPropertyEntries(this, context.Config, context.Language,
|
||||
&dagChecker, this->CompileOptionsEntries);
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->CompileOptionsEntries);
|
||||
|
||||
AddInterfaceEntries(this, context.Config, "INTERFACE_COMPILE_OPTIONS",
|
||||
context.Language, &dagChecker, entries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_OPTIONS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
processOptions(this, entries, result, uniqueOptions, debugOptions,
|
||||
"compile options", OptionsParse::Shell);
|
||||
@@ -289,13 +287,11 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
|
||||
|
||||
this->DebugCompileFeaturesDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries =
|
||||
EvaluateTargetPropertyEntries(this, context.Config, context.Language,
|
||||
&dagChecker, this->CompileFeaturesEntries);
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->CompileFeaturesEntries);
|
||||
|
||||
AddInterfaceEntries(this, context.Config, "INTERFACE_COMPILE_FEATURES",
|
||||
context.Language, &dagChecker, entries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_FEATURES", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
processOptions(this, entries, result, uniqueFeatures, debugFeatures,
|
||||
"compile features", OptionsParse::None);
|
||||
@@ -342,12 +338,10 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
|
||||
this->DebugCompileDefinitionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context.Config, context.Language, &dagChecker,
|
||||
this->CompileDefinitionsEntries);
|
||||
this, context, &dagChecker, this->CompileDefinitionsEntries);
|
||||
|
||||
AddInterfaceEntries(this, context.Config, "INTERFACE_COMPILE_DEFINITIONS",
|
||||
context.Language, &dagChecker, entries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(this, "INTERFACE_COMPILE_DEFINITIONS", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
processOptions(this, entries, list, uniqueOptions, debugDefines,
|
||||
"compile definitions", OptionsParse::None);
|
||||
@@ -382,13 +376,11 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
|
||||
|
||||
this->DebugPrecompileHeadersDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries =
|
||||
EvaluateTargetPropertyEntries(this, context.Config, context.Language,
|
||||
&dagChecker, this->PrecompileHeadersEntries);
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->PrecompileHeadersEntries);
|
||||
|
||||
AddInterfaceEntries(this, context.Config, "INTERFACE_PRECOMPILE_HEADERS",
|
||||
context.Language, &dagChecker, entries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(this, "INTERFACE_PRECOMPILE_HEADERS", context,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes);
|
||||
|
||||
std::vector<BT<std::string>> list;
|
||||
processOptions(this, entries, list, uniqueOptions, debugDefines,
|
||||
@@ -442,15 +434,14 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
|
||||
|
||||
this->DebugLinkOptionsDone = true;
|
||||
|
||||
EvaluatedTargetPropertyEntries entries =
|
||||
EvaluateTargetPropertyEntries(this, context.Config, context.Language,
|
||||
&dagChecker, this->LinkOptionsEntries);
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context, &dagChecker, this->LinkOptionsEntries);
|
||||
|
||||
AddInterfaceEntries(
|
||||
this, context.Config, "INTERFACE_LINK_OPTIONS", context.Language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW ? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_OPTIONS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
processOptions(this, entries, result, uniqueOptions, debugOptions,
|
||||
"link options", OptionsParse::Shell, this->IsDeviceLink());
|
||||
@@ -624,8 +615,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
|
||||
if (cmValue linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
|
||||
std::unique_ptr<TargetPropertyEntry> entry = TargetPropertyEntry::Create(
|
||||
*this->LocalGenerator->GetCMakeInstance(), *linkOptions);
|
||||
entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
|
||||
this, context.Config, context.Language, &dagChecker, *entry));
|
||||
entries.Entries.emplace_back(
|
||||
EvaluateTargetPropertyEntry(this, context, &dagChecker, *entry));
|
||||
}
|
||||
processOptions(this, entries, result, uniqueOptions, false,
|
||||
"static library link options", OptionsParse::Shell);
|
||||
@@ -671,15 +662,15 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
|
||||
for (auto const& depend : depends) {
|
||||
std::unique_ptr<TargetPropertyEntry> entry = TargetPropertyEntry::Create(
|
||||
*this->LocalGenerator->GetCMakeInstance(), depend);
|
||||
entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
|
||||
this, context.Config, context.Language, &dagChecker, *entry));
|
||||
entries.Entries.emplace_back(
|
||||
EvaluateTargetPropertyEntry(this, context, &dagChecker, *entry));
|
||||
}
|
||||
}
|
||||
AddInterfaceEntries(
|
||||
this, context.Config, "INTERFACE_LINK_DEPENDS", context.Language,
|
||||
&dagChecker, entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW ? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
AddInterfaceEntries(this, "INTERFACE_LINK_DEPENDS", context, &dagChecker,
|
||||
entries, IncludeRuntimeInterface::Yes,
|
||||
this->GetPolicyStatusCMP0099() == cmPolicies::NEW
|
||||
? UseTo::Link
|
||||
: UseTo::Compile);
|
||||
|
||||
processOptions(this, entries, result, uniqueOptions, false, "link depends",
|
||||
OptionsParse::None);
|
||||
|
||||
@@ -47,12 +47,13 @@ namespace {
|
||||
using UseTo = cmGeneratorTarget::UseTo;
|
||||
|
||||
void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
if (cmLinkImplementationLibraries const* impl =
|
||||
headTarget->GetLinkImplementationLibraries(config, UseTo::Link)) {
|
||||
headTarget->GetLinkImplementationLibraries(context.Config,
|
||||
UseTo::Link)) {
|
||||
entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
|
||||
for (cmLinkImplItem const& lib : impl->Libraries) {
|
||||
if (lib.Target &&
|
||||
@@ -67,8 +68,7 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
||||
cge->SetEvaluateForBuildsystem(true);
|
||||
|
||||
EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
|
||||
cmExpandList(cge->Evaluate(headTarget->GetLocalGenerator(), config,
|
||||
headTarget, dagChecker),
|
||||
cmExpandList(cge->Evaluate(context, dagChecker, headTarget),
|
||||
ee.Values);
|
||||
if (cge->GetHadContextSensitiveCondition()) {
|
||||
ee.ContextDependent = true;
|
||||
@@ -80,16 +80,14 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
|
||||
}
|
||||
|
||||
void addFileSetEntry(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
cmFileSet const* fileSet,
|
||||
EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
cm::GenEx::Context context(headTarget->GetLocalGenerator(), config,
|
||||
/*language=*/std::string());
|
||||
auto dirCges = fileSet->CompileDirectoryEntries();
|
||||
auto dirs = fileSet->EvaluateDirectoryEntries(
|
||||
dirCges, context.LG, context.Config, headTarget, dagChecker);
|
||||
auto dirs = fileSet->EvaluateDirectoryEntries(dirCges, context, headTarget,
|
||||
dagChecker);
|
||||
bool contextSensitiveDirs = false;
|
||||
for (auto const& dirCge : dirCges) {
|
||||
if (dirCge->GetHadContextSensitiveCondition()) {
|
||||
@@ -101,8 +99,8 @@ void addFileSetEntry(cmGeneratorTarget const* headTarget,
|
||||
for (auto& entryCge : fileSet->CompileFileEntries()) {
|
||||
auto tpe = cmGeneratorTarget::TargetPropertyEntry::CreateFileSet(
|
||||
dirs, contextSensitiveDirs, std::move(entryCge), fileSet);
|
||||
entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
|
||||
headTarget, context.Config, context.Language, dagChecker, *tpe));
|
||||
entries.Entries.emplace_back(
|
||||
EvaluateTargetPropertyEntry(headTarget, context, dagChecker, *tpe));
|
||||
EvaluatedTargetPropertyEntry const& entry = entries.Entries.back();
|
||||
for (auto const& file : entry.Values) {
|
||||
auto* sf = headTarget->Makefile->GetOrCreateSource(file);
|
||||
@@ -142,20 +140,20 @@ void addFileSetEntry(cmGeneratorTarget const* headTarget,
|
||||
}
|
||||
|
||||
void AddFileSetEntries(cmGeneratorTarget const* headTarget,
|
||||
std::string const& config,
|
||||
cm::GenEx::Context const& context,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
EvaluatedTargetPropertyEntries& entries)
|
||||
{
|
||||
for (auto const& entry : headTarget->Target->GetHeaderSetsEntries()) {
|
||||
for (auto const& name : cmList{ entry.Value }) {
|
||||
auto const* headerSet = headTarget->Target->GetFileSet(name);
|
||||
addFileSetEntry(headTarget, config, dagChecker, headerSet, entries);
|
||||
addFileSetEntry(headTarget, context, dagChecker, headerSet, entries);
|
||||
}
|
||||
}
|
||||
for (auto const& entry : headTarget->Target->GetCxxModuleSetsEntries()) {
|
||||
for (auto const& name : cmList{ entry.Value }) {
|
||||
auto const* cxxModuleSet = headTarget->Target->GetFileSet(name);
|
||||
addFileSetEntry(headTarget, config, dagChecker, cxxModuleSet, entries);
|
||||
addFileSetEntry(headTarget, context, dagChecker, cxxModuleSet, entries);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,7 +249,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
};
|
||||
|
||||
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
|
||||
this, context.Config, context.Language, &dagChecker, this->SourceEntries);
|
||||
this, context, &dagChecker, this->SourceEntries);
|
||||
|
||||
std::unordered_set<std::string> uniqueSrcs;
|
||||
bool contextDependentDirectSources =
|
||||
@@ -259,9 +257,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
|
||||
// Collect INTERFACE_SOURCES of all direct link-dependencies.
|
||||
EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
|
||||
AddInterfaceEntries(
|
||||
this, context.Config, "INTERFACE_SOURCES", context.Language, &dagChecker,
|
||||
linkInterfaceSourcesEntries, IncludeRuntimeInterface::No, UseTo::Compile);
|
||||
AddInterfaceEntries(this, "INTERFACE_SOURCES", context, &dagChecker,
|
||||
linkInterfaceSourcesEntries, IncludeRuntimeInterface::No,
|
||||
UseTo::Compile);
|
||||
bool contextDependentInterfaceSources = processSources(
|
||||
this, linkInterfaceSourcesEntries, files, uniqueSrcs, debugSources);
|
||||
|
||||
@@ -269,7 +267,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
bool contextDependentObjects = false;
|
||||
if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
|
||||
EvaluatedTargetPropertyEntries linkObjectsEntries;
|
||||
AddObjectEntries(this, context.Config, &dagChecker, linkObjectsEntries);
|
||||
AddObjectEntries(this, context, &dagChecker, linkObjectsEntries);
|
||||
contextDependentObjects = processSources(this, linkObjectsEntries, files,
|
||||
uniqueSrcs, debugSources);
|
||||
// Note that for imported targets or multi-config generators supporting
|
||||
@@ -280,7 +278,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
|
||||
|
||||
// Collect this target's file sets.
|
||||
EvaluatedTargetPropertyEntries fileSetEntries;
|
||||
AddFileSetEntries(this, context.Config, &dagChecker, fileSetEntries);
|
||||
AddFileSetEntries(this, context, &dagChecker, fileSetEntries);
|
||||
bool contextDependentFileSets =
|
||||
processSources(this, fileSetEntries, files, uniqueSrcs, debugSources);
|
||||
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
#include "cmList.h"
|
||||
#include "cmListFileCache.h"
|
||||
|
||||
class cmLocalGenerator;
|
||||
namespace cm {
|
||||
namespace GenEx {
|
||||
struct Context;
|
||||
}
|
||||
}
|
||||
|
||||
class cmake;
|
||||
struct cmGeneratorExpressionDAGChecker;
|
||||
|
||||
@@ -33,10 +38,9 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::string const& Evaluate(cmLocalGenerator*, std::string const&,
|
||||
std::string const& Evaluate(cm::GenEx::Context const&,
|
||||
cmGeneratorTarget const*,
|
||||
cmGeneratorExpressionDAGChecker*,
|
||||
std::string const&) const override
|
||||
cmGeneratorExpressionDAGChecker*) const override
|
||||
{
|
||||
return this->PropertyValue.Value;
|
||||
}
|
||||
@@ -64,13 +68,11 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::string const& Evaluate(cmLocalGenerator* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::string const& language) const override
|
||||
std::string const& Evaluate(
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const override
|
||||
{
|
||||
return this->ge->Evaluate(lg, config, headTarget, dagChecker, nullptr,
|
||||
language);
|
||||
return this->ge->Evaluate(context, dagChecker, headTarget);
|
||||
}
|
||||
|
||||
cmListFileBacktrace GetBacktrace() const override
|
||||
@@ -105,14 +107,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
std::string const& Evaluate(cmLocalGenerator* lg, std::string const& config,
|
||||
cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker,
|
||||
std::string const& /*lang*/) const override
|
||||
std::string const& Evaluate(
|
||||
cm::GenEx::Context const& context, cmGeneratorTarget const* headTarget,
|
||||
cmGeneratorExpressionDAGChecker* dagChecker) const override
|
||||
{
|
||||
std::map<std::string, std::vector<std::string>> filesPerDir;
|
||||
this->FileSet->EvaluateFileEntry(this->BaseDirs, filesPerDir,
|
||||
this->EntryCge, lg, config, headTarget,
|
||||
this->EntryCge, context, headTarget,
|
||||
dagChecker);
|
||||
|
||||
std::vector<std::string> files;
|
||||
|
||||
@@ -126,13 +126,13 @@ cmInstallFileSetGenerator::CalculateFilesPerDir(
|
||||
cm::GenEx::Context context(this->LocalGenerator, config);
|
||||
|
||||
auto dirCges = this->FileSet->CompileDirectoryEntries();
|
||||
auto dirs = this->FileSet->EvaluateDirectoryEntries(
|
||||
dirCges, context.LG, context.Config, this->Target);
|
||||
auto dirs =
|
||||
this->FileSet->EvaluateDirectoryEntries(dirCges, context, this->Target);
|
||||
|
||||
auto fileCges = this->FileSet->CompileFileEntries();
|
||||
for (auto const& fileCge : fileCges) {
|
||||
this->FileSet->EvaluateFileEntry(dirs, result, fileCge, context.LG,
|
||||
context.Config, this->Target);
|
||||
this->FileSet->EvaluateFileEntry(dirs, result, fileCge, context,
|
||||
this->Target);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -364,12 +364,12 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
|
||||
auto fileEntries = file_set->CompileFileEntries();
|
||||
auto directoryEntries = file_set->CompileDirectoryEntries();
|
||||
auto directories = file_set->EvaluateDirectoryEntries(
|
||||
directoryEntries, context.LG, context.Config, this->GeneratorTarget);
|
||||
directoryEntries, context, this->GeneratorTarget);
|
||||
|
||||
std::map<std::string, std::vector<std::string>> files;
|
||||
for (auto const& entry : fileEntries) {
|
||||
file_set->EvaluateFileEntry(directories, files, entry, context.LG,
|
||||
context.Config, this->GeneratorTarget);
|
||||
file_set->EvaluateFileEntry(directories, files, entry, context,
|
||||
this->GeneratorTarget);
|
||||
}
|
||||
|
||||
for (auto const& it : files) {
|
||||
|
||||
@@ -1971,10 +1971,10 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr, context,
|
||||
};
|
||||
AddInterfaceEntries(
|
||||
this->GenTarget, context.Config, "INTERFACE_AUTOMOC_MACRO_NAMES",
|
||||
context.Language, &dagChecker, InterfaceAutoMocMacroNamesEntries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(this->GenTarget, "INTERFACE_AUTOMOC_MACRO_NAMES",
|
||||
context, &dagChecker,
|
||||
InterfaceAutoMocMacroNamesEntries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1982,10 +1982,9 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
|
||||
cmGeneratorExpressionDAGChecker dagChecker{
|
||||
this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr, context,
|
||||
};
|
||||
AddInterfaceEntries(this->GenTarget, context.Config,
|
||||
"INTERFACE_AUTOMOC_MACRO_NAMES", context.Language,
|
||||
&dagChecker, InterfaceAutoMocMacroNamesEntries,
|
||||
IncludeRuntimeInterface::Yes);
|
||||
AddInterfaceEntries(
|
||||
this->GenTarget, "INTERFACE_AUTOMOC_MACRO_NAMES", context, &dagChecker,
|
||||
InterfaceAutoMocMacroNamesEntries, IncludeRuntimeInterface::Yes);
|
||||
}
|
||||
|
||||
for (auto const& entry : InterfaceAutoMocMacroNamesEntries.Entries) {
|
||||
|
||||
Reference in New Issue
Block a user