Merge topic 'refactor-computation'

616f0311 cmGlobalGenerator: Move path computation to Compute.
9eea0486 cmGlobalGenerator: Do more computation at compute time.
2eca0559 cmGlobalGenerator: De-virtualize Compute().
21f428f4 VisualStudio: Replace Compute override with AddExtraIDETargets override.
a9588e90 VisualStudio10: Initialize the LongestSource at generate time.
4407eee0 cmGlobalGenerator: Call AddExtraIDETargets as a hook of Compute().
a09c545d Xcode: Extract a AddExtraIDETargets method.
This commit is contained in:
Brad King 2015-10-06 10:59:00 -04:00 committed by CMake Topic Stage
commit c914d2bda2
10 changed files with 24 additions and 53 deletions

View File

@ -1282,12 +1282,7 @@ bool cmGlobalGenerator::Compute()
}
}
return true;
}
void cmGlobalGenerator::Generate()
{
unsigned int i;
this->AddExtraIDETargets();
// Trace the dependencies, after that no custom commands should be added
// because their dependencies might not be handled correctly
@ -1307,22 +1302,27 @@ void cmGlobalGenerator::Generate()
// Compute the inter-target dependencies.
if(!this->ComputeTargetDepends())
{
return;
return false;
}
// Create a map from local generator to the complete set of targets
// it builds by default.
this->InitializeProgressMarks();
this->ProcessEvaluationFiles();
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
this->LocalGenerators[i]->ComputeHomeRelativeOutputPath();
}
return true;
}
void cmGlobalGenerator::Generate()
{
// Create a map from local generator to the complete set of targets
// it builds by default.
this->InitializeProgressMarks();
this->ProcessEvaluationFiles();
// Generate project files
for (i = 0; i < this->LocalGenerators.size(); ++i)
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
this->SetCurrentMakefile(this->LocalGenerators[i]->GetMakefile());
this->LocalGenerators[i]->Generate();

View File

@ -83,7 +83,8 @@ public:
*/
virtual void Configure();
virtual bool Compute();
bool Compute();
virtual void AddExtraIDETargets() {}
enum TargetTypes {
AllTargets,

View File

@ -325,19 +325,9 @@ cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator(
return new cmLocalVisualStudio10Generator(this, mf);
}
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio10Generator::Compute()
{
if (!cmGlobalVisualStudio8Generator::Compute())
{
return false;
}
this->LongestSource = LongestSourcePath();
return true;
}
void cmGlobalVisualStudio10Generator::Generate()
{
this->LongestSource = LongestSourcePath();
this->cmGlobalVisualStudio8Generator::Generate();
if(this->LongestSource.Length > 0)
{

View File

@ -45,8 +45,6 @@ public:
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
virtual bool Compute();
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);

View File

@ -348,13 +348,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
}
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio8Generator::Compute()
void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
{
if (!cmGlobalVisualStudio7Generator::Compute())
{
return false;
}
cmGlobalVisualStudio7Generator::AddExtraIDETargets();
if(this->AddCheckTarget())
{
// All targets depend on the build-system check target.
@ -368,7 +364,6 @@ bool cmGlobalVisualStudio8Generator::Compute()
}
}
}
return true;
}
//----------------------------------------------------------------------------

View File

@ -67,7 +67,7 @@ public:
return !this->WindowsCEVersion.empty(); }
protected:
virtual bool Compute();
virtual void AddExtraIDETargets();
virtual const char* GetIDEVersion() { return "8.0"; }
virtual std::string FindDevEnvCommand();

View File

@ -64,13 +64,8 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase(
}
//----------------------------------------------------------------------------
bool cmGlobalVisualStudioGenerator::Compute()
void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
{
if (!cmGlobalGenerator::Compute())
{
return false;
}
// Add a special target that depends on ALL projects for easy build
// of one configuration only.
const char* no_working_dir = 0;
@ -144,7 +139,6 @@ bool cmGlobalVisualStudioGenerator::Compute()
static_cast<cmLocalVisualStudioGenerator*>(*lgi);
lg->AddCMakeListsRules();
}
return true;
}
//----------------------------------------------------------------------------

View File

@ -111,7 +111,7 @@ public:
cmGeneratorTarget*, std::vector<cmCustomCommand>& commands,
std::string const& configName);
protected:
virtual bool Compute();
virtual void AddExtraIDETargets();
// Does this VS version link targets to each other if there are
// dependencies in the SLN file? This was done for VS versions

View File

@ -376,14 +376,8 @@ cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf)
return new cmLocalXCodeGenerator(this, mf);
}
//----------------------------------------------------------------------------
bool cmGlobalXCodeGenerator::Compute()
void cmGlobalXCodeGenerator::AddExtraIDETargets()
{
if (!cmGlobalGenerator::Compute())
{
return false;
}
std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
// make sure extra targets are added before calling
// the parent generate which will call trace depends
@ -394,7 +388,6 @@ bool cmGlobalXCodeGenerator::Compute()
// add ALL_BUILD, INSTALL, etc
this->AddExtraTargets(root, it->second);
}
return true;
}
void cmGlobalXCodeGenerator::Generate()

View File

@ -87,7 +87,7 @@ public:
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
void AppendFlag(std::string& flags, std::string const& flag);
protected:
virtual bool Compute();
virtual void AddExtraIDETargets();
virtual void Generate();
private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,