1# Copyright (c) 2012 Google Inc. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5r"""Code to validate and convert settings of the Microsoft build tools.
6
7This file contains code to validate and convert settings of the Microsoft
8build tools.  The function ConvertToMSBuildSettings(), ValidateMSVSSettings(),
9and ValidateMSBuildSettings() are the entry points.
10
11This file was created by comparing the projects created by Visual Studio 2008
12and Visual Studio 2010 for all available settings through the user interface.
13The MSBuild schemas were also considered.  They are typically found in the
14MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
15"""
16
17from __future__ import print_function
18
19from gyp import string_types
20
21import sys
22import re
23
24# Dictionaries of settings validators. The key is the tool name, the value is
25# a dictionary mapping setting names to validation functions.
26_msvs_validators = {}
27_msbuild_validators = {}
28
29
30# A dictionary of settings converters. The key is the tool name, the value is
31# a dictionary mapping setting names to conversion functions.
32_msvs_to_msbuild_converters = {}
33
34
35# Tool name mapping from MSVS to MSBuild.
36_msbuild_name_of_tool = {}
37
38
39class _Tool(object):
40  """Represents a tool used by MSVS or MSBuild.
41
42  Attributes:
43      msvs_name: The name of the tool in MSVS.
44      msbuild_name: The name of the tool in MSBuild.
45  """
46
47  def __init__(self, msvs_name, msbuild_name):
48    self.msvs_name = msvs_name
49    self.msbuild_name = msbuild_name
50
51
52def _AddTool(tool):
53  """Adds a tool to the four dictionaries used to process settings.
54
55  This only defines the tool.  Each setting also needs to be added.
56
57  Args:
58    tool: The _Tool object to be added.
59  """
60  _msvs_validators[tool.msvs_name] = {}
61  _msbuild_validators[tool.msbuild_name] = {}
62  _msvs_to_msbuild_converters[tool.msvs_name] = {}
63  _msbuild_name_of_tool[tool.msvs_name] = tool.msbuild_name
64
65
66def _GetMSBuildToolSettings(msbuild_settings, tool):
67  """Returns an MSBuild tool dictionary.  Creates it if needed."""
68  return msbuild_settings.setdefault(tool.msbuild_name, {})
69
70
71class _Type(object):
72  """Type of settings (Base class)."""
73
74  def ValidateMSVS(self, value):
75    """Verifies that the value is legal for MSVS.
76
77    Args:
78      value: the value to check for this type.
79
80    Raises:
81      ValueError if value is not valid for MSVS.
82    """
83
84  def ValidateMSBuild(self, value):
85    """Verifies that the value is legal for MSBuild.
86
87    Args:
88      value: the value to check for this type.
89
90    Raises:
91      ValueError if value is not valid for MSBuild.
92    """
93
94  def ConvertToMSBuild(self, value):
95    """Returns the MSBuild equivalent of the MSVS value given.
96
97    Args:
98      value: the MSVS value to convert.
99
100    Returns:
101      the MSBuild equivalent.
102
103    Raises:
104      ValueError if value is not valid.
105    """
106    return value
107
108
109class _String(_Type):
110  """A setting that's just a string."""
111
112  def ValidateMSVS(self, value):
113    if not isinstance(value, string_types):
114      raise ValueError('expected string; got %r' % value)
115
116  def ValidateMSBuild(self, value):
117    if not isinstance(value, string_types):
118      raise ValueError('expected string; got %r' % value)
119
120  def ConvertToMSBuild(self, value):
121    # Convert the macros
122    return ConvertVCMacrosToMSBuild(value)
123
124
125class _StringList(_Type):
126  """A settings that's a list of strings."""
127
128  def ValidateMSVS(self, value):
129    if not isinstance(value, string_types) and not isinstance(value, list):
130      raise ValueError('expected string list; got %r' % value)
131
132  def ValidateMSBuild(self, value):
133    if not isinstance(value, string_types) and not isinstance(value, list):
134      raise ValueError('expected string list; got %r' % value)
135
136  def ConvertToMSBuild(self, value):
137    # Convert the macros
138    if isinstance(value, list):
139      return [ConvertVCMacrosToMSBuild(i) for i in value]
140    else:
141      return ConvertVCMacrosToMSBuild(value)
142
143
144class _Boolean(_Type):
145  """Boolean settings, can have the values 'false' or 'true'."""
146
147  def _Validate(self, value):
148    if value != 'true' and value != 'false':
149      raise ValueError('expected bool; got %r' % value)
150
151  def ValidateMSVS(self, value):
152    self._Validate(value)
153
154  def ValidateMSBuild(self, value):
155    self._Validate(value)
156
157  def ConvertToMSBuild(self, value):
158    self._Validate(value)
159    return value
160
161
162class _Integer(_Type):
163  """Integer settings."""
164
165  def __init__(self, msbuild_base=10):
166    _Type.__init__(self)
167    self._msbuild_base = msbuild_base
168
169  def ValidateMSVS(self, value):
170    # Try to convert, this will raise ValueError if invalid.
171    self.ConvertToMSBuild(value)
172
173  def ValidateMSBuild(self, value):
174    # Try to convert, this will raise ValueError if invalid.
175    int(value, self._msbuild_base)
176
177  def ConvertToMSBuild(self, value):
178    msbuild_format = (self._msbuild_base == 10) and '%d' or '0x%04x'
179    return msbuild_format % int(value)
180
181
182class _Enumeration(_Type):
183  """Type of settings that is an enumeration.
184
185  In MSVS, the values are indexes like '0', '1', and '2'.
186  MSBuild uses text labels that are more representative, like 'Win32'.
187
188  Constructor args:
189    label_list: an array of MSBuild labels that correspond to the MSVS index.
190        In the rare cases where MSVS has skipped an index value, None is
191        used in the array to indicate the unused spot.
192    new: an array of labels that are new to MSBuild.
193  """
194
195  def __init__(self, label_list, new=None):
196    _Type.__init__(self)
197    self._label_list = label_list
198    self._msbuild_values = set(value for value in label_list
199                               if value is not None)
200    if new is not None:
201      self._msbuild_values.update(new)
202
203  def ValidateMSVS(self, value):
204    # Try to convert.  It will raise an exception if not valid.
205    self.ConvertToMSBuild(value)
206
207  def ValidateMSBuild(self, value):
208    if value not in self._msbuild_values:
209      raise ValueError('unrecognized enumerated value %s' % value)
210
211  def ConvertToMSBuild(self, value):
212    index = int(value)
213    if index < 0 or index >= len(self._label_list):
214      raise ValueError('index value (%d) not in expected range [0, %d)' %
215                       (index, len(self._label_list)))
216    label = self._label_list[index]
217    if label is None:
218      raise ValueError('converted value for %s not specified.' % value)
219    return label
220
221
222# Instantiate the various generic types.
223_boolean = _Boolean()
224_integer = _Integer()
225# For now, we don't do any special validation on these types:
226_string = _String()
227_file_name = _String()
228_folder_name = _String()
229_file_list = _StringList()
230_folder_list = _StringList()
231_string_list = _StringList()
232# Some boolean settings went from numerical values to boolean.  The
233# mapping is 0: default, 1: false, 2: true.
234_newly_boolean = _Enumeration(['', 'false', 'true'])
235
236
237def _Same(tool, name, setting_type):
238  """Defines a setting that has the same name in MSVS and MSBuild.
239
240  Args:
241    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
242    name: the name of the setting.
243    setting_type: the type of this setting.
244  """
245  _Renamed(tool, name, name, setting_type)
246
247
248def _Renamed(tool, msvs_name, msbuild_name, setting_type):
249  """Defines a setting for which the name has changed.
250
251  Args:
252    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
253    msvs_name: the name of the MSVS setting.
254    msbuild_name: the name of the MSBuild setting.
255    setting_type: the type of this setting.
256  """
257
258  def _Translate(value, msbuild_settings):
259    msbuild_tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
260    msbuild_tool_settings[msbuild_name] = setting_type.ConvertToMSBuild(value)
261
262  _msvs_validators[tool.msvs_name][msvs_name] = setting_type.ValidateMSVS
263  _msbuild_validators[tool.msbuild_name][msbuild_name] = (
264      setting_type.ValidateMSBuild)
265  _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
266
267
268def _Moved(tool, settings_name, msbuild_tool_name, setting_type):
269  _MovedAndRenamed(tool, settings_name, msbuild_tool_name, settings_name,
270                   setting_type)
271
272
273def _MovedAndRenamed(tool, msvs_settings_name, msbuild_tool_name,
274                     msbuild_settings_name, setting_type):
275  """Defines a setting that may have moved to a new section.
276
277  Args:
278    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
279    msvs_settings_name: the MSVS name of the setting.
280    msbuild_tool_name: the name of the MSBuild tool to place the setting under.
281    msbuild_settings_name: the MSBuild name of the setting.
282    setting_type: the type of this setting.
283  """
284
285  def _Translate(value, msbuild_settings):
286    tool_settings = msbuild_settings.setdefault(msbuild_tool_name, {})
287    tool_settings[msbuild_settings_name] = setting_type.ConvertToMSBuild(value)
288
289  _msvs_validators[tool.msvs_name][msvs_settings_name] = (
290      setting_type.ValidateMSVS)
291  validator = setting_type.ValidateMSBuild
292  _msbuild_validators[msbuild_tool_name][msbuild_settings_name] = validator
293  _msvs_to_msbuild_converters[tool.msvs_name][msvs_settings_name] = _Translate
294
295
296def _MSVSOnly(tool, name, setting_type):
297  """Defines a setting that is only found in MSVS.
298
299  Args:
300    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
301    name: the name of the setting.
302    setting_type: the type of this setting.
303  """
304
305  def _Translate(unused_value, unused_msbuild_settings):
306    # Since this is for MSVS only settings, no translation will happen.
307    pass
308
309  _msvs_validators[tool.msvs_name][name] = setting_type.ValidateMSVS
310  _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
311
312
313def _MSBuildOnly(tool, name, setting_type):
314  """Defines a setting that is only found in MSBuild.
315
316  Args:
317    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
318    name: the name of the setting.
319    setting_type: the type of this setting.
320  """
321
322  def _Translate(value, msbuild_settings):
323    # Let msbuild-only properties get translated as-is from msvs_settings.
324    tool_settings = msbuild_settings.setdefault(tool.msbuild_name, {})
325    tool_settings[name] = value
326
327  _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild
328  _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate
329
330
331def _ConvertedToAdditionalOption(tool, msvs_name, flag):
332  """Defines a setting that's handled via a command line option in MSBuild.
333
334  Args:
335    tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
336    msvs_name: the name of the MSVS setting that if 'true' becomes a flag
337    flag: the flag to insert at the end of the AdditionalOptions
338  """
339
340  def _Translate(value, msbuild_settings):
341    if value == 'true':
342      tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
343      if 'AdditionalOptions' in tool_settings:
344        new_flags = '%s %s' % (tool_settings['AdditionalOptions'], flag)
345      else:
346        new_flags = flag
347      tool_settings['AdditionalOptions'] = new_flags
348  _msvs_validators[tool.msvs_name][msvs_name] = _boolean.ValidateMSVS
349  _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
350
351
352def _CustomGeneratePreprocessedFile(tool, msvs_name):
353  def _Translate(value, msbuild_settings):
354    tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
355    if value == '0':
356      tool_settings['PreprocessToFile'] = 'false'
357      tool_settings['PreprocessSuppressLineNumbers'] = 'false'
358    elif value == '1':  # /P
359      tool_settings['PreprocessToFile'] = 'true'
360      tool_settings['PreprocessSuppressLineNumbers'] = 'false'
361    elif value == '2':  # /EP /P
362      tool_settings['PreprocessToFile'] = 'true'
363      tool_settings['PreprocessSuppressLineNumbers'] = 'true'
364    else:
365      raise ValueError('value must be one of [0, 1, 2]; got %s' % value)
366  # Create a bogus validator that looks for '0', '1', or '2'
367  msvs_validator = _Enumeration(['a', 'b', 'c']).ValidateMSVS
368  _msvs_validators[tool.msvs_name][msvs_name] = msvs_validator
369  msbuild_validator = _boolean.ValidateMSBuild
370  msbuild_tool_validators = _msbuild_validators[tool.msbuild_name]
371  msbuild_tool_validators['PreprocessToFile'] = msbuild_validator
372  msbuild_tool_validators['PreprocessSuppressLineNumbers'] = msbuild_validator
373  _msvs_to_msbuild_converters[tool.msvs_name][msvs_name] = _Translate
374
375
376fix_vc_macro_slashes_regex_list = ('IntDir', 'OutDir')
377fix_vc_macro_slashes_regex = re.compile(
378  r'(\$\((?:%s)\))(?:[\\/]+)' % "|".join(fix_vc_macro_slashes_regex_list)
379)
380
381# Regular expression to detect keys that were generated by exclusion lists
382_EXCLUDED_SUFFIX_RE = re.compile('^(.*)_excluded$')
383
384
385def _ValidateExclusionSetting(setting, settings, error_msg, stderr=sys.stderr):
386  """Verify that 'setting' is valid if it is generated from an exclusion list.
387
388  If the setting appears to be generated from an exclusion list, the root name
389  is checked.
390
391  Args:
392      setting:   A string that is the setting name to validate
393      settings:  A dictionary where the keys are valid settings
394      error_msg: The message to emit in the event of error
395      stderr:    The stream receiving the error messages.
396  """
397  # This may be unrecognized because it's an exclusion list. If the
398  # setting name has the _excluded suffix, then check the root name.
399  unrecognized = True
400  m = re.match(_EXCLUDED_SUFFIX_RE, setting)
401  if m:
402    root_setting = m.group(1)
403    unrecognized = root_setting not in settings
404
405  if unrecognized:
406    # We don't know this setting. Give a warning.
407    print(error_msg, file=stderr)
408
409
410def FixVCMacroSlashes(s):
411  """Replace macros which have excessive following slashes.
412
413  These macros are known to have a built-in trailing slash. Furthermore, many
414  scripts hiccup on processing paths with extra slashes in the middle.
415
416  This list is probably not exhaustive.  Add as needed.
417  """
418  if '$' in s:
419    s = fix_vc_macro_slashes_regex.sub(r'\1', s)
420  return s
421
422
423def ConvertVCMacrosToMSBuild(s):
424  """Convert the MSVS macros found in the string to the MSBuild equivalent.
425
426  This list is probably not exhaustive.  Add as needed.
427  """
428  if '$' in s:
429    replace_map = {
430        '$(ConfigurationName)': '$(Configuration)',
431        '$(InputDir)': '%(RelativeDir)',
432        '$(InputExt)': '%(Extension)',
433        '$(InputFileName)': '%(Filename)%(Extension)',
434        '$(InputName)': '%(Filename)',
435        '$(InputPath)': '%(Identity)',
436        '$(ParentName)': '$(ProjectFileName)',
437        '$(PlatformName)': '$(Platform)',
438        '$(SafeInputName)': '%(Filename)',
439    }
440    for old, new in replace_map.items():
441      s = s.replace(old, new)
442    s = FixVCMacroSlashes(s)
443  return s
444
445
446def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
447  """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
448
449  Args:
450      msvs_settings: A dictionary.  The key is the tool name.  The values are
451          themselves dictionaries of settings and their values.
452      stderr: The stream receiving the error messages.
453
454  Returns:
455      A dictionary of MSBuild settings.  The key is either the MSBuild tool name
456      or the empty string (for the global settings).  The values are themselves
457      dictionaries of settings and their values.
458  """
459  msbuild_settings = {}
460  for msvs_tool_name, msvs_tool_settings in msvs_settings.items():
461    if msvs_tool_name in _msvs_to_msbuild_converters:
462      msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]
463      for msvs_setting, msvs_value in msvs_tool_settings.items():
464        if msvs_setting in msvs_tool:
465          # Invoke the translation function.
466          try:
467            msvs_tool[msvs_setting](msvs_value, msbuild_settings)
468          except ValueError as e:
469            print('Warning: while converting %s/%s to MSBuild, '
470                              '%s' % (msvs_tool_name, msvs_setting, e), file=stderr)
471        else:
472          _ValidateExclusionSetting(msvs_setting,
473                                    msvs_tool,
474                                    ('Warning: unrecognized setting %s/%s '
475                                     'while converting to MSBuild.' %
476                                     (msvs_tool_name, msvs_setting)),
477                                    stderr)
478    else:
479      print('Warning: unrecognized tool %s while converting to '
480                        'MSBuild.' % msvs_tool_name, file=stderr)
481  return msbuild_settings
482
483
484def ValidateMSVSSettings(settings, stderr=sys.stderr):
485  """Validates that the names of the settings are valid for MSVS.
486
487  Args:
488      settings: A dictionary.  The key is the tool name.  The values are
489          themselves dictionaries of settings and their values.
490      stderr: The stream receiving the error messages.
491  """
492  _ValidateSettings(_msvs_validators, settings, stderr)
493
494
495def ValidateMSBuildSettings(settings, stderr=sys.stderr):
496  """Validates that the names of the settings are valid for MSBuild.
497
498  Args:
499      settings: A dictionary.  The key is the tool name.  The values are
500          themselves dictionaries of settings and their values.
501      stderr: The stream receiving the error messages.
502  """
503  _ValidateSettings(_msbuild_validators, settings, stderr)
504
505
506def _ValidateSettings(validators, settings, stderr):
507  """Validates that the settings are valid for MSBuild or MSVS.
508
509  We currently only validate the names of the settings, not their values.
510
511  Args:
512      validators: A dictionary of tools and their validators.
513      settings: A dictionary.  The key is the tool name.  The values are
514          themselves dictionaries of settings and their values.
515      stderr: The stream receiving the error messages.
516  """
517  for tool_name in settings:
518    if tool_name in validators:
519      tool_validators = validators[tool_name]
520      for setting, value in settings[tool_name].items():
521        if setting in tool_validators:
522          try:
523            tool_validators[setting](value)
524          except ValueError as e:
525            print('Warning: for %s/%s, %s' %
526                              (tool_name, setting, e), file=stderr)
527        else:
528          _ValidateExclusionSetting(setting,
529                                    tool_validators,
530                                    ('Warning: unrecognized setting %s/%s' %
531                                     (tool_name, setting)),
532                                    stderr)
533
534    else:
535      print('Warning: unrecognized tool %s' % (tool_name), file=stderr)
536
537
538# MSVS and MBuild names of the tools.
539_compile = _Tool('VCCLCompilerTool', 'ClCompile')
540_link = _Tool('VCLinkerTool', 'Link')
541_midl = _Tool('VCMIDLTool', 'Midl')
542_rc = _Tool('VCResourceCompilerTool', 'ResourceCompile')
543_lib = _Tool('VCLibrarianTool', 'Lib')
544_manifest = _Tool('VCManifestTool', 'Manifest')
545_masm = _Tool('MASM', 'MASM')
546_armasm = _Tool('ARMASM', 'ARMASM')
547
548
549_AddTool(_compile)
550_AddTool(_link)
551_AddTool(_midl)
552_AddTool(_rc)
553_AddTool(_lib)
554_AddTool(_manifest)
555_AddTool(_masm)
556_AddTool(_armasm)
557# Add sections only found in the MSBuild settings.
558_msbuild_validators[''] = {}
559_msbuild_validators['ProjectReference'] = {}
560_msbuild_validators['ManifestResourceCompile'] = {}
561
562# Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and
563# ClCompile in MSBuild.
564# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for
565# the schema of the MSBuild ClCompile settings.
566
567# Options that have the same name in MSVS and MSBuild
568_Same(_compile, 'AdditionalIncludeDirectories', _folder_list)  # /I
569_Same(_compile, 'AdditionalOptions', _string_list)
570_Same(_compile, 'AdditionalUsingDirectories', _folder_list)  # /AI
571_Same(_compile, 'AssemblerListingLocation', _file_name)  # /Fa
572_Same(_compile, 'BrowseInformationFile', _file_name)
573_Same(_compile, 'BufferSecurityCheck', _boolean)  # /GS
574_Same(_compile, 'DisableLanguageExtensions', _boolean)  # /Za
575_Same(_compile, 'DisableSpecificWarnings', _string_list)  # /wd
576_Same(_compile, 'EnableFiberSafeOptimizations', _boolean)  # /GT
577_Same(_compile, 'EnablePREfast', _boolean)  # /analyze Visible='false'
578_Same(_compile, 'ExpandAttributedSource', _boolean)  # /Fx
579_Same(_compile, 'FloatingPointExceptions', _boolean)  # /fp:except
580_Same(_compile, 'ForceConformanceInForLoopScope', _boolean)  # /Zc:forScope
581_Same(_compile, 'ForcedIncludeFiles', _file_list)  # /FI
582_Same(_compile, 'ForcedUsingFiles', _file_list)  # /FU
583_Same(_compile, 'GenerateXMLDocumentationFiles', _boolean)  # /doc
584_Same(_compile, 'IgnoreStandardIncludePath', _boolean)  # /X
585_Same(_compile, 'MinimalRebuild', _boolean)  # /Gm
586_Same(_compile, 'OmitDefaultLibName', _boolean)  # /Zl
587_Same(_compile, 'OmitFramePointers', _boolean)  # /Oy
588_Same(_compile, 'PreprocessorDefinitions', _string_list)  # /D
589_Same(_compile, 'ProgramDataBaseFileName', _file_name)  # /Fd
590_Same(_compile, 'RuntimeTypeInfo', _boolean)  # /GR
591_Same(_compile, 'ShowIncludes', _boolean)  # /showIncludes
592_Same(_compile, 'SmallerTypeCheck', _boolean)  # /RTCc
593_Same(_compile, 'StringPooling', _boolean)  # /GF
594_Same(_compile, 'SuppressStartupBanner', _boolean)  # /nologo
595_Same(_compile, 'TreatWChar_tAsBuiltInType', _boolean)  # /Zc:wchar_t
596_Same(_compile, 'UndefineAllPreprocessorDefinitions', _boolean)  # /u
597_Same(_compile, 'UndefinePreprocessorDefinitions', _string_list)  # /U
598_Same(_compile, 'UseFullPaths', _boolean)  # /FC
599_Same(_compile, 'WholeProgramOptimization', _boolean)  # /GL
600_Same(_compile, 'XMLDocumentationFileName', _file_name)
601
602_Same(_compile, 'AssemblerOutput',
603      _Enumeration(['NoListing',
604                    'AssemblyCode',  # /FA
605                    'All',  # /FAcs
606                    'AssemblyAndMachineCode',  # /FAc
607                    'AssemblyAndSourceCode']))  # /FAs
608_Same(_compile, 'BasicRuntimeChecks',
609      _Enumeration(['Default',
610                    'StackFrameRuntimeCheck',  # /RTCs
611                    'UninitializedLocalUsageCheck',  # /RTCu
612                    'EnableFastChecks']))  # /RTC1
613_Same(_compile, 'BrowseInformation',
614      _Enumeration(['false',
615                    'true',  # /FR
616                    'true']))  # /Fr
617_Same(_compile, 'CallingConvention',
618      _Enumeration(['Cdecl',  # /Gd
619                    'FastCall',  # /Gr
620                    'StdCall',  # /Gz
621                    'VectorCall']))  # /Gv
622_Same(_compile, 'CompileAs',
623      _Enumeration(['Default',
624                    'CompileAsC',  # /TC
625                    'CompileAsCpp']))  # /TP
626_Same(_compile, 'DebugInformationFormat',
627      _Enumeration(['',  # Disabled
628                    'OldStyle',  # /Z7
629                    None,
630                    'ProgramDatabase',  # /Zi
631                    'EditAndContinue']))  # /ZI
632_Same(_compile, 'EnableEnhancedInstructionSet',
633      _Enumeration(['NotSet',
634                    'StreamingSIMDExtensions',  # /arch:SSE
635                    'StreamingSIMDExtensions2',  # /arch:SSE2
636                    'AdvancedVectorExtensions',  # /arch:AVX (vs2012+)
637                    'NoExtensions',  # /arch:IA32 (vs2012+)
638                    # This one only exists in the new msbuild format.
639                    'AdvancedVectorExtensions2',  # /arch:AVX2 (vs2013r2+)
640                    ]))
641_Same(_compile, 'ErrorReporting',
642      _Enumeration(['None',  # /errorReport:none
643                    'Prompt',  # /errorReport:prompt
644                    'Queue'],  # /errorReport:queue
645                   new=['Send']))  # /errorReport:send"
646_Same(_compile, 'ExceptionHandling',
647      _Enumeration(['false',
648                    'Sync',  # /EHsc
649                    'Async'],  # /EHa
650                   new=['SyncCThrow']))  # /EHs
651_Same(_compile, 'FavorSizeOrSpeed',
652      _Enumeration(['Neither',
653                    'Speed',  # /Ot
654                    'Size']))  # /Os
655_Same(_compile, 'FloatingPointModel',
656      _Enumeration(['Precise',  # /fp:precise
657                    'Strict',  # /fp:strict
658                    'Fast']))  # /fp:fast
659_Same(_compile, 'InlineFunctionExpansion',
660      _Enumeration(['Default',
661                    'OnlyExplicitInline',  # /Ob1
662                    'AnySuitable'],  # /Ob2
663                   new=['Disabled']))  # /Ob0
664_Same(_compile, 'Optimization',
665      _Enumeration(['Disabled',  # /Od
666                    'MinSpace',  # /O1
667                    'MaxSpeed',  # /O2
668                    'Full']))  # /Ox
669_Same(_compile, 'RuntimeLibrary',
670      _Enumeration(['MultiThreaded',  # /MT
671                    'MultiThreadedDebug',  # /MTd
672                    'MultiThreadedDLL',  # /MD
673                    'MultiThreadedDebugDLL']))  # /MDd
674_Same(_compile, 'StructMemberAlignment',
675      _Enumeration(['Default',
676                    '1Byte',  # /Zp1
677                    '2Bytes',  # /Zp2
678                    '4Bytes',  # /Zp4
679                    '8Bytes',  # /Zp8
680                    '16Bytes']))  # /Zp16
681_Same(_compile, 'WarningLevel',
682      _Enumeration(['TurnOffAllWarnings',  # /W0
683                    'Level1',  # /W1
684                    'Level2',  # /W2
685                    'Level3',  # /W3
686                    'Level4'],  # /W4
687                   new=['EnableAllWarnings']))  # /Wall
688
689# Options found in MSVS that have been renamed in MSBuild.
690_Renamed(_compile, 'EnableFunctionLevelLinking', 'FunctionLevelLinking',
691         _boolean)  # /Gy
692_Renamed(_compile, 'EnableIntrinsicFunctions', 'IntrinsicFunctions',
693         _boolean)  # /Oi
694_Renamed(_compile, 'KeepComments', 'PreprocessKeepComments', _boolean)  # /C
695_Renamed(_compile, 'ObjectFile', 'ObjectFileName', _file_name)  # /Fo
696_Renamed(_compile, 'OpenMP', 'OpenMPSupport', _boolean)  # /openmp
697_Renamed(_compile, 'PrecompiledHeaderThrough', 'PrecompiledHeaderFile',
698         _file_name)  # Used with /Yc and /Yu
699_Renamed(_compile, 'PrecompiledHeaderFile', 'PrecompiledHeaderOutputFile',
700         _file_name)  # /Fp
701_Renamed(_compile, 'UsePrecompiledHeader', 'PrecompiledHeader',
702         _Enumeration(['NotUsing',  # VS recognized '' for this value too.
703                       'Create',   # /Yc
704                       'Use']))  # /Yu
705_Renamed(_compile, 'WarnAsError', 'TreatWarningAsError', _boolean)  # /WX
706
707_ConvertedToAdditionalOption(_compile, 'DefaultCharIsUnsigned', '/J')
708
709# MSVS options not found in MSBuild.
710_MSVSOnly(_compile, 'Detect64BitPortabilityProblems', _boolean)
711_MSVSOnly(_compile, 'UseUnicodeResponseFiles', _boolean)
712
713# MSBuild options not found in MSVS.
714_MSBuildOnly(_compile, 'BuildingInIDE', _boolean)
715_MSBuildOnly(_compile, 'CompileAsManaged',
716             _Enumeration([], new=['false',
717                                   'true']))  # /clr
718_MSBuildOnly(_compile, 'CreateHotpatchableImage', _boolean)  # /hotpatch
719_MSBuildOnly(_compile, 'MultiProcessorCompilation', _boolean)  # /MP
720_MSBuildOnly(_compile, 'PreprocessOutputPath', _string)  # /Fi
721_MSBuildOnly(_compile, 'ProcessorNumber', _integer)  # the number of processors
722_MSBuildOnly(_compile, 'TrackerLogDirectory', _folder_name)
723_MSBuildOnly(_compile, 'TreatSpecificWarningsAsErrors', _string_list)  # /we
724_MSBuildOnly(_compile, 'UseUnicodeForAssemblerListing', _boolean)  # /FAu
725
726# Defines a setting that needs very customized processing
727_CustomGeneratePreprocessedFile(_compile, 'GeneratePreprocessedFile')
728
729
730# Directives for converting MSVS VCLinkerTool to MSBuild Link.
731# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for
732# the schema of the MSBuild Link settings.
733
734# Options that have the same name in MSVS and MSBuild
735_Same(_link, 'AdditionalDependencies', _file_list)
736_Same(_link, 'AdditionalLibraryDirectories', _folder_list)  # /LIBPATH
737#  /MANIFESTDEPENDENCY:
738_Same(_link, 'AdditionalManifestDependencies', _file_list)
739_Same(_link, 'AdditionalOptions', _string_list)
740_Same(_link, 'AddModuleNamesToAssembly', _file_list)  # /ASSEMBLYMODULE
741_Same(_link, 'AllowIsolation', _boolean)  # /ALLOWISOLATION
742_Same(_link, 'AssemblyLinkResource', _file_list)  # /ASSEMBLYLINKRESOURCE
743_Same(_link, 'BaseAddress', _string)  # /BASE
744_Same(_link, 'CLRUnmanagedCodeCheck', _boolean)  # /CLRUNMANAGEDCODECHECK
745_Same(_link, 'DelayLoadDLLs', _file_list)  # /DELAYLOAD
746_Same(_link, 'DelaySign', _boolean)  # /DELAYSIGN
747_Same(_link, 'EmbedManagedResourceFile', _file_list)  # /ASSEMBLYRESOURCE
748_Same(_link, 'EnableUAC', _boolean)  # /MANIFESTUAC
749_Same(_link, 'EntryPointSymbol', _string)  # /ENTRY
750_Same(_link, 'ForceSymbolReferences', _file_list)  # /INCLUDE
751_Same(_link, 'FunctionOrder', _file_name)  # /ORDER
752_Same(_link, 'GenerateDebugInformation', _boolean)  # /DEBUG
753_Same(_link, 'GenerateMapFile', _boolean)  # /MAP
754_Same(_link, 'HeapCommitSize', _string)
755_Same(_link, 'HeapReserveSize', _string)  # /HEAP
756_Same(_link, 'IgnoreAllDefaultLibraries', _boolean)  # /NODEFAULTLIB
757_Same(_link, 'IgnoreEmbeddedIDL', _boolean)  # /IGNOREIDL
758_Same(_link, 'ImportLibrary', _file_name)  # /IMPLIB
759_Same(_link, 'KeyContainer', _file_name)  # /KEYCONTAINER
760_Same(_link, 'KeyFile', _file_name)  # /KEYFILE
761_Same(_link, 'ManifestFile', _file_name)  # /ManifestFile
762_Same(_link, 'MapExports', _boolean)  # /MAPINFO:EXPORTS
763_Same(_link, 'MapFileName', _file_name)
764_Same(_link, 'MergedIDLBaseFileName', _file_name)  # /IDLOUT
765_Same(_link, 'MergeSections', _string)  # /MERGE
766_Same(_link, 'MidlCommandFile', _file_name)  # /MIDL
767_Same(_link, 'ModuleDefinitionFile', _file_name)  # /DEF
768_Same(_link, 'OutputFile', _file_name)  # /OUT
769_Same(_link, 'PerUserRedirection', _boolean)
770_Same(_link, 'Profile', _boolean)  # /PROFILE
771_Same(_link, 'ProfileGuidedDatabase', _file_name)  # /PGD
772_Same(_link, 'ProgramDatabaseFile', _file_name)  # /PDB
773_Same(_link, 'RegisterOutput', _boolean)
774_Same(_link, 'SetChecksum', _boolean)  # /RELEASE
775_Same(_link, 'StackCommitSize', _string)
776_Same(_link, 'StackReserveSize', _string)  # /STACK
777_Same(_link, 'StripPrivateSymbols', _file_name)  # /PDBSTRIPPED
778_Same(_link, 'SupportUnloadOfDelayLoadedDLL', _boolean)  # /DELAY:UNLOAD
779_Same(_link, 'SuppressStartupBanner', _boolean)  # /NOLOGO
780_Same(_link, 'SwapRunFromCD', _boolean)  # /SWAPRUN:CD
781_Same(_link, 'TurnOffAssemblyGeneration', _boolean)  # /NOASSEMBLY
782_Same(_link, 'TypeLibraryFile', _file_name)  # /TLBOUT
783_Same(_link, 'TypeLibraryResourceID', _integer)  # /TLBID
784_Same(_link, 'UACUIAccess', _boolean)  # /uiAccess='true'
785_Same(_link, 'Version', _string)  # /VERSION
786
787_Same(_link, 'EnableCOMDATFolding', _newly_boolean)  # /OPT:ICF
788_Same(_link, 'FixedBaseAddress', _newly_boolean)  # /FIXED
789_Same(_link, 'LargeAddressAware', _newly_boolean)  # /LARGEADDRESSAWARE
790_Same(_link, 'OptimizeReferences', _newly_boolean)  # /OPT:REF
791_Same(_link, 'RandomizedBaseAddress', _newly_boolean)  # /DYNAMICBASE
792_Same(_link, 'TerminalServerAware', _newly_boolean)  # /TSAWARE
793
794_subsystem_enumeration = _Enumeration(
795    ['NotSet',
796     'Console',  # /SUBSYSTEM:CONSOLE
797     'Windows',  # /SUBSYSTEM:WINDOWS
798     'Native',  # /SUBSYSTEM:NATIVE
799     'EFI Application',  # /SUBSYSTEM:EFI_APPLICATION
800     'EFI Boot Service Driver',  # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
801     'EFI ROM',  # /SUBSYSTEM:EFI_ROM
802     'EFI Runtime',  # /SUBSYSTEM:EFI_RUNTIME_DRIVER
803     'WindowsCE'],  # /SUBSYSTEM:WINDOWSCE
804    new=['POSIX'])  # /SUBSYSTEM:POSIX
805
806_target_machine_enumeration = _Enumeration(
807    ['NotSet',
808     'MachineX86',  # /MACHINE:X86
809     None,
810     'MachineARM',  # /MACHINE:ARM
811     'MachineEBC',  # /MACHINE:EBC
812     'MachineIA64',  # /MACHINE:IA64
813     None,
814     'MachineMIPS',  # /MACHINE:MIPS
815     'MachineMIPS16',  # /MACHINE:MIPS16
816     'MachineMIPSFPU',  # /MACHINE:MIPSFPU
817     'MachineMIPSFPU16',  # /MACHINE:MIPSFPU16
818     None,
819     None,
820     None,
821     'MachineSH4',  # /MACHINE:SH4
822     None,
823     'MachineTHUMB',  # /MACHINE:THUMB
824     'MachineX64'])  # /MACHINE:X64
825
826_Same(_link, 'AssemblyDebug',
827      _Enumeration(['',
828                    'true',  # /ASSEMBLYDEBUG
829                    'false']))  # /ASSEMBLYDEBUG:DISABLE
830_Same(_link, 'CLRImageType',
831      _Enumeration(['Default',
832                    'ForceIJWImage',  # /CLRIMAGETYPE:IJW
833                    'ForcePureILImage',  # /Switch="CLRIMAGETYPE:PURE
834                    'ForceSafeILImage']))  # /Switch="CLRIMAGETYPE:SAFE
835_Same(_link, 'CLRThreadAttribute',
836      _Enumeration(['DefaultThreadingAttribute',  # /CLRTHREADATTRIBUTE:NONE
837                    'MTAThreadingAttribute',  # /CLRTHREADATTRIBUTE:MTA
838                    'STAThreadingAttribute']))  # /CLRTHREADATTRIBUTE:STA
839_Same(_link, 'DataExecutionPrevention',
840      _Enumeration(['',
841                    'false',  # /NXCOMPAT:NO
842                    'true']))  # /NXCOMPAT
843_Same(_link, 'Driver',
844      _Enumeration(['NotSet',
845                    'Driver',  # /Driver
846                    'UpOnly',  # /DRIVER:UPONLY
847                    'WDM']))  # /DRIVER:WDM
848_Same(_link, 'LinkTimeCodeGeneration',
849      _Enumeration(['Default',
850                    'UseLinkTimeCodeGeneration',  # /LTCG
851                    'PGInstrument',  # /LTCG:PGInstrument
852                    'PGOptimization',  # /LTCG:PGOptimize
853                    'PGUpdate']))  # /LTCG:PGUpdate
854_Same(_link, 'ShowProgress',
855      _Enumeration(['NotSet',
856                    'LinkVerbose',  # /VERBOSE
857                    'LinkVerboseLib'],  # /VERBOSE:Lib
858                   new=['LinkVerboseICF',  # /VERBOSE:ICF
859                        'LinkVerboseREF',  # /VERBOSE:REF
860                        'LinkVerboseSAFESEH',  # /VERBOSE:SAFESEH
861                        'LinkVerboseCLR']))  # /VERBOSE:CLR
862_Same(_link, 'SubSystem', _subsystem_enumeration)
863_Same(_link, 'TargetMachine', _target_machine_enumeration)
864_Same(_link, 'UACExecutionLevel',
865      _Enumeration(['AsInvoker',  # /level='asInvoker'
866                    'HighestAvailable',  # /level='highestAvailable'
867                    'RequireAdministrator']))  # /level='requireAdministrator'
868_Same(_link, 'MinimumRequiredVersion', _string)
869_Same(_link, 'TreatLinkerWarningAsErrors', _boolean)  # /WX
870
871
872# Options found in MSVS that have been renamed in MSBuild.
873_Renamed(_link, 'ErrorReporting', 'LinkErrorReporting',
874         _Enumeration(['NoErrorReport',  # /ERRORREPORT:NONE
875                       'PromptImmediately',  # /ERRORREPORT:PROMPT
876                       'QueueForNextLogin'],  # /ERRORREPORT:QUEUE
877                      new=['SendErrorReport']))  # /ERRORREPORT:SEND
878_Renamed(_link, 'IgnoreDefaultLibraryNames', 'IgnoreSpecificDefaultLibraries',
879         _file_list)  # /NODEFAULTLIB
880_Renamed(_link, 'ResourceOnlyDLL', 'NoEntryPoint', _boolean)  # /NOENTRY
881_Renamed(_link, 'SwapRunFromNet', 'SwapRunFromNET', _boolean)  # /SWAPRUN:NET
882
883_Moved(_link, 'GenerateManifest', '', _boolean)
884_Moved(_link, 'IgnoreImportLibrary', '', _boolean)
885_Moved(_link, 'LinkIncremental', '', _newly_boolean)
886_Moved(_link, 'LinkLibraryDependencies', 'ProjectReference', _boolean)
887_Moved(_link, 'UseLibraryDependencyInputs', 'ProjectReference', _boolean)
888
889# MSVS options not found in MSBuild.
890_MSVSOnly(_link, 'OptimizeForWindows98', _newly_boolean)
891_MSVSOnly(_link, 'UseUnicodeResponseFiles', _boolean)
892
893# MSBuild options not found in MSVS.
894_MSBuildOnly(_link, 'BuildingInIDE', _boolean)
895_MSBuildOnly(_link, 'ImageHasSafeExceptionHandlers', _boolean)  # /SAFESEH
896_MSBuildOnly(_link, 'LinkDLL', _boolean)  # /DLL Visible='false'
897_MSBuildOnly(_link, 'LinkStatus', _boolean)  # /LTCG:STATUS
898_MSBuildOnly(_link, 'PreventDllBinding', _boolean)  # /ALLOWBIND
899_MSBuildOnly(_link, 'SupportNobindOfDelayLoadedDLL', _boolean)  # /DELAY:NOBIND
900_MSBuildOnly(_link, 'TrackerLogDirectory', _folder_name)
901_MSBuildOnly(_link, 'MSDOSStubFileName', _file_name)  # /STUB Visible='false'
902_MSBuildOnly(_link, 'SectionAlignment', _integer)  # /ALIGN
903_MSBuildOnly(_link, 'SpecifySectionAttributes', _string)  # /SECTION
904_MSBuildOnly(_link, 'ForceFileOutput',
905             _Enumeration([], new=['Enabled',  # /FORCE
906                                   # /FORCE:MULTIPLE
907                                   'MultiplyDefinedSymbolOnly',
908                                   'UndefinedSymbolOnly']))  # /FORCE:UNRESOLVED
909_MSBuildOnly(_link, 'CreateHotPatchableImage',
910             _Enumeration([], new=['Enabled',  # /FUNCTIONPADMIN
911                                   'X86Image',  # /FUNCTIONPADMIN:5
912                                   'X64Image',  # /FUNCTIONPADMIN:6
913                                   'ItaniumImage']))  # /FUNCTIONPADMIN:16
914_MSBuildOnly(_link, 'CLRSupportLastError',
915             _Enumeration([], new=['Enabled',  # /CLRSupportLastError
916                                   'Disabled',  # /CLRSupportLastError:NO
917                                   # /CLRSupportLastError:SYSTEMDLL
918                                   'SystemDlls']))
919
920
921# Directives for converting VCResourceCompilerTool to ResourceCompile.
922# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for
923# the schema of the MSBuild ResourceCompile settings.
924
925_Same(_rc, 'AdditionalOptions', _string_list)
926_Same(_rc, 'AdditionalIncludeDirectories', _folder_list)  # /I
927_Same(_rc, 'Culture', _Integer(msbuild_base=16))
928_Same(_rc, 'IgnoreStandardIncludePath', _boolean)  # /X
929_Same(_rc, 'PreprocessorDefinitions', _string_list)  # /D
930_Same(_rc, 'ResourceOutputFileName', _string)  # /fo
931_Same(_rc, 'ShowProgress', _boolean)  # /v
932# There is no UI in VisualStudio 2008 to set the following properties.
933# However they are found in CL and other tools.  Include them here for
934# completeness, as they are very likely to have the same usage pattern.
935_Same(_rc, 'SuppressStartupBanner', _boolean)  # /nologo
936_Same(_rc, 'UndefinePreprocessorDefinitions', _string_list)  # /u
937
938# MSBuild options not found in MSVS.
939_MSBuildOnly(_rc, 'NullTerminateStrings', _boolean)  # /n
940_MSBuildOnly(_rc, 'TrackerLogDirectory', _folder_name)
941
942
943# Directives for converting VCMIDLTool to Midl.
944# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for
945# the schema of the MSBuild Midl settings.
946
947_Same(_midl, 'AdditionalIncludeDirectories', _folder_list)  # /I
948_Same(_midl, 'AdditionalOptions', _string_list)
949_Same(_midl, 'CPreprocessOptions', _string)  # /cpp_opt
950_Same(_midl, 'ErrorCheckAllocations', _boolean)  # /error allocation
951_Same(_midl, 'ErrorCheckBounds', _boolean)  # /error bounds_check
952_Same(_midl, 'ErrorCheckEnumRange', _boolean)  # /error enum
953_Same(_midl, 'ErrorCheckRefPointers', _boolean)  # /error ref
954_Same(_midl, 'ErrorCheckStubData', _boolean)  # /error stub_data
955_Same(_midl, 'GenerateStublessProxies', _boolean)  # /Oicf
956_Same(_midl, 'GenerateTypeLibrary', _boolean)
957_Same(_midl, 'HeaderFileName', _file_name)  # /h
958_Same(_midl, 'IgnoreStandardIncludePath', _boolean)  # /no_def_idir
959_Same(_midl, 'InterfaceIdentifierFileName', _file_name)  # /iid
960_Same(_midl, 'MkTypLibCompatible', _boolean)  # /mktyplib203
961_Same(_midl, 'OutputDirectory', _string)  # /out
962_Same(_midl, 'PreprocessorDefinitions', _string_list)  # /D
963_Same(_midl, 'ProxyFileName', _file_name)  # /proxy
964_Same(_midl, 'RedirectOutputAndErrors', _file_name)  # /o
965_Same(_midl, 'SuppressStartupBanner', _boolean)  # /nologo
966_Same(_midl, 'TypeLibraryName', _file_name)  # /tlb
967_Same(_midl, 'UndefinePreprocessorDefinitions', _string_list)  # /U
968_Same(_midl, 'WarnAsError', _boolean)  # /WX
969
970_Same(_midl, 'DefaultCharType',
971      _Enumeration(['Unsigned',  # /char unsigned
972                    'Signed',  # /char signed
973                    'Ascii']))  # /char ascii7
974_Same(_midl, 'TargetEnvironment',
975      _Enumeration(['NotSet',
976                    'Win32',  # /env win32
977                    'Itanium',  # /env ia64
978                    'X64',  # /env x64
979                    'ARM64',  # /env arm64
980                    ]))
981_Same(_midl, 'EnableErrorChecks',
982      _Enumeration(['EnableCustom',
983                    'None',  # /error none
984                    'All']))  # /error all
985_Same(_midl, 'StructMemberAlignment',
986      _Enumeration(['NotSet',
987                    '1',  # Zp1
988                    '2',  # Zp2
989                    '4',  # Zp4
990                    '8']))  # Zp8
991_Same(_midl, 'WarningLevel',
992      _Enumeration(['0',  # /W0
993                    '1',  # /W1
994                    '2',  # /W2
995                    '3',  # /W3
996                    '4']))  # /W4
997
998_Renamed(_midl, 'DLLDataFileName', 'DllDataFileName', _file_name)  # /dlldata
999_Renamed(_midl, 'ValidateParameters', 'ValidateAllParameters',
1000         _boolean)  # /robust
1001
1002# MSBuild options not found in MSVS.
1003_MSBuildOnly(_midl, 'ApplicationConfigurationMode', _boolean)  # /app_config
1004_MSBuildOnly(_midl, 'ClientStubFile', _file_name)  # /cstub
1005_MSBuildOnly(_midl, 'GenerateClientFiles',
1006             _Enumeration([], new=['Stub',  # /client stub
1007                                   'None']))  # /client none
1008_MSBuildOnly(_midl, 'GenerateServerFiles',
1009             _Enumeration([], new=['Stub',  # /client stub
1010                                   'None']))  # /client none
1011_MSBuildOnly(_midl, 'LocaleID', _integer)  # /lcid DECIMAL
1012_MSBuildOnly(_midl, 'ServerStubFile', _file_name)  # /sstub
1013_MSBuildOnly(_midl, 'SuppressCompilerWarnings', _boolean)  # /no_warn
1014_MSBuildOnly(_midl, 'TrackerLogDirectory', _folder_name)
1015_MSBuildOnly(_midl, 'TypeLibFormat',
1016             _Enumeration([], new=['NewFormat',  # /newtlb
1017                                   'OldFormat']))  # /oldtlb
1018
1019
1020# Directives for converting VCLibrarianTool to Lib.
1021# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for
1022# the schema of the MSBuild Lib settings.
1023
1024_Same(_lib, 'AdditionalDependencies', _file_list)
1025_Same(_lib, 'AdditionalLibraryDirectories', _folder_list)  # /LIBPATH
1026_Same(_lib, 'AdditionalOptions', _string_list)
1027_Same(_lib, 'ExportNamedFunctions', _string_list)  # /EXPORT
1028_Same(_lib, 'ForceSymbolReferences', _string)  # /INCLUDE
1029_Same(_lib, 'IgnoreAllDefaultLibraries', _boolean)  # /NODEFAULTLIB
1030_Same(_lib, 'IgnoreSpecificDefaultLibraries', _file_list)  # /NODEFAULTLIB
1031_Same(_lib, 'ModuleDefinitionFile', _file_name)  # /DEF
1032_Same(_lib, 'OutputFile', _file_name)  # /OUT
1033_Same(_lib, 'SuppressStartupBanner', _boolean)  # /NOLOGO
1034_Same(_lib, 'UseUnicodeResponseFiles', _boolean)
1035_Same(_lib, 'LinkTimeCodeGeneration', _boolean)  # /LTCG
1036_Same(_lib, 'TargetMachine', _target_machine_enumeration)
1037
1038# TODO(jeanluc) _link defines the same value that gets moved to
1039# ProjectReference.  We may want to validate that they are consistent.
1040_Moved(_lib, 'LinkLibraryDependencies', 'ProjectReference', _boolean)
1041
1042_MSBuildOnly(_lib, 'DisplayLibrary', _string)  # /LIST Visible='false'
1043_MSBuildOnly(_lib, 'ErrorReporting',
1044             _Enumeration([], new=['PromptImmediately',  # /ERRORREPORT:PROMPT
1045                                   'QueueForNextLogin',  # /ERRORREPORT:QUEUE
1046                                   'SendErrorReport',  # /ERRORREPORT:SEND
1047                                   'NoErrorReport']))  # /ERRORREPORT:NONE
1048_MSBuildOnly(_lib, 'MinimumRequiredVersion', _string)
1049_MSBuildOnly(_lib, 'Name', _file_name)  # /NAME
1050_MSBuildOnly(_lib, 'RemoveObjects', _file_list)  # /REMOVE
1051_MSBuildOnly(_lib, 'SubSystem', _subsystem_enumeration)
1052_MSBuildOnly(_lib, 'TrackerLogDirectory', _folder_name)
1053_MSBuildOnly(_lib, 'TreatLibWarningAsErrors', _boolean)  # /WX
1054_MSBuildOnly(_lib, 'Verbose', _boolean)
1055
1056
1057# Directives for converting VCManifestTool to Mt.
1058# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for
1059# the schema of the MSBuild Lib settings.
1060
1061# Options that have the same name in MSVS and MSBuild
1062_Same(_manifest, 'AdditionalManifestFiles', _file_list)  # /manifest
1063_Same(_manifest, 'AdditionalOptions', _string_list)
1064_Same(_manifest, 'AssemblyIdentity', _string)  # /identity:
1065_Same(_manifest, 'ComponentFileName', _file_name)  # /dll
1066_Same(_manifest, 'GenerateCatalogFiles', _boolean)  # /makecdfs
1067_Same(_manifest, 'InputResourceManifests', _string)  # /inputresource
1068_Same(_manifest, 'OutputManifestFile', _file_name)  # /out
1069_Same(_manifest, 'RegistrarScriptFile', _file_name)  # /rgs
1070_Same(_manifest, 'ReplacementsFile', _file_name)  # /replacements
1071_Same(_manifest, 'SuppressStartupBanner', _boolean)  # /nologo
1072_Same(_manifest, 'TypeLibraryFile', _file_name)  # /tlb:
1073_Same(_manifest, 'UpdateFileHashes', _boolean)  # /hashupdate
1074_Same(_manifest, 'UpdateFileHashesSearchPath', _file_name)
1075_Same(_manifest, 'VerboseOutput', _boolean)  # /verbose
1076
1077# Options that have moved location.
1078_MovedAndRenamed(_manifest, 'ManifestResourceFile',
1079                 'ManifestResourceCompile',
1080                 'ResourceOutputFileName',
1081                 _file_name)
1082_Moved(_manifest, 'EmbedManifest', '', _boolean)
1083
1084# MSVS options not found in MSBuild.
1085_MSVSOnly(_manifest, 'DependencyInformationFile', _file_name)
1086_MSVSOnly(_manifest, 'UseFAT32Workaround', _boolean)
1087_MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean)
1088
1089# MSBuild options not found in MSVS.
1090_MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean)
1091_MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean)  # /category
1092_MSBuildOnly(_manifest, 'ManifestFromManagedAssembly',
1093             _file_name)  # /managedassemblyname
1094_MSBuildOnly(_manifest, 'OutputResourceManifests', _string)  # /outputresource
1095_MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean)  # /nodependency
1096_MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name)
1097
1098
1099# Directives for MASM.
1100# See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the
1101# MSBuild MASM settings.
1102
1103# Options that have the same name in MSVS and MSBuild.
1104_Same(_masm, 'UseSafeExceptionHandlers', _boolean)  # /safeseh
1105