View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0009742 | CMake | CMake | public | 2009-10-20 11:50 | 2016-06-10 14:31 | ||||
Reporter | Juan Jesus Garcia de Soria | ||||||||
Assigned To | Bill Hoffman | ||||||||
Priority | normal | Severity | feature | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-8 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0009742: [w/PATCH] Enhance include_external_msproject so that it can use C# and VB.NET projects. | ||||||||
Description | Currently it seems that CMake can include external pre-existing projects by using the command include_external_msproject(). It seems, however, restricted to .vcproj (C/C++ projects). In my organization we are looking into using CMake for our building needs, but in Windows we tend to mix C++ with .NET via C++/CLI. This forces us to include .NET projects in our building scripts. Currently the code has the following shortcomings: * Uses the same project type GUID (the one for .vcproj files) for all referenced external projects. * Fails to find the project instance GUID in .csproj and .vbproj files (the XML is substantially different from .vcproj files). * Fails to map solution configurations. These projects typically have only Debug/Release configurations, and usually use "Any CPU" as the platform, and not Win32/x64. I've attached two patches (one for 2.6.4, another one for 2.8.0-rc3) that somehow fix the above shorcomings. Configuration matching is pretty hardcoded: * Debug -> Debug. * Evertything Else -> Release. * Platform will be "Any CPU" always. But it seems to work up to the point that our developers can edit and build solutions including the three kinds of projects (C/C++, C# and VB.NET). It would be nice if these patches get applied :-) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | cmake_2.8.0-rc3_patch_for_dotnet.diff [^] (12,932 bytes) 2009-10-20 11:50 [Show Content] [Hide Content]diff -ur -x '*.vcproj*' -x '*.sln*' -x '*.cmake*' cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio71Generator.cxx cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio71Generator.cxx --- cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio71Generator.cxx 2009-10-09 16:32:12.000000000 +0200 +++ cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio71Generator.cxx 2009-10-20 17:17:06.431276900 +0200 @@ -248,7 +248,7 @@ const char* location, const std::set<cmStdString>& depends) { - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) @@ -284,18 +284,31 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } diff -ur -x '*.vcproj*' -x '*.sln*' -x '*.cmake*' cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio71Generator.h cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio71Generator.h --- cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio71Generator.h 2009-10-09 16:32:12.000000000 +0200 +++ cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio71Generator.h 2009-10-20 16:53:00.739434500 +0200 @@ -64,7 +64,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, diff -ur -x '*.vcproj*' -x '*.sln*' -x '*.cmake*' cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio7Generator.cxx cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio7Generator.cxx --- cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio7Generator.cxx 2009-10-09 16:32:12.000000000 +0200 +++ cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio7Generator.cxx 2009-10-20 17:21:30.571471100 +0200 @@ -249,7 +249,8 @@ if(expath) { this->WriteProjectConfigurations(fout, target->GetName(), - true); + true, + this->IsExternalProjectForAnyCPU(expath)); } else { @@ -260,7 +261,7 @@ if (vcprojName) { this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + partOfDefaultBuild, false); } } } @@ -482,22 +483,62 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } +const char* cmGlobalVisualStudio7Generator::GetExternalProjectExtension(const char* location) { + const char* res = strrchr(location, '.'); + return res ? res : ""; +} + +bool cmGlobalVisualStudio7Generator::IsExternalProjectForAnyCPU(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + return (strcmp(".vbproj", ext) == 0 || strcmp(".csproj", ext) == 0); +} + +const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + if(strcmp(".vbproj", ext) == 0) + { + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; + } + else if(strcmp(".csproj", ext) == 0) + { + return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; + } + else + { + return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; + } +} // Write a dsp file into the SLN file, @@ -508,8 +549,7 @@ const char* location, const std::set<cmStdString>&) { - std::string d = cmSystemTools::ConvertToOutputPath(location); - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) diff -ur -x '*.vcproj*' -x '*.sln*' -x '*.cmake*' cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio7Generator.h cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio7Generator.h --- cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio7Generator.h 2009-10-09 16:32:12.000000000 +0200 +++ cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio7Generator.h 2009-10-20 17:22:57.317352500 +0200 @@ -95,6 +95,15 @@ protected: virtual const char* GetIDEVersion() { return "7.0"; } + ///! Get the GUID for the external project type given by a VS project location. + virtual const char* GetExternalProjectTypeGUID(const char* location); + + ///! Check whether the VS project at the given location must be configured for AnyCPU. + virtual bool IsExternalProjectForAnyCPU(const char* location); + + ///! Get the project extension for an external VS project file. + virtual const char* GetExternalProjectExtension(const char* location); + static cmIDEFlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); @@ -106,7 +115,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual void AddPlatformDefinitions(cmMakefile* mf); diff -ur -x '*.vcproj*' -x '*.sln*' -x '*.cmake*' cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio8Generator.cxx cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio8Generator.cxx --- cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio8Generator.cxx 2009-10-09 16:32:12.000000000 +0200 +++ cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio8Generator.cxx 2009-10-20 16:53:00.801875300 +0200 @@ -271,20 +271,31 @@ void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + std::string projectPlatform = this->PlatformName; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".ActiveCfg = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".Build.0 = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; } } } diff -ur -x '*.vcproj*' -x '*.sln*' -x '*.cmake*' cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio8Generator.h cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio8Generator.h --- cmake-2.8.0-rc3-orig/Source/cmGlobalVisualStudio8Generator.h 2009-10-09 16:32:12.000000000 +0200 +++ cmake-2.8.0-rc3-fixed/Source/cmGlobalVisualStudio8Generator.h 2009-10-20 16:53:00.801875300 +0200 @@ -69,7 +69,8 @@ virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); std::string PlatformName; // Win32 or x64 }; #endif diff -ur -x '*.vcproj*' -x '*.sln*' -x '*.cmake*' cmake-2.8.0-rc3-orig/Source/cmLocalVisualStudio7Generator.cxx cmake-2.8.0-rc3-fixed/Source/cmLocalVisualStudio7Generator.cxx --- cmake-2.8.0-rc3-orig/Source/cmLocalVisualStudio7Generator.cxx 2009-10-09 16:32:12.000000000 +0200 +++ cmake-2.8.0-rc3-fixed/Source/cmLocalVisualStudio7Generator.cxx 2009-10-20 16:53:00.817485500 +0200 @@ -1834,11 +1834,44 @@ class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void CharacterDataHandler(const char* data, int length) { + if(inGuidElement) + { + this->GUID.append(data, length); + } + } + virtual void EndElement(const char* name) + { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = false; + + size_t pos = 0; + size_t len = GUID.size(); + + // Remove leading '{' and trailing '}'... + if(len > 0 && GUID[len - 1] == '}') + { + len--; + } + if(len > 0 && GUID[0] == '{') + { + pos++; + len--; + } + + GUID = GUID.substr(pos, len); + } } virtual void StartElement(const char* name, const char** atts) { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = true; + return; + } + // once the GUID is found do nothing if(this->GUID.size()) { @@ -1868,6 +1901,7 @@ } int InitializeParser() { + inGuidElement = false; int ret = cmXMLParser::InitializeParser(); if(ret == 0) { @@ -1879,6 +1913,9 @@ return 1; } std::string GUID; + +private: + bool inGuidElement; }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( cmake_2.6.4_patch_for_dotnet.diff [^] (12,582 bytes) 2009-10-20 11:50 [Show Content] [Hide Content] diff -ur -x '*.vcproj*' -x '*.dir*' -x '*.cmake*' cmake-2.6.4-orig/Source/cmGlobalVisualStudio71Generator.cxx cmake-2.6.4/Source/cmGlobalVisualStudio71Generator.cxx --- cmake-2.6.4-orig/Source/cmGlobalVisualStudio71Generator.cxx 2009-04-28 15:28:02.000000000 +0200 +++ cmake-2.6.4/Source/cmGlobalVisualStudio71Generator.cxx 2009-10-20 16:39:50.769653300 +0200 @@ -253,7 +253,8 @@ const std::vector<std::string>& depends) { std::cout << "WriteExternalProject vs71\n"; - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) @@ -289,18 +290,31 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } diff -ur -x '*.vcproj*' -x '*.dir*' -x '*.cmake*' cmake-2.6.4-orig/Source/cmGlobalVisualStudio71Generator.h cmake-2.6.4/Source/cmGlobalVisualStudio71Generator.h --- cmake-2.6.4-orig/Source/cmGlobalVisualStudio71Generator.h 2009-04-28 15:28:02.000000000 +0200 +++ cmake-2.6.4/Source/cmGlobalVisualStudio71Generator.h 2009-10-20 13:14:30.544184900 +0200 @@ -68,7 +68,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, diff -ur -x '*.vcproj*' -x '*.dir*' -x '*.cmake*' cmake-2.6.4-orig/Source/cmGlobalVisualStudio7Generator.cxx cmake-2.6.4/Source/cmGlobalVisualStudio7Generator.cxx --- cmake-2.6.4-orig/Source/cmGlobalVisualStudio7Generator.cxx 2009-04-28 15:28:02.000000000 +0200 +++ cmake-2.6.4/Source/cmGlobalVisualStudio7Generator.cxx 2009-10-20 16:39:50.800873700 +0200 @@ -274,8 +274,10 @@ cmCustomCommand cc = target->GetPostBuildCommands()[0]; const cmCustomCommandLines& cmds = cc.GetCommandLines(); std::string project = cmds[0][0]; + std::string location = cmds[0][1]; this->WriteProjectConfigurations(fout, project.c_str(), - true); + true, + this->IsExternalProjectForAnyCPU(location.c_str())); } else { @@ -286,7 +288,7 @@ if (vcprojName) { this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + partOfDefaultBuild, false); } } } @@ -568,22 +570,62 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } +const char* cmGlobalVisualStudio7Generator::GetExternalProjectExtension(const char* location) { + const char* res = strrchr(location, '.'); + return res ? res : ""; +} + +bool cmGlobalVisualStudio7Generator::IsExternalProjectForAnyCPU(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + return (strcmp(".vbproj", ext) == 0 || strcmp(".csproj", ext) == 0); +} + +const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + if(strcmp(".vbproj", ext) == 0) + { + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; + } + else if(strcmp(".csproj", ext) == 0) + { + return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; + } + else + { + return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; + } +} // Write a dsp file into the SLN file, @@ -595,8 +637,8 @@ const std::vector<std::string>&) { std::cout << "WriteExternalProject vs7\n"; - std::string d = cmSystemTools::ConvertToOutputPath(location); - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) diff -ur -x '*.vcproj*' -x '*.dir*' -x '*.cmake*' cmake-2.6.4-orig/Source/cmGlobalVisualStudio7Generator.h cmake-2.6.4/Source/cmGlobalVisualStudio7Generator.h --- cmake-2.6.4-orig/Source/cmGlobalVisualStudio7Generator.h 2009-04-28 15:28:02.000000000 +0200 +++ cmake-2.6.4/Source/cmGlobalVisualStudio7Generator.h 2009-10-20 15:37:55.307900300 +0200 @@ -103,6 +103,15 @@ }; protected: + ///! Get the GUID for the external project type given by a VS project location. + virtual const char* GetExternalProjectTypeGUID(const char* location); + + ///! Check whether the VS project at the given location must be configured for AnyCPU. + virtual bool IsExternalProjectForAnyCPU(const char* location); + + ///! Get the project extension for an external VS project file. + virtual const char* GetExternalProjectExtension(const char* location); + static cmVS7FlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); @@ -114,7 +123,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual void AddPlatformDefinitions(cmMakefile* mf); diff -ur -x '*.vcproj*' -x '*.dir*' -x '*.cmake*' cmake-2.6.4-orig/Source/cmGlobalVisualStudio8Generator.cxx cmake-2.6.4/Source/cmGlobalVisualStudio8Generator.cxx --- cmake-2.6.4-orig/Source/cmGlobalVisualStudio8Generator.cxx 2009-04-28 15:28:02.000000000 +0200 +++ cmake-2.6.4/Source/cmGlobalVisualStudio8Generator.cxx 2009-10-20 16:34:16.024524500 +0200 @@ -303,20 +303,31 @@ void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + std::string projectPlatform = this->PlatformName; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".ActiveCfg = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".Build.0 = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; } } } diff -ur -x '*.vcproj*' -x '*.dir*' -x '*.cmake*' cmake-2.6.4-orig/Source/cmGlobalVisualStudio8Generator.h cmake-2.6.4/Source/cmGlobalVisualStudio8Generator.h --- cmake-2.6.4-orig/Source/cmGlobalVisualStudio8Generator.h 2009-04-28 15:28:02.000000000 +0200 +++ cmake-2.6.4/Source/cmGlobalVisualStudio8Generator.h 2009-10-20 13:01:31.782527300 +0200 @@ -75,7 +75,8 @@ virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); std::string PlatformName; // Win32 or x64 }; #endif diff -ur -x '*.vcproj*' -x '*.dir*' -x '*.cmake*' cmake-2.6.4-orig/Source/cmLocalVisualStudio7Generator.cxx cmake-2.6.4/Source/cmLocalVisualStudio7Generator.cxx --- cmake-2.6.4-orig/Source/cmLocalVisualStudio7Generator.cxx 2009-04-28 15:28:04.000000000 +0200 +++ cmake-2.6.4/Source/cmLocalVisualStudio7Generator.cxx 2009-10-20 11:33:55.781356700 +0200 @@ -1907,11 +1907,44 @@ class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void CharacterDataHandler(const char* data, int length) { + if(inGuidElement) + { + this->GUID.append(data, length); + } + } + virtual void EndElement(const char* name) + { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = false; + + size_t pos = 0; + size_t len = GUID.size(); + + // Remove leading '{' and trailing '}'... + if(len > 0 && GUID[len - 1] == '}') + { + len--; + } + if(len > 0 && GUID[0] == '{') + { + pos++; + len--; + } + + GUID = GUID.substr(pos, len); + } } virtual void StartElement(const char* name, const char** atts) { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = true; + return; + } + // once the GUID is found do nothing if(this->GUID.size()) { @@ -1941,6 +1974,7 @@ } int InitializeParser() { + inGuidElement = false; int ret = cmXMLParser::InitializeParser(); if(ret == 0) { @@ -1952,6 +1986,9 @@ return 1; } std::string GUID; + +private: + bool inGuidElement; }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( cmake_2.8.0_patch_for_dotnet_v2.diff [^] (13,114 bytes) 2009-11-19 05:37 [Show Content] [Hide Content] diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio71Generator.cxx cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.cxx --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio71Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.cxx 2009-11-18 18:43:07.144850700 +0100 @@ -248,7 +248,7 @@ const char* location, const std::set<cmStdString>& depends) { - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) @@ -284,18 +284,31 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio71Generator.h cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.h --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio71Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.h 2009-11-18 18:43:07.144850700 +0100 @@ -64,7 +64,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio7Generator.cxx cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.cxx --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio7Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.cxx 2009-11-18 18:43:07.160476000 +0100 @@ -249,7 +249,8 @@ if(expath) { this->WriteProjectConfigurations(fout, target->GetName(), - true); + true, + this->IsExternalProjectForAnyCPU(expath)); } else { @@ -260,7 +261,7 @@ if (vcprojName) { this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + partOfDefaultBuild, false); } } } @@ -482,22 +483,62 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } +const char* cmGlobalVisualStudio7Generator::GetExternalProjectExtension(const char* location) { + const char* res = strrchr(location, '.'); + return res ? res : ""; +} + +bool cmGlobalVisualStudio7Generator::IsExternalProjectForAnyCPU(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + return (strcmp(".vbproj", ext) == 0 || strcmp(".csproj", ext) == 0); +} + +const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + if(strcmp(".vbproj", ext) == 0) + { + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; + } + else if(strcmp(".csproj", ext) == 0) + { + return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; + } + else + { + return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; + } +} // Write a dsp file into the SLN file, @@ -508,8 +549,7 @@ const char* location, const std::set<cmStdString>&) { - std::string d = cmSystemTools::ConvertToOutputPath(location); - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio7Generator.h cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.h --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio7Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.h 2009-11-18 18:43:07.160476000 +0100 @@ -99,6 +99,15 @@ protected: virtual const char* GetIDEVersion() { return "7.0"; } + ///! Get the GUID for the external project type given by a VS project location. + virtual const char* GetExternalProjectTypeGUID(const char* location); + + ///! Check whether the VS project at the given location must be configured for AnyCPU. + virtual bool IsExternalProjectForAnyCPU(const char* location); + + ///! Get the project extension for an external VS project file. + virtual const char* GetExternalProjectExtension(const char* location); + static cmIDEFlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); @@ -110,7 +119,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual void AddPlatformDefinitions(cmMakefile* mf); diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio8Generator.cxx cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.cxx --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio8Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.cxx 2009-11-18 18:43:07.191726600 +0100 @@ -262,20 +262,31 @@ void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + std::string projectPlatform = this->PlatformName; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".ActiveCfg = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".Build.0 = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; } } } diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio8Generator.h cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.h --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio8Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.h 2009-11-18 18:43:07.191726600 +0100 @@ -77,7 +77,8 @@ virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); std::string PlatformName; // Win32 or x64 }; #endif diff -ur cmake-2.8.0-orig/Source/cmLocalVisualStudio7Generator.cxx cmake-2.8.0/Source/cmLocalVisualStudio7Generator.cxx --- cmake-2.8.0-orig/Source/cmLocalVisualStudio7Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmLocalVisualStudio7Generator.cxx 2009-11-19 10:38:17.516976100 +0100 @@ -678,6 +678,16 @@ << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; + // Check wheter we have to activate CLR support. + if(const char* clrFlag = target.GetProperty("CLR_FLAG")) + { + // We have to disable BasicRuntimeChecks if CLR_FLAG is not "0". + if(strcmp("0", clrFlag) != 0) + { + targetOptions.AddFlag("BasicRuntimeChecks", "0"); + } + fout << "\t\t\tManagedExtensions=\"" << clrFlag << "\"\n"; + } // If unicode is enabled change the character set to unicode, if not // then default to MBCS. if(targetOptions.UsingUnicode()) @@ -1845,11 +1855,44 @@ class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void CharacterDataHandler(const char* data, int length) { + if(inGuidElement) + { + this->GUID.append(data, length); + } + } + virtual void EndElement(const char* name) + { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = false; + + size_t pos = 0; + size_t len = GUID.size(); + + // Remove leading '{' and trailing '}'... + if(len > 0 && GUID[len - 1] == '}') + { + len--; + } + if(len > 0 && GUID[0] == '{') + { + pos++; + len--; + } + + GUID = GUID.substr(pos, len); + } } virtual void StartElement(const char* name, const char** atts) { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = true; + return; + } + // once the GUID is found do nothing if(this->GUID.size()) { @@ -1879,6 +1922,7 @@ } int InitializeParser() { + inGuidElement = false; int ret = cmXMLParser::InitializeParser(); if(ret == 0) { @@ -1890,6 +1934,9 @@ return 1; } std::string GUID; + +private: + bool inGuidElement; }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( cmake_2.8.0_patch_for_dotnet_v3.diff [^] (13,204 bytes) 2009-11-20 10:10 [Show Content] [Hide Content] diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio71Generator.cxx cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.cxx --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio71Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.cxx 2009-11-18 18:43:07.144850700 +0100 @@ -248,7 +248,7 @@ const char* location, const std::set<cmStdString>& depends) { - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) @@ -284,18 +284,31 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio71Generator.h cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.h --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio71Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.h 2009-11-18 18:43:07.144850700 +0100 @@ -64,7 +64,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio7Generator.cxx cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.cxx --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio7Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.cxx 2009-11-18 18:43:07.160476000 +0100 @@ -249,7 +249,8 @@ if(expath) { this->WriteProjectConfigurations(fout, target->GetName(), - true); + true, + this->IsExternalProjectForAnyCPU(expath)); } else { @@ -260,7 +261,7 @@ if (vcprojName) { this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + partOfDefaultBuild, false); } } } @@ -482,22 +483,62 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } +const char* cmGlobalVisualStudio7Generator::GetExternalProjectExtension(const char* location) { + const char* res = strrchr(location, '.'); + return res ? res : ""; +} + +bool cmGlobalVisualStudio7Generator::IsExternalProjectForAnyCPU(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + return (strcmp(".vbproj", ext) == 0 || strcmp(".csproj", ext) == 0); +} + +const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + if(strcmp(".vbproj", ext) == 0) + { + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; + } + else if(strcmp(".csproj", ext) == 0) + { + return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; + } + else + { + return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; + } +} // Write a dsp file into the SLN file, @@ -508,8 +549,7 @@ const char* location, const std::set<cmStdString>&) { - std::string d = cmSystemTools::ConvertToOutputPath(location); - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio7Generator.h cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.h --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio7Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.h 2009-11-18 18:43:07.160476000 +0100 @@ -99,6 +99,15 @@ protected: virtual const char* GetIDEVersion() { return "7.0"; } + ///! Get the GUID for the external project type given by a VS project location. + virtual const char* GetExternalProjectTypeGUID(const char* location); + + ///! Check whether the VS project at the given location must be configured for AnyCPU. + virtual bool IsExternalProjectForAnyCPU(const char* location); + + ///! Get the project extension for an external VS project file. + virtual const char* GetExternalProjectExtension(const char* location); + static cmIDEFlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); @@ -110,7 +119,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual void AddPlatformDefinitions(cmMakefile* mf); diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio8Generator.cxx cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.cxx --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio8Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.cxx 2009-11-18 18:43:07.191726600 +0100 @@ -262,20 +262,31 @@ void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + std::string projectPlatform = this->PlatformName; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".ActiveCfg = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".Build.0 = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; } } } diff -ur cmake-2.8.0-orig/Source/cmGlobalVisualStudio8Generator.h cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.h --- cmake-2.8.0-orig/Source/cmGlobalVisualStudio8Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.h 2009-11-18 18:43:07.191726600 +0100 @@ -77,7 +77,8 @@ virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); std::string PlatformName; // Win32 or x64 }; #endif diff -ur cmake-2.8.0-orig/Source/cmLocalVisualStudio7Generator.cxx cmake-2.8.0/Source/cmLocalVisualStudio7Generator.cxx --- cmake-2.8.0-orig/Source/cmLocalVisualStudio7Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0/Source/cmLocalVisualStudio7Generator.cxx 2009-11-20 15:47:15.939967100 +0100 @@ -678,6 +678,17 @@ << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; + // Check wheter we have to activate CLR support. + if(const char* clrFlag = target.GetProperty("CLR_FLAG")) + { + // We have to disable BasicRuntimeChecks and set ExceptionHandling to 3 if CLR_FLAG is not "0". + if(strcmp("0", clrFlag) != 0) + { + targetOptions.AddFlag("BasicRuntimeChecks", "0"); + targetOptions.AddFlag("ExceptionHandling", "3"); + } + fout << "\t\t\tManagedExtensions=\"" << clrFlag << "\"\n"; + } // If unicode is enabled change the character set to unicode, if not // then default to MBCS. if(targetOptions.UsingUnicode()) @@ -1845,11 +1856,44 @@ class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void CharacterDataHandler(const char* data, int length) { + if(inGuidElement) + { + this->GUID.append(data, length); + } + } + virtual void EndElement(const char* name) + { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = false; + + size_t pos = 0; + size_t len = GUID.size(); + + // Remove leading '{' and trailing '}'... + if(len > 0 && GUID[len - 1] == '}') + { + len--; + } + if(len > 0 && GUID[0] == '{') + { + pos++; + len--; + } + + GUID = GUID.substr(pos, len); + } } virtual void StartElement(const char* name, const char** atts) { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = true; + return; + } + // once the GUID is found do nothing if(this->GUID.size()) { @@ -1879,6 +1923,7 @@ } int InitializeParser() { + inGuidElement = false; int ret = cmXMLParser::InitializeParser(); if(ret == 0) { @@ -1890,6 +1935,9 @@ return 1; } std::string GUID; + +private: + bool inGuidElement; }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( cmake_2.8.0_patch_for_dotnet_v4.diff [^] (14,506 bytes) 2010-02-11 04:15 [Show Content] [Hide Content] diff -ur --strip-trailing-cr cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.cxx cmake-2.8.0_new/Source/cmGlobalVisualStudio71Generator.cxx --- cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0_new/Source/cmGlobalVisualStudio71Generator.cxx 2010-02-09 11:50:12.100697600 +0100 @@ -248,7 +248,7 @@ const char* location, const std::set<cmStdString>& depends) { - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) @@ -284,18 +284,31 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } diff -ur --strip-trailing-cr cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.h cmake-2.8.0_new/Source/cmGlobalVisualStudio71Generator.h --- cmake-2.8.0/Source/cmGlobalVisualStudio71Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0_new/Source/cmGlobalVisualStudio71Generator.h 2010-02-09 11:50:12.100697600 +0100 @@ -64,7 +64,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, diff -ur --strip-trailing-cr cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.cxx cmake-2.8.0_new/Source/cmGlobalVisualStudio7Generator.cxx --- cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0_new/Source/cmGlobalVisualStudio7Generator.cxx 2010-02-09 11:50:12.116322700 +0100 @@ -249,7 +249,8 @@ if(expath) { this->WriteProjectConfigurations(fout, target->GetName(), - true); + true, + this->IsExternalProjectForAnyCPU(expath)); } else { @@ -260,7 +261,7 @@ if (vcprojName) { this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + partOfDefaultBuild, false); } } } @@ -482,22 +483,62 @@ // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } +const char* cmGlobalVisualStudio7Generator::GetExternalProjectExtension(const char* location) { + const char* res = strrchr(location, '.'); + return res ? res : ""; +} + +bool cmGlobalVisualStudio7Generator::IsExternalProjectForAnyCPU(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + return (strcmp(".vbproj", ext) == 0 || strcmp(".csproj", ext) == 0); +} + +const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + if(strcmp(".vbproj", ext) == 0) + { + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; + } + else if(strcmp(".csproj", ext) == 0) + { + return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; + } + else + { + return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; + } +} // Write a dsp file into the SLN file, @@ -508,8 +549,7 @@ const char* location, const std::set<cmStdString>&) { - std::string d = cmSystemTools::ConvertToOutputPath(location); - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) diff -ur --strip-trailing-cr cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.h cmake-2.8.0_new/Source/cmGlobalVisualStudio7Generator.h --- cmake-2.8.0/Source/cmGlobalVisualStudio7Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0_new/Source/cmGlobalVisualStudio7Generator.h 2010-02-09 11:50:12.116322700 +0100 @@ -99,6 +99,15 @@ protected: virtual const char* GetIDEVersion() { return "7.0"; } + ///! Get the GUID for the external project type given by a VS project location. + virtual const char* GetExternalProjectTypeGUID(const char* location); + + ///! Check whether the VS project at the given location must be configured for AnyCPU. + virtual bool IsExternalProjectForAnyCPU(const char* location); + + ///! Get the project extension for an external VS project file. + virtual const char* GetExternalProjectExtension(const char* location); + static cmIDEFlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); @@ -110,7 +119,8 @@ const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual void AddPlatformDefinitions(cmMakefile* mf); diff -ur --strip-trailing-cr cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.cxx cmake-2.8.0_new/Source/cmGlobalVisualStudio8Generator.cxx --- cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0_new/Source/cmGlobalVisualStudio8Generator.cxx 2010-02-09 11:50:12.131947800 +0100 @@ -262,20 +262,31 @@ void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + std::string projectPlatform = this->PlatformName; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".ActiveCfg = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i << "|" << this->PlatformName << ".Build.0 = " - << *i << "|" << this->PlatformName << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; } } } diff -ur --strip-trailing-cr cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.h cmake-2.8.0_new/Source/cmGlobalVisualStudio8Generator.h --- cmake-2.8.0/Source/cmGlobalVisualStudio8Generator.h 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0_new/Source/cmGlobalVisualStudio8Generator.h 2010-02-09 11:50:12.131947800 +0100 @@ -77,7 +77,8 @@ virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); std::string PlatformName; // Win32 or x64 }; #endif diff -ur --strip-trailing-cr cmake-2.8.0/Source/cmLocalVisualStudio7Generator.cxx cmake-2.8.0_new/Source/cmLocalVisualStudio7Generator.cxx --- cmake-2.8.0/Source/cmLocalVisualStudio7Generator.cxx 2009-11-13 12:58:00.000000000 +0100 +++ cmake-2.8.0_new/Source/cmLocalVisualStudio7Generator.cxx 2010-02-10 18:54:51.357855300 +0100 @@ -678,6 +678,17 @@ << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; + // Check wheter we have to activate CLR support. + if(const char* clrFlag = target.GetProperty("CLR_FLAG")) + { + // We have to disable BasicRuntimeChecks and set ExceptionHandling to 3 if CLR_FLAG is not "0". + if(strcmp("0", clrFlag) != 0) + { + targetOptions.AddFlag("BasicRuntimeChecks", "0"); + targetOptions.AddFlag("ExceptionHandling", "3"); + } + fout << "\t\t\tManagedExtensions=\"" << clrFlag << "\"\n"; + } // If unicode is enabled change the character set to unicode, if not // then default to MBCS. if(targetOptions.UsingUnicode()) @@ -1220,6 +1231,7 @@ std::string CompileDefsConfig; std::string AdditionalDeps; bool ExcludedFromBuild; + bool ForceNativeCompilation; }; class cmLocalVisualStudio7GeneratorFCInfo @@ -1332,6 +1344,31 @@ } } + // Setup exclusions from managed compilation if it's not a ExcludedFromBuild file. + fc.ForceNativeCompilation = false; + if(lang && strcmp("CXX", lang) == 0) + { + if(const char* globalClrFlag = target.GetProperty("CLR_FLAG")) + { + if(strcmp("0", globalClrFlag) != 0) + { + // By default when globalClrFlag is activated all files will be native + fc.ForceNativeCompilation = true; + if(const char* localClrFlag = sf.GetProperty("CLR_FLAG")) + { + if(strcmp("0", localClrFlag) != 0) + { + // If globalClrFlag is activated and fileFlag too, we enable manage compilation + fc.ForceNativeCompilation = false; + } + } + } + } + if(fc.ForceNativeCompilation) + { + needfc = true; + } + } if(needfc) { this->FileConfigMap[*i] = fc; @@ -1485,7 +1522,11 @@ { fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" << fc.ObjectName.c_str() << "\"\n"; - } + } + if(fc.ForceNativeCompilation) + { + fout << "\t\t\t\t\tCompileAsManaged=\"0\"\n"; + } fout << "\t\t\t\t\t/>\n" << "\t\t\t\t</FileConfiguration>\n"; } @@ -1845,11 +1886,44 @@ class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void CharacterDataHandler(const char* data, int length) { + if(inGuidElement) + { + this->GUID.append(data, length); + } + } + virtual void EndElement(const char* name) + { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = false; + + size_t pos = 0; + size_t len = GUID.size(); + + // Remove leading '{' and trailing '}'... + if(len > 0 && GUID[len - 1] == '}') + { + len--; + } + if(len > 0 && GUID[0] == '{') + { + pos++; + len--; + } + + GUID = GUID.substr(pos, len); + } } virtual void StartElement(const char* name, const char** atts) { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = true; + return; + } + // once the GUID is found do nothing if(this->GUID.size()) { @@ -1879,6 +1953,7 @@ } int InitializeParser() { + inGuidElement = false; int ret = cmXMLParser::InitializeParser(); if(ret == 0) { @@ -1890,6 +1965,9 @@ return 1; } std::string GUID; + +private: + bool inGuidElement; }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( managed_include_external_msproject.diff [^] (3,107 bytes) 2011-03-02 02:58 [Show Content] [Hide Content] diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index adb5f2f..5fdae6b 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -243,7 +243,7 @@ void cmGlobalVisualStudio71Generator const char* location, const std::set<cmStdString>& depends) { - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 51b8918..0402bfe 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -595,7 +595,33 @@ void cmGlobalVisualStudio7Generator } } +const char* cmGlobalVisualStudio7Generator::GetExternalProjectExtension(const char* location) { + const char* res = strrchr(location, '.'); + return res ? res : ""; +} + +bool cmGlobalVisualStudio7Generator::IsExternalProjectForAnyCPU(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + return (strcmp(".vbproj", ext) == 0 || strcmp(".csproj", ext) == 0); +} +const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + if(strcmp(".vbproj", ext) == 0) + { + return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; + } + else if(strcmp(".csproj", ext) == 0) + { + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; + } + else + { + return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; + } +} // Write a dsp file into the SLN file, // Note, that dependencies from executables to @@ -606,8 +632,7 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout, const std::set<cmStdString>&) { std::string d = cmSystemTools::ConvertToOutputPath(location); - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" - << name << "\", \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) << "}\"\n"; diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index b6c84e8..fef146d 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -97,6 +97,10 @@ public: virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; } protected: + virtual const char* GetExternalProjectTypeGUID(const char* location); + virtual bool IsExternalProjectForAnyCPU(const char* location); + virtual const char* GetExternalProjectExtension(const char* location); + virtual const char* GetIDEVersion() { return "7.0"; } static cmIDEFlagTable const* GetExtraFlagTableVS7(); 0001-ms-external-project-.NET-project-support.patch [^] (16,108 bytes) 2011-05-09 09:10 [Show Content] [Hide Content] From 3050fdb475a32a5b31f55b92d777ad212563e3d7 Mon Sep 17 00:00:00 2001 From: be <be@ipetronik.com> Date: Mon, 9 May 2011 15:02:23 +0200 Subject: [PATCH] ms external project .NET project support. --- Source/cmGlobalVisualStudio71Generator.cxx | 29 ++++++-- Source/cmGlobalVisualStudio71Generator.h | 3 +- Source/cmGlobalVisualStudio7Generator.cxx | 51 ++++++++++++-- Source/cmGlobalVisualStudio7Generator.h | 14 +++- Source/cmGlobalVisualStudio8Generator.cxx | 18 ++++- Source/cmGlobalVisualStudio8Generator.h | 3 +- Source/cmLocalVisualStudio7Generator.cxx | 104 ++++++++++++++++++++++++---- 7 files changed, 189 insertions(+), 33 deletions(-) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index adb5f2f..e84adef 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -243,7 +243,7 @@ void cmGlobalVisualStudio71Generator const char* location, const std::set<cmStdString>& depends) { - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) @@ -278,21 +278,34 @@ void cmGlobalVisualStudio71Generator // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator -::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); - i != this->Configurations.end(); ++i) + i != this->Configurations.end(); ++i) + { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) - { + { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; - } + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } + } } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 81c2087..992546f 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -64,7 +64,8 @@ protected: const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 51b8918..4b52e96 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -250,7 +250,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( if(expath) { this->WriteProjectConfigurations(fout, target->GetName(), - true); + true, + this->IsExternalProjectForAnyCPU(expath)); } else { @@ -261,7 +262,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( if (vcprojName) { this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + partOfDefaultBuild, false); } } } @@ -579,22 +580,62 @@ cmGlobalVisualStudio7Generator // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } +const char* cmGlobalVisualStudio7Generator::GetExternalProjectExtension(const char* location) { + const char* res = strrchr(location, '.'); + return res ? res : ""; +} + +bool cmGlobalVisualStudio7Generator::IsExternalProjectForAnyCPU(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + return (strcmp(".vbproj", ext) == 0 || strcmp(".csproj", ext) == 0); +} + +const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + if(strcmp(".vbproj", ext) == 0) + { + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; + } + else if(strcmp(".csproj", ext) == 0) + { + return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; + } + else + { + return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; + } +} // Write a dsp file into the SLN file, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index b6c84e8..1ba5896 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -99,6 +99,15 @@ public: protected: virtual const char* GetIDEVersion() { return "7.0"; } + ///! Get the GUID for the external project type given by a VS project location. + virtual const char* GetExternalProjectTypeGUID(const char* location); + + ///! Check whether the VS project at the given location must be configured for AnyCPU. + virtual bool IsExternalProjectForAnyCPU(const char* location); + + ///! Get the project extension for an external VS project file. + virtual const char* GetExternalProjectExtension(const char* location); + static cmIDEFlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); @@ -109,8 +118,9 @@ protected: virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, - const char* name, - bool partOfDefaultBuild); + const char* name, + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget* target); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ef723b7..8d00bfd 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -270,20 +270,32 @@ cmGlobalVisualStudio8Generator void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + std::string projectPlatform = this->GetPlatformName(); + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } + fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".ActiveCfg = " - << *i << "|" << this->GetPlatformName() << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".Build.0 = " - << *i << "|" << this->GetPlatformName() << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; } } } diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index e0913ed..cae275b 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -77,7 +77,8 @@ protected: virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 58bae1c..7d93cbd 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -725,6 +725,17 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; + // Check wheter we have to activate CLR support. + if(const char* clrFlag = target.GetProperty("CLR_FLAG")) + { + // We have to disable BasicRuntimeChecks and set ExceptionHandling to 3 if CLR_FLAG is not "0". + if(strcmp("0", clrFlag) != 0) + { + targetOptions.AddFlag("BasicRuntimeChecks", "0"); + targetOptions.AddFlag("ExceptionHandling", "3"); + } + fout << "\t\t\tManagedExtensions=\"" << clrFlag << "\"\n"; + } // If unicode is enabled change the character set to unicode, if not // then default to MBCS. if(targetOptions.UsingUnicode()) @@ -1290,6 +1301,7 @@ struct cmLVS7GFileConfig std::string CompileDefsConfig; std::string AdditionalDeps; bool ExcludedFromBuild; + bool ForceNativeCompilation; }; class cmLocalVisualStudio7GeneratorFCInfo @@ -1402,6 +1414,32 @@ cmLocalVisualStudio7GeneratorFCInfo } } + // Setup exclusions from managed compilation if it's not a ExcludedFromBuild file. + fc.ForceNativeCompilation = false; + if(lang && strcmp("CXX", lang) == 0) + { + if(const char* globalClrFlag = target.GetProperty("CLR_FLAG")) + { + if(strcmp("0", globalClrFlag) != 0) + { + // By default when globalClrFlag is activated all files will be native + fc.ForceNativeCompilation = true; + if(const char* localClrFlag = sf.GetProperty("CLR_FLAG")) + { + if(strcmp("0", localClrFlag) != 0) + { + // If globalClrFlag is activated and fileFlag too, we enable manage compilation + fc.ForceNativeCompilation = false; + } + } + } + } + if(fc.ForceNativeCompilation) + { + needfc = true; + } + } + if(needfc) { this->FileConfigMap[*i] = fc; @@ -1550,26 +1588,30 @@ void cmLocalVisualStudio7Generator fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n"); fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); fileOptions.OutputPreprocessorDefinitions(fout, - "\t\t\t\t\t", "\n", - lang); - } + "\t\t\t\t\t", "\n", + lang); + } if(!fc.AdditionalDeps.empty()) - { + { fout << "\t\t\t\t\tAdditionalDependencies=\"" - << fc.AdditionalDeps.c_str() << "\"\n"; - } + << fc.AdditionalDeps.c_str() << "\"\n"; + } if(!fc.ObjectName.empty()) - { + { fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" - << fc.ObjectName.c_str() << "\"\n"; - } - fout << "\t\t\t\t\t/>\n" - << "\t\t\t\t</FileConfiguration>\n"; + << fc.ObjectName.c_str() << "\"\n"; + } + if(fc.ForceNativeCompilation) + { + fout << "\t\t\t\t\tCompileAsManaged=\"0\"\n"; } + fout << "\t\t\t\t\t/>\n" + << "\t\t\t\t</FileConfiguration>\n"; } - fout << "\t\t\t</File>\n"; } + fout << "\t\t\t</File>\n"; } + } std::vector<cmSourceGroup> const& children = sg->GetGroupChildren(); @@ -1927,11 +1969,43 @@ std::string cmLocalVisualStudio7Generator class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void CharacterDataHandler(const char* data, int length) + { + if(inGuidElement) { + this->GUID.append(data, length); + } + } + virtual void EndElement(const char* name) + { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = false; + + size_t pos = 0; + size_t len = GUID.size(); + + // Remove leading '{' and trailing '}'... + if(len > 0 && GUID[len - 1] == '}') + { + len--; + } + if(len > 0 && GUID[0] == '{') + { + pos++; + len--; + } + + GUID = GUID.substr(pos, len); } + } virtual void StartElement(const char* name, const char** atts) { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = true; + return; + } // once the GUID is found do nothing if(this->GUID.size()) { @@ -1961,6 +2035,7 @@ public: } int InitializeParser() { + inGuidElement = false; int ret = cmXMLParser::InitializeParser(); if(ret == 0) { @@ -1972,6 +2047,9 @@ public: return 1; } std::string GUID; + +private: + bool inGuidElement; }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( -- 1.7.3.1.msysgit.0 0001-ms-external-project-.NET-project-support-GUID-fixed.patch [^] (16,108 bytes) 2011-05-16 02:18 [Show Content] [Hide Content] From 3050fdb475a32a5b31f55b92d777ad212563e3d7 Mon Sep 17 00:00:00 2001 From: be <be@ipetronik.com> Date: Mon, 9 May 2011 15:02:23 +0200 Subject: [PATCH] ms external project .NET project support. --- Source/cmGlobalVisualStudio71Generator.cxx | 29 ++++++-- Source/cmGlobalVisualStudio71Generator.h | 3 +- Source/cmGlobalVisualStudio7Generator.cxx | 51 ++++++++++++-- Source/cmGlobalVisualStudio7Generator.h | 14 +++- Source/cmGlobalVisualStudio8Generator.cxx | 18 ++++- Source/cmGlobalVisualStudio8Generator.h | 3 +- Source/cmLocalVisualStudio7Generator.cxx | 104 ++++++++++++++++++++++++---- 7 files changed, 189 insertions(+), 33 deletions(-) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index adb5f2f..e84adef 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -243,7 +243,7 @@ void cmGlobalVisualStudio71Generator const char* location, const std::set<cmStdString>& depends) { - fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"" + fout << "Project(\"{" << this->GetExternalProjectTypeGUID(location) << "}\") = \"" << name << "\", \"" << this->ConvertToSolutionPath(location) << "\", \"{" << this->GetGUID(name) @@ -278,21 +278,34 @@ void cmGlobalVisualStudio71Generator // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator -::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) +::WriteProjectConfigurations(std::ostream& fout, const char* name, + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); - i != this->Configurations.end(); ++i) + i != this->Configurations.end(); ++i) + { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) - { + { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; - } + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } + } } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 81c2087..992546f 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -64,7 +64,8 @@ protected: const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteExternalProject(std::ostream& fout, const char* name, const char* path, diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 51b8918..4b52e96 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -250,7 +250,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( if(expath) { this->WriteProjectConfigurations(fout, target->GetName(), - true); + true, + this->IsExternalProjectForAnyCPU(expath)); } else { @@ -261,7 +262,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( if (vcprojName) { this->WriteProjectConfigurations(fout, vcprojName, - partOfDefaultBuild); + partOfDefaultBuild, false); } } } @@ -579,22 +580,62 @@ cmGlobalVisualStudio7Generator // executables to the libraries it uses are also done here void cmGlobalVisualStudio7Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + const char* projectPlatform = "Win32"; + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|Win32\n"; + << ".ActiveCfg = " << projectConfiguration + << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|Win32\n"; + << ".Build.0 = " << projectConfiguration + << "|" << projectPlatform << "\n"; } } } +const char* cmGlobalVisualStudio7Generator::GetExternalProjectExtension(const char* location) { + const char* res = strrchr(location, '.'); + return res ? res : ""; +} + +bool cmGlobalVisualStudio7Generator::IsExternalProjectForAnyCPU(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + return (strcmp(".vbproj", ext) == 0 || strcmp(".csproj", ext) == 0); +} + +const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { + const char* ext = this->GetExternalProjectExtension(location); + + if(strcmp(".vbproj", ext) == 0) + { + return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; + } + else if(strcmp(".csproj", ext) == 0) + { + return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; + } + else + { + return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; + } +} // Write a dsp file into the SLN file, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index b6c84e8..1ba5896 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -99,6 +99,15 @@ public: protected: virtual const char* GetIDEVersion() { return "7.0"; } + ///! Get the GUID for the external project type given by a VS project location. + virtual const char* GetExternalProjectTypeGUID(const char* location); + + ///! Check whether the VS project at the given location must be configured for AnyCPU. + virtual bool IsExternalProjectForAnyCPU(const char* location); + + ///! Get the project extension for an external VS project file. + virtual const char* GetExternalProjectExtension(const char* location); + static cmIDEFlagTable const* GetExtraFlagTableVS7(); virtual void OutputSLNFile(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); @@ -109,8 +118,9 @@ protected: virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); virtual void WriteProjectConfigurations(std::ostream& fout, - const char* name, - bool partOfDefaultBuild); + const char* name, + bool partOfDefaultBuild, + bool platformIndependent); virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget* target); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index ef723b7..8d00bfd 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -270,20 +270,32 @@ cmGlobalVisualStudio8Generator void cmGlobalVisualStudio8Generator ::WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild) + bool partOfDefaultBuild, + bool platformIndependent) { std::string guid = this->GetGUID(name); for(std::vector<std::string>::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { + std::string projectConfiguration(*i); + std::string projectPlatform = this->GetPlatformName(); + if(platformIndependent) + { + projectPlatform = "Any CPU"; + if(projectConfiguration != "Debug") + { + projectConfiguration = "Release"; + } + } + fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".ActiveCfg = " - << *i << "|" << this->GetPlatformName() << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; if(partOfDefaultBuild) { fout << "\t\t{" << guid << "}." << *i << "|" << this->GetPlatformName() << ".Build.0 = " - << *i << "|" << this->GetPlatformName() << "\n"; + << projectConfiguration << "|" << projectPlatform << "\n"; } } } diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index e0913ed..cae275b 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -77,7 +77,8 @@ protected: virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, - bool partOfDefaultBuild); + bool partOfDefaultBuild, + bool platformIndependent); virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 58bae1c..7d93cbd 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -725,6 +725,17 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; + // Check wheter we have to activate CLR support. + if(const char* clrFlag = target.GetProperty("CLR_FLAG")) + { + // We have to disable BasicRuntimeChecks and set ExceptionHandling to 3 if CLR_FLAG is not "0". + if(strcmp("0", clrFlag) != 0) + { + targetOptions.AddFlag("BasicRuntimeChecks", "0"); + targetOptions.AddFlag("ExceptionHandling", "3"); + } + fout << "\t\t\tManagedExtensions=\"" << clrFlag << "\"\n"; + } // If unicode is enabled change the character set to unicode, if not // then default to MBCS. if(targetOptions.UsingUnicode()) @@ -1290,6 +1301,7 @@ struct cmLVS7GFileConfig std::string CompileDefsConfig; std::string AdditionalDeps; bool ExcludedFromBuild; + bool ForceNativeCompilation; }; class cmLocalVisualStudio7GeneratorFCInfo @@ -1402,6 +1414,32 @@ cmLocalVisualStudio7GeneratorFCInfo } } + // Setup exclusions from managed compilation if it's not a ExcludedFromBuild file. + fc.ForceNativeCompilation = false; + if(lang && strcmp("CXX", lang) == 0) + { + if(const char* globalClrFlag = target.GetProperty("CLR_FLAG")) + { + if(strcmp("0", globalClrFlag) != 0) + { + // By default when globalClrFlag is activated all files will be native + fc.ForceNativeCompilation = true; + if(const char* localClrFlag = sf.GetProperty("CLR_FLAG")) + { + if(strcmp("0", localClrFlag) != 0) + { + // If globalClrFlag is activated and fileFlag too, we enable manage compilation + fc.ForceNativeCompilation = false; + } + } + } + } + if(fc.ForceNativeCompilation) + { + needfc = true; + } + } + if(needfc) { this->FileConfigMap[*i] = fc; @@ -1550,26 +1588,30 @@ void cmLocalVisualStudio7Generator fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n"); fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); fileOptions.OutputPreprocessorDefinitions(fout, - "\t\t\t\t\t", "\n", - lang); - } + "\t\t\t\t\t", "\n", + lang); + } if(!fc.AdditionalDeps.empty()) - { + { fout << "\t\t\t\t\tAdditionalDependencies=\"" - << fc.AdditionalDeps.c_str() << "\"\n"; - } + << fc.AdditionalDeps.c_str() << "\"\n"; + } if(!fc.ObjectName.empty()) - { + { fout << "\t\t\t\t\tObjectFile=\"$(IntDir)/" - << fc.ObjectName.c_str() << "\"\n"; - } - fout << "\t\t\t\t\t/>\n" - << "\t\t\t\t</FileConfiguration>\n"; + << fc.ObjectName.c_str() << "\"\n"; + } + if(fc.ForceNativeCompilation) + { + fout << "\t\t\t\t\tCompileAsManaged=\"0\"\n"; } + fout << "\t\t\t\t\t/>\n" + << "\t\t\t\t</FileConfiguration>\n"; } - fout << "\t\t\t</File>\n"; } + fout << "\t\t\t</File>\n"; } + } std::vector<cmSourceGroup> const& children = sg->GetGroupChildren(); @@ -1927,11 +1969,43 @@ std::string cmLocalVisualStudio7Generator class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void CharacterDataHandler(const char* data, int length) + { + if(inGuidElement) { + this->GUID.append(data, length); + } + } + virtual void EndElement(const char* name) + { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = false; + + size_t pos = 0; + size_t len = GUID.size(); + + // Remove leading '{' and trailing '}'... + if(len > 0 && GUID[len - 1] == '}') + { + len--; + } + if(len > 0 && GUID[0] == '{') + { + pos++; + len--; + } + + GUID = GUID.substr(pos, len); } + } virtual void StartElement(const char* name, const char** atts) { + if(strcmp("ProjectGuid", name) == 0) + { + inGuidElement = true; + return; + } // once the GUID is found do nothing if(this->GUID.size()) { @@ -1961,6 +2035,7 @@ public: } int InitializeParser() { + inGuidElement = false; int ret = cmXMLParser::InitializeParser(); if(ret == 0) { @@ -1972,6 +2047,9 @@ public: return 1; } std::string GUID; + +private: + bool inGuidElement; }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( -- 1.7.3.1.msysgit.0 | ||||||||
Relationships | |
Relationships |
Notes | |
(0018486) Juan Jesus Garcia de Soria (reporter) 2009-11-19 05:40 |
I've just attached "cmake_2.8.0_patch_for_dotnet_v2.diff", rebased against the just released 2.8.0. It also provides a new target property: "CLR_FLAG". This gets translated to a "ManagedExtensions" value in the outputted .vcproj file, so that you can enable CLR compatibility in a C++ project. For instance, setting CLR_FLAG=1 for a target is the same that compiling the target with the "/clr" flag. |
(0018494) Juan Jesus Garcia de Soria (reporter) 2009-11-20 10:11 |
New version of the patch, that also sets ExceptionHandling=3 when CLR_FLAG is activated. |
(0019508) Juan Jesus Garcia de Soria (reporter) 2010-02-11 04:16 |
New version (v4) of the patch. Now you have to set CLR_FLAG property (with a non-"0" value) for source files that you want to be compiled as /clr too. This means that you can control which files to compile as managed. It also means that by default all files will be compiled as native. |
(0025618) Jens Frederich (reporter) 2011-03-02 03:00 |
Hello, I've just attached "managed_include_external_msproject.diff", rebase against the just 2.8.4 release branch. Please accept this patch, we needing the feature! |
(0025847) Matt Deckard (reporter) 2011-03-21 15:42 |
Jens, your patch doesn't seem to include the changes to cmVS7XMLParser which I found were needed so that it would include the correct project instance GUIDs for .csproj files. |
(0025860) Jens Frederich (reporter) 2011-03-22 04:42 |
Hello Matt. Mmmhhh, sorry I don't know what you mean with that. The correct GUID is set at cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(...). const char* cmGlobalVisualStudio7Generator::GetExternalProjectTypeGUID(const char* location) { const char* ext = this->GetExternalProjectExtension(location); if(strcmp(".vbproj", ext) == 0) { return "F184B08F-C81C-45F6-A57F-5ABD9991F28F"; } else if(strcmp(".csproj", ext) == 0) { return "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"; } else { return "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"; } } That's the GUID's for VisualStudio 10 project files. |
(0026461) Thomas Bernard (reporter) 2011-05-09 09:11 |
We would also really need this functionality ! I just added a patch which summurizes the previous patches posted previously. Should be a git compatible patch based on CMake 2.8.3 |
(0026462) Thomas Bernard (reporter) 2011-05-09 09:12 |
Sorry about that: the patch I posted is based on CMake 2.8.4 ! |
(0026502) Erik Hasslmeyer (reporter) 2011-05-13 19:07 |
Hello Thomas I tested your patch "0001-ms-external-project-.NET-project-support.patch" and the .csproj and .vbproj GUIDs seem to be mixed up. correct way (as posted by Jens Frederich): vbproj -> F184B08F-C81C-45F6-A57F-5ABD9991F28F csproj -> FAE04EC0-301F-11D3-BF4B-00C04F79EFBC your way: vbproj -> FAE04EC0-301F-11D3-BF4B-00C04F79EFBC csproj -> F184B08F-C81C-45F6-A57F-5ABD9991F28F The rest of the patch seems to work for me. Would be nice if this feature is included in the next release. |
(0026503) Thomas Bernard (reporter) 2011-05-16 02:21 |
Thanks Erik for the error report :) I took what was contained in the other patches without checking the contents thouroughly enough. I just uploaded an updated patch which should fix that issue. |
(0026504) Jens Frederich (reporter) 2011-05-16 03:18 |
Hello Thomas, a little hit. The project GUIDs: vbproj -> F184B08F-C81C-45F6-A57F-5ABD9991F28F csproj -> FAE04EC0-301F-11D3-BF4B-00C04F79EFBC are MS Visual Studio 2010 Id's. I hope that is correct for you. |
(0026505) Thomas Bernard (reporter) 2011-05-16 03:22 |
Didn't meen to hurt anybody. Might have been my mistake in merging the patches... The GUIDs you mention absolutly match the last patch update I send. |
(0026506) Jens Frederich (reporter) 2011-05-16 03:50 |
No no, your patch is absolutely correct. I want point out it's only a MS VS 2010 patch. Visual Studio 2005/2008 vbproj/csproj projects have other GUIDs... |
(0026507) Thomas Bernard (reporter) 2011-05-16 03:56 |
Just checked on my machine the GUIDs for VS2005 and VS2008. They are identical to the above mentioned GUIDs. I tested the patch with VS2008 and it worked perfectly. I expect it to work with VS2005, VS2008 and VS2010. |
(0026508) Jens Frederich (reporter) 2011-05-16 04:00 |
Ah okay, I was mistaken. Sorry! |
(0027633) Yuri (reporter) 2011-10-24 00:06 |
May be it's worh implementing GetExternalProjectTypeGUID via cmake scripts? In such a way it would be easier to add other types of projects, say vdproj or wixproj. |
(0027971) David Cole (manager) 2011-12-13 19:27 |
Unset target version field; too late for a fix to go into 2.8.7; deferred until a future version. |
(0029515) Yuri (reporter) 2012-05-21 03:00 edited on: 2012-05-21 10:30 |
Fixed in terms of 0013120 |
(0041606) Kitware Robot (administrator) 2016-06-10 14:27 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2009-10-20 11:50 | Juan Jesus Garcia de Soria | New Issue | |
2009-10-20 11:50 | Juan Jesus Garcia de Soria | File Added: cmake_2.8.0-rc3_patch_for_dotnet.diff | |
2009-10-20 11:50 | Juan Jesus Garcia de Soria | File Added: cmake_2.6.4_patch_for_dotnet.diff | |
2009-11-19 05:37 | Juan Jesus Garcia de Soria | File Added: cmake_2.8.0_patch_for_dotnet_v2.diff | |
2009-11-19 05:40 | Juan Jesus Garcia de Soria | Note Added: 0018486 | |
2009-11-20 10:11 | Juan Jesus Garcia de Soria | File Added: cmake_2.8.0_patch_for_dotnet_v3.diff | |
2009-11-20 10:11 | Juan Jesus Garcia de Soria | Note Added: 0018494 | |
2010-02-11 04:15 | Juan Jesus Garcia de Soria | File Added: cmake_2.8.0_patch_for_dotnet_v4.diff | |
2010-02-11 04:16 | Juan Jesus Garcia de Soria | Note Added: 0019508 | |
2010-12-15 09:02 | David Cole | Status | new => assigned |
2010-12-15 09:02 | David Cole | Assigned To | => Bill Hoffman |
2011-03-02 02:58 | Jens Frederich | File Added: managed_include_external_msproject.diff | |
2011-03-02 03:00 | Jens Frederich | Note Added: 0025618 | |
2011-03-21 15:42 | Matt Deckard | Note Added: 0025847 | |
2011-03-22 04:42 | Jens Frederich | Note Added: 0025860 | |
2011-05-09 09:10 | Thomas Bernard | File Added: 0001-ms-external-project-.NET-project-support.patch | |
2011-05-09 09:11 | Thomas Bernard | Note Added: 0026461 | |
2011-05-09 09:12 | Thomas Bernard | Note Added: 0026462 | |
2011-05-13 19:07 | Erik Hasslmeyer | Note Added: 0026502 | |
2011-05-16 02:18 | Thomas Bernard | File Added: 0001-ms-external-project-.NET-project-support-GUID-fixed.patch | |
2011-05-16 02:21 | Thomas Bernard | Note Added: 0026503 | |
2011-05-16 03:18 | Jens Frederich | Note Added: 0026504 | |
2011-05-16 03:22 | Thomas Bernard | Note Added: 0026505 | |
2011-05-16 03:50 | Jens Frederich | Note Added: 0026506 | |
2011-05-16 03:56 | Thomas Bernard | Note Added: 0026507 | |
2011-05-16 04:00 | Jens Frederich | Note Added: 0026508 | |
2011-10-24 00:06 | Yuri | Note Added: 0027633 | |
2011-10-24 09:38 | David Cole | Target Version | => CMake 2.8.7 |
2011-12-13 19:27 | David Cole | Note Added: 0027971 | |
2011-12-13 19:27 | David Cole | Target Version | CMake 2.8.7 => |
2012-05-21 03:00 | Yuri | Note Added: 0029515 | |
2012-05-21 10:30 | David Cole | Note Edited: 0029515 | |
2016-06-10 14:27 | Kitware Robot | Note Added: 0041606 | |
2016-06-10 14:27 | Kitware Robot | Status | assigned => resolved |
2016-06-10 14:27 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |