From d9d40942a0e7fe2780e33ddd0912ecb3e2335079 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 12 Nov 2007 22:33:00 -0500 Subject: [PATCH] ENH: add guess progress for first time configuring a project. --- Source/cmGlobalGenerator.cxx | 32 ++++++++++++++++++++++++++++++++ Source/cmGlobalGenerator.h | 1 + 2 files changed, 33 insertions(+) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 463c56cff..a0182ee1b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -681,6 +681,7 @@ bool cmGlobalGenerator::IsDependedOn(const char* project, void cmGlobalGenerator::Configure() { + this->FirstTimeProgress = 0.0; // Delete any existing cmLocalGenerators unsigned int i; for (i = 0; i < this->LocalGenerators.size(); ++i) @@ -896,6 +897,26 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir, const char *target, std::string *output, cmMakefile *mf) { + // if this is not set, then this is a first time configure + // and there is a good chance that the try compile stuff will + // take the bulk of the time, so try and guess some progress + // by getting closer and closer to 100 without actually getting there. + if (!this->CMakeInstance->GetCacheManager()->GetCacheValue + ("CMAKE_NUMBER_OF_LOCAL_GENERATORS")) + { + // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set + // we are in the first time progress and we have no + // idea how long it will be. So, just move 1/10th of the way + // there each time, and don't go over 95% + this->FirstTimeProgress += ((1.0 - this->FirstTimeProgress) /30.0); + if(this->FirstTimeProgress > 0.95f) + { + this->FirstTimeProgress = 0.95f; + } + this->CMakeInstance->UpdateProgress("Configuring", + this->FirstTimeProgress); + } + std::string makeCommand = this->CMakeInstance-> GetCacheManager()->GetCacheValue("CMAKE_MAKE_PROGRAM"); if(makeCommand.size() == 0) @@ -1055,6 +1076,17 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) if (!numGenC) { + // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set + // we are in the first time progress and we have no + // idea how long it will be. So, just move half way + // there each time, and don't go over 95% + this->FirstTimeProgress += ((1.0 - this->FirstTimeProgress) /30.0); + if(this->FirstTimeProgress > 0.95f) + { + this->FirstTimeProgress = 0.95f; + } + this->CMakeInstance->UpdateProgress("Configuring", + this->FirstTimeProgress); return; } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index d88ef0925..160c728d0 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -270,6 +270,7 @@ protected: cmTargetManifest TargetManifest; private: + float FirstTimeProgress; // If you add a new map here, make sure it is copied // in EnableLanguagesFromGenerator std::map IgnoreExtensions;