Skip to content

Commit

Permalink
Move language standard in separate method within vsbackend
Browse files Browse the repository at this point in the history
  • Loading branch information
Moroz Oleg authored and jpakkane committed Nov 2, 2021
1 parent 387e846 commit b726241
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
13 changes: 4 additions & 9 deletions mesonbuild/backend/vs2010backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,15 +1119,7 @@ def gen_vcxproj(self, target, ofname, guid):
else:
ET.SubElement(clconf, 'FavorSizeOrSpeed').text = 'Speed'
# Note: SuppressStartupBanner is /NOLOGO and is 'true' by default
if self.name in ('vs2017', 'vs2019'):
if 'cpp' in file_args:
optargs = [x for x in file_args['cpp'] if x.startswith('/std:c++')]
if optargs:
ET.SubElement(clconf, 'LanguageStandard').text = optargs[0].replace("/std:c++","stdcpp")
if 'c' in file_args:
optargs = [x for x in file_args['c'] if x.startswith('/std:c')]
if optargs:
ET.SubElement(clconf, 'LanguageStandard_C').text = optargs[0].replace("/std:c","stdc")
self.generate_lang_standard_info(file_args, clconf)
pch_sources = {}
if self.environment.coredata.options.get(OptionKey('b_pch')):
for lang in ['c', 'cpp']:
Expand Down Expand Up @@ -1515,3 +1507,6 @@ def generate_debug_information(self, link):
def add_regen_dependency(self, root):
regen_vcxproj = os.path.join(self.environment.get_build_dir(), 'REGEN.vcxproj')
self.add_project_reference(root, regen_vcxproj, self.environment.coredata.regen_guid)

def generate_lang_standard_info(self, file_args, clconf):
pass
10 changes: 10 additions & 0 deletions mesonbuild/backend/vs2017backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,13 @@ def __init__(self, build: T.Optional[Build], interpreter: T.Optional[Interpreter
def generate_debug_information(self, link):
# valid values for vs2017 is 'false', 'true', 'DebugFastLink', 'DebugFull'
ET.SubElement(link, 'GenerateDebugInformation').text = 'DebugFull'

def generate_lang_standard_info(self, file_args, clconf):
if 'cpp' in file_args:
optargs = [x for x in file_args['cpp'] if x.startswith('/std:c++')]
if optargs:
ET.SubElement(clconf, 'LanguageStandard').text = optargs[0].replace("/std:c++", "stdcpp")
if 'c' in file_args:
optargs = [x for x in file_args['c'] if x.startswith('/std:c')]
if optargs:
ET.SubElement(clconf, 'LanguageStandard_C').text = optargs[0].replace("/std:c", "stdc")
10 changes: 10 additions & 0 deletions mesonbuild/backend/vs2019backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ def __init__(self, build: T.Optional[Build], interpreter: T.Optional[Interpreter
def generate_debug_information(self, link):
# valid values for vs2019 is 'false', 'true', 'DebugFastLink', 'DebugFull'
ET.SubElement(link, 'GenerateDebugInformation').text = 'DebugFull'

def generate_lang_standard_info(self, file_args, clconf):
if 'cpp' in file_args:
optargs = [x for x in file_args['cpp'] if x.startswith('/std:c++')]
if optargs:
ET.SubElement(clconf, 'LanguageStandard').text = optargs[0].replace("/std:c++", "stdcpp")
if 'c' in file_args:
optargs = [x for x in file_args['c'] if x.startswith('/std:c')]
if optargs:
ET.SubElement(clconf, 'LanguageStandard_C').text = optargs[0].replace("/std:c", "stdc")

0 comments on commit b726241

Please sign in to comment.