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 import copy | 5 import copy |
6 import ntpath | 6 import ntpath |
7 import os | 7 import os |
8 import posixpath | 8 import posixpath |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 if def_file: | 1070 if def_file: |
1071 _ToolAppend(tools, 'VCLinkerTool', 'ModuleDefinitionFile', def_file) | 1071 _ToolAppend(tools, 'VCLinkerTool', 'ModuleDefinitionFile', def_file) |
1072 | 1072 |
1073 _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name) | 1073 _AddConfigurationToMSVS(p, spec, tools, config, config_type, config_name) |
1074 | 1074 |
1075 | 1075 |
1076 def _GetIncludeDirs(config): | 1076 def _GetIncludeDirs(config): |
1077 """Returns the list of directories to be used for #include directives. | 1077 """Returns the list of directories to be used for #include directives. |
1078 | 1078 |
1079 Arguments: | 1079 Arguments: |
1080 config: The dictionnary that defines the special processing to be done | 1080 config: The dictionary that defines the special processing to be done |
1081 for this configuration. | 1081 for this configuration. |
1082 Returns: | 1082 Returns: |
1083 The list of directory paths. | 1083 The list of directory paths. |
1084 """ | 1084 """ |
1085 # TODO(bradnelson): include_dirs should really be flexible enough not to | 1085 # TODO(bradnelson): include_dirs should really be flexible enough not to |
1086 # require this sort of thing. | 1086 # require this sort of thing. |
1087 include_dirs = ( | 1087 include_dirs = ( |
1088 config.get('include_dirs', []) + | 1088 config.get('include_dirs', []) + |
1089 config.get('msvs_system_include_dirs', [])) | 1089 config.get('msvs_system_include_dirs', [])) |
1090 resource_include_dirs = config.get('resource_include_dirs', include_dirs) | 1090 resource_include_dirs = config.get('resource_include_dirs', include_dirs) |
1091 include_dirs = _FixPaths(include_dirs) | 1091 include_dirs = _FixPaths(include_dirs) |
1092 resource_include_dirs = _FixPaths(resource_include_dirs) | 1092 resource_include_dirs = _FixPaths(resource_include_dirs) |
1093 return include_dirs, resource_include_dirs | 1093 return include_dirs, resource_include_dirs |
1094 | 1094 |
1095 | 1095 |
| 1096 def _GetLibraryDirs(config): |
| 1097 """Returns the list of directories to be used for library search paths. |
| 1098 |
| 1099 Arguments: |
| 1100 config: The dictionary that defines the special processing to be done |
| 1101 for this configuration. |
| 1102 Returns: |
| 1103 The list of directory paths. |
| 1104 """ |
| 1105 library_dirs = config.get('library_dirs', []) |
| 1106 library_dirs = _FixPaths(library_dirs) |
| 1107 return library_dirs |
| 1108 |
| 1109 |
1096 def _GetLibraries(spec): | 1110 def _GetLibraries(spec): |
1097 """Returns the list of libraries for this configuration. | 1111 """Returns the list of libraries for this configuration. |
1098 | 1112 |
1099 Arguments: | 1113 Arguments: |
1100 spec: The target dictionary containing the properties of the target. | 1114 spec: The target dictionary containing the properties of the target. |
1101 Returns: | 1115 Returns: |
1102 The list of directory paths. | 1116 The list of directory paths. |
1103 """ | 1117 """ |
1104 libraries = spec.get('libraries', []) | 1118 libraries = spec.get('libraries', []) |
1105 # Strip out -l, as it is not used on windows (but is needed so we can pass | 1119 # Strip out -l, as it is not used on windows (but is needed so we can pass |
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2731 if 'msbuild_settings' in configuration: | 2745 if 'msbuild_settings' in configuration: |
2732 converted = False | 2746 converted = False |
2733 msbuild_settings = configuration['msbuild_settings'] | 2747 msbuild_settings = configuration['msbuild_settings'] |
2734 MSVSSettings.ValidateMSBuildSettings(msbuild_settings) | 2748 MSVSSettings.ValidateMSBuildSettings(msbuild_settings) |
2735 else: | 2749 else: |
2736 converted = True | 2750 converted = True |
2737 msvs_settings = configuration.get('msvs_settings', {}) | 2751 msvs_settings = configuration.get('msvs_settings', {}) |
2738 msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings) | 2752 msbuild_settings = MSVSSettings.ConvertToMSBuildSettings(msvs_settings) |
2739 include_dirs, resource_include_dirs = _GetIncludeDirs(configuration) | 2753 include_dirs, resource_include_dirs = _GetIncludeDirs(configuration) |
2740 libraries = _GetLibraries(spec) | 2754 libraries = _GetLibraries(spec) |
| 2755 library_dirs = _GetLibraryDirs(configuration) |
2741 out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec) | 2756 out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec) |
2742 defines = _GetDefines(configuration) | 2757 defines = _GetDefines(configuration) |
2743 if converted: | 2758 if converted: |
2744 # Visual Studio 2010 has TR1 | 2759 # Visual Studio 2010 has TR1 |
2745 defines = [d for d in defines if d != '_HAS_TR1=0'] | 2760 defines = [d for d in defines if d != '_HAS_TR1=0'] |
2746 # Warn of ignored settings | 2761 # Warn of ignored settings |
2747 ignored_settings = ['msvs_prebuild', 'msvs_postbuild', 'msvs_tool_files'] | 2762 ignored_settings = ['msvs_prebuild', 'msvs_postbuild', 'msvs_tool_files'] |
2748 for ignored_setting in ignored_settings: | 2763 for ignored_setting in ignored_settings: |
2749 value = configuration.get(ignored_setting) | 2764 value = configuration.get(ignored_setting) |
2750 if value: | 2765 if value: |
(...skipping 11 matching lines...) Expand all Loading... |
2762 # Add the information to the appropriate tool | 2777 # Add the information to the appropriate tool |
2763 # TODO(jeanluc) We could optimize and generate these settings only if | 2778 # TODO(jeanluc) We could optimize and generate these settings only if |
2764 # the corresponding files are found, e.g. don't generate ResourceCompile | 2779 # the corresponding files are found, e.g. don't generate ResourceCompile |
2765 # if you don't have any resources. | 2780 # if you don't have any resources. |
2766 _ToolAppend(msbuild_settings, 'ClCompile', | 2781 _ToolAppend(msbuild_settings, 'ClCompile', |
2767 'AdditionalIncludeDirectories', include_dirs) | 2782 'AdditionalIncludeDirectories', include_dirs) |
2768 _ToolAppend(msbuild_settings, 'ResourceCompile', | 2783 _ToolAppend(msbuild_settings, 'ResourceCompile', |
2769 'AdditionalIncludeDirectories', resource_include_dirs) | 2784 'AdditionalIncludeDirectories', resource_include_dirs) |
2770 # Add in libraries. | 2785 # Add in libraries. |
2771 _ToolAppend(msbuild_settings, 'Link', 'AdditionalDependencies', libraries) | 2786 _ToolAppend(msbuild_settings, 'Link', 'AdditionalDependencies', libraries) |
| 2787 _ToolAppend(msbuild_settings, 'Link', 'AdditionalLibraryDirectories', |
| 2788 library_dirs) |
2772 if out_file: | 2789 if out_file: |
2773 _ToolAppend(msbuild_settings, msbuild_tool, 'OutputFile', out_file, | 2790 _ToolAppend(msbuild_settings, msbuild_tool, 'OutputFile', out_file, |
2774 only_if_unset=True) | 2791 only_if_unset=True) |
2775 # Add defines. | 2792 # Add defines. |
2776 _ToolAppend(msbuild_settings, 'ClCompile', | 2793 _ToolAppend(msbuild_settings, 'ClCompile', |
2777 'PreprocessorDefinitions', defines) | 2794 'PreprocessorDefinitions', defines) |
2778 _ToolAppend(msbuild_settings, 'ResourceCompile', | 2795 _ToolAppend(msbuild_settings, 'ResourceCompile', |
2779 'PreprocessorDefinitions', defines) | 2796 'PreprocessorDefinitions', defines) |
2780 # Add disabled warnings. | 2797 # Add disabled warnings. |
2781 _ToolAppend(msbuild_settings, 'ClCompile', | 2798 _ToolAppend(msbuild_settings, 'ClCompile', |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3117 action_spec.extend( | 3134 action_spec.extend( |
3118 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3135 # TODO(jeanluc) 'Document' for all or just if as_sources? |
3119 [['FileType', 'Document'], | 3136 [['FileType', 'Document'], |
3120 ['Command', command], | 3137 ['Command', command], |
3121 ['Message', description], | 3138 ['Message', description], |
3122 ['Outputs', outputs] | 3139 ['Outputs', outputs] |
3123 ]) | 3140 ]) |
3124 if additional_inputs: | 3141 if additional_inputs: |
3125 action_spec.append(['AdditionalInputs', additional_inputs]) | 3142 action_spec.append(['AdditionalInputs', additional_inputs]) |
3126 actions_spec.append(action_spec) | 3143 actions_spec.append(action_spec) |
OLD | NEW |