summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-08-01 10:05:13 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-08-01 11:07:11 (GMT)
commit6c0e9ee276e9e35a970990baec09c0c2c85b3804 (patch)
tree1ab194088ca83c2e6bcb6c5bfd09ac69a8e3be13 /Source
parent9432b14e916421a727265f9a05dc1fbe6c6ec381 (diff)
downloadCMake-6c0e9ee276e9e35a970990baec09c0c2c85b3804.zip
CMake-6c0e9ee276e9e35a970990baec09c0c2c85b3804.tar.gz
CMake-6c0e9ee276e9e35a970990baec09c0c2c85b3804.tar.bz2
cmMakefile: Store EvaluationFiles.
Relieve the cmGlobalGenerator of this responsibility. Evaluate the generator expressions in the context of the cmLocalGenerator.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileCommand.cxx7
-rw-r--r--Source/cmGlobalGenerator.cxx56
-rw-r--r--Source/cmGlobalGenerator.h8
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx26
-rw-r--r--Source/cmLocalGenerator.cxx48
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmMakefile.cxx21
-rw-r--r--Source/cmMakefile.h9
8 files changed, 100 insertions, 77 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 0daed66..87faf84 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3573,11 +3573,8 @@ void cmFileCommand::AddEvaluationFile(const std::string &inputName,
cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge
= conditionGe.Parse(condition);
- this->Makefile->GetGlobalGenerator()->AddEvaluationFile(inputName,
- outputCge,
- this->Makefile,
- conditionCge,
- inputIsContent);
+ this->Makefile->AddEvaluationFile(inputName, outputCge,
+ conditionCge, inputIsContent);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 1d6608b..d6d36d4 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -30,7 +30,6 @@
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGeneratorExpression.h"
-#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmExportBuildFileGenerator.h"
#include "cmCPackPropertiesGenerator.h"
#include "cmAlgorithms.h"
@@ -1561,9 +1560,6 @@ void cmGlobalGenerator::ClearGeneratorMembers()
cmDeleteAll(this->GeneratorTargets);
this->GeneratorTargets.clear();
- cmDeleteAll(this->EvaluationFiles);
- this->EvaluationFiles.clear();
-
cmDeleteAll(this->BuildExportSets);
this->BuildExportSets.clear();
@@ -3032,61 +3028,21 @@ cmGlobalGenerator::GetFilenameTargetDepends(cmSourceFile* sf) const {
void cmGlobalGenerator::CreateEvaluationSourceFiles(
std::string const& config) const
{
- for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
- li = this->EvaluationFiles.begin();
- li != this->EvaluationFiles.end();
- ++li)
+ unsigned int i;
+ for (i = 0; i < this->LocalGenerators.size(); ++i)
{
- (*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()
{
std::vector<std::string> generatedFiles;
- for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
- li = this->EvaluationFiles.begin();
- li != this->EvaluationFiles.end();
- ++li)
+ unsigned int i;
+ for (i = 0; i < this->LocalGenerators.size(); ++i)
{
- (*li)->Generate();
- 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());
+ this->LocalGenerators[i]->ProcessEvaluationFiles(generatedFiles);
}
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 9492372..3402fbc 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -34,7 +34,6 @@
class cmake;
class cmGeneratorTarget;
-class cmGeneratorExpressionEvaluationFile;
class cmMakefile;
class cmLocalGenerator;
class cmExternalMakefileProjectGenerator;
@@ -334,12 +333,6 @@ public:
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();
std::map<std::string, cmExportBuildFileGenerator*>& GetBuildExportSets()
@@ -436,7 +429,6 @@ protected:
TargetMap TotalTargets;
TargetMap AliasTargets;
TargetMap ImportedTargets;
- std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
const char* GetPredefinedTargetsFolder();
virtual bool UseFolderProperty();
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index d24cce8..cc7f78b 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1055,23 +1055,21 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
{
knownDependencies.insert( ng->ConvertToNinjaPath( *j ) );
}
- }
- knownDependencies.insert( "CMakeCache.txt" );
-
- for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
- li = this->EvaluationFiles.begin();
- li != this->EvaluationFiles.end();
- ++li)
- {
- //get all the files created by generator expressions and convert them
- //to ninja paths
- std::vector<std::string> files = (*li)->GetFiles();
- typedef std::vector<std::string>::const_iterator vect_it;
- for(vect_it j = files.begin(); j != files.end(); ++j)
+ std::vector<cmGeneratorExpressionEvaluationFile*> const& ef =
+ (*i)->GetMakefile()->GetEvaluationFiles();
+ for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
+ li = ef.begin(); li != ef.end(); ++li)
{
- knownDependencies.insert( ng->ConvertToNinjaPath( *j ) );
+ //get all the files created by generator expressions and convert them
+ //to ninja paths
+ std::vector<std::string> evaluationFiles = (*li)->GetFiles();
+ for(vect_it j = evaluationFiles.begin(); j != evaluationFiles.end(); ++j)
+ {
+ knownDependencies.insert( ng->ConvertToNinjaPath( *j ) );
+ }
}
}
+ knownDependencies.insert( "CMakeCache.txt" );
for(TargetAliasMap::const_iterator i= this->TargetAliases.begin();
i != this->TargetAliases.end();
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6b48a44..7cc256a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -16,6 +16,7 @@
#include "cmGlobalGenerator.h"
#include "cmInstallGenerator.h"
#include "cmInstallFilesGenerator.h"
+#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmInstallScriptGenerator.h"
#include "cmInstallTargetGenerator.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(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();
+ 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()
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 2971574..1c18788 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -305,6 +305,8 @@ public:
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();
protected:
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4bdc9d5..1407888 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -21,6 +21,7 @@
#include "cmState.h"
#include "cmOutputConverter.h"
#include "cmFunctionBlocker.h"
+#include "cmGeneratorExpressionEvaluationFile.h"
#include "cmListFileCache.h"
#include "cmCommandArgumentParserHelper.h"
#include "cmGeneratorExpression.h"
@@ -235,6 +236,9 @@ cmMakefile::~cmMakefile()
cmDeleteAll(this->ImportedTargetsOwned);
cmDeleteAll(this->FinalPassCommands);
cmDeleteAll(this->FunctionBlockers);
+ cmDeleteAll(this->EvaluationFiles);
+ this->EvaluationFiles.clear();
+
this->FunctionBlockers.clear();
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,
+ this, condition,
+ inputIsContent));
+}
+
+std::vector<cmGeneratorExpressionEvaluationFile*>
+cmMakefile::GetEvaluationFiles() const
+{
+ return this->EvaluationFiles;
+}
+
namespace
{
struct file_not_persistent
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 1e5c301..c16ab3d 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -52,6 +52,7 @@ class cmVariableWatch;
class cmake;
class cmMakefileCall;
class cmCMakePolicyCommand;
+class cmGeneratorExpressionEvaluationFile;
/** \class cmMakefile
* \brief Process the input CMakeLists.txt file.
@@ -799,6 +800,12 @@ public:
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:
// add link libraries and directories to the target
void AddGlobalLinkInformation(const std::string& name, cmTarget& target);
@@ -895,6 +902,8 @@ private:
std::vector<cmMakefile*> UnConfiguredDirectories;
+ std::vector<cmGeneratorExpressionEvaluationFile*> EvaluationFiles;
+
cmPropertyMap Properties;
std::vector<cmCommandContext const*> ContextStack;