BUG: Fix progress when total number of source files is less than 100.

This commit is contained in:
Brad King 2006-05-30 16:23:24 -04:00
parent d9e060e062
commit d3073828f0
2 changed files with 30 additions and 7 deletions

View File

@ -703,15 +703,23 @@ cmGlobalUnixMakefileGenerator3
std::string progressDir = std::string progressDir =
lg->GetMakefile()->GetHomeOutputDirectory(); lg->GetMakefile()->GetHomeOutputDirectory();
progressDir += "/CMakeFiles"; progressDir += "/CMakeFiles";
{
// TODO: Convert the total progress count to a make variable.
cmOStringStream progCmd; cmOStringStream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # in target
progCmd << lg->Convert(progressDir.c_str(), progCmd << lg->Convert(progressDir.c_str(),
cmLocalGenerator::FULL, cmLocalGenerator::FULL,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
int n = this->GetNumberOfSourceFiles();
if(n > 100)
{
n = 100;
}
if (this->NumberOfSourceFiles) if (this->NumberOfSourceFiles)
{ {
progCmd << " " << progCmd << " " <<
(100*this->GetTargetTotalNumberOfSourceFiles(t->second))/ (n*this->GetTargetTotalNumberOfSourceFiles(t->second))/
this->NumberOfSourceFiles; this->NumberOfSourceFiles;
} }
else else
@ -719,9 +727,19 @@ cmGlobalUnixMakefileGenerator3
progCmd << " 0"; progCmd << " 0";
} }
commands.push_back(progCmd.str()); commands.push_back(progCmd.str());
}
commands.push_back(lg->GetRecursiveMakeCall commands.push_back(lg->GetRecursiveMakeCall
("CMakeFiles/Makefile2",t->second.GetName())); ("CMakeFiles/Makefile2",t->second.GetName()));
depends.clear(); {
cmOStringStream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
progCmd << lg->Convert(progressDir.c_str(),
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
progCmd << " 0";
commands.push_back(progCmd.str());
}
depends.clear();
depends.push_back("cmake_check_build_system"); depends.push_back("cmake_check_build_system");
lg->WriteMakeRule(ruleFileStream, lg->WriteMakeRule(ruleFileStream,
"Build rule for target.", "Build rule for target.",
@ -840,7 +858,7 @@ cmGlobalUnixMakefileGenerator3
lg->GetMakefile()->GetHomeOutputDirectory(); lg->GetMakefile()->GetHomeOutputDirectory();
progressDir += "/CMakeFiles"; progressDir += "/CMakeFiles";
cmOStringStream progCmd; cmOStringStream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; // all target counts
progCmd << lg->Convert(progressDir.c_str(), progCmd << lg->Convert(progressDir.c_str(),
cmLocalGenerator::FULL, cmLocalGenerator::FULL,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);

View File

@ -1402,13 +1402,18 @@ void cmLocalUnixMakefileGenerator3
std::string progressDir = this->Makefile->GetHomeOutputDirectory(); std::string progressDir = this->Makefile->GetHomeOutputDirectory();
progressDir += "/CMakeFiles"; progressDir += "/CMakeFiles";
cmOStringStream progCmd; cmOStringStream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # src files
progCmd << this->Convert(progressDir.c_str(), progCmd << this->Convert(progressDir.c_str(),
cmLocalGenerator::FULL, cmLocalGenerator::FULL,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
cmGlobalUnixMakefileGenerator3 *gg = cmGlobalUnixMakefileGenerator3 *gg =
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator); static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
progCmd << " " << gg->GetNumberOfSourceFiles(); int n = gg->GetNumberOfSourceFiles();
if(n > 100)
{
n = 100;
}
progCmd << " " << n;
commands.push_back(progCmd.str()); commands.push_back(progCmd.str());
} }
@ -1422,7 +1427,7 @@ void cmLocalUnixMakefileGenerator3
std::string progressDir = this->Makefile->GetHomeOutputDirectory(); std::string progressDir = this->Makefile->GetHomeOutputDirectory();
progressDir += "/CMakeFiles"; progressDir += "/CMakeFiles";
cmOStringStream progCmd; cmOStringStream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
progCmd << this->Convert(progressDir.c_str(), progCmd << this->Convert(progressDir.c_str(),
cmLocalGenerator::FULL, cmLocalGenerator::FULL,
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);