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
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
17import sys
18import 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
35class _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
48def _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
62def _GetMSBuildToolSettings(msbuild_settings, tool):
63  """Returns an MSBuild tool dictionary.  Creates it if needed."""
64  return msbuild_settings.setdefault(tool.msbuild_name, {})
65
66
67class _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
105class _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
121class _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
140class _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
158class _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
178class _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
233def _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
244def _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
264def _Moved(tool, settings_name, msbuild_tool_name, setting_type):
265  _MovedAndRenamed(tool, settings_name, msbuild_tool_name, settings_name,
266                   setting_type)
267
268
269def _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
292def _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
309def _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
320def _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
341def _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
365fix_vc_macro_slashes_regex_list = ('IntDir', 'OutDir')
366fix_vc_macro_slashes_regex = re.compile(
367  r'(\$\((?:%s)\))(?:[\\/]+)' % "|".join(fix_vc_macro_slashes_regex_list)
368)
369
370def FixVCMacroSlashes(s):
371  """Replace macros which have excessive following slashes.
372
373  These macros are known to have a built-in trailing slash. Furthermore, many
374  scripts hiccup on processing paths with extra slashes in the middle.
375
376  This list is probably not exhaustive.  Add as needed.
377  """
378  if '$' in s:
379    s = fix_vc_macro_slashes_regex.sub(r'\1', s)
380  return s
381
382
383def ConvertVCMacrosToMSBuild(s):
384  """Convert the the MSVS macros found in the string to the MSBuild equivalent.
385
386  This list is probably not exhaustive.  Add as needed.
387  """
388  if '$' in s:
389    replace_map = {
390        '$(ConfigurationName)': '$(Configuration)',
391        '$(InputDir)': '%(RootDir)%(Directory)',
392        '$(InputExt)': '%(Extension)',
393        '$(InputFileName)': '%(Filename)%(Extension)',
394        '$(InputName)': '%(Filename)',
395        '$(InputPath)': '%(FullPath)',
396        '$(ParentName)': '$(ProjectFileName)',
397        '$(PlatformName)': '$(Platform)',
398        '$(SafeInputName)': '%(Filename)',
399    }
400    for old, new in replace_map.iteritems():
401      s = s.replace(old, new)
402    s = FixVCMacroSlashes(s)
403  return s
404
405
406def ConvertToMSBuildSettings(msvs_settings, stderr=sys.stderr):
407  """Converts MSVS settings (VS2008 and earlier) to MSBuild settings (VS2010+).
408
409  Args:
410      msvs_settings: A dictionary.  The key is the tool name.  The values are
411          themselves dictionaries of settings and their values.
412      stderr: The stream receiving the error messages.
413
414  Returns:
415      A dictionary of MSBuild settings.  The key is either the MSBuild tool name
416      or the empty string (for the global settings).  The values are themselves
417      dictionaries of settings and their values.
418  """
419  msbuild_settings = {}
420  for msvs_tool_name, msvs_tool_settings in msvs_settings.iteritems():
421    if msvs_tool_name in _msvs_to_msbuild_converters:
422      msvs_tool = _msvs_to_msbuild_converters[msvs_tool_name]
423      for msvs_setting, msvs_value in msvs_tool_settings.iteritems():
424        if msvs_setting in msvs_tool:
425          # Invoke the translation function.
426          try:
427            msvs_tool[msvs_setting](msvs_value, msbuild_settings)
428          except ValueError, e:
429            print >> stderr, ('Warning: while converting %s/%s to MSBuild, '
430                              '%s' % (msvs_tool_name, msvs_setting, e))
431        else:
432          # We don't know this setting.  Give a warning.
433          print >> stderr, ('Warning: unrecognized setting %s/%s '
434                            'while converting to MSBuild.' %
435                            (msvs_tool_name, msvs_setting))
436    else:
437      print >> stderr, ('Warning: unrecognized tool %s while converting to '
438                        'MSBuild.' % msvs_tool_name)
439  return msbuild_settings
440
441
442def ValidateMSVSSettings(settings, stderr=sys.stderr):
443  """Validates that the names of the settings are valid for MSVS.
444
445  Args:
446      settings: A dictionary.  The key is the tool name.  The values are
447          themselves dictionaries of settings and their values.
448      stderr: The stream receiving the error messages.
449  """
450  _ValidateSettings(_msvs_validators, settings, stderr)
451
452
453def ValidateMSBuildSettings(settings, stderr=sys.stderr):
454  """Validates that the names of the settings are valid for MSBuild.
455
456  Args:
457      settings: A dictionary.  The key is the tool name.  The values are
458          themselves dictionaries of settings and their values.
459      stderr: The stream receiving the error messages.
460  """
461  _ValidateSettings(_msbuild_validators, settings, stderr)
462
463
464def _ValidateSettings(validators, settings, stderr):
465  """Validates that the settings are valid for MSBuild or MSVS.
466
467  We currently only validate the names of the settings, not their values.
468
469  Args:
470      validators: A dictionary of tools and their validators.
471      settings: A dictionary.  The key is the tool name.  The values are
472          themselves dictionaries of settings and their values.
473      stderr: The stream receiving the error messages.
474  """
475  for tool_name in settings:
476    if tool_name in validators:
477      tool_validators = validators[tool_name]
478      for setting, value in settings[tool_name].iteritems():
479        if setting in tool_validators:
480          try:
481            tool_validators[setting](value)
482          except ValueError, e:
483            print >> stderr, ('Warning: for %s/%s, %s' %
484                              (tool_name, setting, e))
485        else:
486          print >> stderr, ('Warning: unrecognized setting %s/%s' %
487                            (tool_name, setting))
488    else:
489      print >> stderr, ('Warning: unrecognized tool %s' % tool_name)
490
491
492# MSVS and MBuild names of the tools.
493_compile = _Tool('VCCLCompilerTool', 'ClCompile')
494_link = _Tool('VCLinkerTool', 'Link')
495_midl = _Tool('VCMIDLTool', 'Midl')
496_rc = _Tool('VCResourceCompilerTool', 'ResourceCompile')
497_lib = _Tool('VCLibrarianTool', 'Lib')
498_manifest = _Tool('VCManifestTool', 'Manifest')
499
500
501_AddTool(_compile)
502_AddTool(_link)
503_AddTool(_midl)
504_AddTool(_rc)
505_AddTool(_lib)
506_AddTool(_manifest)
507# Add sections only found in the MSBuild settings.
508_msbuild_validators[''] = {}
509_msbuild_validators['ProjectReference'] = {}
510_msbuild_validators['ManifestResourceCompile'] = {}
511
512# Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and
513# ClCompile in MSBuild.
514# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for
515# the schema of the MSBuild ClCompile settings.
516
517# Options that have the same name in MSVS and MSBuild
518_Same(_compile, 'AdditionalIncludeDirectories', _folder_list)  # /I
519_Same(_compile, 'AdditionalOptions', _string_list)
520_Same(_compile, 'AdditionalUsingDirectories', _folder_list)  # /AI
521_Same(_compile, 'AssemblerListingLocation', _file_name)  # /Fa
522_Same(_compile, 'BrowseInformationFile', _file_name)
523_Same(_compile, 'BufferSecurityCheck', _boolean)  # /GS
524_Same(_compile, 'DisableLanguageExtensions', _boolean)  # /Za
525_Same(_compile, 'DisableSpecificWarnings', _string_list)  # /wd
526_Same(_compile, 'EnableFiberSafeOptimizations', _boolean)  # /GT
527_Same(_compile, 'EnablePREfast', _boolean)  # /analyze Visible='false'
528_Same(_compile, 'ExpandAttributedSource', _boolean)  # /Fx
529_Same(_compile, 'FloatingPointExceptions', _boolean)  # /fp:except
530_Same(_compile, 'ForceConformanceInForLoopScope', _boolean)  # /Zc:forScope
531_Same(_compile, 'ForcedIncludeFiles', _file_list)  # /FI
532_Same(_compile, 'ForcedUsingFiles', _file_list)  # /FU
533_Same(_compile, 'GenerateXMLDocumentationFiles', _boolean)  # /doc
534_Same(_compile, 'IgnoreStandardIncludePath', _boolean)  # /X
535_Same(_compile, 'MinimalRebuild', _boolean)  # /Gm
536_Same(_compile, 'OmitDefaultLibName', _boolean)  # /Zl
537_Same(_compile, 'OmitFramePointers', _boolean)  # /Oy
538_Same(_compile, 'PreprocessorDefinitions', _string_list)  # /D
539_Same(_compile, 'ProgramDataBaseFileName', _file_name)  # /Fd
540_Same(_compile, 'RuntimeTypeInfo', _boolean)  # /GR
541_Same(_compile, 'ShowIncludes', _boolean)  # /showIncludes
542_Same(_compile, 'SmallerTypeCheck', _boolean)  # /RTCc
543_Same(_compile, 'StringPooling', _boolean)  # /GF
544_Same(_compile, 'SuppressStartupBanner', _boolean)  # /nologo
545_Same(_compile, 'TreatWChar_tAsBuiltInType', _boolean)  # /Zc:wchar_t
546_Same(_compile, 'UndefineAllPreprocessorDefinitions', _boolean)  # /u
547_Same(_compile, 'UndefinePreprocessorDefinitions', _string_list)  # /U
548_Same(_compile, 'UseFullPaths', _boolean)  # /FC
549_Same(_compile, 'WholeProgramOptimization', _boolean)  # /GL
550_Same(_compile, 'XMLDocumentationFileName', _file_name)
551
552_Same(_compile, 'AssemblerOutput',
553      _Enumeration(['NoListing',
554                    'AssemblyCode',  # /FA
555                    'All',  # /FAcs
556                    'AssemblyAndMachineCode',  # /FAc
557                    'AssemblyAndSourceCode']))  # /FAs
558_Same(_compile, 'BasicRuntimeChecks',
559      _Enumeration(['Default',
560                    'StackFrameRuntimeCheck',  # /RTCs
561                    'UninitializedLocalUsageCheck',  # /RTCu
562                    'EnableFastChecks']))  # /RTC1
563_Same(_compile, 'BrowseInformation',
564      _Enumeration(['false',
565                    'true',  # /FR
566                    'true']))  # /Fr
567_Same(_compile, 'CallingConvention',
568      _Enumeration(['Cdecl',  # /Gd
569                    'FastCall',  # /Gr
570                    'StdCall']))  # /Gz
571_Same(_compile, 'CompileAs',
572      _Enumeration(['Default',
573                    'CompileAsC',  # /TC
574                    'CompileAsCpp']))  # /TP
575_Same(_compile, 'DebugInformationFormat',
576      _Enumeration(['',  # Disabled
577                    'OldStyle',  # /Z7
578                    None,
579                    'ProgramDatabase',  # /Zi
580                    'EditAndContinue']))  # /ZI
581_Same(_compile, 'EnableEnhancedInstructionSet',
582      _Enumeration(['NotSet',
583                    'StreamingSIMDExtensions',  # /arch:SSE
584                    'StreamingSIMDExtensions2']))  # /arch:SSE2
585_Same(_compile, 'ErrorReporting',
586      _Enumeration(['None',  # /errorReport:none
587                    'Prompt',  # /errorReport:prompt
588                    'Queue'],  # /errorReport:queue
589                   new=['Send']))  # /errorReport:send"
590_Same(_compile, 'ExceptionHandling',
591      _Enumeration(['false',
592                    'Sync',  # /EHsc
593                    'Async'],  # /EHa
594                   new=['SyncCThrow']))  # /EHs
595_Same(_compile, 'FavorSizeOrSpeed',
596      _Enumeration(['Neither',
597                    'Speed',  # /Ot
598                    'Size']))  # /Os
599_Same(_compile, 'FloatingPointModel',
600      _Enumeration(['Precise',  # /fp:precise
601                    'Strict',  # /fp:strict
602                    'Fast']))  # /fp:fast
603_Same(_compile, 'InlineFunctionExpansion',
604      _Enumeration(['Default',
605                    'OnlyExplicitInline',  # /Ob1
606                    'AnySuitable'],  # /Ob2
607                   new=['Disabled']))  # /Ob0
608_Same(_compile, 'Optimization',
609      _Enumeration(['Disabled',  # /Od
610                    'MinSpace',  # /O1
611                    'MaxSpeed',  # /O2
612                    'Full']))  # /Ox
613_Same(_compile, 'RuntimeLibrary',
614      _Enumeration(['MultiThreaded',  # /MT
615                    'MultiThreadedDebug',  # /MTd
616                    'MultiThreadedDLL',  # /MD
617                    'MultiThreadedDebugDLL']))  # /MDd
618_Same(_compile, 'StructMemberAlignment',
619      _Enumeration(['Default',
620                    '1Byte',  # /Zp1
621                    '2Bytes',  # /Zp2
622                    '4Bytes',  # /Zp4
623                    '8Bytes',  # /Zp8
624                    '16Bytes']))  # /Zp16
625_Same(_compile, 'WarningLevel',
626      _Enumeration(['TurnOffAllWarnings',  # /W0
627                    'Level1',  # /W1
628                    'Level2',  # /W2
629                    'Level3',  # /W3
630                    'Level4'],  # /W4
631                   new=['EnableAllWarnings']))  # /Wall
632
633# Options found in MSVS that have been renamed in MSBuild.
634_Renamed(_compile, 'EnableFunctionLevelLinking', 'FunctionLevelLinking',
635         _boolean)  # /Gy
636_Renamed(_compile, 'EnableIntrinsicFunctions', 'IntrinsicFunctions',
637         _boolean)  # /Oi
638_Renamed(_compile, 'KeepComments', 'PreprocessKeepComments', _boolean)  # /C
639_Renamed(_compile, 'ObjectFile', 'ObjectFileName', _file_name)  # /Fo
640_Renamed(_compile, 'OpenMP', 'OpenMPSupport', _boolean)  # /openmp
641_Renamed(_compile, 'PrecompiledHeaderThrough', 'PrecompiledHeaderFile',
642         _file_name)  # Used with /Yc and /Yu
643_Renamed(_compile, 'PrecompiledHeaderFile', 'PrecompiledHeaderOutputFile',
644         _file_name)  # /Fp
645_Renamed(_compile, 'UsePrecompiledHeader', 'PrecompiledHeader',
646         _Enumeration(['NotUsing',  # VS recognized '' for this value too.
647                       'Create',   # /Yc
648                       'Use']))  # /Yu
649_Renamed(_compile, 'WarnAsError', 'TreatWarningAsError', _boolean)  # /WX
650
651_ConvertedToAdditionalOption(_compile, 'DefaultCharIsUnsigned', '/J')
652
653# MSVS options not found in MSBuild.
654_MSVSOnly(_compile, 'Detect64BitPortabilityProblems', _boolean)
655_MSVSOnly(_compile, 'UseUnicodeResponseFiles', _boolean)
656
657# MSBuild options not found in MSVS.
658_MSBuildOnly(_compile, 'BuildingInIDE', _boolean)
659_MSBuildOnly(_compile, 'CompileAsManaged',
660             _Enumeration([], new=['false',
661                                   'true',  # /clr
662                                   'Pure',  # /clr:pure
663                                   'Safe',  # /clr:safe
664                                   'OldSyntax']))  # /clr:oldSyntax
665_MSBuildOnly(_compile, 'CreateHotpatchableImage', _boolean)  # /hotpatch
666_MSBuildOnly(_compile, 'MultiProcessorCompilation', _boolean)  # /MP
667_MSBuildOnly(_compile, 'PreprocessOutputPath', _string)  # /Fi
668_MSBuildOnly(_compile, 'ProcessorNumber', _integer)  # the number of processors
669_MSBuildOnly(_compile, 'TrackerLogDirectory', _folder_name)
670_MSBuildOnly(_compile, 'TreatSpecificWarningsAsErrors', _string_list)  # /we
671_MSBuildOnly(_compile, 'UseUnicodeForAssemblerListing', _boolean)  # /FAu
672
673# Defines a setting that needs very customized processing
674_CustomGeneratePreprocessedFile(_compile, 'GeneratePreprocessedFile')
675
676
677# Directives for converting MSVS VCLinkerTool to MSBuild Link.
678# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\link.xml" for
679# the schema of the MSBuild Link settings.
680
681# Options that have the same name in MSVS and MSBuild
682_Same(_link, 'AdditionalDependencies', _file_list)
683_Same(_link, 'AdditionalLibraryDirectories', _folder_list)  # /LIBPATH
684#  /MANIFESTDEPENDENCY:
685_Same(_link, 'AdditionalManifestDependencies', _file_list)
686_Same(_link, 'AdditionalOptions', _string_list)
687_Same(_link, 'AddModuleNamesToAssembly', _file_list)  # /ASSEMBLYMODULE
688_Same(_link, 'AllowIsolation', _boolean)  # /ALLOWISOLATION
689_Same(_link, 'AssemblyLinkResource', _file_list)  # /ASSEMBLYLINKRESOURCE
690_Same(_link, 'BaseAddress', _string)  # /BASE
691_Same(_link, 'CLRUnmanagedCodeCheck', _boolean)  # /CLRUNMANAGEDCODECHECK
692_Same(_link, 'DelayLoadDLLs', _file_list)  # /DELAYLOAD
693_Same(_link, 'DelaySign', _boolean)  # /DELAYSIGN
694_Same(_link, 'EmbedManagedResourceFile', _file_list)  # /ASSEMBLYRESOURCE
695_Same(_link, 'EnableUAC', _boolean)  # /MANIFESTUAC
696_Same(_link, 'EntryPointSymbol', _string)  # /ENTRY
697_Same(_link, 'ForceSymbolReferences', _file_list)  # /INCLUDE
698_Same(_link, 'FunctionOrder', _file_name)  # /ORDER
699_Same(_link, 'GenerateDebugInformation', _boolean)  # /DEBUG
700_Same(_link, 'GenerateMapFile', _boolean)  # /MAP
701_Same(_link, 'HeapCommitSize', _string)
702_Same(_link, 'HeapReserveSize', _string)  # /HEAP
703_Same(_link, 'IgnoreAllDefaultLibraries', _boolean)  # /NODEFAULTLIB
704_Same(_link, 'IgnoreEmbeddedIDL', _boolean)  # /IGNOREIDL
705_Same(_link, 'ImportLibrary', _file_name)  # /IMPLIB
706_Same(_link, 'KeyContainer', _file_name)  # /KEYCONTAINER
707_Same(_link, 'KeyFile', _file_name)  # /KEYFILE
708_Same(_link, 'ManifestFile', _file_name)  # /ManifestFile
709_Same(_link, 'MapExports', _boolean)  # /MAPINFO:EXPORTS
710_Same(_link, 'MapFileName', _file_name)
711_Same(_link, 'MergedIDLBaseFileName', _file_name)  # /IDLOUT
712_Same(_link, 'MergeSections', _string)  # /MERGE
713_Same(_link, 'MidlCommandFile', _file_name)  # /MIDL
714_Same(_link, 'ModuleDefinitionFile', _file_name)  # /DEF
715_Same(_link, 'OutputFile', _file_name)  # /OUT
716_Same(_link, 'PerUserRedirection', _boolean)
717_Same(_link, 'Profile', _boolean)  # /PROFILE
718_Same(_link, 'ProfileGuidedDatabase', _file_name)  # /PGD
719_Same(_link, 'ProgramDatabaseFile', _file_name)  # /PDB
720_Same(_link, 'RegisterOutput', _boolean)
721_Same(_link, 'SetChecksum', _boolean)  # /RELEASE
722_Same(_link, 'StackCommitSize', _string)
723_Same(_link, 'StackReserveSize', _string)  # /STACK
724_Same(_link, 'StripPrivateSymbols', _file_name)  # /PDBSTRIPPED
725_Same(_link, 'SupportUnloadOfDelayLoadedDLL', _boolean)  # /DELAY:UNLOAD
726_Same(_link, 'SuppressStartupBanner', _boolean)  # /NOLOGO
727_Same(_link, 'SwapRunFromCD', _boolean)  # /SWAPRUN:CD
728_Same(_link, 'TurnOffAssemblyGeneration', _boolean)  # /NOASSEMBLY
729_Same(_link, 'TypeLibraryFile', _file_name)  # /TLBOUT
730_Same(_link, 'TypeLibraryResourceID', _integer)  # /TLBID
731_Same(_link, 'UACUIAccess', _boolean)  # /uiAccess='true'
732_Same(_link, 'Version', _string)  # /VERSION
733
734_Same(_link, 'EnableCOMDATFolding', _newly_boolean)  # /OPT:ICF
735_Same(_link, 'FixedBaseAddress', _newly_boolean)  # /FIXED
736_Same(_link, 'LargeAddressAware', _newly_boolean)  # /LARGEADDRESSAWARE
737_Same(_link, 'OptimizeReferences', _newly_boolean)  # /OPT:REF
738_Same(_link, 'RandomizedBaseAddress', _newly_boolean)  # /DYNAMICBASE
739_Same(_link, 'TerminalServerAware', _newly_boolean)  # /TSAWARE
740
741_subsystem_enumeration = _Enumeration(
742    ['NotSet',
743     'Console',  # /SUBSYSTEM:CONSOLE
744     'Windows',  # /SUBSYSTEM:WINDOWS
745     'Native',  # /SUBSYSTEM:NATIVE
746     'EFI Application',  # /SUBSYSTEM:EFI_APPLICATION
747     'EFI Boot Service Driver',  # /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER
748     'EFI ROM',  # /SUBSYSTEM:EFI_ROM
749     'EFI Runtime',  # /SUBSYSTEM:EFI_RUNTIME_DRIVER
750     'WindowsCE'],  # /SUBSYSTEM:WINDOWSCE
751    new=['POSIX'])  # /SUBSYSTEM:POSIX
752
753_target_machine_enumeration = _Enumeration(
754    ['NotSet',
755     'MachineX86',  # /MACHINE:X86
756     None,
757     'MachineARM',  # /MACHINE:ARM
758     'MachineEBC',  # /MACHINE:EBC
759     'MachineIA64',  # /MACHINE:IA64
760     None,
761     'MachineMIPS',  # /MACHINE:MIPS
762     'MachineMIPS16',  # /MACHINE:MIPS16
763     'MachineMIPSFPU',  # /MACHINE:MIPSFPU
764     'MachineMIPSFPU16',  # /MACHINE:MIPSFPU16
765     None,
766     None,
767     None,
768     'MachineSH4',  # /MACHINE:SH4
769     None,
770     'MachineTHUMB',  # /MACHINE:THUMB
771     'MachineX64'])  # /MACHINE:X64
772
773_Same(_link, 'AssemblyDebug',
774      _Enumeration(['',
775                    'true',  # /ASSEMBLYDEBUG
776                    'false']))  # /ASSEMBLYDEBUG:DISABLE
777_Same(_link, 'CLRImageType',
778      _Enumeration(['Default',
779                    'ForceIJWImage',  # /CLRIMAGETYPE:IJW
780                    'ForcePureILImage',  # /Switch="CLRIMAGETYPE:PURE
781                    'ForceSafeILImage']))  # /Switch="CLRIMAGETYPE:SAFE
782_Same(_link, 'CLRThreadAttribute',
783      _Enumeration(['DefaultThreadingAttribute',  # /CLRTHREADATTRIBUTE:NONE
784                    'MTAThreadingAttribute',  # /CLRTHREADATTRIBUTE:MTA
785                    'STAThreadingAttribute']))  # /CLRTHREADATTRIBUTE:STA
786_Same(_link, 'DataExecutionPrevention',
787      _Enumeration(['',
788                    'false',  # /NXCOMPAT:NO
789                    'true']))  # /NXCOMPAT
790_Same(_link, 'Driver',
791      _Enumeration(['NotSet',
792                    'Driver',  # /Driver
793                    'UpOnly',  # /DRIVER:UPONLY
794                    'WDM']))  # /DRIVER:WDM
795_Same(_link, 'LinkTimeCodeGeneration',
796      _Enumeration(['Default',
797                    'UseLinkTimeCodeGeneration',  # /LTCG
798                    'PGInstrument',  # /LTCG:PGInstrument
799                    'PGOptimization',  # /LTCG:PGOptimize
800                    'PGUpdate']))  # /LTCG:PGUpdate
801_Same(_link, 'ShowProgress',
802      _Enumeration(['NotSet',
803                    'LinkVerbose',  # /VERBOSE
804                    'LinkVerboseLib'],  # /VERBOSE:Lib
805                   new=['LinkVerboseICF',  # /VERBOSE:ICF
806                        'LinkVerboseREF',  # /VERBOSE:REF
807                        'LinkVerboseSAFESEH',  # /VERBOSE:SAFESEH
808                        'LinkVerboseCLR']))  # /VERBOSE:CLR
809_Same(_link, 'SubSystem', _subsystem_enumeration)
810_Same(_link, 'TargetMachine', _target_machine_enumeration)
811_Same(_link, 'UACExecutionLevel',
812      _Enumeration(['AsInvoker',  # /level='asInvoker'
813                    'HighestAvailable',  # /level='highestAvailable'
814                    'RequireAdministrator']))  # /level='requireAdministrator'
815
816
817# Options found in MSVS that have been renamed in MSBuild.
818_Renamed(_link, 'ErrorReporting', 'LinkErrorReporting',
819         _Enumeration(['NoErrorReport',  # /ERRORREPORT:NONE
820                       'PromptImmediately',  # /ERRORREPORT:PROMPT
821                       'QueueForNextLogin'],  # /ERRORREPORT:QUEUE
822                      new=['SendErrorReport']))  # /ERRORREPORT:SEND
823_Renamed(_link, 'IgnoreDefaultLibraryNames', 'IgnoreSpecificDefaultLibraries',
824         _file_list)  # /NODEFAULTLIB
825_Renamed(_link, 'ResourceOnlyDLL', 'NoEntryPoint', _boolean)  # /NOENTRY
826_Renamed(_link, 'SwapRunFromNet', 'SwapRunFromNET', _boolean)  # /SWAPRUN:NET
827
828_Moved(_link, 'GenerateManifest', '', _boolean)
829_Moved(_link, 'IgnoreImportLibrary', '', _boolean)
830_Moved(_link, 'LinkIncremental', '', _newly_boolean)
831_Moved(_link, 'LinkLibraryDependencies', 'ProjectReference', _boolean)
832_Moved(_link, 'UseLibraryDependencyInputs', 'ProjectReference', _boolean)
833
834# MSVS options not found in MSBuild.
835_MSVSOnly(_link, 'OptimizeForWindows98', _newly_boolean)
836_MSVSOnly(_link, 'UseUnicodeResponseFiles', _boolean)
837# These settings generate correctly in the MSVS output files when using
838# e.g. DelayLoadDLLs! or AdditionalDependencies! to exclude files from
839# configuration entries, but result in spurious artifacts which can be
840# safely ignored here.  See crbug.com/246570
841_MSVSOnly(_link, 'AdditionalLibraryDirectories_excluded', _folder_list)
842_MSVSOnly(_link, 'DelayLoadDLLs_excluded', _file_list)
843_MSVSOnly(_link, 'AdditionalDependencies_excluded', _file_list)
844
845# MSBuild options not found in MSVS.
846_MSBuildOnly(_link, 'BuildingInIDE', _boolean)
847_MSBuildOnly(_link, 'ImageHasSafeExceptionHandlers', _boolean)  # /SAFESEH
848_MSBuildOnly(_link, 'LinkDLL', _boolean)  # /DLL Visible='false'
849_MSBuildOnly(_link, 'LinkStatus', _boolean)  # /LTCG:STATUS
850_MSBuildOnly(_link, 'PreventDllBinding', _boolean)  # /ALLOWBIND
851_MSBuildOnly(_link, 'SupportNobindOfDelayLoadedDLL', _boolean)  # /DELAY:NOBIND
852_MSBuildOnly(_link, 'TrackerLogDirectory', _folder_name)
853_MSBuildOnly(_link, 'TreatLinkerWarningAsErrors', _boolean)  # /WX
854_MSBuildOnly(_link, 'MinimumRequiredVersion', _string)
855_MSBuildOnly(_link, 'MSDOSStubFileName', _file_name)  # /STUB Visible='false'
856_MSBuildOnly(_link, 'SectionAlignment', _integer)  # /ALIGN
857_MSBuildOnly(_link, 'SpecifySectionAttributes', _string)  # /SECTION
858_MSBuildOnly(_link, 'ForceFileOutput',
859             _Enumeration([], new=['Enabled',  # /FORCE
860                                   # /FORCE:MULTIPLE
861                                   'MultiplyDefinedSymbolOnly',
862                                   'UndefinedSymbolOnly']))  # /FORCE:UNRESOLVED
863_MSBuildOnly(_link, 'CreateHotPatchableImage',
864             _Enumeration([], new=['Enabled',  # /FUNCTIONPADMIN
865                                   'X86Image',  # /FUNCTIONPADMIN:5
866                                   'X64Image',  # /FUNCTIONPADMIN:6
867                                   'ItaniumImage']))  # /FUNCTIONPADMIN:16
868_MSBuildOnly(_link, 'CLRSupportLastError',
869             _Enumeration([], new=['Enabled',  # /CLRSupportLastError
870                                   'Disabled',  # /CLRSupportLastError:NO
871                                   # /CLRSupportLastError:SYSTEMDLL
872                                   'SystemDlls']))
873
874
875# Directives for converting VCResourceCompilerTool to ResourceCompile.
876# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\rc.xml" for
877# the schema of the MSBuild ResourceCompile settings.
878
879_Same(_rc, 'AdditionalOptions', _string_list)
880_Same(_rc, 'AdditionalIncludeDirectories', _folder_list)  # /I
881_Same(_rc, 'Culture', _Integer(msbuild_base=16))
882_Same(_rc, 'IgnoreStandardIncludePath', _boolean)  # /X
883_Same(_rc, 'PreprocessorDefinitions', _string_list)  # /D
884_Same(_rc, 'ResourceOutputFileName', _string)  # /fo
885_Same(_rc, 'ShowProgress', _boolean)  # /v
886# There is no UI in VisualStudio 2008 to set the following properties.
887# However they are found in CL and other tools.  Include them here for
888# completeness, as they are very likely to have the same usage pattern.
889_Same(_rc, 'SuppressStartupBanner', _boolean)  # /nologo
890_Same(_rc, 'UndefinePreprocessorDefinitions', _string_list)  # /u
891
892# MSBuild options not found in MSVS.
893_MSBuildOnly(_rc, 'NullTerminateStrings', _boolean)  # /n
894_MSBuildOnly(_rc, 'TrackerLogDirectory', _folder_name)
895
896
897# Directives for converting VCMIDLTool to Midl.
898# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\midl.xml" for
899# the schema of the MSBuild Midl settings.
900
901_Same(_midl, 'AdditionalIncludeDirectories', _folder_list)  # /I
902_Same(_midl, 'AdditionalOptions', _string_list)
903_Same(_midl, 'CPreprocessOptions', _string)  # /cpp_opt
904_Same(_midl, 'ErrorCheckAllocations', _boolean)  # /error allocation
905_Same(_midl, 'ErrorCheckBounds', _boolean)  # /error bounds_check
906_Same(_midl, 'ErrorCheckEnumRange', _boolean)  # /error enum
907_Same(_midl, 'ErrorCheckRefPointers', _boolean)  # /error ref
908_Same(_midl, 'ErrorCheckStubData', _boolean)  # /error stub_data
909_Same(_midl, 'GenerateStublessProxies', _boolean)  # /Oicf
910_Same(_midl, 'GenerateTypeLibrary', _boolean)
911_Same(_midl, 'HeaderFileName', _file_name)  # /h
912_Same(_midl, 'IgnoreStandardIncludePath', _boolean)  # /no_def_idir
913_Same(_midl, 'InterfaceIdentifierFileName', _file_name)  # /iid
914_Same(_midl, 'MkTypLibCompatible', _boolean)  # /mktyplib203
915_Same(_midl, 'OutputDirectory', _string)  # /out
916_Same(_midl, 'PreprocessorDefinitions', _string_list)  # /D
917_Same(_midl, 'ProxyFileName', _file_name)  # /proxy
918_Same(_midl, 'RedirectOutputAndErrors', _file_name)  # /o
919_Same(_midl, 'SuppressStartupBanner', _boolean)  # /nologo
920_Same(_midl, 'TypeLibraryName', _file_name)  # /tlb
921_Same(_midl, 'UndefinePreprocessorDefinitions', _string_list)  # /U
922_Same(_midl, 'WarnAsError', _boolean)  # /WX
923
924_Same(_midl, 'DefaultCharType',
925      _Enumeration(['Unsigned',  # /char unsigned
926                    'Signed',  # /char signed
927                    'Ascii']))  # /char ascii7
928_Same(_midl, 'TargetEnvironment',
929      _Enumeration(['NotSet',
930                    'Win32',  # /env win32
931                    'Itanium',  # /env ia64
932                    'X64']))  # /env x64
933_Same(_midl, 'EnableErrorChecks',
934      _Enumeration(['EnableCustom',
935                    'None',  # /error none
936                    'All']))  # /error all
937_Same(_midl, 'StructMemberAlignment',
938      _Enumeration(['NotSet',
939                    '1',  # Zp1
940                    '2',  # Zp2
941                    '4',  # Zp4
942                    '8']))  # Zp8
943_Same(_midl, 'WarningLevel',
944      _Enumeration(['0',  # /W0
945                    '1',  # /W1
946                    '2',  # /W2
947                    '3',  # /W3
948                    '4']))  # /W4
949
950_Renamed(_midl, 'DLLDataFileName', 'DllDataFileName', _file_name)  # /dlldata
951_Renamed(_midl, 'ValidateParameters', 'ValidateAllParameters',
952         _boolean)  # /robust
953
954# MSBuild options not found in MSVS.
955_MSBuildOnly(_midl, 'ApplicationConfigurationMode', _boolean)  # /app_config
956_MSBuildOnly(_midl, 'ClientStubFile', _file_name)  # /cstub
957_MSBuildOnly(_midl, 'GenerateClientFiles',
958             _Enumeration([], new=['Stub',  # /client stub
959                                   'None']))  # /client none
960_MSBuildOnly(_midl, 'GenerateServerFiles',
961             _Enumeration([], new=['Stub',  # /client stub
962                                   'None']))  # /client none
963_MSBuildOnly(_midl, 'LocaleID', _integer)  # /lcid DECIMAL
964_MSBuildOnly(_midl, 'ServerStubFile', _file_name)  # /sstub
965_MSBuildOnly(_midl, 'SuppressCompilerWarnings', _boolean)  # /no_warn
966_MSBuildOnly(_midl, 'TrackerLogDirectory', _folder_name)
967_MSBuildOnly(_midl, 'TypeLibFormat',
968             _Enumeration([], new=['NewFormat',  # /newtlb
969                                   'OldFormat']))  # /oldtlb
970
971
972# Directives for converting VCLibrarianTool to Lib.
973# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\lib.xml" for
974# the schema of the MSBuild Lib settings.
975
976_Same(_lib, 'AdditionalDependencies', _file_list)
977_Same(_lib, 'AdditionalLibraryDirectories', _folder_list)  # /LIBPATH
978_Same(_lib, 'AdditionalOptions', _string_list)
979_Same(_lib, 'ExportNamedFunctions', _string_list)  # /EXPORT
980_Same(_lib, 'ForceSymbolReferences', _string)  # /INCLUDE
981_Same(_lib, 'IgnoreAllDefaultLibraries', _boolean)  # /NODEFAULTLIB
982_Same(_lib, 'IgnoreSpecificDefaultLibraries', _file_list)  # /NODEFAULTLIB
983_Same(_lib, 'ModuleDefinitionFile', _file_name)  # /DEF
984_Same(_lib, 'OutputFile', _file_name)  # /OUT
985_Same(_lib, 'SuppressStartupBanner', _boolean)  # /NOLOGO
986_Same(_lib, 'UseUnicodeResponseFiles', _boolean)
987_Same(_lib, 'LinkTimeCodeGeneration', _boolean)  # /LTCG
988
989# TODO(jeanluc) _link defines the same value that gets moved to
990# ProjectReference.  We may want to validate that they are consistent.
991_Moved(_lib, 'LinkLibraryDependencies', 'ProjectReference', _boolean)
992
993# TODO(jeanluc) I don't think these are genuine settings but byproducts of Gyp.
994_MSVSOnly(_lib, 'AdditionalLibraryDirectories_excluded', _folder_list)
995
996_MSBuildOnly(_lib, 'DisplayLibrary', _string)  # /LIST Visible='false'
997_MSBuildOnly(_lib, 'ErrorReporting',
998             _Enumeration([], new=['PromptImmediately',  # /ERRORREPORT:PROMPT
999                                   'QueueForNextLogin',  # /ERRORREPORT:QUEUE
1000                                   'SendErrorReport',  # /ERRORREPORT:SEND
1001                                   'NoErrorReport']))  # /ERRORREPORT:NONE
1002_MSBuildOnly(_lib, 'MinimumRequiredVersion', _string)
1003_MSBuildOnly(_lib, 'Name', _file_name)  # /NAME
1004_MSBuildOnly(_lib, 'RemoveObjects', _file_list)  # /REMOVE
1005_MSBuildOnly(_lib, 'SubSystem', _subsystem_enumeration)
1006_MSBuildOnly(_lib, 'TargetMachine', _target_machine_enumeration)
1007_MSBuildOnly(_lib, 'TrackerLogDirectory', _folder_name)
1008_MSBuildOnly(_lib, 'TreatLibWarningAsErrors', _boolean)  # /WX
1009_MSBuildOnly(_lib, 'Verbose', _boolean)
1010
1011
1012# Directives for converting VCManifestTool to Mt.
1013# See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\mt.xml" for
1014# the schema of the MSBuild Lib settings.
1015
1016# Options that have the same name in MSVS and MSBuild
1017_Same(_manifest, 'AdditionalManifestFiles', _file_list)  # /manifest
1018_Same(_manifest, 'AdditionalOptions', _string_list)
1019_Same(_manifest, 'AssemblyIdentity', _string)  # /identity:
1020_Same(_manifest, 'ComponentFileName', _file_name)  # /dll
1021_Same(_manifest, 'GenerateCatalogFiles', _boolean)  # /makecdfs
1022_Same(_manifest, 'InputResourceManifests', _string)  # /inputresource
1023_Same(_manifest, 'OutputManifestFile', _file_name)  # /out
1024_Same(_manifest, 'RegistrarScriptFile', _file_name)  # /rgs
1025_Same(_manifest, 'ReplacementsFile', _file_name)  # /replacements
1026_Same(_manifest, 'SuppressStartupBanner', _boolean)  # /nologo
1027_Same(_manifest, 'TypeLibraryFile', _file_name)  # /tlb:
1028_Same(_manifest, 'UpdateFileHashes', _boolean)  # /hashupdate
1029_Same(_manifest, 'UpdateFileHashesSearchPath', _file_name)
1030_Same(_manifest, 'VerboseOutput', _boolean)  # /verbose
1031
1032# Options that have moved location.
1033_MovedAndRenamed(_manifest, 'ManifestResourceFile',
1034                 'ManifestResourceCompile',
1035                 'ResourceOutputFileName',
1036                 _file_name)
1037_Moved(_manifest, 'EmbedManifest', '', _boolean)
1038
1039# MSVS options not found in MSBuild.
1040_MSVSOnly(_manifest, 'DependencyInformationFile', _file_name)
1041_MSVSOnly(_manifest, 'UseFAT32Workaround', _boolean)
1042_MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean)
1043
1044# MSBuild options not found in MSVS.
1045_MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean)
1046_MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean)  # /category
1047_MSBuildOnly(_manifest, 'ManifestFromManagedAssembly',
1048             _file_name)  # /managedassemblyname
1049_MSBuildOnly(_manifest, 'OutputResourceManifests', _string)  # /outputresource
1050_MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean)  # /nodependency
1051_MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name)
1052