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