Merge topic 'VS11-WinRT-project-issue-12930'
a03447b
VS: Simplify ;-separated attribute value parsing9e01aef
VS: Add support for WinRT project properties (#12930)
This commit is contained in:
commit
43b463cdfc
|
@ -1064,6 +1064,16 @@ void cmTarget::DefineProperties(cmake *cm)
|
||||||
"Adds one or more semicolon-delimited .NET references to a "
|
"Adds one or more semicolon-delimited .NET references to a "
|
||||||
"generated Visual Studio project. For example, \"System;"
|
"generated Visual Studio project. For example, \"System;"
|
||||||
"System.Windows.Forms\".");
|
"System.Windows.Forms\".");
|
||||||
|
cm->DefineProperty
|
||||||
|
("VS_WINRT_EXTENSIONS", cmProperty::TARGET,
|
||||||
|
"Visual Studio project C++/CX language extensions for Windows Runtime",
|
||||||
|
"Can be set to enable C++/CX language extensions.");
|
||||||
|
cm->DefineProperty
|
||||||
|
("VS_WINRT_REFERENCES", cmProperty::TARGET,
|
||||||
|
"Visual Studio project Windows Runtime Metadata references",
|
||||||
|
"Adds one or more semicolon-delimited WinRT references to a "
|
||||||
|
"generated Visual Studio project. For example, \"Windows;"
|
||||||
|
"Windows.UI.Core\".");
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("VS_GLOBAL_<variable>", cmProperty::TARGET,
|
("VS_GLOBAL_<variable>", cmProperty::TARGET,
|
||||||
"Visual Studio project-specific global variable.",
|
"Visual Studio project-specific global variable.",
|
||||||
|
|
|
@ -255,6 +255,7 @@ void cmVisualStudio10TargetGenerator::Generate()
|
||||||
this->WriteObjSources();
|
this->WriteObjSources();
|
||||||
this->WriteCLSources();
|
this->WriteCLSources();
|
||||||
this->WriteDotNetReferences();
|
this->WriteDotNetReferences();
|
||||||
|
this->WriteWinRTReferences();
|
||||||
this->WriteProjectReferences();
|
this->WriteProjectReferences();
|
||||||
this->WriteString(
|
this->WriteString(
|
||||||
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
|
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
|
||||||
|
@ -268,33 +269,49 @@ void cmVisualStudio10TargetGenerator::Generate()
|
||||||
|
|
||||||
void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
|
void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
|
||||||
{
|
{
|
||||||
const char* vsDotNetReferences
|
std::vector<std::string> references;
|
||||||
= this->Target->GetProperty("VS_DOTNET_REFERENCES");
|
if(const char* vsDotNetReferences =
|
||||||
if(vsDotNetReferences)
|
this->Target->GetProperty("VS_DOTNET_REFERENCES"))
|
||||||
|
{
|
||||||
|
cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
|
||||||
|
}
|
||||||
|
if(!references.empty())
|
||||||
{
|
{
|
||||||
std::string references(vsDotNetReferences);
|
|
||||||
std::string::size_type position = 0;
|
|
||||||
|
|
||||||
this->WriteString("<ItemGroup>\n", 1);
|
this->WriteString("<ItemGroup>\n", 1);
|
||||||
while(references.length() > 0)
|
for(std::vector<std::string>::iterator ri = references.begin();
|
||||||
|
ri != references.end(); ++ri)
|
||||||
{
|
{
|
||||||
if((position = references.find(";")) == std::string::npos)
|
|
||||||
{
|
|
||||||
position = references.length() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->WriteString("<Reference Include=\"", 2);
|
this->WriteString("<Reference Include=\"", 2);
|
||||||
(*this->BuildFileStream) <<
|
(*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
|
||||||
cmVS10EscapeXML(references.substr(0, position)) << "\">\n";
|
|
||||||
this->WriteString("<CopyLocalSatelliteAssemblies>true"
|
this->WriteString("<CopyLocalSatelliteAssemblies>true"
|
||||||
"</CopyLocalSatelliteAssemblies>\n", 3);
|
"</CopyLocalSatelliteAssemblies>\n", 3);
|
||||||
this->WriteString("<ReferenceOutputAssembly>true"
|
this->WriteString("<ReferenceOutputAssembly>true"
|
||||||
"</ReferenceOutputAssembly>\n", 3);
|
"</ReferenceOutputAssembly>\n", 3);
|
||||||
this->WriteString("</Reference>\n", 2);
|
this->WriteString("</Reference>\n", 2);
|
||||||
|
|
||||||
references.erase(0, position + 1);
|
|
||||||
}
|
}
|
||||||
|
this->WriteString("</ItemGroup>\n", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
|
||||||
|
{
|
||||||
|
std::vector<std::string> references;
|
||||||
|
if(const char* vsWinRTReferences =
|
||||||
|
this->Target->GetProperty("VS_WINRT_REFERENCES"))
|
||||||
|
{
|
||||||
|
cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
|
||||||
|
}
|
||||||
|
if(!references.empty())
|
||||||
|
{
|
||||||
|
this->WriteString("<ItemGroup>\n", 1);
|
||||||
|
for(std::vector<std::string>::iterator ri = references.begin();
|
||||||
|
ri != references.end(); ++ri)
|
||||||
|
{
|
||||||
|
this->WriteString("<Reference Include=\"", 2);
|
||||||
|
(*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
|
||||||
|
this->WriteString("<IsWinMDFile>true</IsWinMDFile>\n", 3);
|
||||||
|
this->WriteString("</Reference>\n", 2);
|
||||||
|
}
|
||||||
this->WriteString("</ItemGroup>\n", 1);
|
this->WriteString("</ItemGroup>\n", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +389,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
|
||||||
this->WriteString(mfcLine.c_str(), 2);
|
this->WriteString(mfcLine.c_str(), 2);
|
||||||
|
|
||||||
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
|
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
|
||||||
this->ClOptions[*i]->UsingUnicode())
|
this->ClOptions[*i]->UsingUnicode() ||
|
||||||
|
this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
|
||||||
{
|
{
|
||||||
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
|
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
|
||||||
}
|
}
|
||||||
|
@ -387,6 +405,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
|
||||||
pts += "</PlatformToolset>\n";
|
pts += "</PlatformToolset>\n";
|
||||||
this->WriteString(pts.c_str(), 2);
|
this->WriteString(pts.c_str(), 2);
|
||||||
}
|
}
|
||||||
|
if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
|
||||||
|
{
|
||||||
|
this->WriteString("<Immersive>true</Immersive>\n", 2);
|
||||||
|
}
|
||||||
this->WriteString("</PropertyGroup>\n", 1);
|
this->WriteString("</PropertyGroup>\n", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ private:
|
||||||
void WriteProjectConfigurationValues();
|
void WriteProjectConfigurationValues();
|
||||||
void WriteCLSources();
|
void WriteCLSources();
|
||||||
void WriteDotNetReferences();
|
void WriteDotNetReferences();
|
||||||
|
void WriteWinRTReferences();
|
||||||
void WriteObjSources();
|
void WriteObjSources();
|
||||||
void WritePathAndIncrementalLinkOptions();
|
void WritePathAndIncrementalLinkOptions();
|
||||||
void WriteItemDefinitionGroups();
|
void WriteItemDefinitionGroups();
|
||||||
|
|
Loading…
Reference in New Issue