From 50759a9ed3f7be7763fbbd6b54a338607ab3a513 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 22 Oct 2009 08:24:11 -0400 Subject: [PATCH] WIP: VS 10 Win64 generator See issue #9754. --- Source/CMakeLists.txt | 2 + Source/cmGlobalVisualStudio10Generator.cxx | 3 +- .../cmGlobalVisualStudio10Win64Generator.cxx | 37 +++++++++++++++++++ Source/cmGlobalVisualStudio10Win64Generator.h | 36 ++++++++++++++++++ Source/cmGlobalVisualStudio8Generator.h | 2 + Source/cmLocalVisualStudio10Generator.cxx | 8 ++-- Source/cmVisualStudio10TargetGenerator.cxx | 15 +++++--- Source/cmVisualStudio10TargetGenerator.h | 6 +-- Source/cmake.cxx | 3 ++ 9 files changed, 98 insertions(+), 14 deletions(-) create mode 100644 Source/cmGlobalVisualStudio10Win64Generator.cxx create mode 100644 Source/cmGlobalVisualStudio10Win64Generator.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index d188b11a8..909969139 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -303,6 +303,8 @@ IF (WIN32) cmLocalVisualStudio10Generator.h cmGlobalVisualStudio10Generator.h cmGlobalVisualStudio10Generator.cxx + cmGlobalVisualStudio10Win64Generator.h + cmGlobalVisualStudio10Win64Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmGlobalWatcomWMakeGenerator.cxx diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index b6ae951ef..d90974285 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -37,7 +37,8 @@ void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() { - cmLocalGenerator*lg = new cmLocalVisualStudio10Generator; + cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator; + lg->SetPlatformName(this->PlatformName.c_str()); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx new file mode 100644 index 000000000..0e821c72a --- /dev/null +++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx @@ -0,0 +1,37 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalVisualStudio10Win64Generator.h" +#include "cmMakefile.h" +#include "cmake.h" + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator() +{ + this->PlatformName = "x64"; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio10Win64Generator +::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.Name = this->GetName(); + entry.Brief = "Generates Visual Studio 10 Win64 project files."; + entry.Full = ""; +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio10Win64Generator::EnableLanguage( + std::vector const& lang, cmMakefile *mf, bool optional) +{ + mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); + cmGlobalVisualStudio10Generator::EnableLanguage(lang, mf, optional); +} diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h new file mode 100644 index 000000000..51b68c028 --- /dev/null +++ b/Source/cmGlobalVisualStudio10Win64Generator.h @@ -0,0 +1,36 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGlobalVisualStudio10Win64Generator_h +#define cmGlobalVisualStudio10Win64Generator_h + +#include "cmGlobalVisualStudio10Generator.h" + +class cmGlobalVisualStudio10Win64Generator : + public cmGlobalVisualStudio10Generator +{ +public: + cmGlobalVisualStudio10Win64Generator(); + static cmGlobalGenerator* New() { + return new cmGlobalVisualStudio10Win64Generator; } + + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalVisualStudio10Win64Generator::GetActualName();} + static const char* GetActualName() {return "Visual Studio 10 Win64";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + virtual void EnableLanguage(std::vectorconst& languages, + cmMakefile *, bool optional); +}; +#endif diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 7370ef6f3..9d836bda3 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -38,6 +38,8 @@ public: ///! Create a local generator appropriate to this Global Generator virtual cmLocalGenerator *CreateLocalGenerator(); + std::string const& GetPlatformName() const { return this->PlatformName; } + /** * Override Configure and Generate to add the build-system check * target. diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 382192e05..8df0ffaff 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -13,7 +13,7 @@ #include "cmTarget.h" #include "cmMakefile.h" #include "cmVisualStudio10TargetGenerator.h" -#include "cmGlobalVisualStudio7Generator.h" +#include "cmGlobalVisualStudio10Generator.h" #include #include "cmXMLParser.h" class cmVS10XMLParser : public cmXMLParser @@ -93,9 +93,9 @@ void cmLocalVisualStudio10Generator::Generate() for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) { - cmVisualStudio10TargetGenerator tg(&l->second, - (cmGlobalVisualStudio7Generator*) - this->GetGlobalGenerator()); + cmVisualStudio10TargetGenerator tg( + &l->second, static_cast( + this->GetGlobalGenerator())); tg.Generate(); } this->WriteStampFiles(); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 74a6df4e2..e1c1fba42 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -10,7 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmVisualStudio10TargetGenerator.h" -#include "cmGlobalVisualStudio7Generator.h" +#include "cmGlobalVisualStudio10Generator.h" #include "cmTarget.h" #include "cmComputeLinkInformation.h" #include "cmGeneratedFileStream.h" @@ -32,7 +32,7 @@ static std::string cmVS10EscapeXML(std::string arg) cmVisualStudio10TargetGenerator:: cmVisualStudio10TargetGenerator(cmTarget* target, - cmGlobalVisualStudio7Generator* gg) + cmGlobalVisualStudio10Generator* gg) { this->GlobalGenerator = gg; this->Target = target; @@ -43,7 +43,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->Name = this->Target->GetName(); this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); - this->Platform = "|Win32"; + this->Platform = gg->GetPlatformName(); this->ComputeObjectNames(); this->BuildFileStream = 0; } @@ -80,7 +80,7 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag( (*stream ) << ""; (*stream ) << "<" << tag << " Condition=\"'$(Configuration)|$(Platform)'=='"; - (*stream ) << config << this->Platform << "'\""; + (*stream ) << config << "|" << this->Platform << "'\""; if(attribute) { (*stream ) << attribute; @@ -141,6 +141,8 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteString("\n", 2); this->WriteString("\n", 2); this->WriteString("Win32Proj\n", 2); + this->WriteString("", 2); + (*this->BuildFileStream) << this->Platform << "\n"; this->WriteString("\n", 1); this->WriteString("\n", @@ -187,10 +189,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() i != configs->end(); ++i) { this->WriteString("BuildFileStream ) << *i << this->Platform << "\">\n"; + (*this->BuildFileStream ) << *i << "|" << this->Platform << "\">\n"; this->WriteString("", 3); (*this->BuildFileStream ) << *i << "\n"; - this->WriteString("Win32\n", 3); + this->WriteString("", 3); + (*this->BuildFileStream) << this->Platform << "\n"; this->WriteString("\n", 2); } this->WriteString("\n", 1); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 127554f9b..f70a06696 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -16,7 +16,7 @@ class cmTarget; class cmMakefile; class cmGeneratedFileStream; -class cmGlobalVisualStudio7Generator; +class cmGlobalVisualStudio10Generator; class cmSourceFile; class cmCustomCommand; class cmLocalVisualStudio7Generator; @@ -27,7 +27,7 @@ class cmVisualStudio10TargetGenerator { public: cmVisualStudio10TargetGenerator(cmTarget* target, - cmGlobalVisualStudio7Generator* gg); + cmGlobalVisualStudio10Generator* gg); ~cmVisualStudio10TargetGenerator(); void Generate(); // used by cmVisualStudioGeneratorOptions @@ -82,7 +82,7 @@ private: std::string Platform; std::string GUID; std::string Name; - cmGlobalVisualStudio7Generator* GlobalGenerator; + cmGlobalVisualStudio10Generator* GlobalGenerator; cmGeneratedFileStream* BuildFileStream; cmLocalVisualStudio7Generator* LocalGenerator; std::set SourcesVisited; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a40d89e10..b9162bbe0 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -63,6 +63,7 @@ # include "cmGlobalVisualStudio9Generator.h" # include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio10Generator.h" +# include "cmGlobalVisualStudio10Win64Generator.h" # include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" @@ -2364,6 +2365,8 @@ void cmake::AddDefaultGenerators() &cmGlobalVisualStudio7Generator::New; this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] = &cmGlobalVisualStudio10Generator::New; + this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] = + &cmGlobalVisualStudio10Win64Generator::New; this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] = &cmGlobalVisualStudio71Generator::New; this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =