[Cmake-commits] CMake branch, next, updated. v3.1.2-1070-ge74b7b5
Brad King
brad.king at kitware.com
Fri Feb 6 09:22:05 EST 2015
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 e74b7b59722283f44775831ddb0357bdcc9c798a (commit)
via 8521fdf56e4908676c28c6bbdda3f1fb2284d3d7 (commit)
via 69ac6d27555cd4819d0c7f40e4471c6f885e23ab (commit)
from cd8706623698962a152d8dce29a3c03bf8008cf7 (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=e74b7b59722283f44775831ddb0357bdcc9c798a
commit e74b7b59722283f44775831ddb0357bdcc9c798a
Merge: cd87066 8521fdf
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Feb 6 09:22:04 2015 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Feb 6 09:22:04 2015 -0500
Merge topic 'fix-make-parallel-output' into next
8521fdf5 Makefile: Fix output during parallel builds (#12991)
69ac6d27 bootstrap: Enable color Makefile output
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8521fdf56e4908676c28c6bbdda3f1fb2284d3d7
commit 8521fdf56e4908676c28c6bbdda3f1fb2284d3d7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 5 16:48:16 2015 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Feb 6 08:36:51 2015 -0500
Makefile: Fix output during parallel builds (#12991)
Replace use of separate "cmake -E cmake_progress_report" and "cmake -E
cmake_echo_color" commands to report the progress and message portions
of build output lines with --progress-* options to the latter to print
everything with a single command. The line buffering of the stdout FILE
stream should cause the whole line to be printed with one atomic write.
This will avoid inter-mixing of line-wise messages from different
processes during a parallel build.
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 5f1bb83..e0ccaa9 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -779,29 +779,24 @@ cmGlobalUnixMakefileGenerator3
localName += "/all";
depends.clear();
- std::string progressDir =
- lg->GetMakefile()->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ progress.Dir = lg->GetMakefile()->GetHomeOutputDirectory();
+ progress.Dir += cmake::GetCMakeFilesDirectory();
+ {
+ std::ostringstream progressArg;
+ const char* sep = "";
+ std::vector<unsigned long>& progFiles =
+ this->ProgressMap[gtarget->Target].Marks;
+ for (std::vector<unsigned long>::iterator i = progFiles.begin();
+ i != progFiles.end(); ++i)
{
- std::ostringstream progCmd;
- progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
- // all target counts
- progCmd << lg->Convert(progressDir,
- cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
- progCmd << " ";
- std::vector<unsigned long>& progFiles =
- this->ProgressMap[gtarget->Target].Marks;
- for (std::vector<unsigned long>::iterator i = progFiles.begin();
- i != progFiles.end(); ++i)
- {
- progCmd << " " << *i;
- }
- commands.push_back(progCmd.str());
+ progressArg << sep << *i;
+ sep = ",";
}
- progressDir = "Built target ";
- progressDir += name;
- lg->AppendEcho(commands,progressDir.c_str());
+ progress.Arg = progressArg.str();
+ }
+ lg->AppendEcho(commands, "Built target " + name,
+ cmLocalUnixMakefileGenerator3::EchoNormal, &progress);
this->AppendGlobalTargetDepends(depends,*gtarget->Target);
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
@@ -819,15 +814,13 @@ cmGlobalUnixMakefileGenerator3
// Write the rule.
commands.clear();
- progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
{
// TODO: Convert the total progress count to a make variable.
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
// # in target
- progCmd << lg->Convert(progressDir,
+ progCmd << lg->Convert(progress.Dir,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
//
@@ -843,7 +836,7 @@ cmGlobalUnixMakefileGenerator3
{
std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
- progCmd << lg->Convert(progressDir,
+ progCmd << lg->Convert(progress.Dir,
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
progCmd << " 0";
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 72d4ef0..c60a9c7 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1346,8 +1346,9 @@ cmLocalUnixMakefileGenerator3
//----------------------------------------------------------------------------
void
cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
- const char* text,
- EchoColor color)
+ std::string const& text,
+ EchoColor color,
+ EchoProgress const* progress)
{
// Choose the color for the text.
std::string color_name;
@@ -1380,7 +1381,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
// Echo one line at a time.
std::string line;
line.reserve(200);
- for(const char* c = text;; ++c)
+ for(const char* c = text.c_str();; ++c)
{
if(*c == '\n' || *c == '\0')
{
@@ -1389,7 +1390,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
{
// Add a command to echo this line.
std::string cmd;
- if(color_name.empty())
+ if(color_name.empty() && !progress)
{
// Use the native echo command.
cmd = "@echo ";
@@ -1400,6 +1401,17 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
// Use cmake to echo the text in color.
cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) ";
cmd += color_name;
+ if (progress)
+ {
+ cmd += "--progress-dir=";
+ cmd += this->Convert(progress->Dir,
+ cmLocalGenerator::FULL,
+ cmLocalGenerator::SHELL);
+ cmd += " ";
+ cmd += "--progress-num=";
+ cmd += progress->Arg;
+ cmd += " ";
+ }
cmd += this->EscapeForShell(line);
}
commands.push_back(cmd);
@@ -1408,6 +1420,9 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
// Reset the line to emtpy.
line = "";
+ // Progress appears only on first line.
+ progress = 0;
+
// Terminate on end-of-string.
if(*c == '\0')
{
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 7c8e27f..1ff5e7f 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -184,8 +184,9 @@ public:
// append an echo command
enum EchoColor { EchoNormal, EchoDepend, EchoBuild, EchoLink,
EchoGenerate, EchoGlobal };
- void AppendEcho(std::vector<std::string>& commands, const char* text,
- EchoColor color = EchoNormal);
+ struct EchoProgress { std::string Dir; std::string Arg; };
+ void AppendEcho(std::vector<std::string>& commands, std::string const& text,
+ EchoColor color = EchoNormal, EchoProgress const* = 0);
/** Get whether the makefile is to have color. */
bool GetColorMakefile() const { return this->ColorMakefile; }
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 7ed0c10..20207f5 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -618,16 +618,19 @@ cmMakefileTargetGenerator
std::vector<std::string> commands;
// add in a progress call if needed
- this->AppendProgress(commands);
+ this->NumberOfProgressActions++;
if(!this->NoRuleMessages)
{
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ this->MakeEchoProgress(progress);
std::string buildEcho = "Building ";
buildEcho += lang;
buildEcho += " object ";
buildEcho += relativeObj;
this->LocalGenerator->AppendEcho
- (commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild);
+ (commands, buildEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild,
+ &progress);
}
std::string targetOutPathReal;
@@ -1200,12 +1203,15 @@ void cmMakefileTargetGenerator
if(!comment.empty())
{
// add in a progress call if needed
- this->AppendProgress(commands);
+ this->NumberOfProgressActions++;
if(!this->NoRuleMessages)
{
+ cmLocalUnixMakefileGenerator3::EchoProgress progress;
+ this->MakeEchoProgress(progress);
this->LocalGenerator
->AppendEcho(commands, comment.c_str(),
- cmLocalUnixMakefileGenerator3::EchoGenerate);
+ cmLocalUnixMakefileGenerator3::EchoGenerate,
+ &progress);
}
}
@@ -1263,22 +1269,14 @@ void cmMakefileTargetGenerator
//----------------------------------------------------------------------------
void
-cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands)
+cmMakefileTargetGenerator
+::MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress& progress) const
{
- this->NumberOfProgressActions++;
- if(this->NoRuleMessages)
- {
- return;
- }
- std::string progressDir = this->Makefile->GetHomeOutputDirectory();
- progressDir += cmake::GetCMakeFilesDirectory();
- std::ostringstream progCmd;
- progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
- progCmd << this->LocalGenerator->Convert(progressDir,
- cmLocalGenerator::FULL,
- cmLocalGenerator::SHELL);
- progCmd << " $(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")";
- commands.push_back(progCmd.str());
+ progress.Dir = this->Makefile->GetHomeOutputDirectory();
+ progress.Dir += cmake::GetCMakeFilesDirectory();
+ std::ostringstream progressArg;
+ progressArg << "$(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")";
+ progress.Arg = progressArg.str();
}
//----------------------------------------------------------------------------
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index e31e086..b072cfa 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -109,7 +109,7 @@ protected:
void GenerateExtraOutput(const char* out, const char* in,
bool symbolic = false);
- void AppendProgress(std::vector<std::string>& commands);
+ void MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress&) const;
// write out the variable that lists the objects for this target
void WriteObjectsVariable(std::string& variableName,
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 6b04d26..5260cb0 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -534,48 +534,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Command to report progress for a build
else if (args[1] == "cmake_progress_report" && args.size() >= 3)
{
- std::string dirName = args[2];
- dirName += "/Progress";
- std::string fName;
- FILE *progFile;
-
- // read the count
- fName = dirName;
- fName += "/count.txt";
- progFile = cmsys::SystemTools::Fopen(fName,"r");
- int count = 0;
- if (!progFile)
- {
- return 0;
- }
- else
- {
- if (1!=fscanf(progFile,"%i",&count))
- {
- cmSystemTools::Message("Could not read from progress file.");
- }
- fclose(progFile);
- }
- unsigned int i;
- for (i = 3; i < args.size(); ++i)
- {
- fName = dirName;
- fName += "/";
- fName += args[i];
- progFile = cmsys::SystemTools::Fopen(fName,"w");
- if (progFile)
- {
- fprintf(progFile,"empty");
- fclose(progFile);
- }
- }
- int fileNum = static_cast<int>
- (cmsys::Directory::GetNumberOfFilesInDirectory(dirName));
- if (count > 0)
- {
- // print the progress
- fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
- }
+ // This has been superseded by cmake_echo_color --progress-*
+ // options. We leave it here to avoid errors if somehow this
+ // is invoked by an existing makefile without regenerating.
return 0;
}
@@ -987,6 +948,65 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
}
//----------------------------------------------------------------------------
+static void cmcmdProgressReport(std::string const& dir,
+ std::string const& num)
+{
+ std::string dirName = dir;
+ dirName += "/Progress";
+ std::string fName;
+ FILE *progFile;
+
+ // read the count
+ fName = dirName;
+ fName += "/count.txt";
+ progFile = cmsys::SystemTools::Fopen(fName,"r");
+ int count = 0;
+ if (!progFile)
+ {
+ return;
+ }
+ else
+ {
+ if (1!=fscanf(progFile,"%i",&count))
+ {
+ cmSystemTools::Message("Could not read from progress file.");
+ }
+ fclose(progFile);
+ }
+ const char* last = num.c_str();
+ for(const char* c = last;; ++c)
+ {
+ if (*c == ',' || *c == '\0')
+ {
+ if (c != last)
+ {
+ fName = dirName;
+ fName += "/";
+ fName.append(last, c-last);
+ progFile = cmsys::SystemTools::Fopen(fName,"w");
+ if (progFile)
+ {
+ fprintf(progFile,"empty");
+ fclose(progFile);
+ }
+ }
+ if(*c == '\0')
+ {
+ break;
+ }
+ last = c + 1;
+ }
+ }
+ int fileNum = static_cast<int>
+ (cmsys::Directory::GetNumberOfFilesInDirectory(dirName));
+ if (count > 0)
+ {
+ // print the progress
+ fprintf(stdout,"[%3i%%] ",((fileNum-3)*100)/count);
+ }
+}
+
+//----------------------------------------------------------------------------
int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
{
// The arguments are
@@ -996,6 +1016,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
bool enabled = true;
int color = cmsysTerminal_Color_Normal;
bool newline = true;
+ std::string progressDir;
for(unsigned int i=2; i < args.size(); ++i)
{
if(args[i].find("--switch=") == 0)
@@ -1014,6 +1035,18 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
}
}
}
+ else if(cmHasLiteralPrefix(args[i], "--progress-dir="))
+ {
+ progressDir = args[i].substr(15);
+ }
+ else if(cmHasLiteralPrefix(args[i], "--progress-num="))
+ {
+ if (!progressDir.empty())
+ {
+ std::string const& progressNum = args[i].substr(15);
+ cmcmdProgressReport(progressDir, progressNum);
+ }
+ }
else if(args[i] == "--normal")
{
color = cmsysTerminal_Color_Normal;
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69ac6d27555cd4819d0c7f40e4471c6f885e23ab
commit 69ac6d27555cd4819d0c7f40e4471c6f885e23ab
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 5 16:29:59 2015 -0500
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 5 16:44:56 2015 -0500
bootstrap: Enable color Makefile output
Build the needed infrastructure during bootstrap in order to allow
"cmake -E cmake_echo_color" to be used unconditionally during
generation.
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index fbf2140..72d4ef0 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -27,10 +27,10 @@
#ifdef CMAKE_BUILD_WITH_CMAKE
# include "cmDependsFortran.h"
# include "cmDependsJava.h"
-# include <cmsys/Terminal.h>
#endif
#include <cmsys/auto_ptr.hxx>
+#include <cmsys/Terminal.h>
#include <queue>
@@ -1351,7 +1351,6 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
{
// Choose the color for the text.
std::string color_name;
-#ifdef CMAKE_BUILD_WITH_CMAKE
if(this->GlobalGenerator->GetToolSupportsColor() && this->ColorMakefile)
{
// See cmake::ExecuteEchoColor in cmake.cxx for these options.
@@ -1377,9 +1376,6 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
break;
}
}
-#else
- (void)color;
-#endif
// Echo one line at a time.
std::string line;
@@ -1617,14 +1613,10 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
targetName = targetName.substr(0, targetName.length()-4);
std::string message = "Scanning dependencies of target ";
message += targetName;
-#ifdef CMAKE_BUILD_WITH_CMAKE
cmSystemTools::MakefileColorEcho(
cmsysTerminal_Color_ForegroundMagenta |
cmsysTerminal_Color_ForegroundBold,
message.c_str(), true, color);
-#else
- fprintf(stdout, "%s\n", message.c_str());
-#endif
return this->ScanDependencies(dir.c_str(), validDependencies);
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index e9735ed..ec3d846 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -27,10 +27,10 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmArchiveWrite.h"
# include <cm_libarchive.h>
-# include <cmsys/Terminal.h>
#endif
#include <cmsys/stl/algorithm>
#include <cmsys/FStream.hxx>
+#include <cmsys/Terminal.h>
#if defined(_WIN32)
# include <windows.h>
@@ -2284,7 +2284,6 @@ std::string const& cmSystemTools::GetCMakeRoot()
}
//----------------------------------------------------------------------------
-#if defined(CMAKE_BUILD_WITH_CMAKE)
void cmSystemTools::MakefileColorEcho(int color, const char* message,
bool newline, bool enabled)
{
@@ -2314,7 +2313,6 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message,
fprintf(stdout, "%s%s", message, newline? "\n" : "");
}
}
-#endif
//----------------------------------------------------------------------------
bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 361f42e..c59ae96 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -428,11 +428,9 @@ public:
static std::string const& GetCMakeCursesCommand();
static std::string const& GetCMakeRoot();
-#if defined(CMAKE_BUILD_WITH_CMAKE)
/** Echo a message in color using KWSys's Terminal cprintf. */
static void MakefileColorEcho(int color, const char* message,
bool newLine, bool enabled);
-#endif
/** Try to guess the soname of a shared library. */
static bool GuessLibrarySOName(std::string const& fullPath,
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 28fcd27..6b04d26 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -18,12 +18,12 @@
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
-# include <cmsys/Terminal.h>
#endif
#include <cmsys/Directory.hxx>
#include <cmsys/Process.h>
#include <cmsys/FStream.hxx>
+#include <cmsys/Terminal.h>
#if defined(CMAKE_HAVE_VS_GENERATORS)
#include "cmCallVisualStudioMacro.h"
@@ -753,12 +753,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
{
return cmcmd::VisualStudioLink(args, 2);
}
-#ifdef CMAKE_BUILD_WITH_CMAKE
// Internal CMake color makefile support.
else if (args[1] == "cmake_echo_color")
{
return cmcmd::ExecuteEchoColor(args);
}
+#ifdef CMAKE_BUILD_WITH_CMAKE
else if (args[1] == "cmake_autogen" && args.size() >= 4)
{
cmQtAutoGenerators autogen;
@@ -987,7 +987,6 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link)
}
//----------------------------------------------------------------------------
-#ifdef CMAKE_BUILD_WITH_CMAKE
int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
{
// The arguments are
@@ -1073,12 +1072,6 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
return 0;
}
-#else
-int cmcmd::ExecuteEchoColor(std::vector<std::string>&)
-{
- return 1;
-}
-#endif
//----------------------------------------------------------------------------
int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
diff --git a/bootstrap b/bootstrap
index a88eb6a..8e22bee 100755
--- a/bootstrap
+++ b/bootstrap
@@ -333,13 +333,15 @@ if ${cmake_system_mingw}; then
EncodingC \
ProcessWin32 \
String \
- System"
+ System \
+ Terminal"
else
KWSYS_C_SOURCES="\
EncodingC \
ProcessUNIX \
String \
- System"
+ System \
+ Terminal"
fi
KWSYS_CXX_SOURCES="\
@@ -362,7 +364,8 @@ KWSYS_FILES="\
String.h \
String.hxx \
System.h \
- SystemTools.hxx"
+ SystemTools.hxx \
+ Terminal.h"
KWSYS_IOS_FILES="
fstream \
-----------------------------------------------------------------------
Summary of changes:
Source/cmGlobalUnixMakefileGenerator3.cxx | 43 ++++------
Source/cmLocalUnixMakefileGenerator3.cxx | 33 +++++---
Source/cmLocalUnixMakefileGenerator3.h | 5 +-
Source/cmMakefileTargetGenerator.cxx | 36 ++++----
Source/cmMakefileTargetGenerator.h | 2 +-
Source/cmSystemTools.cxx | 4 +-
Source/cmSystemTools.h | 2 -
Source/cmcmd.cxx | 128 +++++++++++++++++------------
bootstrap | 9 +-
9 files changed, 143 insertions(+), 119 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list