[Cmake-commits] CMake branch, next, updated. v2.8.8-3096-gca82ed3
Peter Kuemmel
syntheticpp at gmx.net
Sun Jun 10 14:23:43 EDT 2012
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 ca82ed3df9a429ef32d843b28cbb35aa004f3880 (commit)
via ba8d0db217399dede6d897c928b4dbf52e7e141b (commit)
from afae0914662c91f25907861319a3a20ef4096d3e (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=ca82ed3df9a429ef32d843b28cbb35aa004f3880
commit ca82ed3df9a429ef32d843b28cbb35aa004f3880
Merge: afae091 ba8d0db
Author: Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sun Jun 10 14:23:35 2012 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jun 10 14:23:35 2012 -0400
Merge topic 'ninja-cldeps' into next
ba8d0db Ninja: don't pollute the rules file with useless comments
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba8d0db217399dede6d897c928b4dbf52e7e141b
commit ba8d0db217399dede6d897c928b4dbf52e7e141b
Author: Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Sun Jun 10 20:20:29 2012 +0200
Commit: Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Sun Jun 10 20:20:29 2012 +0200
Ninja: don't pollute the rules file with useless comments
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 648855c..4773c37 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -43,12 +43,13 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os,
std::string replace = comment;
std::string::size_type lpos = 0;
std::string::size_type rpos;
+ os << "\n#############################################\n";
while((rpos = replace.find('\n', lpos)) != std::string::npos)
{
os << "# " << replace.substr(lpos, rpos - lpos) << "\n";
lpos = rpos + 1;
}
- os << "# " << replace.substr(lpos) << "\n";
+ os << "# " << replace.substr(lpos) << "\n\n";
}
static bool IsIdentChar(char c)
@@ -318,6 +319,8 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
cmGlobalNinjaGenerator::Indent(os, 1);
os << "generator = 1\n";
}
+
+ os << "\n";
}
void cmGlobalNinjaGenerator::WriteVariable(std::ostream& os,
@@ -374,12 +377,21 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator()
, CompileCommandsStream(0)
, Rules()
, AllDependencies()
+ , CommentStream(0)
{
// // Ninja is not ported to non-Unix OS yet.
// this->ForceUnixPaths = true;
this->FindMakeProgramFile = "CMakeNinjaFindMake.cmake";
+ this->ClearCommentStream();
+}
+
+void cmGlobalNinjaGenerator::ClearCommentStream()
+{
+ delete CommentStream;
+ CommentStream = new cmsys_ios::stringstream(std::ios::out);
}
+
//----------------------------------------------------------------------------
// Virtual public methods.
@@ -537,7 +549,13 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name,
{
// Do not add the same rule twice.
if (this->HasRule(name))
+ {
+ this->ClearCommentStream();
return;
+ }
+
+ *this->RulesFileStream << this->GetCommentStream().str();
+ this->ClearCommentStream();
this->Rules.insert(name);
cmGlobalNinjaGenerator::WriteRule(*this->RulesFileStream,
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 0c740e8..b2c2aa8 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -16,6 +16,8 @@
# include "cmGlobalGenerator.h"
# include "cmNinjaTypes.h"
+//#define NINJA_GEN_VERBOSE_FILES
+
class cmLocalGenerator;
class cmGeneratedFileStream;
class cmGeneratorTarget;
@@ -215,6 +217,11 @@ public:
cmGeneratedFileStream* GetRulesFileStream() const
{ return this->RulesFileStream; }
+ void ClearCommentStream();
+ cmsys_ios::stringstream& GetCommentStream() const
+ { return *this->CommentStream; }
+
+
void AddCXXCompileCommand(const std::string &commandLine,
const std::string &sourceFile);
@@ -346,6 +353,9 @@ private:
static cmLocalGenerator* LocalGenerator;
static bool UsingMinGW;
+
+ cmsys_ios::stringstream* CommentStream;
+
};
#endif // ! cmGlobalNinjaGenerator_h
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index a0141cf..5d193cd 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -46,7 +46,9 @@ void cmLocalNinjaGenerator::Generate()
this->SetConfigName();
this->WriteProcessedMakefile(this->GetBuildFileStream());
+#ifdef NINJA_GEN_VERBOSE_FILES
this->WriteProcessedMakefile(this->GetRulesFileStream());
+#endif
this->WriteBuildFileTop();
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index ddf96eb..e377706 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -96,13 +96,11 @@ void cmNinjaNormalTargetGenerator::Generate()
#endif
this->WriteLinkStatement();
}
-
- this->GetBuildFileStream() << "\n";
- this->GetRulesFileStream() << "\n";
}
void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
{
+#ifdef NINJA_GEN_VERBOSE_FILES
cmGlobalNinjaGenerator::WriteDivider(this->GetRulesFileStream());
this->GetRulesFileStream()
<< "# Rules for each languages for "
@@ -110,6 +108,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
<< " target "
<< this->GetTargetName()
<< "\n\n";
+#endif
std::set<cmStdString> languages;
this->GetTarget()->GetLanguages(languages);
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 40fdc8b..f66d1d3 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -309,10 +309,11 @@ void
cmNinjaTargetGenerator
::WriteLanguageRules(const std::string& language)
{
+#ifdef NINJA_GEN_VERBOSE_FILES
this->GetRulesFileStream()
<< "# Rules for language " << language << "\n\n";
+#endif
this->WriteCompileRule(language);
- this->GetRulesFileStream() << "\n";
}
void
-----------------------------------------------------------------------
Summary of changes:
Source/cmGlobalNinjaGenerator.cxx | 20 +++++++++++++++++++-
Source/cmGlobalNinjaGenerator.h | 10 ++++++++++
Source/cmLocalNinjaGenerator.cxx | 2 ++
Source/cmNinjaNormalTargetGenerator.cxx | 5 ++---
Source/cmNinjaTargetGenerator.cxx | 3 ++-
5 files changed, 35 insertions(+), 5 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list