diff options
author | Ken Martin <ken.martin@kitware.com> | 2006-07-12 17:11:27 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2006-07-12 17:11:27 (GMT) |
commit | ed54b93533c00d4f4ecbbbb7dfe82d7c238b30a5 (patch) | |
tree | 42df7d2e5b0918398b5d2eab70dfa009c164fc7e | |
parent | 6bdff065941d020ea9e61fe19daa810cce653c04 (diff) | |
download | CMake-ed54b93533c00d4f4ecbbbb7dfe82d7c238b30a5.zip CMake-ed54b93533c00d4f4ecbbbb7dfe82d7c238b30a5.tar.gz CMake-ed54b93533c00d4f4ecbbbb7dfe82d7c238b30a5.tar.bz2 |
ENH: added progress for subdir all targets and fixed compiler waring
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 76 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 6 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.h | 1 |
3 files changed, 72 insertions, 11 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 0a440eb..e88c457 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -133,20 +133,25 @@ void cmGlobalUnixMakefileGenerator3::Generate() 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; - for (i = 1; i < this->LocalGenerators.size(); ++i) + for (i = 0; i < this->LocalGenerators.size(); ++i) { cmLocalUnixMakefileGenerator3 *lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); lg->WriteProgressVariables(total,current); } - // write the top one last to get the total count - if (this->LocalGenerators.size()) + for (i = 0; i < this->LocalGenerators.size(); ++i) { cmLocalUnixMakefileGenerator3 *lg = - static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]); - lg->WriteProgressVariables(total,current); + static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); + lg->WriteAllProgressVariable(); } // write the main makefile @@ -935,7 +940,7 @@ GetNumberOfProgressActionsInAll(cmLocalUnixMakefileGenerator3 *lg) if (t->second.IsInAll()) { 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 { - // TODO: would be nice to report progress for subdir "all" targets - return 0; + std::deque<cmLocalUnixMakefileGenerator3 *> lg3Stack; + 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; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 2252c16..94c9094 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -150,7 +150,10 @@ void cmLocalUnixMakefileGenerator3 delete *mtgIter; } this->TargetGenerators.clear(); +} +void cmLocalUnixMakefileGenerator3::WriteAllProgressVariable() +{ // write the top level progress for the all target std::string progressFileNameFull = this->ConvertToFullPath("progress.make"); @@ -1447,7 +1450,7 @@ void cmLocalUnixMakefileGenerator3 progCmd << this->Convert(progressDir.c_str(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL); - progCmd << " $(CMAKE_ALL_PROGRESS)\n"; + progCmd << " $(CMAKE_ALL_PROGRESS)"; commands.push_back(progCmd.str()); } std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash(); @@ -1457,7 +1460,6 @@ void cmLocalUnixMakefileGenerator3 this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), this->Makefile->GetStartOutputDirectory()); - if (!this->Parent) { cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 5674790..7744e1b 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -80,6 +80,7 @@ public: // write the progress variables used by the makefiles void WriteProgressVariables(unsigned long total, unsigned long ¤t); + void WriteAllProgressVariable(); /** * If true, then explicitly pass MAKEFLAGS on the make all target for makes |