diff options
author | Brad King <brad.king@kitware.com> | 2013-05-21 19:12:48 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-05-21 19:12:48 (GMT) |
commit | f292ffb62cf2251c1239f4750487efeb52daf1d7 (patch) | |
tree | c2a3459e7d1eb9736cdb0c68e5051c180beddf31 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 1a2a0daddad3b1e460e5bc9e6f6795524f7c573b (diff) | |
parent | 79ec7868d0f08c9ff2e6fa6454b205132acecc24 (diff) | |
download | CMake-f292ffb62cf2251c1239f4750487efeb52daf1d7.zip CMake-f292ffb62cf2251c1239f4750487efeb52daf1d7.tar.gz CMake-f292ffb62cf2251c1239f4750487efeb52daf1d7.tar.bz2 |
Merge topic 'vs-windows-forms'
79ec786 VS: Add Windows Forms Support
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5e8f76d..273b203 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -291,6 +291,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteCustomCommands(); this->WriteAllSources(); this->WriteDotNetReferences(); + this->WriteWinRTReferences(); this->WriteProjectReferences(); this->WriteString( @@ -455,6 +456,12 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() this->WriteString("<WindowsAppContainer>true" "</WindowsAppContainer>\n", 2); } + + if(!this->GeneratorTarget->ResxSources.empty()) + { + this->WriteString("<CLRSupport>true</CLRSupport>\n", 2); + } + this->WriteString("</PropertyGroup>\n", 1); } } @@ -647,6 +654,23 @@ void cmVisualStudio10TargetGenerator::WriteGroups() this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups); } + std::vector<cmSourceFile*> resxObjs = this->GeneratorTarget->ResxSources; + if(!resxObjs.empty()) + { + this->WriteString("<ItemGroup>\n", 1); + for(std::vector<cmSourceFile*>::iterator oi = resxObjs.begin(); + oi != resxObjs.end(); ++oi) + { + std::string obj = (*oi)->GetFullPath(); + this->WriteString("<EmbeddedResource Include=\"", 2); + this->ConvertToWindowsSlash(obj); + (*this->BuildFileStream ) << obj << "\">\n"; + this->WriteString("<Filter>Resource Files</Filter>\n", 3); + this->WriteString("</EmbeddedResource>\n", 2); + } + this->WriteString("</ItemGroup>\n", 1); + } + // Add object library contents as external objects. std::vector<std::string> objs; this->GeneratorTarget->UseObjectLibraries(objs); @@ -701,6 +725,23 @@ void cmVisualStudio10TargetGenerator::WriteGroups() << "</UniqueIdentifier>\n"; this->WriteString("</Filter>\n", 2); } + + if(!this->GeneratorTarget->ResxSources.empty()) + { + this->WriteString("<Filter Include=\"Resource Files\">\n", 2); + std::string guidName = "SG_Filter_Resource Files"; + this->GlobalGenerator->CreateGUID(guidName.c_str()); + this->WriteString("<UniqueIdentifier>", 3); + std::string guid = + this->GlobalGenerator->GetGUID(guidName.c_str()); + (*this->BuildFileStream) << "{" << guid << "}" + << "</UniqueIdentifier>\n"; + this->WriteString("<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;", 3); + (*this->BuildFileStream) << "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;"; + (*this->BuildFileStream) << "mfcribbon-ms</Extensions>\n"; + this->WriteString("</Filter>\n", 2); + } + this->WriteString("</ItemGroup>\n", 1); this->WriteString("</Project>\n", 0); // restore stream pointer @@ -832,8 +873,20 @@ void cmVisualStudio10TargetGenerator::WriteSource( } this->ConvertToWindowsSlash(sourceFile); this->WriteString("<", 2); - (*this->BuildFileStream ) << tool << - " Include=\"" << sourceFile << "\"" << (end? end : " />\n"); + (*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\""; + + if(sf->GetExtension() == "h" && + this->IsResxHeader(sf->GetFullPath())) + { + (*this->BuildFileStream ) << ">\n"; + this->WriteString("<FileType>CppForm</FileType>\n", 3); + this->WriteString("</ClInclude>\n", 2); + } + else + { + (*this->BuildFileStream ) << (end? end : " />\n"); + } + ToolSource toolSource = {sf, forceRelative}; this->Tools[tool].push_back(toolSource); } @@ -1725,3 +1778,12 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() } this->WriteString("</ItemGroup>\n", 1); } + +bool cmVisualStudio10TargetGenerator:: + IsResxHeader(const std::string& headerFile) +{ + std::set<std::string>::iterator it = + this->GeneratorTarget->ExpectedResxHeaders.find(headerFile); + + return it != this->GeneratorTarget->ExpectedResxHeaders.end(); +} |