Merge topic 'refactor-evaluation-files'
12c3f248
cmGeneratorExpressionEvaluationFile: Require generator context.6c0e9ee2
cmMakefile: Store EvaluationFiles.
This commit is contained in:
commit
370e2c6785
|
@ -3573,11 +3573,8 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName,
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge
|
||||||
= conditionGe.Parse(condition);
|
= conditionGe.Parse(condition);
|
||||||
|
|
||||||
this->Makefile->GetGlobalGenerator()->AddEvaluationFile(inputName,
|
this->Makefile->AddEvaluationFile(inputName, outputCge,
|
||||||
outputCge,
|
conditionCge, inputIsContent);
|
||||||
this->Makefile,
|
|
||||||
conditionCge,
|
|
||||||
inputIsContent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -25,19 +25,18 @@
|
||||||
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
|
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
|
||||||
const std::string &input,
|
const std::string &input,
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
|
||||||
cmMakefile *makefile,
|
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
||||||
bool inputIsContent)
|
bool inputIsContent)
|
||||||
: Input(input),
|
: Input(input),
|
||||||
OutputFileExpr(outputFileExpr),
|
OutputFileExpr(outputFileExpr),
|
||||||
Makefile(makefile),
|
|
||||||
Condition(condition),
|
Condition(condition),
|
||||||
InputIsContent(inputIsContent)
|
InputIsContent(inputIsContent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg,
|
||||||
|
const std::string& config,
|
||||||
const std::string& lang,
|
const std::string& lang,
|
||||||
cmCompiledGeneratorExpression* inputExpression,
|
cmCompiledGeneratorExpression* inputExpression,
|
||||||
std::map<std::string, std::string> &outputFiles, mode_t perm)
|
std::map<std::string, std::string> &outputFiles, mode_t perm)
|
||||||
|
@ -45,7 +44,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
||||||
std::string rawCondition = this->Condition->GetInput();
|
std::string rawCondition = this->Condition->GetInput();
|
||||||
if (!rawCondition.empty())
|
if (!rawCondition.empty())
|
||||||
{
|
{
|
||||||
std::string condResult = this->Condition->Evaluate(this->Makefile, config,
|
std::string condResult = this->Condition->Evaluate(lg->GetMakefile(),
|
||||||
|
config,
|
||||||
false, 0, 0, 0, lang);
|
false, 0, 0, 0, lang);
|
||||||
if (condResult == "0")
|
if (condResult == "0")
|
||||||
{
|
{
|
||||||
|
@ -56,16 +56,17 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "Evaluation file condition \"" << rawCondition << "\" did "
|
e << "Evaluation file condition \"" << rawCondition << "\" did "
|
||||||
"not evaluate to valid content. Got \"" << condResult << "\".";
|
"not evaluate to valid content. Got \"" << condResult << "\".";
|
||||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
lg->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string outputFileName
|
const std::string outputFileName
|
||||||
= this->OutputFileExpr->Evaluate(this->Makefile, config,
|
= this->OutputFileExpr->Evaluate(lg->GetMakefile(), config,
|
||||||
false, 0, 0, 0, lang);
|
false, 0, 0, 0, lang);
|
||||||
const std::string outputContent
|
const std::string outputContent
|
||||||
= inputExpression->Evaluate(this->Makefile, config,
|
= inputExpression->Evaluate(lg->GetMakefile(),
|
||||||
|
config,
|
||||||
false, 0, 0, 0, lang);
|
false, 0, 0, 0, lang);
|
||||||
|
|
||||||
std::map<std::string, std::string>::iterator it
|
std::map<std::string, std::string>::iterator it
|
||||||
|
@ -81,11 +82,11 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
||||||
e << "Evaluation file to be written multiple times for different "
|
e << "Evaluation file to be written multiple times for different "
|
||||||
"configurations or languages with different content:\n "
|
"configurations or languages with different content:\n "
|
||||||
<< outputFileName;
|
<< outputFileName;
|
||||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
lg->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->Makefile->AddCMakeOutputFile(outputFileName.c_str());
|
lg->GetMakefile()->AddCMakeOutputFile(outputFileName.c_str());
|
||||||
this->Files.push_back(outputFileName);
|
this->Files.push_back(outputFileName);
|
||||||
outputFiles[outputFileName] = outputContent;
|
outputFiles[outputFileName] = outputContent;
|
||||||
|
|
||||||
|
@ -100,18 +101,19 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
|
void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
|
||||||
std::string const& config)
|
cmLocalGenerator *lg, std::string const& config)
|
||||||
{
|
{
|
||||||
std::vector<std::string> enabledLanguages;
|
std::vector<std::string> enabledLanguages;
|
||||||
cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator();
|
cmGlobalGenerator *gg = lg->GetGlobalGenerator();
|
||||||
gg->GetEnabledLanguages(enabledLanguages);
|
gg->GetEnabledLanguages(enabledLanguages);
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator le = enabledLanguages.begin();
|
for(std::vector<std::string>::const_iterator le = enabledLanguages.begin();
|
||||||
le != enabledLanguages.end(); ++le)
|
le != enabledLanguages.end(); ++le)
|
||||||
{
|
{
|
||||||
std::string name = this->OutputFileExpr->Evaluate(this->Makefile, config,
|
std::string name = this->OutputFileExpr->Evaluate(lg->GetMakefile(),
|
||||||
|
config,
|
||||||
false, 0, 0, 0, *le);
|
false, 0, 0, 0, *le);
|
||||||
cmSourceFile* sf = this->Makefile->GetOrCreateSource(name);
|
cmSourceFile* sf = lg->GetMakefile()->GetOrCreateSource(name);
|
||||||
sf->SetProperty("GENERATED", "1");
|
sf->SetProperty("GENERATED", "1");
|
||||||
|
|
||||||
gg->SetFilenameTargetDepends(sf,
|
gg->SetFilenameTargetDepends(sf,
|
||||||
|
@ -120,7 +122,7 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGeneratorExpressionEvaluationFile::Generate()
|
void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator *lg)
|
||||||
{
|
{
|
||||||
mode_t perm = 0;
|
mode_t perm = 0;
|
||||||
std::string inputContent;
|
std::string inputContent;
|
||||||
|
@ -130,14 +132,14 @@ void cmGeneratorExpressionEvaluationFile::Generate()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->Makefile->AddCMakeDependFile(this->Input.c_str());
|
lg->GetMakefile()->AddCMakeDependFile(this->Input.c_str());
|
||||||
cmSystemTools::GetPermissions(this->Input.c_str(), perm);
|
cmSystemTools::GetPermissions(this->Input.c_str(), perm);
|
||||||
cmsys::ifstream fin(this->Input.c_str());
|
cmsys::ifstream fin(this->Input.c_str());
|
||||||
if(!fin)
|
if(!fin)
|
||||||
{
|
{
|
||||||
std::ostringstream e;
|
std::ostringstream e;
|
||||||
e << "Evaluation file \"" << this->Input << "\" cannot be read.";
|
e << "Evaluation file \"" << this->Input << "\" cannot be read.";
|
||||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
|
lg->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +161,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
|
||||||
std::map<std::string, std::string> outputFiles;
|
std::map<std::string, std::string> outputFiles;
|
||||||
|
|
||||||
std::vector<std::string> allConfigs;
|
std::vector<std::string> allConfigs;
|
||||||
this->Makefile->GetConfigurations(allConfigs);
|
lg->GetMakefile()->GetConfigurations(allConfigs);
|
||||||
|
|
||||||
if (allConfigs.empty())
|
if (allConfigs.empty())
|
||||||
{
|
{
|
||||||
|
@ -167,7 +169,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> enabledLanguages;
|
std::vector<std::string> enabledLanguages;
|
||||||
cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator();
|
cmGlobalGenerator *gg = lg->GetGlobalGenerator();
|
||||||
gg->GetEnabledLanguages(enabledLanguages);
|
gg->GetEnabledLanguages(enabledLanguages);
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator le = enabledLanguages.begin();
|
for(std::vector<std::string>::const_iterator le = enabledLanguages.begin();
|
||||||
|
@ -176,7 +178,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
|
||||||
for(std::vector<std::string>::const_iterator li = allConfigs.begin();
|
for(std::vector<std::string>::const_iterator li = allConfigs.begin();
|
||||||
li != allConfigs.end(); ++li)
|
li != allConfigs.end(); ++li)
|
||||||
{
|
{
|
||||||
this->Generate(*li, *le, inputExpression.get(), outputFiles, perm);
|
this->Generate(lg, *li, *le, inputExpression.get(), outputFiles, perm);
|
||||||
if(cmSystemTools::GetFatalErrorOccured())
|
if(cmSystemTools::GetFatalErrorOccured())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -18,31 +18,32 @@
|
||||||
|
|
||||||
#include "cmGeneratorExpression.h"
|
#include "cmGeneratorExpression.h"
|
||||||
|
|
||||||
|
class cmLocalGenerator;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
class cmGeneratorExpressionEvaluationFile
|
class cmGeneratorExpressionEvaluationFile
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmGeneratorExpressionEvaluationFile(const std::string &input,
|
cmGeneratorExpressionEvaluationFile(const std::string &input,
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr,
|
||||||
cmMakefile *makefile,
|
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
||||||
bool inputIsContent);
|
bool inputIsContent);
|
||||||
|
|
||||||
void Generate();
|
void Generate(cmLocalGenerator* lg);
|
||||||
|
|
||||||
std::vector<std::string> GetFiles() const { return this->Files; }
|
std::vector<std::string> GetFiles() const { return this->Files; }
|
||||||
|
|
||||||
void CreateOutputFile(std::string const& config);
|
void CreateOutputFile(cmLocalGenerator* lg, std::string const& config);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Generate(const std::string& config, const std::string& lang,
|
void Generate(cmLocalGenerator* lg, const std::string& config,
|
||||||
|
const std::string& lang,
|
||||||
cmCompiledGeneratorExpression* inputExpression,
|
cmCompiledGeneratorExpression* inputExpression,
|
||||||
std::map<std::string, std::string> &outputFiles, mode_t perm);
|
std::map<std::string, std::string> &outputFiles, mode_t perm);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string Input;
|
const std::string Input;
|
||||||
const cmsys::auto_ptr<cmCompiledGeneratorExpression> OutputFileExpr;
|
const cmsys::auto_ptr<cmCompiledGeneratorExpression> OutputFileExpr;
|
||||||
cmMakefile *Makefile;
|
|
||||||
const cmsys::auto_ptr<cmCompiledGeneratorExpression> Condition;
|
const cmsys::auto_ptr<cmCompiledGeneratorExpression> Condition;
|
||||||
std::vector<std::string> Files;
|
std::vector<std::string> Files;
|
||||||
const bool InputIsContent;
|
const bool InputIsContent;
|
||||||
|
|
|
@ -44,7 +44,6 @@ typedef struct {
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmGeneratorExpression.h"
|
#include "cmGeneratorExpression.h"
|
||||||
#include "cmGeneratorExpressionEvaluationFile.h"
|
|
||||||
#include "cmExportBuildFileGenerator.h"
|
#include "cmExportBuildFileGenerator.h"
|
||||||
#include "cmCPackPropertiesGenerator.h"
|
#include "cmCPackPropertiesGenerator.h"
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
|
@ -1597,9 +1596,6 @@ void cmGlobalGenerator::ClearGeneratorMembers()
|
||||||
cmDeleteAll(this->GeneratorTargets);
|
cmDeleteAll(this->GeneratorTargets);
|
||||||
this->GeneratorTargets.clear();
|
this->GeneratorTargets.clear();
|
||||||
|
|
||||||
cmDeleteAll(this->EvaluationFiles);
|
|
||||||
this->EvaluationFiles.clear();
|
|
||||||
|
|
||||||
cmDeleteAll(this->BuildExportSets);
|
cmDeleteAll(this->BuildExportSets);
|
||||||
this->BuildExportSets.clear();
|
this->BuildExportSets.clear();
|
||||||
|
|
||||||
|
@ -3068,61 +3064,21 @@ cmGlobalGenerator::GetFilenameTargetDepends(cmSourceFile* sf) const {
|
||||||
void cmGlobalGenerator::CreateEvaluationSourceFiles(
|
void cmGlobalGenerator::CreateEvaluationSourceFiles(
|
||||||
std::string const& config) const
|
std::string const& config) const
|
||||||
{
|
{
|
||||||
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
|
unsigned int i;
|
||||||
li = this->EvaluationFiles.begin();
|
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
li != this->EvaluationFiles.end();
|
|
||||||
++li)
|
|
||||||
{
|
{
|
||||||
(*li)->CreateOutputFile(config);
|
this->LocalGenerators[i]->CreateEvaluationFileOutputs(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void cmGlobalGenerator::AddEvaluationFile(const std::string &inputFile,
|
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputExpr,
|
|
||||||
cmMakefile *makefile,
|
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
|
||||||
bool inputIsContent)
|
|
||||||
{
|
|
||||||
this->EvaluationFiles.push_back(
|
|
||||||
new cmGeneratorExpressionEvaluationFile(inputFile, outputExpr,
|
|
||||||
makefile, condition,
|
|
||||||
inputIsContent));
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalGenerator::ProcessEvaluationFiles()
|
void cmGlobalGenerator::ProcessEvaluationFiles()
|
||||||
{
|
{
|
||||||
std::vector<std::string> generatedFiles;
|
std::vector<std::string> generatedFiles;
|
||||||
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
|
unsigned int i;
|
||||||
li = this->EvaluationFiles.begin();
|
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
li != this->EvaluationFiles.end();
|
|
||||||
++li)
|
|
||||||
{
|
{
|
||||||
(*li)->Generate();
|
this->LocalGenerators[i]->ProcessEvaluationFiles(generatedFiles);
|
||||||
if (cmSystemTools::GetFatalErrorOccured())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::vector<std::string> files = (*li)->GetFiles();
|
|
||||||
std::sort(files.begin(), files.end());
|
|
||||||
|
|
||||||
std::vector<std::string> intersection;
|
|
||||||
std::set_intersection(files.begin(), files.end(),
|
|
||||||
generatedFiles.begin(), generatedFiles.end(),
|
|
||||||
std::back_inserter(intersection));
|
|
||||||
if (!intersection.empty())
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("Files to be generated by multiple different "
|
|
||||||
"commands: ", cmWrap('"', intersection, '"', " ").c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
generatedFiles.insert(generatedFiles.end(),
|
|
||||||
files.begin(), files.end());
|
|
||||||
std::vector<std::string>::iterator newIt =
|
|
||||||
generatedFiles.end() - files.size();
|
|
||||||
std::inplace_merge(generatedFiles.begin(), newIt, generatedFiles.end());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
class cmake;
|
class cmake;
|
||||||
class cmGeneratorTarget;
|
class cmGeneratorTarget;
|
||||||
class cmGeneratorExpressionEvaluationFile;
|
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
class cmLocalGenerator;
|
class cmLocalGenerator;
|
||||||
class cmExternalMakefileProjectGenerator;
|
class cmExternalMakefileProjectGenerator;
|
||||||
|
@ -334,12 +333,6 @@ public:
|
||||||
|
|
||||||
static std::string EscapeJSON(const std::string& s);
|
static std::string EscapeJSON(const std::string& s);
|
||||||
|
|
||||||
void AddEvaluationFile(const std::string &inputFile,
|
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName,
|
|
||||||
cmMakefile *makefile,
|
|
||||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
|
||||||
bool inputIsContent);
|
|
||||||
|
|
||||||
void ProcessEvaluationFiles();
|
void ProcessEvaluationFiles();
|
||||||
|
|
||||||
std::map<std::string, cmExportBuildFileGenerator*>& GetBuildExportSets()
|
std::map<std::string, cmExportBuildFileGenerator*>& GetBuildExportSets()
|
||||||
|
@ -436,7 +429,6 @@ protected:
|
||||||
TargetMap TotalTargets;
|
TargetMap TotalTargets;
|
||||||
TargetMap AliasTargets;
|
TargetMap AliasTargets;
|
||||||
TargetMap ImportedTargets;
|
TargetMap ImportedTargets;
|
||||||
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
|
|
||||||
|
|
||||||
const char* GetPredefinedTargetsFolder();
|
const char* GetPredefinedTargetsFolder();
|
||||||
virtual bool UseFolderProperty();
|
virtual bool UseFolderProperty();
|
||||||
|
|
|
@ -1055,23 +1055,21 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
|
||||||
{
|
{
|
||||||
knownDependencies.insert( ng->ConvertToNinjaPath( *j ) );
|
knownDependencies.insert( ng->ConvertToNinjaPath( *j ) );
|
||||||
}
|
}
|
||||||
}
|
std::vector<cmGeneratorExpressionEvaluationFile*> const& ef =
|
||||||
knownDependencies.insert( "CMakeCache.txt" );
|
(*i)->GetMakefile()->GetEvaluationFiles();
|
||||||
|
|
||||||
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
|
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
|
||||||
li = this->EvaluationFiles.begin();
|
li = ef.begin(); li != ef.end(); ++li)
|
||||||
li != this->EvaluationFiles.end();
|
|
||||||
++li)
|
|
||||||
{
|
{
|
||||||
//get all the files created by generator expressions and convert them
|
//get all the files created by generator expressions and convert them
|
||||||
//to ninja paths
|
//to ninja paths
|
||||||
std::vector<std::string> files = (*li)->GetFiles();
|
std::vector<std::string> evaluationFiles = (*li)->GetFiles();
|
||||||
typedef std::vector<std::string>::const_iterator vect_it;
|
for(vect_it j = evaluationFiles.begin(); j != evaluationFiles.end(); ++j)
|
||||||
for(vect_it j = files.begin(); j != files.end(); ++j)
|
|
||||||
{
|
{
|
||||||
knownDependencies.insert( ng->ConvertToNinjaPath( *j ) );
|
knownDependencies.insert( ng->ConvertToNinjaPath( *j ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
knownDependencies.insert( "CMakeCache.txt" );
|
||||||
|
|
||||||
for(TargetAliasMap::const_iterator i= this->TargetAliases.begin();
|
for(TargetAliasMap::const_iterator i= this->TargetAliases.begin();
|
||||||
i != this->TargetAliases.end();
|
i != this->TargetAliases.end();
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include "cmInstallGenerator.h"
|
#include "cmInstallGenerator.h"
|
||||||
#include "cmInstallFilesGenerator.h"
|
#include "cmInstallFilesGenerator.h"
|
||||||
|
#include "cmGeneratorExpressionEvaluationFile.h"
|
||||||
#include "cmInstallScriptGenerator.h"
|
#include "cmInstallScriptGenerator.h"
|
||||||
#include "cmInstallTargetGenerator.h"
|
#include "cmInstallTargetGenerator.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
|
@ -212,6 +213,53 @@ void cmLocalGenerator::GenerateTestFiles()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmLocalGenerator::CreateEvaluationFileOutputs(std::string const& config)
|
||||||
|
{
|
||||||
|
std::vector<cmGeneratorExpressionEvaluationFile*> ef =
|
||||||
|
this->Makefile->GetEvaluationFiles();
|
||||||
|
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
|
||||||
|
li = ef.begin(); li != ef.end(); ++li)
|
||||||
|
{
|
||||||
|
(*li)->CreateOutputFile(this, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmLocalGenerator::ProcessEvaluationFiles(
|
||||||
|
std::vector<std::string>& generatedFiles)
|
||||||
|
{
|
||||||
|
std::vector<cmGeneratorExpressionEvaluationFile*> ef =
|
||||||
|
this->Makefile->GetEvaluationFiles();
|
||||||
|
for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
|
||||||
|
li = ef.begin();
|
||||||
|
li != ef.end();
|
||||||
|
++li)
|
||||||
|
{
|
||||||
|
(*li)->Generate(this);
|
||||||
|
if (cmSystemTools::GetFatalErrorOccured())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::vector<std::string> files = (*li)->GetFiles();
|
||||||
|
std::sort(files.begin(), files.end());
|
||||||
|
|
||||||
|
std::vector<std::string> intersection;
|
||||||
|
std::set_intersection(files.begin(), files.end(),
|
||||||
|
generatedFiles.begin(), generatedFiles.end(),
|
||||||
|
std::back_inserter(intersection));
|
||||||
|
if (!intersection.empty())
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Files to be generated by multiple different "
|
||||||
|
"commands: ", cmWrap('"', intersection, '"', " ").c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
generatedFiles.insert(generatedFiles.end(), files.begin(), files.end());
|
||||||
|
std::vector<std::string>::iterator newIt =
|
||||||
|
generatedFiles.end() - files.size();
|
||||||
|
std::inplace_merge(generatedFiles.begin(), newIt, generatedFiles.end());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalGenerator::GenerateInstallRules()
|
void cmLocalGenerator::GenerateInstallRules()
|
||||||
{
|
{
|
||||||
|
|
|
@ -305,6 +305,8 @@ public:
|
||||||
|
|
||||||
void IssueMessage(cmake::MessageType t, std::string const& text) const;
|
void IssueMessage(cmake::MessageType t, std::string const& text) const;
|
||||||
|
|
||||||
|
void CreateEvaluationFileOutputs(const std::string& config);
|
||||||
|
void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles);
|
||||||
|
|
||||||
void ComputeObjectMaxPath();
|
void ComputeObjectMaxPath();
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "cmState.h"
|
#include "cmState.h"
|
||||||
#include "cmOutputConverter.h"
|
#include "cmOutputConverter.h"
|
||||||
#include "cmFunctionBlocker.h"
|
#include "cmFunctionBlocker.h"
|
||||||
|
#include "cmGeneratorExpressionEvaluationFile.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
#include "cmCommandArgumentParserHelper.h"
|
#include "cmCommandArgumentParserHelper.h"
|
||||||
#include "cmGeneratorExpression.h"
|
#include "cmGeneratorExpression.h"
|
||||||
|
@ -235,6 +236,9 @@ cmMakefile::~cmMakefile()
|
||||||
cmDeleteAll(this->ImportedTargetsOwned);
|
cmDeleteAll(this->ImportedTargetsOwned);
|
||||||
cmDeleteAll(this->FinalPassCommands);
|
cmDeleteAll(this->FinalPassCommands);
|
||||||
cmDeleteAll(this->FunctionBlockers);
|
cmDeleteAll(this->FunctionBlockers);
|
||||||
|
cmDeleteAll(this->EvaluationFiles);
|
||||||
|
this->EvaluationFiles.clear();
|
||||||
|
|
||||||
this->FunctionBlockers.clear();
|
this->FunctionBlockers.clear();
|
||||||
if (this->PolicyStack.size() != 1)
|
if (this->PolicyStack.size() != 1)
|
||||||
{
|
{
|
||||||
|
@ -777,6 +781,23 @@ void cmMakefile::EnforceDirectoryLevelRules() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmMakefile::AddEvaluationFile(const std::string& inputFile,
|
||||||
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName,
|
||||||
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
||||||
|
bool inputIsContent)
|
||||||
|
{
|
||||||
|
this->EvaluationFiles.push_back(
|
||||||
|
new cmGeneratorExpressionEvaluationFile(inputFile, outputName,
|
||||||
|
condition,
|
||||||
|
inputIsContent));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<cmGeneratorExpressionEvaluationFile*>
|
||||||
|
cmMakefile::GetEvaluationFiles() const
|
||||||
|
{
|
||||||
|
return this->EvaluationFiles;
|
||||||
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
struct file_not_persistent
|
struct file_not_persistent
|
||||||
|
|
|
@ -52,6 +52,7 @@ class cmVariableWatch;
|
||||||
class cmake;
|
class cmake;
|
||||||
class cmMakefileCall;
|
class cmMakefileCall;
|
||||||
class cmCMakePolicyCommand;
|
class cmCMakePolicyCommand;
|
||||||
|
class cmGeneratorExpressionEvaluationFile;
|
||||||
|
|
||||||
/** \class cmMakefile
|
/** \class cmMakefile
|
||||||
* \brief Process the input CMakeLists.txt file.
|
* \brief Process the input CMakeLists.txt file.
|
||||||
|
@ -799,6 +800,12 @@ public:
|
||||||
|
|
||||||
void EnforceDirectoryLevelRules() const;
|
void EnforceDirectoryLevelRules() const;
|
||||||
|
|
||||||
|
void AddEvaluationFile(const std::string &inputFile,
|
||||||
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName,
|
||||||
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition,
|
||||||
|
bool inputIsContent);
|
||||||
|
std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// add link libraries and directories to the target
|
// add link libraries and directories to the target
|
||||||
void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
|
void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
|
||||||
|
@ -895,6 +902,8 @@ private:
|
||||||
|
|
||||||
std::vector<cmMakefile*> UnConfiguredDirectories;
|
std::vector<cmMakefile*> UnConfiguredDirectories;
|
||||||
|
|
||||||
|
std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
|
||||||
|
|
||||||
cmPropertyMap Properties;
|
cmPropertyMap Properties;
|
||||||
|
|
||||||
std::vector<cmCommandContext const*> ContextStack;
|
std::vector<cmCommandContext const*> ContextStack;
|
||||||
|
|
Loading…
Reference in New Issue