From 7a526c35f60ced43606bf028a21dedfaac77c2e9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 17 Jul 2014 16:58:34 -0400 Subject: VS: Delay getting platform name in local generator Ask the global generator during generation instead of trying to store it up front. Later the global generator may not know the platform name when it is creating the local generator. --- Source/cmGlobalVisualStudio10Generator.cxx | 1 - Source/cmGlobalVisualStudio11Generator.cxx | 1 - Source/cmGlobalVisualStudio12Generator.cxx | 1 - Source/cmGlobalVisualStudio14Generator.cxx | 1 - Source/cmGlobalVisualStudio8Generator.cxx | 1 - Source/cmGlobalVisualStudio9Generator.cxx | 1 - Source/cmLocalVisualStudio7Generator.cxx | 24 ++++++++++++++++-------- Source/cmLocalVisualStudio7Generator.h | 3 --- 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 043f89d..c1b087a 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -168,7 +168,6 @@ cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10); - lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 0bd51ea..e5a159b 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -147,7 +147,6 @@ cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11); - lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 47c43fa..4235cbc 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -127,7 +127,6 @@ cmLocalGenerator *cmGlobalVisualStudio12Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS12); - lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 076b057..d001f93 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -108,7 +108,6 @@ cmLocalGenerator *cmGlobalVisualStudio14Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14); - lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 1bac322..9fd3d5a 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -126,7 +126,6 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); - lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 00d9179..1d73b5c 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -115,7 +115,6 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator() { cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); - lg->SetPlatformName(this->GetPlatformName()); lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); lg->SetGlobalGenerator(this); return lg; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a6c6e8d..e0fe0fd 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -48,7 +48,6 @@ extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[]; cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v): cmLocalVisualStudioGenerator(v) { - this->PlatformName = "Win32"; this->ExtraFlagTable = 0; this->Internal = new cmLocalVisualStudio7GeneratorInternals(this); } @@ -647,8 +646,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, { mfcFlag = "0"; } + cmGlobalVisualStudio7Generator* gg = + static_cast(this->GlobalGenerator); fout << "\t\tPlatformName << "\"\n" + << "\t\t\tName=\"" << configName + << "|" << gg->GetPlatformName() << "\"\n" << "\t\t\tOutputDirectory=\"" << configName << "\"\n"; // This is an internal type to Visual Studio, it seems that: // 4 == static library @@ -896,11 +898,11 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, } fout << "\"\n"; fout << "\t\t\t\tMkTypLibCompatible=\"false\"\n"; - if( this->PlatformName == "x64" ) + if( gg->GetPlatformName() == "x64" ) { fout << "\t\t\t\tTargetEnvironment=\"3\"\n"; } - else if( this->PlatformName == "ia64" ) + else if( gg->GetPlatformName() == "ia64" ) { fout << "\t\t\t\tTargetEnvironment=\"2\"\n"; } @@ -1640,6 +1642,8 @@ bool cmLocalVisualStudio7Generator std::ostream &fout, const std::string& libName, std::vector *configs) { + cmGlobalVisualStudio7Generator* gg = + static_cast(this->GlobalGenerator); const std::vector &sourceFiles = sg->GetSourceFiles(); std::vector const& children = sg->GetGroupChildren(); @@ -1730,7 +1734,7 @@ bool cmLocalVisualStudio7Generator cmLVS7GFileConfig const& fc = fci->second; fout << "\t\t\t\tfirst - << "|" << this->PlatformName << "\""; + << "|" << gg->GetPlatformName() << "\""; if(fc.ExcludedFromBuild) { fout << " ExcludedFromBuild=\"true\""; @@ -1800,6 +1804,9 @@ WriteCustomRule(std::ostream& fout, const cmCustomCommand& command, FCInfo& fcinfo) { + cmGlobalVisualStudio7Generator* gg = + static_cast(this->GlobalGenerator); + // Write the rule for each configuration. std::vector::iterator i; std::vector *configs = @@ -1820,7 +1827,8 @@ WriteCustomRule(std::ostream& fout, cmCustomCommandGenerator ccg(command, *i, this->Makefile); cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i]; fout << "\t\t\t\tPlatformName << "\">\n"; + fout << "\t\t\t\t\tName=\"" << *i << "|" + << gg->GetPlatformName() << "\">\n"; if(!fc.CompileFlags.empty()) { fout << "\t\t\t\t\t\n" << "\tProjectGUID=\"{" << gg->GetGUID(libName.c_str()) << "}\">\n" << "\t\n" - << "\t\tPlatformName << "\"/>\n" + << "\t\tGetPlatformName() << "\"/>\n" << "\t\n"; } @@ -2085,7 +2093,7 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, } fout << "\tKeyword=\"" << keyword << "\">\n" << "\t\n" - << "\t\tPlatformName << "\"/>\n" + << "\t\tGetPlatformName() << "\"/>\n" << "\t\n"; } diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 6c04559..c2caa26 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -53,8 +53,6 @@ public: */ void SetBuildType(BuildType,const std::string& name); - void SetPlatformName(const std::string& n) { this->PlatformName = n;} - void SetExtraFlagTable(cmVS7FlagTable const* table) { this->ExtraFlagTable = table; } virtual std::string GetTargetDirectory(cmTarget const&) const; @@ -124,7 +122,6 @@ private: std::string ModuleDefinitionFile; bool FortranProject; bool WindowsCEProject; - std::string PlatformName; // Win32 or x64 cmLocalVisualStudio7GeneratorInternals* Internal; }; -- cgit v0.12