[Cmake-commits] CMake branch, next, updated. v3.0.0-rc2-1157-gedb7508
Stephen Kelly
steveire at gmail.com
Tue Mar 18 16:06:35 EDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via edb75087b8e84ca97a187b5bf31716d2e5082c8b (commit)
via 006c1c4c652a523550061def14bded9ffe56055b (commit)
via af85220cdf34bb686d0f9aae6b38fc118d4e36ca (commit)
from aa97e3804348cfb9b08d8634640765b4221cea03 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=edb75087b8e84ca97a187b5bf31716d2e5082c8b
commit edb75087b8e84ca97a187b5bf31716d2e5082c8b
Merge: aa97e38 006c1c4
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Mar 18 16:06:34 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Mar 18 16:06:34 2014 -0400
Merge topic 'target-sources-refactor' into next
006c1c4c cmGeneratorTarget: Compute target objects on demand
af85220c cmTarget: Compute languages from object libraries on demand.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=006c1c4c652a523550061def14bded9ffe56055b
commit 006c1c4c652a523550061def14bded9ffe56055b
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Mar 14 13:21:26 2014 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Mar 18 21:05:39 2014 +0100
cmGeneratorTarget: Compute target objects on demand
Add a ComputeObjectMapping method to compute the object
names. It takes mapping to populate as an out-parameter so
that it can be extended in the future with parameters
relevant to generator expression evaluation.
Remove the supporting cmGeneratorTarget::AddObject method. It is
no longer needed as the container member is populated directly.
The ComputeObjectMapping method is called whenever objects are
requested from the cmGeneratorTarget. Because the Xcode generator
makes no such request, explicitly invoke the method from that
generator so that the logic of checking for bad sources in object
libraries is executed.
In a follow-up, the UseObjectLibraries usage may be replaced by a
true generator expression evaluator for TARGET_OBJECTS. That
will require generators to use cmGeneratorTarget::GetExternalObjects
which is not currently the case for Xcode and VS generators.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 0b80d6b..323e3f7 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -310,18 +310,36 @@ cmGeneratorTarget
::GetObjectSources(std::vector<cmSourceFile const*> &data) const
{
IMPLEMENT_VISIT(ObjectSources);
+
+ if (!this->Objects.empty())
+ {
+ return;
+ }
+
+ for(std::vector<cmSourceFile const*>::const_iterator it = data.begin();
+ it != data.end(); ++it)
+ {
+ this->Objects[*it];
+ }
+
+ this->LocalGenerator->ComputeObjectFilenames(this->Objects, this);
}
-//----------------------------------------------------------------------------
-const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
+void cmGeneratorTarget::ComputeObjectMapping()
{
- return this->Objects[file];
+ if(!this->Objects.empty())
+ {
+ return;
+ }
+ std::vector<cmSourceFile const*> sourceFiles;
+ this->GetObjectSources(sourceFiles);
}
-void cmGeneratorTarget::AddObject(cmSourceFile const* sf,
- std::string const&name)
+//----------------------------------------------------------------------------
+const std::string& cmGeneratorTarget::GetObjectName(cmSourceFile const* file)
{
- this->Objects[sf] = name;
+ this->ComputeObjectMapping();
+ return this->Objects[file];
}
//----------------------------------------------------------------------------
@@ -333,6 +351,7 @@ void cmGeneratorTarget::AddExplicitObjectName(cmSourceFile const* sf)
//----------------------------------------------------------------------------
bool cmGeneratorTarget::HasExplicitObjectName(cmSourceFile const* file) const
{
+ const_cast<cmGeneratorTarget*>(this)->ComputeObjectMapping();
std::set<cmSourceFile const*>::const_iterator it
= this->ExplicitObjectName.find(file);
return it != this->ExplicitObjectName.end();
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index cb59783..38e6510 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -35,7 +35,6 @@ public:
void GetObjectSources(std::vector<cmSourceFile const*> &) const;
const std::string& GetObjectName(cmSourceFile const* file);
- void AddObject(cmSourceFile const* sf, std::string const&name);
bool HasExplicitObjectName(cmSourceFile const* file) const;
void AddExplicitObjectName(cmSourceFile const* sf);
@@ -47,6 +46,8 @@ public:
void GetCustomCommands(std::vector<cmSourceFile const*>&) const;
void GetExpectedResxHeaders(std::set<std::string>&) const;
+ void ComputeObjectMapping();
+
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
@@ -123,7 +124,7 @@ private:
typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
SourceEntriesType SourceEntries;
- std::map<cmSourceFile const*, std::string> Objects;
+ mutable std::map<cmSourceFile const*, std::string> Objects;
std::set<cmSourceFile const*> ExplicitObjectName;
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0041954..4765521 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1215,8 +1215,6 @@ void cmGlobalGenerator::Generate()
this->LocalGenerators[i]->GenerateTargetManifest();
}
- this->ComputeGeneratorTargetObjects();
-
this->ProcessEvaluationFiles();
// Compute the inter-target dependencies.
@@ -1433,27 +1431,6 @@ void cmGlobalGenerator::CreateGeneratorTargets()
}
}
-//----------------------------------------------------------------------------
-void cmGlobalGenerator::ComputeGeneratorTargetObjects()
-{
- // Construct per-target generator information.
- for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
- {
- cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
- cmGeneratorTargetsType targets = mf->GetGeneratorTargets();
- for(cmGeneratorTargetsType::iterator ti = targets.begin();
- ti != targets.end(); ++ti)
- {
- if (ti->second->Target->IsImported()
- || ti->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY)
- {
- continue;
- }
- cmGeneratorTarget* gt = ti->second;
- this->ComputeTargetObjects(gt);
- }
- }
-}
//----------------------------------------------------------------------------
void cmGlobalGenerator::ClearGeneratorMembers()
@@ -1515,29 +1492,6 @@ cmGlobalGenerator::GetGeneratorTarget(cmTarget const* t) const
}
//----------------------------------------------------------------------------
-void cmGlobalGenerator::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 cmGlobalGenerator::ComputeTargetObjectDirectory(cmGeneratorTarget*) const
{
}
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 49a418d..2a82430 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -442,8 +442,6 @@ private:
friend class cmake;
void CreateGeneratorTargets(cmMakefile* mf);
void CreateGeneratorTargets();
- void ComputeGeneratorTargetObjects();
- void ComputeTargetObjects(cmGeneratorTarget* gt) const;
void ClearGeneratorMembers();
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 96b23d2..ddeab3b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -988,6 +988,8 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
cmtarget.GetSourceFiles(classes);
std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
+ gtgt->ComputeObjectMapping();
+
std::vector<cmXCodeObject*> externalObjFiles;
std::vector<cmXCodeObject*> headerFiles;
std::vector<cmXCodeObject*> resourceFiles;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=af85220cdf34bb686d0f9aae6b38fc118d4e36ca
commit af85220cdf34bb686d0f9aae6b38fc118d4e36ca
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Mar 18 19:23:45 2014 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Mar 18 21:05:39 2014 +0100
cmTarget: Compute languages from object libraries on demand.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 55cc071..41846f3 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -608,13 +608,6 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
if(src[0] == '$' && src[1] == '<')
{
this->AddSource(src);
-
- if(cmHasLiteralPrefix(i->c_str(), "$<TARGET_OBJECTS:") &&
- (*i)[i->size()-1] == '>')
- {
- std::string objLibName = i->substr(17, i->size()-18);
- this->ObjectLibraries.push_back(objLibName);
- }
}
else
{
@@ -5013,6 +5006,53 @@ void cmTarget::GetLanguages(std::set<std::string>& languages) const
languages.insert(lang);
}
}
+
+ std::vector<cmTarget*> objectLibraries;
+ std::vector<cmSourceFile const*> externalObjects;
+ if (this->Makefile->GetGeneratorTargets().empty())
+ {
+ // At configure-time, this method can be called as part of getting the
+ // LOCATION property or to export() a file to be include()d. However
+ // there is no cmGeneratorTarget at configure-time, so search the SOURCES
+ // for TARGET_OBJECTS instead for backwards compatibility with OLD
+ // behavior of CMP0024 and CMP0026 only.
+ std::vector<std::string> srcs;
+ cmSystemTools::ExpandListArgument(this->GetProperty("SOURCES"), srcs);
+ for(std::vector<std::string>::const_iterator it = srcs.begin();
+ it != srcs.end(); ++it)
+ {
+ if (cmHasLiteralPrefix(*it, "$<TARGET_OBJECTS:")
+ && cmHasLiteralSuffix(*it, ">"))
+ {
+ std::string objLibName = it->substr(17, it->size()-18);
+ if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLibName))
+ {
+ objectLibraries.push_back(tgt);
+ }
+ }
+ }
+ }
+ else
+ {
+ cmGeneratorTarget* gt = this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(this);
+ gt->GetExternalObjects(externalObjects);
+ for(std::vector<cmSourceFile const*>::const_iterator
+ i = externalObjects.begin(); i != externalObjects.end(); ++i)
+ {
+ std::string objLib = (*i)->GetObjectLibrary();
+ if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLib))
+ {
+ objectLibraries.push_back(tgt);
+ }
+ }
+ }
+ for(std::vector<cmTarget*>::const_iterator
+ i = objectLibraries.begin(); i != objectLibraries.end(); ++i)
+ {
+ (*i)->GetLanguages(languages);
+ }
}
//----------------------------------------------------------------------------
@@ -6077,19 +6117,6 @@ cmTarget::ComputeLinkImplementationLanguages(LinkImplementation& impl) const
std::set<std::string> languages;
// Get languages used in our source files.
this->GetLanguages(languages);
- // Get languages used in object library sources.
- for(std::vector<std::string>::const_iterator
- i = this->ObjectLibraries.begin();
- i != this->ObjectLibraries.end(); ++i)
- {
- if(cmTarget* objLib = this->Makefile->FindTargetToUse(*i))
- {
- if(objLib->GetType() == cmTarget::OBJECT_LIBRARY)
- {
- objLib->GetLanguages(languages);
- }
- }
- }
// Copy the set of langauges to the link implementation.
for(std::set<std::string>::iterator li = languages.begin();
li != languages.end(); ++li)
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 45fca53..fcbff93 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -137,10 +137,6 @@ public:
*/
void GetSourceFiles(std::vector<std::string> &files) const;
void GetSourceFiles(std::vector<cmSourceFile*> &files) const;
- std::vector<std::string> const& GetObjectLibraries() const
- {
- return this->ObjectLibraries;
- }
/**
* Add sources to the target.
@@ -686,7 +682,6 @@ private:
std::vector<cmCustomCommand> PreLinkCommands;
std::vector<cmCustomCommand> PostBuildCommands;
TargetType TargetTypeValue;
- std::vector<std::string> ObjectLibraries;
LinkLibraryVectorType LinkLibraries;
LinkLibraryVectorType PrevLinkedLibraries;
bool LinkLibrariesAnalyzed;
-----------------------------------------------------------------------
Summary of changes:
Source/cmGeneratorTarget.cxx | 31 +++++++++++++----
Source/cmGeneratorTarget.h | 5 +--
Source/cmGlobalGenerator.cxx | 46 -------------------------
Source/cmGlobalGenerator.h | 2 --
Source/cmGlobalXCodeGenerator.cxx | 2 ++
Source/cmTarget.cxx | 67 ++++++++++++++++++++++++++-----------
Source/cmTarget.h | 5 ---
7 files changed, 77 insertions(+), 81 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list