diff options
author | Jeremiah van Oosten <jpvanoosten@hotmail.com> | 2018-04-24 09:25:13 (GMT) |
---|---|---|
committer | Jeremiah van Oosten <jpvanoosten@hotmail.com> | 2018-04-26 21:00:10 (GMT) |
commit | 83ed65cdde4bebc138d31ae80c39cfdbf42a12c2 (patch) | |
tree | b658f945914ec47aeee85ef031c896f8c0b6775a /Source | |
parent | e52cf1034f1cb712dca28131fc113db0fb580db9 (diff) | |
download | CMake-83ed65cdde4bebc138d31ae80c39cfdbf42a12c2.zip CMake-83ed65cdde4bebc138d31ae80c39cfdbf42a12c2.tar.gz CMake-83ed65cdde4bebc138d31ae80c39cfdbf42a12c2.tar.bz2 |
Add generator expressions for VS_SHADER_ source file properties.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 5c3b134..d766cb5 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1696,12 +1696,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")) { @@ -1843,12 +1843,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); |