| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 Google Inc. All rights reserved. | 3 # Copyright (c) 2011 Google Inc. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import copy | 7 import copy |
| 8 import ntpath | 8 import ntpath |
| 9 import os | 9 import os |
| 10 import posixpath | 10 import posixpath |
| (...skipping 2525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2536 msvs_settings = configuration.get('msvs_settings', {}) | 2536 msvs_settings = configuration.get('msvs_settings', {}) |
| 2537 msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings) | 2537 msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings) |
| 2538 include_dirs, resource_include_dirs = _GetIncludeDirs(configuration) | 2538 include_dirs, resource_include_dirs = _GetIncludeDirs(configuration) |
| 2539 libraries = _GetLibraries(spec) | 2539 libraries = _GetLibraries(spec) |
| 2540 out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec) | 2540 out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec) |
| 2541 defines = _GetDefines(configuration) | 2541 defines = _GetDefines(configuration) |
| 2542 if converted: | 2542 if converted: |
| 2543 # Visual Studio 2010 has TR1 | 2543 # Visual Studio 2010 has TR1 |
| 2544 defines = [d for d in defines if d != '_HAS_TR1=0'] | 2544 defines = [d for d in defines if d != '_HAS_TR1=0'] |
| 2545 # Warn of ignored settings | 2545 # Warn of ignored settings |
| 2546 ignored_settings = ['msvs_prebuild', 'msvs_postbuild', 'msvs_tool_files'] | 2546 ignored_settings = ['msvs_tool_files'] |
| 2547 for ignored_setting in ignored_settings: | 2547 for ignored_setting in ignored_settings: |
| 2548 value = configuration.get(ignored_setting) | 2548 value = configuration.get(ignored_setting) |
| 2549 if value: | 2549 if value: |
| 2550 print ('Warning: The automatic conversion to MSBuild does not handle ' | 2550 print ('Warning: The automatic conversion to MSBuild does not handle ' |
| 2551 '%s. Ignoring setting of %s' % (ignored_setting, str(value))) | 2551 '%s. Ignoring setting of %s' % (ignored_setting, str(value))) |
| 2552 | 2552 |
| 2553 defines = [_EscapeCppDefineForMSBuild(d) for d in defines] | 2553 defines = [_EscapeCppDefineForMSBuild(d) for d in defines] |
| 2554 disabled_warnings = _GetDisabledWarnings(configuration) | 2554 disabled_warnings = _GetDisabledWarnings(configuration) |
| 2555 # TODO(jeanluc) Validate & warn that we don't translate | 2555 prebuild = configuration.get('msvs_prebuild') |
| 2556 # prebuild = configuration.get('msvs_prebuild') | 2556 postbuild = configuration.get('msvs_postbuild') |
| 2557 # postbuild = configuration.get('msvs_postbuild') | |
| 2558 def_file = _GetModuleDefinition(spec) | 2557 def_file = _GetModuleDefinition(spec) |
| 2559 precompiled_header = configuration.get('msvs_precompiled_header') | 2558 precompiled_header = configuration.get('msvs_precompiled_header') |
| 2560 | 2559 |
| 2561 # Add the information to the appropriate tool | 2560 # Add the information to the appropriate tool |
| 2562 # TODO(jeanluc) We could optimize and generate these settings only if | 2561 # TODO(jeanluc) We could optimize and generate these settings only if |
| 2563 # the corresponding files are found, e.g. don't generate ResourceCompile | 2562 # the corresponding files are found, e.g. don't generate ResourceCompile |
| 2564 # if you don't have any resources. | 2563 # if you don't have any resources. |
| 2565 _ToolAppend(msbuild_settings, 'ClCompile', | 2564 _ToolAppend(msbuild_settings, 'ClCompile', |
| 2566 'AdditionalIncludeDirectories', include_dirs) | 2565 'AdditionalIncludeDirectories', include_dirs) |
| 2567 _ToolAppend(msbuild_settings, 'ResourceCompile', | 2566 _ToolAppend(msbuild_settings, 'ResourceCompile', |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2588 _ToolAppend(msbuild_settings, 'ClCompile', | 2587 _ToolAppend(msbuild_settings, 'ClCompile', |
| 2589 'ForcedIncludeFiles', precompiled_header) | 2588 'ForcedIncludeFiles', precompiled_header) |
| 2590 # Loadable modules don't generate import libraries; | 2589 # Loadable modules don't generate import libraries; |
| 2591 # tell dependent projects to not expect one. | 2590 # tell dependent projects to not expect one. |
| 2592 if spec['type'] == 'loadable_module': | 2591 if spec['type'] == 'loadable_module': |
| 2593 _ToolAppend(msbuild_settings, '', 'IgnoreImportLibrary', 'true') | 2592 _ToolAppend(msbuild_settings, '', 'IgnoreImportLibrary', 'true') |
| 2594 # Set the module definition file if any. | 2593 # Set the module definition file if any. |
| 2595 if def_file: | 2594 if def_file: |
| 2596 _ToolAppend(msbuild_settings, 'Link', 'ModuleDefinitionFile', def_file) | 2595 _ToolAppend(msbuild_settings, 'Link', 'ModuleDefinitionFile', def_file) |
| 2597 configuration['finalized_msbuild_settings'] = msbuild_settings | 2596 configuration['finalized_msbuild_settings'] = msbuild_settings |
| 2597 if prebuild: |
| 2598 _ToolAppend(msbuild_settings, 'PreBuildEvent', 'Command', prebuild) |
| 2599 if postbuild: |
| 2600 _ToolAppend(msbuild_settings, 'PostBuildEvent', 'Command', postbuild) |
| 2598 | 2601 |
| 2599 | 2602 |
| 2600 def _GetValueFormattedForMSBuild(tool_name, name, value): | 2603 def _GetValueFormattedForMSBuild(tool_name, name, value): |
| 2601 if type(value) == list: | 2604 if type(value) == list: |
| 2602 # For some settings, VS2010 does not automatically extends the settings | 2605 # For some settings, VS2010 does not automatically extends the settings |
| 2603 # TODO(jeanluc) Is this what we want? | 2606 # TODO(jeanluc) Is this what we want? |
| 2604 if name in ['AdditionalDependencies', | 2607 if name in ['AdditionalDependencies', |
| 2605 'AdditionalIncludeDirectories', | 2608 'AdditionalIncludeDirectories', |
| 2606 'AdditionalLibraryDirectories', | 2609 'AdditionalLibraryDirectories', |
| 2607 'AdditionalOptions', | 2610 'AdditionalOptions', |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2894 action_spec.extend( | 2897 action_spec.extend( |
| 2895 # TODO(jeanluc) 'Document' for all or just if as_sources? | 2898 # TODO(jeanluc) 'Document' for all or just if as_sources? |
| 2896 [['FileType', 'Document'], | 2899 [['FileType', 'Document'], |
| 2897 ['Command', command], | 2900 ['Command', command], |
| 2898 ['Message', description], | 2901 ['Message', description], |
| 2899 ['Outputs', outputs] | 2902 ['Outputs', outputs] |
| 2900 ]) | 2903 ]) |
| 2901 if additional_inputs: | 2904 if additional_inputs: |
| 2902 action_spec.append(['AdditionalInputs', additional_inputs]) | 2905 action_spec.append(['AdditionalInputs', additional_inputs]) |
| 2903 actions_spec.append(action_spec) | 2906 actions_spec.append(action_spec) |
| OLD | NEW |