diff options
author | Brad King <brad.king@kitware.com> | 2012-11-20 16:48:05 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-11-20 16:48:05 (GMT) |
commit | d82200df2652c913244ba09c15e9059ef1048aa2 (patch) | |
tree | f6c3a610e48f2be5a822f9d6ee77c699bf079156 /Source/cmake.cxx | |
parent | 9e73b3a09536aa818793810cb083313b5750db78 (diff) | |
parent | 75ebebc39c93aab4d3a0c03560d2c9db82b574f4 (diff) | |
download | CMake-d82200df2652c913244ba09c15e9059ef1048aa2.zip CMake-d82200df2652c913244ba09c15e9059ef1048aa2.tar.gz CMake-d82200df2652c913244ba09c15e9059ef1048aa2.tar.bz2 |
Merge topic 'generator-factory'
75ebebc VS: Remove platform specific generator files
8b62080 VS: Remove EnableLanguage from platform-specific generators
5bdf011 VS: Remove GetPlatformName from platform-specific generators
8d42ab4 VS: Fix ArchitectureId of Visual Studio 10 IA64 generator
6f439b3 VS: Remove AddPlatformDefinitions from platform-specific generators
5170a88 Make cmGlobalGenerator::GetDocumentation() a static function
04ff866 Allow a GeneratorFactory handling of more than one generator
984ebc3 Search generator in cmake::ExtraGenerators before in cmake::Generators
30a6950 Add cmGlobalGeneratorFactory::GetGenerators()
e8f8414 Introduce the abstract class cmGlobalGeneratorFactory
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 147 |
1 files changed, 68 insertions, 79 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0123427..1ec88fb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -63,15 +63,8 @@ # include "cmGlobalVisualStudio71Generator.h" # include "cmGlobalVisualStudio8Generator.h" # include "cmGlobalVisualStudio9Generator.h" -# include "cmGlobalVisualStudio9IA64Generator.h" -# include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio10Generator.h" -# include "cmGlobalVisualStudio10IA64Generator.h" -# include "cmGlobalVisualStudio10Win64Generator.h" # include "cmGlobalVisualStudio11Generator.h" -# include "cmGlobalVisualStudio11Win64Generator.h" -# include "cmGlobalVisualStudio11ARMGenerator.h" -# include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" @@ -222,6 +215,11 @@ cmake::~cmake() { delete (*j).second; } + for(RegisteredGeneratorsVector::iterator j = this->Generators.begin(); + j != this->Generators.end(); ++j) + { + delete *j; + } #ifdef CMAKE_BUILD_WITH_CMAKE delete this->VariableWatch; #endif @@ -1869,10 +1867,10 @@ void cmake::AddDefaultExtraGenerators() //---------------------------------------------------------------------------- void cmake::GetRegisteredGenerators(std::vector<std::string>& names) { - for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin(); + for(RegisteredGeneratorsVector::const_iterator i = this->Generators.begin(); i != this->Generators.end(); ++i) { - names.push_back(i->first); + (*i)->GetGenerators(names); } for(RegisteredExtraGeneratorsMap::const_iterator i = this->ExtraGenerators.begin(); @@ -1884,29 +1882,36 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names) cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name) { - cmGlobalGenerator* generator = 0; cmExternalMakefileProjectGenerator* extraGenerator = 0; - RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name); - if(genIt == this->Generators.end()) + RegisteredExtraGeneratorsMap::const_iterator extraGenIt = + this->ExtraGenerators.find(name); + if (extraGenIt != this->ExtraGenerators.end()) { - RegisteredExtraGeneratorsMap::const_iterator extraGenIt = - this->ExtraGenerators.find(name); - if (extraGenIt == this->ExtraGenerators.end()) - { - return 0; - } extraGenerator = (extraGenIt->second)(); - genIt=this->Generators.find(extraGenerator->GetGlobalGeneratorName(name)); - if(genIt == this->Generators.end()) + name = extraGenerator->GetGlobalGeneratorName(name); + } + + cmGlobalGenerator* generator = 0; + for (RegisteredGeneratorsVector::const_iterator i = + this->Generators.begin(); i != this->Generators.end(); ++i) + { + generator = (*i)->CreateGlobalGenerator(name); + if (generator) { - delete extraGenerator; - return 0; + break; } - } + } + + if (generator) + { + generator->SetCMakeInstance(this); + generator->SetExternalMakefileProjectGenerator(extraGenerator); + } + else + { + delete extraGenerator; + } - generator = (genIt->second)(); - generator->SetCMakeInstance(this); - generator->SetExternalMakefileProjectGenerator(extraGenerator); return generator; } @@ -2570,55 +2575,41 @@ void cmake::AddDefaultGenerators() { #if defined(_WIN32) && !defined(__CYGWIN__) # if !defined(CMAKE_BOOT_MINGW) - this->Generators[cmGlobalVisualStudio6Generator::GetActualName()] = - &cmGlobalVisualStudio6Generator::New; - this->Generators[cmGlobalVisualStudio7Generator::GetActualName()] = - &cmGlobalVisualStudio7Generator::New; - this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] = - &cmGlobalVisualStudio10Generator::New; - this->Generators[cmGlobalVisualStudio10IA64Generator::GetActualName()] = - &cmGlobalVisualStudio10IA64Generator::New; - this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] = - &cmGlobalVisualStudio10Win64Generator::New; - this->Generators[cmGlobalVisualStudio11Generator::GetActualName()] = - &cmGlobalVisualStudio11Generator::New; - this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] = - &cmGlobalVisualStudio11Win64Generator::New; - this->Generators[cmGlobalVisualStudio11ARMGenerator::GetActualName()] = - &cmGlobalVisualStudio11ARMGenerator::New; - this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] = - &cmGlobalVisualStudio71Generator::New; - this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] = - &cmGlobalVisualStudio8Generator::New; - this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] = - &cmGlobalVisualStudio9Generator::New; - this->Generators[cmGlobalVisualStudio9IA64Generator::GetActualName()] = - &cmGlobalVisualStudio9IA64Generator::New; - this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] = - &cmGlobalVisualStudio9Win64Generator::New; - this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] = - &cmGlobalVisualStudio8Win64Generator::New; - this->Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] = - &cmGlobalBorlandMakefileGenerator::New; - this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] = - &cmGlobalNMakeMakefileGenerator::New; - this->Generators[cmGlobalJOMMakefileGenerator::GetActualName()] = - &cmGlobalJOMMakefileGenerator::New; - this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] = - &cmGlobalWatcomWMakeGenerator::New; + this->Generators.push_back( + cmGlobalVisualStudio6Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio7Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio10Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio11Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio71Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio8Generator::NewFactory()); + this->Generators.push_back( + cmGlobalVisualStudio9Generator::NewFactory()); + this->Generators.push_back( + cmGlobalBorlandMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalNMakeMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalJOMMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalWatcomWMakeGenerator::NewFactory()); # endif - this->Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] = - &cmGlobalMSYSMakefileGenerator::New; - this->Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] = - &cmGlobalMinGWMakefileGenerator::New; + this->Generators.push_back( + cmGlobalMSYSMakefileGenerator::NewFactory()); + this->Generators.push_back( + cmGlobalMinGWMakefileGenerator::NewFactory()); #endif - this->Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] = - &cmGlobalUnixMakefileGenerator3::New; - this->Generators[cmGlobalNinjaGenerator::GetActualName()] = - &cmGlobalNinjaGenerator::New; + this->Generators.push_back( + cmGlobalUnixMakefileGenerator3::NewFactory()); + this->Generators.push_back( + cmGlobalNinjaGenerator::NewFactory()); #ifdef CMAKE_USE_XCODE - this->Generators[cmGlobalXCodeGenerator::GetActualName()] = - &cmGlobalXCodeGenerator::New; + this->Generators.push_back( + cmGlobalXCodeGenerator::NewFactory()); #endif } @@ -2712,17 +2703,15 @@ void cmake::GetPropertiesDocumentation(std::map<std::string, void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) { - for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin(); - i != this->Generators.end(); ++i) + for(RegisteredGeneratorsVector::const_iterator i = + this->Generators.begin(); i != this->Generators.end(); ++i) { cmDocumentationEntry e; - cmGlobalGenerator* generator = (i->second)(); - generator->GetDocumentation(e); - delete generator; + (*i)->GetDocumentation(e); v.push_back(e); } - for(RegisteredExtraGeneratorsMap::const_iterator - i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) + for(RegisteredExtraGeneratorsMap::const_iterator i = + this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i) { cmDocumentationEntry e; cmExternalMakefileProjectGenerator* generator = (i->second)(); |