ENH: added progress for subdir all targets and fixed compiler waring
This commit is contained in:
parent
6bdff06594
commit
ed54b93533
|
@ -133,20 +133,25 @@ void cmGlobalUnixMakefileGenerator3::Generate()
|
||||||
total += lg->GetNumberOfProgressActions();
|
total += lg->GetNumberOfProgressActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// write each target's progress.make
|
// write each target's progress.make this loop is done twice. Bascially the
|
||||||
|
// Generate pass counts all the actions, the first loop below determines
|
||||||
|
// how many actions have progress updates for each target and writes to
|
||||||
|
// corrrect variable values for everything except the all targets. The
|
||||||
|
// second loop actually writes out correct values for the all targets as
|
||||||
|
// well. This is because the all targets require more information that is
|
||||||
|
// computed in the first loop.
|
||||||
unsigned long current = 0;
|
unsigned long current = 0;
|
||||||
for (i = 1; i < this->LocalGenerators.size(); ++i)
|
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
{
|
{
|
||||||
cmLocalUnixMakefileGenerator3 *lg =
|
cmLocalUnixMakefileGenerator3 *lg =
|
||||||
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
||||||
lg->WriteProgressVariables(total,current);
|
lg->WriteProgressVariables(total,current);
|
||||||
}
|
}
|
||||||
// write the top one last to get the total count
|
for (i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
if (this->LocalGenerators.size())
|
|
||||||
{
|
{
|
||||||
cmLocalUnixMakefileGenerator3 *lg =
|
cmLocalUnixMakefileGenerator3 *lg =
|
||||||
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
|
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
|
||||||
lg->WriteProgressVariables(total,current);
|
lg->WriteAllProgressVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the main makefile
|
// write the main makefile
|
||||||
|
@ -935,7 +940,7 @@ GetNumberOfProgressActionsInAll(cmLocalUnixMakefileGenerator3 *lg)
|
||||||
if (t->second.IsInAll())
|
if (t->second.IsInAll())
|
||||||
{
|
{
|
||||||
std::vector<int> &progFiles = lg3->ProgressFiles[t->first];
|
std::vector<int> &progFiles = lg3->ProgressFiles[t->first];
|
||||||
result += progFiles.size();
|
result += static_cast<unsigned long>(progFiles.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -943,8 +948,61 @@ GetNumberOfProgressActionsInAll(cmLocalUnixMakefileGenerator3 *lg)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: would be nice to report progress for subdir "all" targets
|
std::deque<cmLocalUnixMakefileGenerator3 *> lg3Stack;
|
||||||
return 0;
|
lg3Stack.push_back(lg);
|
||||||
|
std::vector<cmStdString> targetsInAll;
|
||||||
|
std::set<cmTarget *> targets;
|
||||||
|
while (lg3Stack.size())
|
||||||
|
{
|
||||||
|
cmLocalUnixMakefileGenerator3 *lg3 = lg3Stack.front();
|
||||||
|
lg3Stack.pop_front();
|
||||||
|
for(cmTargets::iterator l = lg3->GetMakefile()->GetTargets().begin();
|
||||||
|
l != lg3->GetMakefile()->GetTargets().end(); ++l)
|
||||||
|
{
|
||||||
|
if((l->second.GetType() == cmTarget::EXECUTABLE) ||
|
||||||
|
(l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
|
||||||
|
(l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
|
||||||
|
(l->second.GetType() == cmTarget::MODULE_LIBRARY) ||
|
||||||
|
(l->second.GetType() == cmTarget::UTILITY))
|
||||||
|
{
|
||||||
|
// Add this to the list of depends rules in this directory.
|
||||||
|
if (l->second.IsInAll() &&
|
||||||
|
targets.find(&l->second) == targets.end())
|
||||||
|
{
|
||||||
|
std::deque<cmTarget *> activeTgts;
|
||||||
|
activeTgts.push_back(&(l->second));
|
||||||
|
// trace depth of target dependencies
|
||||||
|
while (activeTgts.size())
|
||||||
|
{
|
||||||
|
if (targets.find(activeTgts.front()) == targets.end())
|
||||||
|
{
|
||||||
|
targets.insert(activeTgts.front());
|
||||||
|
cmLocalUnixMakefileGenerator3 *lg4 =
|
||||||
|
static_cast<cmLocalUnixMakefileGenerator3 *>
|
||||||
|
(activeTgts.front()->GetMakefile()->GetLocalGenerator());
|
||||||
|
std::vector<int> &progFiles2 =
|
||||||
|
lg4->ProgressFiles[activeTgts.front()->GetName()];
|
||||||
|
result += progFiles2.size();
|
||||||
|
std::vector<cmTarget *> deps2 =
|
||||||
|
this->GetTargetDepends(*activeTgts.front());
|
||||||
|
activeTgts.insert(activeTgts.end(),deps2.begin(),deps2.end());
|
||||||
|
}
|
||||||
|
activeTgts.pop_front();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The directory-level rule depends on the directory-level
|
||||||
|
// rules of the subdirectories.
|
||||||
|
for(std::vector<cmLocalGenerator*>::iterator sdi =
|
||||||
|
lg3->GetChildren().begin(); sdi != lg3->GetChildren().end(); ++sdi)
|
||||||
|
{
|
||||||
|
cmLocalUnixMakefileGenerator3* slg =
|
||||||
|
static_cast<cmLocalUnixMakefileGenerator3*>(*sdi);
|
||||||
|
lg3Stack.push_back(slg);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,10 @@ void cmLocalUnixMakefileGenerator3
|
||||||
delete *mtgIter;
|
delete *mtgIter;
|
||||||
}
|
}
|
||||||
this->TargetGenerators.clear();
|
this->TargetGenerators.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmLocalUnixMakefileGenerator3::WriteAllProgressVariable()
|
||||||
|
{
|
||||||
// write the top level progress for the all target
|
// write the top level progress for the all target
|
||||||
std::string progressFileNameFull =
|
std::string progressFileNameFull =
|
||||||
this->ConvertToFullPath("progress.make");
|
this->ConvertToFullPath("progress.make");
|
||||||
|
@ -1447,7 +1450,7 @@ void cmLocalUnixMakefileGenerator3
|
||||||
progCmd << this->Convert(progressDir.c_str(),
|
progCmd << this->Convert(progressDir.c_str(),
|
||||||
cmLocalGenerator::FULL,
|
cmLocalGenerator::FULL,
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
progCmd << " $(CMAKE_ALL_PROGRESS)\n";
|
progCmd << " $(CMAKE_ALL_PROGRESS)";
|
||||||
commands.push_back(progCmd.str());
|
commands.push_back(progCmd.str());
|
||||||
}
|
}
|
||||||
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
|
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
|
||||||
|
@ -1457,7 +1460,6 @@ void cmLocalUnixMakefileGenerator3
|
||||||
this->CreateCDCommand(commands,
|
this->CreateCDCommand(commands,
|
||||||
this->Makefile->GetHomeOutputDirectory(),
|
this->Makefile->GetHomeOutputDirectory(),
|
||||||
this->Makefile->GetStartOutputDirectory());
|
this->Makefile->GetStartOutputDirectory());
|
||||||
if (!this->Parent)
|
|
||||||
{
|
{
|
||||||
cmOStringStream progCmd;
|
cmOStringStream progCmd;
|
||||||
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
|
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
|
||||||
|
|
|
@ -80,6 +80,7 @@ public:
|
||||||
|
|
||||||
// write the progress variables used by the makefiles
|
// write the progress variables used by the makefiles
|
||||||
void WriteProgressVariables(unsigned long total, unsigned long ¤t);
|
void WriteProgressVariables(unsigned long total, unsigned long ¤t);
|
||||||
|
void WriteAllProgressVariable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, then explicitly pass MAKEFLAGS on the make all target for makes
|
* If true, then explicitly pass MAKEFLAGS on the make all target for makes
|
||||||
|
|
Loading…
Reference in New Issue