From 8e24e9e09a17f4a944e827503b50c1b5282c1fc6 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 7 Nov 2015 00:04:04 +0200 Subject: [PATCH] Use all the extra flags in vs2010 projects. --- vs2010backend.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/vs2010backend.py b/vs2010backend.py index 8084ba55d..f785b96d4 100644 --- a/vs2010backend.py +++ b/vs2010backend.py @@ -382,12 +382,21 @@ class Vs2010Backend(backends.Backend): # SUCKS, VS can not handle per-language type flags, so just use # them all. extra_args += compiler.get_buildtype_args(self.buildtype) + for l in self.environment.coredata.external_args.values(): + for a in l: + extra_args.append(a) for l in self.build.global_args.values(): for a in l: extra_args.append(a) for l in target.extra_args.values(): for a in l: extra_args.append(a) + # FIXME all the internal flags of VS (optimization etc) are represented + # by their own XML elements. In theory we should split all flags to those + # that have an XML element and those that don't and serialise them + # properly. This is a crapton of work for no real gain, so just dump them + # here. + extra_args = compiler.get_option_compile_args(self.environment.coredata.compiler_options) if len(extra_args) > 0: extra_args.append('%(AdditionalOptions)') ET.SubElement(clconf, "AdditionalOptions").text = ' '.join(extra_args) @@ -413,6 +422,19 @@ class Vs2010Backend(backends.Backend): resourcecompile = ET.SubElement(compiles, 'ResourceCompile') ET.SubElement(resourcecompile, 'PreprocessorDefinitions') link = ET.SubElement(compiles, 'Link') + # Put all language args here, too. + extra_link_args = compiler.get_option_link_args(self.environment.coredata.compiler_options) + extra_link_args += compiler.get_buildtype_linker_args(self.buildtype) + for l in self.environment.coredata.external_link_args.values(): + for a in l: + extra_link_args.append(a) + for l in target.link_args: + for a in l: + extra_link_args.append(a) + if len(extra_args) > 0: + extra_args.append('%(AdditionalOptions)') + ET.SubElement(link, "AdditionalOptions").text = ' '.join(extra_args) + additional_links = [] for t in target.link_targets: lobj = self.build.targets[t.get_id()]