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 | |
323 _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild | 317 _msbuild_validators[tool.msbuild_name][name] = setting_type.ValidateMSBuild |
324 _msvs_to_msbuild_converters[tool.msvs_name][name] = _Translate | |
325 | 318 |
326 | 319 |
327 def _ConvertedToAdditionalOption(tool, msvs_name, flag): | 320 def _ConvertedToAdditionalOption(tool, msvs_name, flag): |
328 """Defines a setting that's handled via a command line option in MSBuild. | 321 """Defines a setting that's handled via a command line option in MSBuild. |
329 | 322 |
330 Args: | 323 Args: |
331 tool: a dictionary that gives the names of the tool for MSVS and MSBuild. | 324 tool: a dictionary that gives the names of the tool for MSVS and MSBuild. |
332 msvs_name: the name of the MSVS setting that if 'true' becomes a flag | 325 msvs_name: the name of the MSVS setting that if 'true' becomes a flag |
333 flag: the flag to insert at the end of the AdditionalOptions | 326 flag: the flag to insert at the end of the AdditionalOptions |
334 """ | 327 """ |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 print >> stderr, ('Warning: unrecognized tool %s' % tool_name) | 524 print >> stderr, ('Warning: unrecognized tool %s' % tool_name) |
532 | 525 |
533 | 526 |
534 # MSVS and MBuild names of the tools. | 527 # MSVS and MBuild names of the tools. |
535 _compile = _Tool('VCCLCompilerTool', 'ClCompile') | 528 _compile = _Tool('VCCLCompilerTool', 'ClCompile') |
536 _link = _Tool('VCLinkerTool', 'Link') | 529 _link = _Tool('VCLinkerTool', 'Link') |
537 _midl = _Tool('VCMIDLTool', 'Midl') | 530 _midl = _Tool('VCMIDLTool', 'Midl') |
538 _rc = _Tool('VCResourceCompilerTool', 'ResourceCompile') | 531 _rc = _Tool('VCResourceCompilerTool', 'ResourceCompile') |
539 _lib = _Tool('VCLibrarianTool', 'Lib') | 532 _lib = _Tool('VCLibrarianTool', 'Lib') |
540 _manifest = _Tool('VCManifestTool', 'Manifest') | 533 _manifest = _Tool('VCManifestTool', 'Manifest') |
541 _masm = _Tool('MASM', 'MASM') | |
542 | 534 |
543 | 535 |
544 _AddTool(_compile) | 536 _AddTool(_compile) |
545 _AddTool(_link) | 537 _AddTool(_link) |
546 _AddTool(_midl) | 538 _AddTool(_midl) |
547 _AddTool(_rc) | 539 _AddTool(_rc) |
548 _AddTool(_lib) | 540 _AddTool(_lib) |
549 _AddTool(_manifest) | 541 _AddTool(_manifest) |
550 _AddTool(_masm) | |
551 # Add sections only found in the MSBuild settings. | 542 # Add sections only found in the MSBuild settings. |
552 _msbuild_validators[''] = {} | 543 _msbuild_validators[''] = {} |
553 _msbuild_validators['ProjectReference'] = {} | 544 _msbuild_validators['ProjectReference'] = {} |
554 _msbuild_validators['ManifestResourceCompile'] = {} | 545 _msbuild_validators['ManifestResourceCompile'] = {} |
555 | 546 |
556 # Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and | 547 # Descriptions of the compiler options, i.e. VCCLCompilerTool in MSVS and |
557 # ClCompile in MSBuild. | 548 # ClCompile in MSBuild. |
558 # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for | 549 # See "c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\1033\cl.xml" for |
559 # the schema of the MSBuild ClCompile settings. | 550 # the schema of the MSBuild ClCompile settings. |
560 | 551 |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 _MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean) | 1070 _MSVSOnly(_manifest, 'UseUnicodeResponseFiles', _boolean) |
1080 | 1071 |
1081 # MSBuild options not found in MSVS. | 1072 # MSBuild options not found in MSVS. |
1082 _MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean) | 1073 _MSBuildOnly(_manifest, 'EnableDPIAwareness', _boolean) |
1083 _MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category | 1074 _MSBuildOnly(_manifest, 'GenerateCategoryTags', _boolean) # /category |
1084 _MSBuildOnly(_manifest, 'ManifestFromManagedAssembly', | 1075 _MSBuildOnly(_manifest, 'ManifestFromManagedAssembly', |
1085 _file_name) # /managedassemblyname | 1076 _file_name) # /managedassemblyname |
1086 _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource | 1077 _MSBuildOnly(_manifest, 'OutputResourceManifests', _string) # /outputresource |
1087 _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency | 1078 _MSBuildOnly(_manifest, 'SuppressDependencyElement', _boolean) # /nodependency |
1088 _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name) | 1079 _MSBuildOnly(_manifest, 'TrackerLogDirectory', _folder_name) |
1089 | |
1090 | |
1091 # Directives for MASM. | |
1092 # See "$(VCTargetsPath)\BuildCustomizations\masm.xml" for the schema of the | |
1093 # MSBuild MASM settings. | |
1094 | |
1095 # Options that have the same name in MSVS and MSBuild. | |
1096 _Same(_masm, 'UseSafeExceptionHandlers', _boolean) # /safeseh | |
OLD | NEW |