diff options
-rw-r--r-- | Source/cmExportLibraryDependenciesCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 19 | ||||
-rw-r--r-- | Source/cmGetDirectoryPropertyCommand.cxx | 7 | ||||
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 9 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 68 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 5 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 1 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 4 | ||||
-rw-r--r-- | Source/cmSetPropertyCommand.cxx | 10 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 |
10 files changed, 72 insertions, 61 deletions
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index cb150a7..fde8fb1 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "cmExportLibraryDependenciesCommand.h" #include "cmGlobalGenerator.h" -#include "cmLocalGenerator.h" #include "cmGeneratedFileStream.h" #include "cmake.h" #include "cmVersion.h" @@ -82,15 +81,14 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const // the project. cmake* cm = this->Makefile->GetCMakeInstance(); cmGlobalGenerator* global = cm->GetGlobalGenerator(); - const std::vector<cmLocalGenerator *>& locals = global->GetLocalGenerators(); + const std::vector<cmMakefile*>& locals = global->GetMakefiles(); std::map<std::string, std::string> libDepsOld; std::map<std::string, std::string> libDepsNew; std::map<std::string, std::string> libTypes; - for(std::vector<cmLocalGenerator *>::const_iterator i = locals.begin(); + for(std::vector<cmMakefile*>::const_iterator i = locals.begin(); i != locals.end(); ++i) { - const cmLocalGenerator* gen = *i; - const cmTargets &tgts = gen->GetMakefile()->GetTargets(); + const cmTargets &tgts = (*i)->GetTargets(); for(cmTargets::const_iterator l = tgts.begin(); l != tgts.end(); ++l) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 76bc426..299c112 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -36,7 +36,7 @@ //---------------------------------------------------------------------------- void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib, - cmTarget *target, cmake *cm) + cmGeneratorTarget const* target, cmake *cm) { if(!badObjLib.empty()) { @@ -50,7 +50,7 @@ void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib, e << "but may contain only sources that compile, header files, and " "other files that would not affect linking of a normal library."; cm->IssueMessage(cmake::FATAL_ERROR, e.str(), - target->GetBacktrace()); + target->Target->GetBacktrace()); } } @@ -133,14 +133,14 @@ struct TagVisitor { DataType& Data; std::vector<cmSourceFile*> BadObjLibFiles; - cmTarget *Target; + cmGeneratorTarget const* Target; cmGlobalGenerator *GlobalGenerator; cmsys::RegularExpression Header; bool IsObjLib; - TagVisitor(cmTarget *target, DataType& data) + TagVisitor(cmGeneratorTarget const* target, DataType& data) : Data(data), Target(target), - GlobalGenerator(target->GetMakefile()->GetGlobalGenerator()), + GlobalGenerator(target->GetLocalGenerator()->GetGlobalGenerator()), Header(CM_HEADER_REGEX), IsObjLib(target->GetType() == cmTarget::OBJECT_LIBRARY) { @@ -234,7 +234,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = lg; - this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); + this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator(); } cmGeneratorTarget::~cmGeneratorTarget() @@ -362,7 +362,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt, { \ std::vector<cmSourceFile*> sourceFiles; \ this->Target->GetSourceFiles(sourceFiles, config); \ - TagVisitor<DATA ## Tag DATATYPE> visitor(this->Target, data); \ + TagVisitor<DATA ## Tag DATATYPE> visitor(this, data); \ for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \ si != sourceFiles.end(); ++si) \ { \ @@ -1557,7 +1557,7 @@ cmTargetTraceDependencies { // Convenience. this->Makefile = this->Target->GetMakefile(); - this->GlobalGenerator = this->Makefile->GetGlobalGenerator(); + this->GlobalGenerator = target->GetLocalGenerator()->GetGlobalGenerator(); this->CurrentEntry = 0; // Queue all the source files already specified for the target. @@ -1945,8 +1945,7 @@ void cmGeneratorTarget::GenerateTargetManifest( { return; } - cmMakefile* mf = this->Target->GetMakefile(); - cmGlobalGenerator* gg = mf->GetGlobalGenerator(); + cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator(); // Get the names. std::string name; diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index c056d95..2558876 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -51,10 +51,8 @@ bool cmGetDirectoryPropertyCommand sd = cmSystemTools::CollapseFullPath(sd); // lookup the makefile from the directory name - cmLocalGenerator *lg = - this->Makefile->GetGlobalGenerator()-> - FindLocalGenerator(sd); - if (!lg) + dir = this->Makefile->GetGlobalGenerator()->FindMakefile(sd); + if (!dir) { this->SetError ("DIRECTORY argument provided but requested directory not found. " @@ -62,7 +60,6 @@ bool cmGetDirectoryPropertyCommand "it is valid but has not been processed yet."); return false; } - dir = lg->GetMakefile(); ++i; } diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 33d638b..4c42f53 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -262,13 +262,8 @@ bool cmGetPropertyCommand::HandleDirectoryMode() dir = cmSystemTools::CollapseFullPath(dir); // Lookup the generator. - if(cmLocalGenerator* lg = - (this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir))) - { - // Use the makefile for the directory found. - mf = lg->GetMakefile(); - } - else + mf = this->Makefile->GetGlobalGenerator()->FindMakefile(dir); + if (!mf) { // Could not find the directory. this->SetError diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 35fe772..cda26cd 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1129,6 +1129,7 @@ void cmGlobalGenerator::Configure() // start with this directory cmLocalGenerator *lg = this->MakeLocalGenerator(); + this->Makefiles.push_back(lg->GetMakefile()); this->LocalGenerators.push_back(lg); // set the Start directories @@ -1147,9 +1148,9 @@ void cmGlobalGenerator::Configure() // update the cache entry for the number of local generators, this is used // for progress char num[100]; - sprintf(num,"%d",static_cast<int>(this->LocalGenerators.size())); + sprintf(num,"%d",static_cast<int>(this->Makefiles.size())); this->GetCMakeInstance()->AddCacheEntry - ("CMAKE_NUMBER_OF_LOCAL_GENERATORS", num, + ("CMAKE_NUMBER_OF_MAKEFILES", num, "number of local generators", cmState::INTERNAL); // check for link libraries and include directories containing "NOTFOUND" @@ -1192,9 +1193,9 @@ void cmGlobalGenerator::Configure() cmTargets globalTargets; this->CreateDefaultGlobalTargets(&globalTargets); - for (i = 0; i < this->LocalGenerators.size(); ++i) + for (i = 0; i < this->Makefiles.size(); ++i) { - cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); + cmMakefile* mf = this->Makefiles[i]; cmTargets* targets = &(mf->GetTargets()); cmTargets::iterator tit; for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit ) @@ -1481,9 +1482,9 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens) void cmGlobalGenerator::FinalizeTargetCompileInfo() { // Construct per-target generator information. - for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) + for(unsigned int i=0; i < this->Makefiles.size(); ++i) { - cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + cmMakefile *mf = this->Makefiles[i]; const cmStringRange noconfig_compile_definitions = mf->GetCompileDefinitionsEntries(); @@ -1600,6 +1601,8 @@ void cmGlobalGenerator::ClearGeneratorMembers() cmDeleteAll(this->BuildExportSets); this->BuildExportSets.clear(); + this->Makefiles.clear(); + cmDeleteAll(this->LocalGenerators); this->LocalGenerators.clear(); @@ -1639,11 +1642,11 @@ void cmGlobalGenerator::CheckLocalGenerators() // std::set<std::string> notFoundMap; // after it is all done do a ConfigureFinalPass cmState* state = this->GetCMakeInstance()->GetState(); - for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) + for (unsigned int i = 0; i < this->Makefiles.size(); ++i) { - this->LocalGenerators[i]->GetMakefile()->ConfigureFinalPass(); + this->Makefiles[i]->ConfigureFinalPass(); cmTargets &targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); + this->Makefiles[i]->GetTargets(); for (cmTargets::iterator l = targets.begin(); l != targets.end(); l++) { @@ -1698,15 +1701,14 @@ void cmGlobalGenerator::CheckLocalGenerators() } std::string text = notFoundMap[varName]; text += "\n used as include directory in directory "; - text += this->LocalGenerators[i] - ->GetMakefile()->GetCurrentSourceDirectory(); + text += this->Makefiles[i]->GetCurrentSourceDirectory(); notFoundMap[varName] = text; } } } this->CMakeInstance->UpdateProgress ("Configuring", 0.9f+0.1f*(static_cast<float>(i)+1.0f)/ - static_cast<float>(this->LocalGenerators.size())); + static_cast<float>(this->Makefiles.size())); } if(!notFoundMap.empty()) @@ -1740,9 +1742,9 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, // 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->GetState()->GetInitializedCacheValue - ("CMAKE_NUMBER_OF_LOCAL_GENERATORS")) + ("CMAKE_NUMBER_OF_MAKEFILES")) { - // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set + // If CMAKE_NUMBER_OF_MAKEFILES 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% @@ -1930,19 +1932,19 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand( } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) +void cmGlobalGenerator::AddMakefile(cmMakefile *mf) { - this->LocalGenerators.push_back(lg); + this->Makefiles.push_back(mf); // update progress // estimate how many lg there will be const char *numGenC = this->CMakeInstance->GetState()->GetInitializedCacheValue - ("CMAKE_NUMBER_OF_LOCAL_GENERATORS"); + ("CMAKE_NUMBER_OF_MAKEFILES"); if (!numGenC) { - // If CMAKE_NUMBER_OF_LOCAL_GENERATORS is not set + // If CMAKE_NUMBER_OF_MAKEFILES 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% @@ -1957,7 +1959,7 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) } int numGen = atoi(numGenC); - float prog = 0.9f*static_cast<float>(this->LocalGenerators.size())/ + float prog = 0.9f*static_cast<float>(this->Makefiles.size())/ static_cast<float>(numGen); if (prog > 0.9f) { @@ -1966,6 +1968,12 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) this->CMakeInstance->UpdateProgress("Configuring", prog); } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) +{ + this->LocalGenerators.push_back(lg); +} + void cmGlobalGenerator::AddInstallComponent(const char* component) { if(component && *component) @@ -2154,6 +2162,20 @@ void cmGlobalGenerator::FillLocalGeneratorToTargetMap() } } +cmMakefile* +cmGlobalGenerator::FindMakefile(const std::string& start_dir) const +{ + for(std::vector<cmMakefile*>::const_iterator it = + this->Makefiles.begin(); it != this->Makefiles.end(); ++it) + { + std::string sd = (*it)->GetCurrentSourceDirectory(); + if (sd == start_dir) + { + return *it; + } + } + return 0; +} ///! Find a local generator by its startdirectory cmLocalGenerator* @@ -2241,7 +2263,7 @@ inline std::string removeQuotes(const std::string& s) void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { - cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); + cmMakefile* mf = this->Makefiles[0]; const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir(); // CPack @@ -2814,9 +2836,9 @@ cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs, } // Shorten the output name (in expected use case). - cmLocalGenerator* lg = this->GetLocalGenerators()[0]; - std::string fname = lg->Convert(outputs[0], - cmLocalGenerator::HOME_OUTPUT); + cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot()); + std::string fname = converter.Convert( + outputs[0], cmLocalGenerator::HOME_OUTPUT); // Associate the hash with this output. this->RuleHashes[fname] = hash; diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index c35cba2..a13bede 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -173,6 +173,8 @@ public: cmake *GetCMakeInstance() const { return this->CMakeInstance; } void SetConfiguredFilesPath(cmGlobalGenerator* gen); + const std::vector<cmMakefile*>& GetMakefiles() const { + return this->Makefiles;} const std::vector<cmLocalGenerator *>& GetLocalGenerators() const { return this->LocalGenerators;} @@ -184,6 +186,7 @@ public: void SetCurrentMakefile(cmMakefile* mf) {this->CurrentMakefile = mf;} + void AddMakefile(cmMakefile *mf); void AddLocalGenerator(cmLocalGenerator *lg); ///! Set an generator for an "external makefile based project" @@ -253,6 +256,7 @@ public: that is a framework. */ bool NameResolvesToFramework(const std::string& libname) const; + cmMakefile* FindMakefile(const std::string& start_dir) const; ///! Find a local generator by its startdirectory cmLocalGenerator* FindLocalGenerator(const std::string& start_dir) const; @@ -404,6 +408,7 @@ protected: std::string FindMakeProgramFile; std::string ConfiguredFilesPath; cmake *CMakeInstance; + std::vector<cmMakefile*> Makefiles; std::vector<cmLocalGenerator *> LocalGenerators; cmMakefile* CurrentMakefile; // map from project name to vector of local generators in that project diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 60a11e1..85bc493 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1857,6 +1857,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, // create a new local generator and set its parent cmLocalGenerator *lg2 = this->GetGlobalGenerator() ->MakeLocalGenerator(newSnapshot, this->LocalGenerator); + this->GetGlobalGenerator()->AddMakefile(lg2->GetMakefile()); this->GetGlobalGenerator()->AddLocalGenerator(lg2); cmMakefile* subMf = lg2->GetMakefile(); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index ce806ba..4eb9b13 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -369,7 +369,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, #if defined(_WIN32) && !defined(__CYGWIN__) bool usePRE_BUILD = false; - cmGlobalGenerator* gg = makefile->GetGlobalGenerator(); + cmGlobalGenerator* gg = lg->GetGlobalGenerator(); if(gg->GetName().find("Visual Studio") != std::string::npos) { cmGlobalVisualStudioGenerator* vsgg = @@ -396,7 +396,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, std::vector<std::string> rcc_output; bool const isNinja = - makefile->GetGlobalGenerator()->GetName() == "Ninja"; + lg->GetGlobalGenerator()->GetName() == "Ninja"; if(isNinja #if defined(_WIN32) && !defined(__CYGWIN__) || usePRE_BUILD diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 31e460f..17ad475 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -205,14 +205,8 @@ bool cmSetPropertyCommand::HandleDirectoryMode() // The local generators are associated with collapsed paths. dir = cmSystemTools::CollapseFullPath(dir); - // Lookup the generator. - if(cmLocalGenerator* lg = - this->Makefile->GetGlobalGenerator()->FindLocalGenerator(dir)) - { - // Use the makefile for the directory found. - mf = lg->GetMakefile(); - } - else + mf = this->Makefile->GetGlobalGenerator()->FindMakefile(dir); + if (!mf) { // Could not find the directory. this->SetError diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8c455b2..d1e6265 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1592,7 +1592,7 @@ int cmake::ActualConfigure() } } - cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); + cmMakefile* mf=this->GlobalGenerator->GetMakefiles()[0]; if (mf->IsOn("CTEST_USE_LAUNCHERS") && !this->State->GetGlobalProperty("RULE_LAUNCH_COMPILE")) { |