summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorJeremiah van Oosten <jpvanoosten@hotmail.com>2017-10-27 14:59:45 (GMT)
committerBrad King <brad.king@kitware.com>2017-10-30 13:52:10 (GMT)
commit025221df2a84500df2fb9ea6bebaf42baaa79400 (patch)
tree47be6fc21490e8b94fed352f1289b1d5659611c4 /Source/cmVisualStudio10TargetGenerator.cxx
parent8ffc1c3d89a5562d40a5bd86c457a3173a1469d0 (diff)
downloadCMake-025221df2a84500df2fb9ea6bebaf42baaa79400.zip
CMake-025221df2a84500df2fb9ea6bebaf42baaa79400.tar.gz
CMake-025221df2a84500df2fb9ea6bebaf42baaa79400.tar.bz2
VS: Add source file property to set hlsl debug and optimization flags
Add `VS_SHADER_DISABLE_OPTIMIZATIONS` and `VS_SHADER_ENABLE_DEBUG` source file properties to control these settings on `.hlsl` files in the VS generator. Fixes: #17406
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 0a303b0..1aadf67 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1602,6 +1602,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
std::string shaderEntryPoint;
std::string shaderModel;
std::string shaderAdditionalFlags;
+ std::string shaderDisableOptimizations;
+ std::string shaderEnableDebug;
std::string outputHeaderFile;
std::string variableName;
std::string settingsGenerator;
@@ -1668,6 +1670,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
shaderAdditionalFlags = saf;
toolHasSettings = true;
}
+ // Figure out if debug information should be generated
+ if (const char* sed = sf->GetProperty("VS_SHADER_ENABLE_DEBUG")) {
+ shaderEnableDebug = cmSystemTools::IsOn(sed) ? "true" : "false";
+ toolHasSettings = true;
+ }
+ // Figure out if optimizations should be disabled
+ if (const char* sdo = sf->GetProperty("VS_SHADER_DISABLE_OPTIMIZATIONS")) {
+ shaderDisableOptimizations = cmSystemTools::IsOn(sdo) ? "true" : "false";
+ toolHasSettings = true;
+ }
} else if (ext == "jpg" || ext == "png") {
tool = "Image";
} else if (ext == "resw") {
@@ -1810,6 +1822,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
this->WriteString("</VariableName>\n", 0);
}
}
+ if (!shaderEnableDebug.empty()) {
+ this->WriteString("<EnableDebuggingInformation>", 3);
+ (*this->BuildFileStream) << cmVS10EscapeXML(shaderEnableDebug)
+ << "</EnableDebuggingInformation>\n";
+ }
+ if (!shaderDisableOptimizations.empty()) {
+ this->WriteString("<DisableOptimizations>", 3);
+ (*this->BuildFileStream) << cmVS10EscapeXML(shaderDisableOptimizations)
+ << "</DisableOptimizations>\n";
+ }
if (!shaderAdditionalFlags.empty()) {
this->WriteString("<AdditionalOptions>", 3);
(*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags)