[Cmake-commits] CMake branch, next, updated. v3.0.0-rc3-1914-g454c8a2
Stephen Kelly
steveire at gmail.com
Sat Apr 5 06:50:59 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 454c8a293a35d865b9fc3433396f8113eaf8a41f (commit)
via 8d952be57a7f4c7eca2dd5978b43390ee3e2082d (commit)
via 9ed2ac6dcb2461064fb05077a7526cc34f7c6a90 (commit)
via a5cf46230335546c8deb749921adbf1b7e0ac75b (commit)
via 69d0ba7f4fed25dc7eb3c5f85bbb8bdcbcbc4975 (commit)
via 3be89defac19e1ae799270f93877660b8f38897c (commit)
from 36859695634d22a803b6f7c7df265872a435b160 (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=454c8a293a35d865b9fc3433396f8113eaf8a41f
commit 454c8a293a35d865b9fc3433396f8113eaf8a41f
Merge: 3685969 8d952be
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Apr 5 06:50:58 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sat Apr 5 06:50:58 2014 -0400
Merge topic 'optimize-source-file-processing' into next
8d952be5 cmTarget: Make GetSourceFiles string overload private.
9ed2ac6d cmGeneratorTarget: Trace cmSourceFile objects instead of strings.
a5cf4623 cmTarget: Cache the cmSourceFiles in GetSourceFiles.
69d0ba7f Add missing source creation.
3be89def cmTarget: Extract a ProcessSourceItemCMP0049 method.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8d952be57a7f4c7eca2dd5978b43390ee3e2082d
commit 8d952be57a7f4c7eca2dd5978b43390ee3e2082d
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Apr 5 12:35:43 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Apr 5 12:45:59 2014 +0200
cmTarget: Make GetSourceFiles string overload private.
Consumers should use the cmSourceFile overload, which is now
always the case.
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 49f85c5..cd95887 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -135,9 +135,6 @@ public:
/**
* Get the list of the source files used by this target
*/
- void GetSourceFiles(std::vector<std::string> &files,
- const std::string& config,
- cmTarget const* head = 0) const;
void GetSourceFiles(std::vector<cmSourceFile*> &files,
const std::string& config,
cmTarget const* head = 0) const;
@@ -683,6 +680,9 @@ private:
const std::string& config,
bool contentOnly) const;
+ void GetSourceFiles(std::vector<std::string> &files,
+ const std::string& config,
+ cmTarget const* head = 0) const;
private:
std::string Name;
std::vector<cmCustomCommand> PreBuildCommands;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ed2ac6dcb2461064fb05077a7526cc34f7c6a90
commit 9ed2ac6dcb2461064fb05077a7526cc34f7c6a90
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Apr 5 11:41:58 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Apr 5 12:45:59 2014 +0200
cmGeneratorTarget: Trace cmSourceFile objects instead of strings.
This reverses the decision in commit d38423ec (cmTarget: Add a
method to obtain list of filenames for sources., 2014-03-17). The
cmSourceFile based API is preferred because that avoids creation of
many cmSourceFileLocation objects for matching strings, and the
result is cached by cmTarget.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 01fad26..88952ef 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -606,12 +606,12 @@ private:
cmGlobalGenerator const* GlobalGenerator;
typedef cmGeneratorTarget::SourceEntry SourceEntry;
SourceEntry* CurrentEntry;
- std::queue<std::string> SourceQueue;
- std::set<std::string> SourcesQueued;
+ std::queue<cmSourceFile*> SourceQueue;
+ std::set<cmSourceFile*> SourcesQueued;
typedef std::map<std::string, cmSourceFile*> NameMapType;
NameMapType NameMap;
- void QueueSource(std::string const& name);
+ void QueueSource(cmSourceFile* sf);
void FollowName(std::string const& name);
void FollowNames(std::vector<std::string> const& names);
bool IsUtility(std::string const& dep);
@@ -636,7 +636,7 @@ cmTargetTraceDependencies
// Queue all the source files already specified for the target.
if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
- std::vector<std::string> sources;
+ std::vector<cmSourceFile*> sources;
std::vector<std::string> configs;
this->Makefile->GetConfigurations(configs);
if (configs.empty())
@@ -648,14 +648,14 @@ cmTargetTraceDependencies
{
this->Target->GetSourceFiles(sources, *ci);
}
- std::set<std::string> emitted;
- for(std::vector<std::string>::const_iterator si = sources.begin();
+ std::set<cmSourceFile*> emitted;
+ for(std::vector<cmSourceFile*>::const_iterator si = sources.begin();
si != sources.end(); ++si)
{
- if(emitted.insert(*si).second && this->SourcesQueued.insert(*si).second)
+ cmSourceFile* sf = *si;
+ if(emitted.insert(sf).second && this->SourcesQueued.insert(sf).second)
{
- this->SourceQueue.push(*si);
- this->Makefile->GetOrCreateSource(*si);
+ this->SourceQueue.push(sf);
}
}
}
@@ -673,8 +673,7 @@ void cmTargetTraceDependencies::Trace()
while(!this->SourceQueue.empty())
{
// Get the next source from the queue.
- std::string src = this->SourceQueue.front();
- cmSourceFile* sf = this->Makefile->GetSource(src);
+ cmSourceFile* sf = this->SourceQueue.front();
this->SourceQueue.pop();
this->CurrentEntry = &this->GeneratorTarget->SourceEntries[sf];
@@ -702,14 +701,14 @@ void cmTargetTraceDependencies::Trace()
}
//----------------------------------------------------------------------------
-void cmTargetTraceDependencies::QueueSource(std::string const& name)
+void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf)
{
- if(this->SourcesQueued.insert(name).second)
+ if(this->SourcesQueued.insert(sf).second)
{
- this->SourceQueue.push(name);
+ this->SourceQueue.push(sf);
// Make sure this file is in the target.
- this->Target->AddSource(name);
+ this->Target->AddSource(sf->GetFullPath());
}
}
@@ -731,7 +730,7 @@ void cmTargetTraceDependencies::FollowName(std::string const& name)
{
this->CurrentEntry->Depends.push_back(sf);
}
- this->QueueSource(sf->GetFullPath());
+ this->QueueSource(sf);
}
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5cf46230335546c8deb749921adbf1b7e0ac75b
commit a5cf46230335546c8deb749921adbf1b7e0ac75b
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Apr 5 11:40:38 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Apr 5 12:45:52 2014 +0200
cmTarget: Cache the cmSourceFiles in GetSourceFiles.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c8e5e01..73b4ea1 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -138,6 +138,10 @@ public:
LinkClosureMapType;
LinkClosureMapType LinkClosureMap;
+ typedef std::map<TargetConfigPair, std::vector<cmSourceFile*> >
+ SourceFilesMapType;
+ SourceFilesMapType SourceFilesMap;
+
struct TargetPropertyEntry {
TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge,
const std::string &targetName = std::string())
@@ -793,19 +797,33 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
const std::string& config,
cmTarget const* head) const
{
- std::vector<std::string> srcs;
- this->GetSourceFiles(srcs, config, head);
- std::set<cmSourceFile*> emitted;
+ // Lookup any existing link implementation for this configuration.
+ TargetConfigPair key(head, cmSystemTools::UpperCase(config));
- for(std::vector<std::string>::const_iterator i = srcs.begin();
- i != srcs.end(); ++i)
+ cmTargetInternals::SourceFilesMapType::iterator
+ it = this->Internal->SourceFilesMap.find(key);
+ if(it != this->Internal->SourceFilesMap.end())
+ {
+ files = it->second;
+ }
+ else
{
- cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i);
- if (emitted.insert(sf).second)
+ std::vector<std::string> srcs;
+ this->GetSourceFiles(srcs, config, head);
+
+ std::set<cmSourceFile*> emitted;
+
+ for(std::vector<std::string>::const_iterator i = srcs.begin();
+ i != srcs.end(); ++i)
{
- files.push_back(sf);
+ cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i);
+ if (emitted.insert(sf).second)
+ {
+ files.push_back(sf);
+ }
}
+ this->Internal->SourceFilesMap[key] = files;
}
}
@@ -836,6 +854,7 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
}
if (!srcFiles.empty())
{
+ this->Internal->SourceFilesMap.clear();
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
@@ -973,6 +992,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
TargetPropertyEntryFinder(sfl))
== this->Internal->SourceEntries.end())
{
+ this->Internal->SourceFilesMap.clear();
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
@@ -1742,6 +1762,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
+ this->Internal->SourceFilesMap.clear();
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
@@ -1828,7 +1849,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
-
+ this->Internal->SourceFilesMap.clear();
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69d0ba7f4fed25dc7eb3c5f85bbb8bdcbcbc4975
commit 69d0ba7f4fed25dc7eb3c5f85bbb8bdcbcbc4975
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Apr 5 11:30:32 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Sat Apr 5 11:30:32 2014 +0200
Add missing source creation.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 4d2ce69..c8e5e01 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -828,6 +828,7 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
{
return;
}
+ this->Makefile->GetOrCreateSource(filename);
}
srcFiles += sep;
srcFiles += filename;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3be89defac19e1ae799270f93877660b8f38897c
commit 3be89defac19e1ae799270f93877660b8f38897c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Apr 4 17:45:28 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Apr 4 17:49:18 2014 +0200
cmTarget: Extract a ProcessSourceItemCMP0049 method.
Avoid calling AddSource for each src filename. That involves
checking each entry for uniqueness and creating a separate
generator expression for each one.
Instead, add a single entry for the list of sources. The source
files are passed through a uniqueness filter at generate-time, so
duplicates don't matter so much.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index a87ec31..4d2ce69 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -812,23 +812,42 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
//----------------------------------------------------------------------------
void cmTarget::AddSources(std::vector<std::string> const& srcs)
{
+ std::string srcFiles;
+ const char* sep = "";
for(std::vector<std::string>::const_iterator i = srcs.begin();
i != srcs.end(); ++i)
{
- const char* src = i->c_str();
- if(src[0] == '$' && src[1] == '<')
- {
- this->AddSource(src);
- }
- else
+ std::string filename = *i;
+ const char* src = filename.c_str();
+
+ if(!(src[0] == '$' && src[1] == '<'))
{
- this->AddSourceCMP0049(src);
+ bool hadError = false;
+ filename = this->ProcessSourceItemCMP0049(filename, hadError);
+ if (hadError)
+ {
+ return;
+ }
}
+ srcFiles += sep;
+ srcFiles += filename;
+ sep = ";";
+ }
+ if (!srcFiles.empty())
+ {
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
+ cge->SetEvaluateForBuildsystem(true);
+ this->Internal->SourceEntries.push_back(
+ new cmTargetInternals::TargetPropertyEntry(cge));
}
}
//----------------------------------------------------------------------------
-cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s)
+std::string cmTarget::ProcessSourceItemCMP0049(const std::string& s,
+ bool& hadError)
{
std::string src = s;
@@ -863,10 +882,24 @@ cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s)
this->Makefile->IssueMessage(messageType, e.str());
if (messageType == cmake::FATAL_ERROR)
{
- return 0;
+ return "";
+ hadError = true;
}
}
}
+ return src;
+}
+
+//----------------------------------------------------------------------------
+cmSourceFile* cmTarget::AddSourceCMP0049(const std::string& s)
+{
+ bool hadError = false;
+ std::string src = this->ProcessSourceItemCMP0049(s, hadError);
+
+ if (hadError)
+ {
+ return 0;
+ }
return this->AddSource(src);
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 055e029..49f85c5 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -752,6 +752,8 @@ private:
void ComputeLinkClosure(const std::string& config, LinkClosure& lc,
cmTarget const* head) const;
+ std::string ProcessSourceItemCMP0049(const std::string& s, bool& hadError);
+
void ClearLinkMaps();
void MaybeInvalidatePropertyCache(const std::string& prop);
-----------------------------------------------------------------------
Summary of changes:
Source/cmGeneratorTarget.cxx | 31 +++++++-------
Source/cmTarget.cxx | 91 +++++++++++++++++++++++++++++++++---------
Source/cmTarget.h | 8 ++--
3 files changed, 93 insertions(+), 37 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list