cmGlobalGenerator: Make ComputeTargetObjects non-virtual

Implement it in terms of the ComputeObjectFilenames virtual method
on the local generators.

Remove the reimplementation from the global generators which are
now all functionally identical.
This commit is contained in:
Stephen Kelly 2014-03-11 20:39:01 +01:00
parent c481fadc07
commit 6c9dd0ec7b
10 changed files with 20 additions and 103 deletions

View File

@ -1516,9 +1516,26 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget*) const void cmGlobalGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
{ {
// Implemented in generator subclasses that need this. std::vector<cmSourceFile const*> objectSources;
gt->GetObjectSources(objectSources);
std::map<cmSourceFile const*, std::string> mapping;
for(std::vector<cmSourceFile const*>::const_iterator it
= objectSources.begin(); it != objectSources.end(); ++it)
{
mapping[*it];
}
gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
for(std::map<cmSourceFile const*, std::string>::const_iterator it
= mapping.begin(); it != mapping.end(); ++it)
{
assert(!it->second.empty());
gt->AddObject(it->first, it->second);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -443,7 +443,7 @@ private:
void CreateGeneratorTargets(cmMakefile* mf); void CreateGeneratorTargets(cmMakefile* mf);
void CreateGeneratorTargets(); void CreateGeneratorTargets();
void ComputeGeneratorTargetObjects(); void ComputeGeneratorTargetObjects();
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; void ComputeTargetObjects(cmGeneratorTarget* gt) const;
void ClearGeneratorMembers(); void ClearGeneratorMembers();

View File

@ -632,29 +632,6 @@ std::string cmGlobalNinjaGenerator::GetEditCacheCommand() const
return cmSystemTools::GetCMakeGUICommand(); return cmSystemTools::GetCMakeGUICommand();
} }
// TODO: Refactor to combine with cmGlobalUnixMakefileGenerator3 impl.
void cmGlobalNinjaGenerator::ComputeTargetObjects(cmGeneratorTarget* gt) const
{
std::vector<cmSourceFile const*> objectSources;
gt->GetObjectSources(objectSources);
std::map<cmSourceFile const*, std::string> mapping;
for(std::vector<cmSourceFile const*>::const_iterator it
= objectSources.begin(); it != objectSources.end(); ++it)
{
mapping[*it];
}
gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
for(std::map<cmSourceFile const*, std::string>::const_iterator it
= mapping.begin(); it != mapping.end(); ++it)
{
assert(!it->second.empty());
gt->AddObject(it->first, it->second);
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalNinjaGenerator void cmGlobalNinjaGenerator
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const

View File

@ -310,8 +310,6 @@ protected:
private: private:
virtual std::string GetEditCacheCommand() const; virtual std::string GetEditCacheCommand() const;
/// @see cmGlobalGenerator::ComputeTargetObjects
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
void OpenBuildFileStream(); void OpenBuildFileStream();
void CloseBuildFileStream(); void CloseBuildFileStream();

View File

@ -103,30 +103,6 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const
return edit_cmd? edit_cmd : ""; return edit_cmd? edit_cmd : "";
} }
//----------------------------------------------------------------------------
void
cmGlobalUnixMakefileGenerator3
::ComputeTargetObjects(cmGeneratorTarget* gt) const
{
std::vector<cmSourceFile const*> objectSources;
gt->GetObjectSources(objectSources);
std::map<cmSourceFile const*, std::string> mapping;
for(std::vector<cmSourceFile const*>::const_iterator it
= objectSources.begin(); it != objectSources.end(); ++it)
{
mapping[*it];
}
gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
for(std::map<cmSourceFile const*, std::string>::const_iterator it
= mapping.begin(); it != mapping.end(); ++it)
{
gt->AddObject(it->first, it->second);
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmGlobalUnixMakefileGenerator3 cmGlobalUnixMakefileGenerator3

View File

@ -199,7 +199,6 @@ protected:
private: private:
virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; } virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; }
virtual std::string GetEditCacheCommand() const; virtual std::string GetEditCacheCommand() const;
virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const;
}; };
#endif #endif

View File

@ -117,30 +117,6 @@ void cmGlobalVisualStudioGenerator::Generate()
this->cmGlobalGenerator::Generate(); this->cmGlobalGenerator::Generate();
} }
//----------------------------------------------------------------------------
void
cmGlobalVisualStudioGenerator
::ComputeTargetObjects(cmGeneratorTarget* gt) const
{
std::vector<cmSourceFile const*> objectSources;
gt->GetObjectSources(objectSources);
std::map<cmSourceFile const*, std::string> mapping;
for(std::vector<cmSourceFile const*>::const_iterator it
= objectSources.begin(); it != objectSources.end(); ++it)
{
mapping[*it];
}
gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
for(std::map<cmSourceFile const*, std::string>::const_iterator it
= mapping.begin(); it != mapping.end(); ++it)
{
gt->AddObject(it->first, it->second);
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalVisualStudioGenerator void cmGlobalVisualStudioGenerator
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const

View File

@ -117,7 +117,6 @@ private:
virtual std::string GetVSMakeProgram() = 0; virtual std::string GetVSMakeProgram() = 0;
void PrintCompilerAdvice(std::ostream&, std::string const&, void PrintCompilerAdvice(std::ostream&, std::string const&,
const char*) const {} const char*) const {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
void FollowLinkDepends(cmTarget const* target, void FollowLinkDepends(cmTarget const* target,
std::set<cmTarget const*>& linked); std::set<cmTarget const*>& linked);

View File

@ -3934,30 +3934,6 @@ bool cmGlobalXCodeGenerator::IsMultiConfig()
return true; return true;
} }
//----------------------------------------------------------------------------
void
cmGlobalXCodeGenerator
::ComputeTargetObjects(cmGeneratorTarget* gt) const
{
std::vector<cmSourceFile const*> objectSources;
gt->GetObjectSources(objectSources);
std::map<cmSourceFile const*, std::string> mapping;
for(std::vector<cmSourceFile const*>::const_iterator it
= objectSources.begin(); it != objectSources.end(); ++it)
{
mapping[*it];
}
gt->LocalGenerator->ComputeObjectFilenames(mapping, gt);
for(std::map<cmSourceFile const*, std::string>::const_iterator it
= mapping.begin(); it != mapping.end(); ++it)
{
gt->AddObject(it->first, it->second);
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalXCodeGenerator void cmGlobalXCodeGenerator
::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const

View File

@ -217,7 +217,6 @@ protected:
private: private:
void PrintCompilerAdvice(std::ostream&, std::string const&, void PrintCompilerAdvice(std::ostream&, std::string const&,
const char*) const {} const char*) const {}
void ComputeTargetObjects(cmGeneratorTarget* gt) const;
std::string GetObjectsNormalDirectory( std::string GetObjectsNormalDirectory(
const std::string &projName, const std::string &projName,