OLD | NEW |
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 r"""Code to validate and convert settings of the Microsoft build tools. | 5 r"""Code to validate and convert settings of the Microsoft build tools. |
6 | 6 |
7 This file contains code to validate and convert settings of the Microsoft | 7 This file contains code to validate and convert settings of the Microsoft |
8 build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(), | 8 build tools. The function ConvertToMSBuildSettings(), ValidateMSVSSettings(), |
9 and ValidateMSBuildSettings() are the entry points. | 9 and ValidateMSBuildSettings() are the entry points. |
10 | 10 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 | 308 |
309 def _MSBuildOnly(tool, name, setting_type): | 309 def _MSBuildOnly(tool, name, setting_type): |
310 """Defines a setting that is only found in MSBuild. | 310 """Defines a setting that is only found in MSBuild. |
311 | 311 |
312 Args: | 312 Args: |
313 tool: a dictionary that gives the names of the tool for MSVS and MSBuild. | 313 tool: a dictionary that gives the names of the tool for MSVS and MSBuild. |
314 name: the name of the setting. | 314 name: the name of the setting. |
315 setting_type: the type of this setting. | 315 setting_type: the type of this setting. |
316 """ | 316 """ |
| 317 |
| 318 def _Translate(value, msbuild_settings): |
| 319 # Let msbuild-only properties get translated as-is from msvs_settings. |
| 320 tool_settings = msbuild_settings.setdefault(tool.msbuild_name, {}) |
| 321 tool_settings[name] = value |
| 322 |
317 _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild | 323 _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild |
| 324 _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate |
318 | 325 |
319 | 326 |
320 def _ConvertedToAdditionalOption(tool, msvs_name, flag): | 327 def _ConvertedToAdditionalOption(tool, msvs_name, flag): |
321 """Defines a setting that's handled via a command line option in MSBuild. | 328 """Defines a setting that's handled via a command line option in MSBuild. |
322 | 329 |
323 Args: | 330 Args: |
324 tool: a dictionary that gives the names of the tool for MSVS and MSBuild. | 331 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 | 332 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 | 333 flag: the flag to insert at the end of the AdditionalOptions |
327 """ | 334 """ |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 print >> stderr, ('Warning: unrecognized tool %s' % tool_name) | 531 print >> stderr, ('Warning: unrecognized tool %s' % tool_name) |
525 | 532 |
526 | 533 |
527 # MSVS and MBuild names of the tools. | 534 # MSVS and MBuild names of the tools. |
528 _compile = _Tool('VCCLCompilerTool', 'ClCompile') | 535 _compile = _Tool('VCCLCompilerTool', 'ClCompile') |
529 _link = _Tool('VCLinkerTool', 'Link') | 536 _link = _Tool('VCLinkerTool', 'Link') |
530 _midl = _Tool('VCMIDLTool', 'Midl') | 537 _midl = _Tool('VCMIDLTool', 'Midl') |
531 _rc = _Tool('VCResourceCompilerTool', 'ResourceCompile') | 538 _rc = _Tool('VCResourceCompilerTool', 'ResourceCompile') |
532 _lib = _Tool('VCLibrarianTool', 'Lib') | 539 _lib = _Tool('VCLibrarianTool', 'Lib') |
533 _manifest = _Tool('VCManifestTool', 'Manifest') | 540 _manifest = _Tool('VCManifestTool', 'Manifest') |
| 541 _masm = _Tool('MASM', 'MASM') |
534 | 542 |
535 | 543 |
536 _AddTool(_compile) | 544 _AddTool(_compile) |
537 _AddTool(_link) | 545 _AddTool(_link) |
538 _AddTool(_midl) | 546 _AddTool(_midl) |
539 _AddTool(_rc) | 547 _AddTool(_rc) |
540 _AddTool(_lib) | 548 _AddTool(_lib) |
541 _AddTool(_manifest) | 549 _AddTool(_manifest) |
| 550 _AddTool(_masm) |
542 # Add sections only found in the MSBuild settings. | 551 # Add sections only found in the MSBuild settings. |
543 _msbuild_validators[''] = {} | 552 _msbuild_validators[''] = {} |
544 _msbuild_validators['ProjectReference'] = {} | 553 _msbuild_validators['ProjectReference'] = {} |
545 _msbuild_validators['ManifestResourceCompile'] = {} | 554 _msbuild_validators['ManifestResourceCompile'] = {} |
546 | 555 |
547 # Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and | 556 # Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and |
548 # ClCompile in MSBuild. | 557 # ClCompile in MSBuild. |
549 # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for | 558 # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for |
550 # the schema of the MSBuild ClCompile settings. | 559 # the schema of the MSBuild ClCompile settings. |
551 | 560 |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 _MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean) | 1082 _MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean) |
1074 | 1083 |
1075 # MSBuild options not found in MSVS. | 1084 # MSBuild options not found in MSVS. |
1076 _MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean) | 1085 _MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean) |
1077 _MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category | 1086 _MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category |
1078 _MSBuildOnly(_manifest, 'ManifestFromManagedAssembly', | 1087 _MSBuildOnly(_manifest, 'ManifestFromManagedAssembly', |
1079 _file_name) # /managedassemblyname | 1088 _file_name) # /managedassemblyname |
1080 _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource | 1089 _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource |
1081 _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency | 1090 _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency |
1082 _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name) | 1091 _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name) |
| 1092 |
| 1093 |
| 1094 # Directives for MASM. |
| 1095 # See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the |
| 1096 # MSBuild MASM settings. |
| 1097 |
| 1098 # Options that have the same name in MSVS and MSBuild. |
| 1099 _Same(_masm, 'UseSafeExceptionHandlers', _boolean) # /safeseh |
OLD | NEW |