[Cmake-commits] CMake branch, next, updated. v3.0.0-rc3-2156-g5f86bb5
Stephen Kelly
steveire at gmail.com
Tue Apr 8 19:42: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 5f86bb5194a4122e1f8245ff8c5950cde9d358b5 (commit)
via adb96ae67e2ae5d8ab543fc60f11750a42ed0c41 (commit)
via eb20b962447a3e42e6b6ad62a829025b29f51b32 (commit)
from 19ef8048be624cde670218cb3cc878597c7f108f (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=5f86bb5194a4122e1f8245ff8c5950cde9d358b5
commit 5f86bb5194a4122e1f8245ff8c5950cde9d358b5
Merge: 19ef804 adb96ae
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Apr 8 19:42:56 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Apr 8 19:42:56 2014 -0400
Merge topic 'optimize-source-file-processing' into next
adb96ae6 cmTarget: Add all sources traced from custom commands at once.
eb20b962 cmTarget: Short-circuit language computation if context independent.
diff --cc Source/cmTarget.cxx
index 1d4d84c,9c0697d..d4c9556
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@@ -232,9 -227,9 +232,10 @@@ cmTarget::cmTarget(
this->BuildInterfaceIncludesAppended = false;
this->DebugIncludesDone = false;
this->DebugCompileOptionsDone = false;
+ this->DebugCompileFeaturesDone = false;
this->DebugCompileDefinitionsDone = false;
this->DebugSourcesDone = false;
+ this->LinkImplementationLanguageIsContextDependent = true;
}
//----------------------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=adb96ae67e2ae5d8ab543fc60f11750a42ed0c41
commit adb96ae67e2ae5d8ab543fc60f11750a42ed0c41
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 9 01:32:14 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 9 01:38:23 2014 +0200
cmTarget: Add all sources traced from custom commands at once.
The AddSource method accepts one file and tries to avoiding adding
it to the sources-list of the target if it already exists. This
involves creating many cmSourceFileLocation objects for matching
on existing files, which is an expensive operation.
Avoid the searching algorithm by appending the new sources as one
group. Generate-time processing of source files will ensure
uniqueness.
Add a new AddTracedSources for this purpose. The existing
AddSources method must process the input for policy CMP0049, but
as these source filenames come from cmSourceFile::GetFullPath(),
we can forego that extra processing.
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 0d25a00..ec5ce9e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -610,6 +610,7 @@ private:
std::set<cmSourceFile*> SourcesQueued;
typedef std::map<std::string, cmSourceFile*> NameMapType;
NameMapType NameMap;
+ std::vector<std::string> NewSources;
void QueueSource(cmSourceFile* sf);
void FollowName(std::string const& name);
@@ -698,6 +699,8 @@ void cmTargetTraceDependencies::Trace()
}
}
this->CurrentEntry = 0;
+
+ this->Target->AddTracedSources(this->NewSources);
}
//----------------------------------------------------------------------------
@@ -707,8 +710,8 @@ void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf)
{
this->SourceQueue.push(sf);
- // Make sure this file is in the target.
- this->Target->AddSource(sf->GetFullPath());
+ // Make sure this file is in the target at the end.
+ this->NewSources.push_back(sf->GetFullPath());
}
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 14af2aa..9c0697d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -852,6 +852,33 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
}
//----------------------------------------------------------------------------
+void cmTarget::AddTracedSources(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)
+ {
+ std::string filename = *i;
+ srcFiles += sep;
+ srcFiles += filename;
+ sep = ";";
+ }
+ if (!srcFiles.empty())
+ {
+ this->Internal->SourceFilesMap.clear();
+ this->LinkImplementationLanguageIsContextDependent = true;
+ 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));
+ }
+}
+
+//----------------------------------------------------------------------------
void cmTarget::AddSources(std::vector<std::string> const& srcs)
{
std::string srcFiles;
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 868e260..45ae487 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -144,6 +144,7 @@ public:
* Add sources to the target.
*/
void AddSources(std::vector<std::string> const& srcs);
+ void AddTracedSources(std::vector<std::string> const& srcs);
cmSourceFile* AddSourceCMP0049(const std::string& src);
cmSourceFile* AddSource(const std::string& src);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb20b962447a3e42e6b6ad62a829025b29f51b32
commit eb20b962447a3e42e6b6ad62a829025b29f51b32
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Apr 9 00:05:36 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Apr 9 00:32:57 2014 +0200
cmTarget: Short-circuit language computation if context independent.
Computing the language involves computing the source files, which
is an expensive operation. It requires calling
cmMakefile::GetOrCreateSource many times, which involves creating
and matching on many cmSourceFileLocation objects.
Source files of a target may depend on the head-target and the
config as of commit e6971df6 (cmTarget: Make the source files depend
on the config., 2014-02-13). The results are cached for each context
as of commit c5b26f3b (cmTarget: Cache the cmSourceFiles in
GetSourceFiles., 2014-04-05).
Each target in the build graph causes language computation of all
of its dependents with itself as the head-target. This means that
for 'core' libraries on which everything depends, the source files
are computed once for every transitive target-level-dependee and
the result is not cached because the head-target is different. This
was observed in the VTK buildsystem.
Short circuit the computation for targets which have a source-list
that is independent of the head-target. If the source-list has
already been computed and the generator expression evaluation
reports that it was context-independent, return the only source-list
already cached for the target. Reset the short-circuit logic when
sources are added and when the link libraries are re-computed.
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d28ac3f..14af2aa 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -229,6 +229,7 @@ cmTarget::cmTarget()
this->DebugCompileOptionsDone = false;
this->DebugCompileDefinitionsDone = false;
this->DebugSourcesDone = false;
+ this->LinkImplementationLanguageIsContextDependent = true;
}
//----------------------------------------------------------------------------
@@ -461,6 +462,7 @@ void cmTarget::FinishConfigure()
//----------------------------------------------------------------------------
void cmTarget::ClearLinkMaps()
{
+ this->LinkImplementationLanguageIsContextDependent = true;
this->Internal->LinkImplMap.clear();
this->Internal->LinkInterfaceMap.clear();
this->Internal->LinkClosureMap.clear();
@@ -552,7 +554,7 @@ bool cmTarget::IsBundleOnApple() const
}
//----------------------------------------------------------------------------
-static void processSources(cmTarget const* tgt,
+static bool processSources(cmTarget const* tgt,
const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
std::vector<std::string> &srcs,
std::set<std::string> &uniqueSrcs,
@@ -562,6 +564,8 @@ static void processSources(cmTarget const* tgt,
{
cmMakefile *mf = tgt->GetMakefile();
+ bool contextDependent = false;
+
for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator
it = entries.begin(), end = entries.end(); it != end; ++it)
{
@@ -576,10 +580,16 @@ static void processSources(cmTarget const* tgt,
tgt,
dagChecker),
entrySources);
- if (mf->IsGeneratingBuildSystem()
- && !(*it)->ge->GetHadContextSensitiveCondition())
+ if (mf->IsGeneratingBuildSystem())
{
- cacheSources = true;
+ if (!(*it)->ge->GetHadContextSensitiveCondition())
+ {
+ cacheSources = true;
+ }
+ else
+ {
+ contextDependent = true;
+ }
}
for(std::vector<std::string>::iterator i = entrySources.begin();
@@ -598,7 +608,7 @@ static void processSources(cmTarget const* tgt,
cm->IssueMessage(cmake::FATAL_ERROR, e,
tgt->GetBacktrace());
}
- return;
+ return contextDependent;
}
}
if (cacheSources)
@@ -629,6 +639,7 @@ static void processSources(cmTarget const* tgt,
+ usedSources, (*it)->ge->GetBacktrace());
}
}
+ return contextDependent;
}
//----------------------------------------------------------------------------
@@ -664,7 +675,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
"SOURCES", 0, 0);
std::set<std::string> uniqueSrcs;
- processSources(this,
+ bool contextDependentDirectSources = processSources(this,
this->Internal->SourceEntries,
files,
uniqueSrcs,
@@ -716,7 +727,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
}
}
- processSources(this,
+ std::vector<std::string>::size_type numFilesBefore = files.size();
+ bool contextDependentInterfaceSources = processSources(this,
this->Internal->CachedLinkInterfaceSourcesEntries[config],
files,
uniqueSrcs,
@@ -725,6 +737,12 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
config,
debugSources);
+ if (!contextDependentDirectSources
+ && !(contextDependentInterfaceSources && numFilesBefore < files.size()))
+ {
+ this->LinkImplementationLanguageIsContextDependent = false;
+ }
+
if (!this->Makefile->IsGeneratingBuildSystem())
{
deleteAndClear(this->Internal->CachedLinkInterfaceSourcesEntries);
@@ -801,6 +819,12 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files,
// Lookup any existing link implementation for this configuration.
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
+ if(!this->LinkImplementationLanguageIsContextDependent)
+ {
+ files = this->Internal->SourceFilesMap.begin()->second;
+ return;
+ }
+
cmTargetInternals::SourceFilesMapType::iterator
it = this->Internal->SourceFilesMap.find(key);
if(it != this->Internal->SourceFilesMap.end())
@@ -854,6 +878,7 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs)
if (!srcFiles.empty())
{
this->Internal->SourceFilesMap.clear();
+ this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
@@ -989,6 +1014,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
== this->Internal->SourceEntries.end())
{
this->Internal->SourceFilesMap.clear();
+ this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt);
cmGeneratorExpression ge(lfbt);
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index da9d0a1..868e260 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -784,6 +784,8 @@ private:
std::string const& suffix,
std::string const& name,
const char* version) const;
+
+ mutable bool LinkImplementationLanguageIsContextDependent;
};
typedef std::map<std::string,cmTarget> cmTargets;
-----------------------------------------------------------------------
Summary of changes:
Source/cmGeneratorTarget.cxx | 7 +++--
Source/cmTarget.cxx | 67 +++++++++++++++++++++++++++++++++++++-----
Source/cmTarget.h | 3 ++
3 files changed, 68 insertions(+), 9 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list