From 853e4643b6737224a5aa0720a4108461a0230991 Mon Sep 17 00:00:00 2001 From: Raymond Zhao <7199958+rzhao271@users.noreply.github.com> Date: Thu, 30 Mar 2023 05:23:36 -0700 Subject: [PATCH] feat(msvs): add SpectreMitigation attribute (#190) --- pylib/gyp/easy_xml_test.py | 2 ++ pylib/gyp/generator/msvs.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/pylib/gyp/easy_xml_test.py b/pylib/gyp/easy_xml_test.py index 342f693a..c5808b84 100755 --- a/pylib/gyp/easy_xml_test.py +++ b/pylib/gyp/easy_xml_test.py @@ -76,6 +76,7 @@ def test_EasyXml_complex(self): '\'Debug|Win32\'" Label="Configuration">' "Application" "Unicode" + "SpectreLoadCF" "" "" ) @@ -99,6 +100,7 @@ def test_EasyXml_complex(self): }, ["ConfigurationType", "Application"], ["CharacterSet", "Unicode"], + ["SpectreMitigation", "SpectreLoadCF"] ], ] ) diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py index 72269bdc..85c354f7 100644 --- a/pylib/gyp/generator/msvs.py +++ b/pylib/gyp/generator/msvs.py @@ -3006,6 +3006,10 @@ def _GetMSBuildConfigurationDetails(spec, build_file): character_set = msbuild_attributes.get("CharacterSet") config_type = msbuild_attributes.get("ConfigurationType") _AddConditionalProperty(properties, condition, "ConfigurationType", config_type) + spectre_mitigation = msbuild_attributes.get('SpectreMitigation') + if spectre_mitigation: + _AddConditionalProperty(properties, condition, "SpectreMitigation", + spectre_mitigation) if config_type == "Driver": _AddConditionalProperty(properties, condition, "DriverType", "WDM") _AddConditionalProperty( @@ -3094,6 +3098,8 @@ def _ConvertMSVSBuildAttributes(spec, config, build_file): msbuild_attributes[a] = _ConvertMSVSCharacterSet(msvs_attributes[a]) elif a == "ConfigurationType": msbuild_attributes[a] = _ConvertMSVSConfigurationType(msvs_attributes[a]) + elif a == "SpectreMitigation": + msbuild_attributes[a] = msvs_attributes[a] else: print("Warning: Do not know how to convert MSVS attribute " + a) return msbuild_attributes