summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-07-29 18:48:20 (GMT)
committerBrad King <brad.king@kitware.com>2014-08-12 14:08:49 (GMT)
commit6fe770e163daf005cd151798c18b89ad50c17125 (patch)
tree4cfb88a28414b51522dc769506b21e139ef54c11
parent9b4dc2ad4a82b233520015fdc5cbf5df1ed540f7 (diff)
downloadCMake-6fe770e163daf005cd151798c18b89ad50c17125.zip
CMake-6fe770e163daf005cd151798c18b89ad50c17125.tar.gz
CMake-6fe770e163daf005cd151798c18b89ad50c17125.tar.bz2
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>
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/prop_sf/VS_SHADER_TYPE.rst4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx17
3 files changed, 22 insertions, 0 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 3b7436a..81b00fa 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -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
diff --git a/Help/prop_sf/VS_SHADER_TYPE.rst b/Help/prop_sf/VS_SHADER_TYPE.rst
new file mode 100644
index 0000000..6880256
--- /dev/null
+++ b/Help/prop_sf/VS_SHADER_TYPE.rst
@@ -0,0 +1,4 @@
+VS_SHADER_TYPE
+--------------
+
+Set the VS shader type of a ``.hlsl`` source file.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 01a3b37..6989c51 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -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";