diff options
author | Kevin M. Godby <kevin@godby.org> | 2017-09-27 03:02:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-09-27 11:56:09 (GMT) |
commit | 49dab3ebfb377e1f2cd826c731c26ddc5346f520 (patch) | |
tree | d747317bac5146d8c4bc8a3f65892d194ab7e00a /Source | |
parent | c40d130034278e28964929e8d61f3280945b7531 (diff) | |
download | CMake-49dab3ebfb377e1f2cd826c731c26ddc5346f520.zip CMake-49dab3ebfb377e1f2cd826c731c26ddc5346f520.tar.gz CMake-49dab3ebfb377e1f2cd826c731c26ddc5346f520.tar.bz2 |
VS: Add VS_SHADER_OUTPUT_HEADER_FILE and VS_SHADER_VARIABLE_NAME properties.
The VS_SHADER_OUTPUT_HEADER_FILE property is the name of the generated
header file containing the object code of the shader.
The VS_SHADER_VARIABLE_NAME property is the name of the variable
containing the object code in the above header file.
Signed-off-by: Kevin M. Godby <kevin@godby.org>
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8dce028..a4e2d55 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1592,6 +1592,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) std::string shaderEntryPoint; std::string shaderModel; std::string shaderAdditionalFlags; + std::string outputHeaderFile; + std::string variableName; std::string settingsGenerator; std::string settingsLastGenOutput; std::string sourceLink; @@ -1641,6 +1643,16 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) shaderModel = sm; toolHasSettings = true; } + // Figure out which output header file to use if any + if (const char* ohf = sf->GetProperty("VS_SHADER_OUTPUT_HEADER_FILE")) { + outputHeaderFile = ohf; + toolHasSettings = true; + } + // Figure out which variable name to use if any + if (const char* vn = sf->GetProperty("VS_SHADER_VARIABLE_NAME")) { + variableName = vn; + toolHasSettings = true; + } // Figure out if there's any additional flags to use if (const char* saf = sf->GetProperty("VS_SHADER_FLAGS")) { shaderAdditionalFlags = saf; @@ -1765,6 +1777,28 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) (*this->BuildFileStream) << cmVS10EscapeXML(shaderModel) << "</ShaderModel>\n"; } + if (!outputHeaderFile.empty()) { + for (size_t i = 0; i != this->Configurations.size(); ++i) { + this->WriteString("<HeaderFileOutput Condition=\"" + "'$(Configuration)|$(Platform)'=='", + 3); + (*this->BuildFileStream) << this->Configurations[i] << "|" + << this->Platform << "'\">" + << cmVS10EscapeXML(outputHeaderFile); + this->WriteString("</HeaderFileOutput>\n", 0); + } + } + if (!variableName.empty()) { + for (size_t i = 0; i != this->Configurations.size(); ++i) { + this->WriteString("<VariableName Condition=\"" + "'$(Configuration)|$(Platform)'=='", + 3); + (*this->BuildFileStream) << this->Configurations[i] << "|" + << this->Platform << "'\">" + << cmVS10EscapeXML(variableName); + this->WriteString("</VariableName>\n", 0); + } + } if (!shaderAdditionalFlags.empty()) { this->WriteString("<AdditionalOptions>", 3); (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags) |