diff options
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index c61902a..6486c8b 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -15,6 +15,7 @@ #include "cmVisualStudioGeneratorOptions.h" #include "windows.h" +#include <iterator> #include <memory> // IWYU pragma: keep static std::string cmVS10EscapeXML(std::string arg) @@ -1174,6 +1175,15 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands() si != customCommands.end(); ++si) { this->WriteCustomCommand(*si); } + + // Add CMakeLists.txt file with rule to re-run CMake for user convenience. + if (this->GeneratorTarget->GetType() != cmStateEnums::GLOBAL_TARGET && + this->GeneratorTarget->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { + if (cmSourceFile const* sf = + this->LocalGenerator->CreateVCProjBuildRule()) { + this->WriteCustomCommand(sf); + } + } } void cmVisualStudio10TargetGenerator::WriteCustomCommand( @@ -1592,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; @@ -1658,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") { @@ -1667,12 +1689,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) } else if (ext == "natvis") { tool = "Natvis"; } else if (ext == "settings") { - // remove path to current source dir (if files are in current source dir) - if (!sourceLink.empty()) { - settingsLastGenOutput = sourceLink; - } else { - settingsLastGenOutput = sf->GetFullPath(); - } + settingsLastGenOutput = + cmsys::SystemTools::GetFilenameName(sf->GetFullPath()); std::size_t pos = settingsLastGenOutput.find(".settings"); settingsLastGenOutput.replace(pos, 9, ".Designer.cs"); settingsGenerator = "SettingsSingleFileGenerator"; @@ -1800,6 +1818,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) @@ -2359,14 +2387,14 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // Choose a language whose flags to use for ClCompile. static const char* clLangs[] = { "CXX", "C", "Fortran", "CSharp" }; std::string langForClCompile; - if (std::find(cmArrayBegin(clLangs), cmArrayEnd(clLangs), linkLanguage) != - cmArrayEnd(clLangs)) { + if (std::find(cm::cbegin(clLangs), cm::cend(clLangs), linkLanguage) != + cm::cend(clLangs)) { langForClCompile = linkLanguage; } else { std::set<std::string> languages; this->GeneratorTarget->GetLanguages(languages, configName); - for (const char* const* l = cmArrayBegin(clLangs); - l != cmArrayEnd(clLangs); ++l) { + for (const char* const* l = cm::cbegin(clLangs); l != cm::cend(clLangs); + ++l) { if (languages.find(*l) != languages.end()) { langForClCompile = *l; break; |