VS: Add a source file property to set the hlsl shader type

Create a VS_SHADER_TYPE source file property.

Inspired-by: Gilles Khouzam <gillesk@microsoft.com>
This commit is contained in:
Brad King 2014-07-29 14:48:20 -04:00
parent 9b4dc2ad4a
commit 6fe770e163
3 changed files with 22 additions and 0 deletions

View File

@ -288,6 +288,7 @@ Properties on Source Files
/prop_sf/OBJECT_OUTPUTS
/prop_sf/SYMBOLIC
/prop_sf/VS_DEPLOYMENT_CONTENT
/prop_sf/VS_SHADER_TYPE
/prop_sf/WRAP_EXCLUDE
/prop_sf/XCODE_EXPLICIT_FILE_TYPE
/prop_sf/XCODE_LAST_KNOWN_FILE_TYPE

View File

@ -0,0 +1,4 @@
VS_SHADER_TYPE
--------------
Set the VS shader type of a ``.hlsl`` source file.

View File

@ -1020,11 +1020,22 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
{
bool toolHasSettings = false;
std::string tool = "None";
std::string shaderType;
std::string const& ext = sf->GetExtension();
if(ext == "appxmanifest")
{
tool = "AppxManifest";
}
else if(ext == "hlsl")
{
tool = "FXCompile";
// Figure out the type of shader compiler to use.
if(const char* st = sf->GetProperty("VS_SHADER_TYPE"))
{
shaderType = st;
toolHasSettings = true;
}
}
else if(ext == "jpg" ||
ext == "png")
{
@ -1078,6 +1089,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
}
}
}
if(!shaderType.empty())
{
this->WriteString("<ShaderType>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(shaderType)
<< "</ShaderType>\n";
}
this->WriteString("</", 2);
(*this->BuildFileStream) << tool << ">\n";