summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-30 13:17:19 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-04-30 13:18:02 (GMT)
commit36d7f8ca106b69fbd02a361a156a31d2be7aae22 (patch)
tree447fd6cf72d9e08b91ce9e92498d9b1f7b0f6bba /Source
parentbea55a02d1a0a1800b8d5d5a9d2522272dd27ae9 (diff)
parent83ed65cdde4bebc138d31ae80c39cfdbf42a12c2 (diff)
downloadCMake-36d7f8ca106b69fbd02a361a156a31d2be7aae22.zip
CMake-36d7f8ca106b69fbd02a361a156a31d2be7aae22.tar.gz
CMake-36d7f8ca106b69fbd02a361a156a31d2be7aae22.tar.bz2
Merge topic 'vs-shader-generator-expressions'
83ed65cdde Add generator expressions for VS_SHADER_ source file properties. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2000
Diffstat (limited to 'Source')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx39
1 files changed, 33 insertions, 6 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6074ae6..5497469 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1691,12 +1691,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
}
// Figure out if debug information should be generated
if (const char* sed = sf->GetProperty("VS_SHADER_ENABLE_DEBUG")) {
- shaderEnableDebug = cmSystemTools::IsOn(sed) ? "true" : "false";
+ shaderEnableDebug = sed;
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";
+ shaderDisableOptimizations = sdo;
toolHasSettings = true;
}
if (const char* sofn = sf->GetProperty("VS_SHADER_OBJECT_FILE_NAME")) {
@@ -1838,12 +1838,39 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
}
}
if (!shaderEnableDebug.empty()) {
- this->WriteElemEscapeXML("EnableDebuggingInformation", shaderEnableDebug,
- 3);
+ cmGeneratorExpression ge;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(shaderEnableDebug);
+
+ for (size_t i = 0; i != this->Configurations.size(); ++i) {
+ const char* enableDebug =
+ cge->Evaluate(this->LocalGenerator, this->Configurations[i]);
+ if (strlen(enableDebug) > 0) {
+ Elem el(*this->BuildFileStream, 3);
+ el.StartElement("EnableDebuggingInformation");
+ el.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" +
+ this->Configurations[i] + "|" + this->Platform + "'");
+ el.Content(cmSystemTools::IsOn(enableDebug) ? "true" : "false");
+ }
+ }
}
if (!shaderDisableOptimizations.empty()) {
- this->WriteElemEscapeXML("DisableOptimizations",
- shaderDisableOptimizations, 3);
+ cmGeneratorExpression ge;
+ std::unique_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(shaderDisableOptimizations);
+
+ for (size_t i = 0; i != this->Configurations.size(); ++i) {
+ const char* disableOptimizations =
+ cge->Evaluate(this->LocalGenerator, this->Configurations[i]);
+ if (strlen(disableOptimizations) > 0) {
+ Elem el(*this->BuildFileStream, 3);
+ el.StartElement("DisableOptimizations");
+ el.Attribute("Condition", "'$(Configuration)|$(Platform)'=='" +
+ this->Configurations[i] + "|" + this->Platform + "'");
+ el.Content(cmSystemTools::IsOn(disableOptimizations) ? "true"
+ : "false");
+ }
+ }
}
if (!shaderObjectFileName.empty()) {
this->WriteElemEscapeXML("ObjectFileOutput", shaderObjectFileName, 3);