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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 | 33 |
34 generator_default_variables = { | 34 generator_default_variables = { |
35 'EXECUTABLE_PREFIX': '', | 35 'EXECUTABLE_PREFIX': '', |
36 'EXECUTABLE_SUFFIX': '.exe', | 36 'EXECUTABLE_SUFFIX': '.exe', |
37 'STATIC_LIB_PREFIX': '', | 37 'STATIC_LIB_PREFIX': '', |
38 'SHARED_LIB_PREFIX': '', | 38 'SHARED_LIB_PREFIX': '', |
39 'STATIC_LIB_SUFFIX': '.lib', | 39 'STATIC_LIB_SUFFIX': '.lib', |
40 'SHARED_LIB_SUFFIX': '.dll', | 40 'SHARED_LIB_SUFFIX': '.dll', |
41 'INTERMEDIATE_DIR': '$(IntDir)', | 41 'INTERMEDIATE_DIR': '$(IntDir)', |
42 'SHARED_INTERMEDIATE_DIR': '$(OutDir)/obj/global_intermediate', | 42 'SHARED_INTERMEDIATE_DIR': '$(OutDir)obj/global_intermediate', |
43 'OS': 'win', | 43 'OS': 'win', |
44 'PRODUCT_DIR': '$(OutDir)', | 44 'PRODUCT_DIR': '$(OutDir)', |
45 'LIB_DIR': '$(OutDir)\\lib', | 45 'LIB_DIR': '$(OutDir)lib', |
46 'RULE_INPUT_ROOT': '$(InputName)', | 46 'RULE_INPUT_ROOT': '$(InputName)', |
47 'RULE_INPUT_DIRNAME': '$(InputDir)', | 47 'RULE_INPUT_DIRNAME': '$(InputDir)', |
48 'RULE_INPUT_EXT': '$(InputExt)', | 48 'RULE_INPUT_EXT': '$(InputExt)', |
49 'RULE_INPUT_NAME': '$(InputFileName)', | 49 'RULE_INPUT_NAME': '$(InputFileName)', |
50 'RULE_INPUT_PATH': '$(InputPath)', | 50 'RULE_INPUT_PATH': '$(InputPath)', |
51 'CONFIGURATION_NAME': '$(ConfigurationName)', | 51 'CONFIGURATION_NAME': '$(ConfigurationName)', |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 # The msvs specific sections that hold paths | 55 # The msvs specific sections that hold paths |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 _ToolAppend(tools, 'VCLinkerTool', 'AdditionalDependencies', libraries) | 1044 _ToolAppend(tools, 'VCLinkerTool', 'AdditionalDependencies', libraries) |
1045 if out_file: | 1045 if out_file: |
1046 _ToolAppend(tools, vc_tool, 'OutputFile', out_file, only_if_unset=True) | 1046 _ToolAppend(tools, vc_tool, 'OutputFile', out_file, only_if_unset=True) |
1047 # Add defines. | 1047 # Add defines. |
1048 _ToolAppend(tools, 'VCCLCompilerTool', 'PreprocessorDefinitions', defines) | 1048 _ToolAppend(tools, 'VCCLCompilerTool', 'PreprocessorDefinitions', defines) |
1049 _ToolAppend(tools, 'VCResourceCompilerTool', 'PreprocessorDefinitions', | 1049 _ToolAppend(tools, 'VCResourceCompilerTool', 'PreprocessorDefinitions', |
1050 defines) | 1050 defines) |
1051 _ToolAppend(tools, 'VCMIDLTool', 'PreprocessorDefinitions', defines) | 1051 _ToolAppend(tools, 'VCMIDLTool', 'PreprocessorDefinitions', defines) |
1052 # Change program database directory to prevent collisions. | 1052 # Change program database directory to prevent collisions. |
1053 _ToolAppend(tools, 'VCCLCompilerTool', 'ProgramDataBaseFileName', | 1053 _ToolAppend(tools, 'VCCLCompilerTool', 'ProgramDataBaseFileName', |
1054 '$(IntDir)\\$(ProjectName)\\vc80.pdb', only_if_unset=True) | 1054 '$(IntDir)$(ProjectName)\\vc80.pdb', only_if_unset=True) |
1055 # Add disabled warnings. | 1055 # Add disabled warnings. |
1056 _ToolAppend(tools, 'VCCLCompilerTool', | 1056 _ToolAppend(tools, 'VCCLCompilerTool', |
1057 'DisableSpecificWarnings', disabled_warnings) | 1057 'DisableSpecificWarnings', disabled_warnings) |
1058 # Add Pre-build. | 1058 # Add Pre-build. |
1059 _ToolAppend(tools, 'VCPreBuildEventTool', 'CommandLine', prebuild) | 1059 _ToolAppend(tools, 'VCPreBuildEventTool', 'CommandLine', prebuild) |
1060 # Add Post-build. | 1060 # Add Post-build. |
1061 _ToolAppend(tools, 'VCPostBuildEventTool', 'CommandLine', postbuild) | 1061 _ToolAppend(tools, 'VCPostBuildEventTool', 'CommandLine', postbuild) |
1062 # Turn on precompiled headers if appropriate. | 1062 # Turn on precompiled headers if appropriate. |
1063 if precompiled_header: | 1063 if precompiled_header: |
1064 precompiled_header = os.path.split(precompiled_header)[1] | 1064 precompiled_header = os.path.split(precompiled_header)[1] |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 Arguments: | 1131 Arguments: |
1132 spec: The target dictionary containing the properties of the target. | 1132 spec: The target dictionary containing the properties of the target. |
1133 Returns: | 1133 Returns: |
1134 A triple of (file path, name of the vc tool, name of the msbuild tool) | 1134 A triple of (file path, name of the vc tool, name of the msbuild tool) |
1135 """ | 1135 """ |
1136 # Select a name for the output file. | 1136 # Select a name for the output file. |
1137 out_file = '' | 1137 out_file = '' |
1138 vc_tool = '' | 1138 vc_tool = '' |
1139 msbuild_tool = '' | 1139 msbuild_tool = '' |
1140 output_file_map = { | 1140 output_file_map = { |
1141 'executable': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.exe'), | 1141 'executable': ('VCLinkerTool', 'Link', '$(OutDir)', '.exe'), |
1142 'shared_library': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.dll'), | 1142 'shared_library': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'), |
1143 'loadable_module': ('VCLinkerTool', 'Link', '$(OutDir)\\', '.dll'), | 1143 'loadable_module': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'), |
1144 'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)\\lib\\', '.lib'), | 1144 'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)lib\\', '.lib'), |
1145 } | 1145 } |
1146 output_file_props = output_file_map.get(spec['type']) | 1146 output_file_props = output_file_map.get(spec['type']) |
1147 if output_file_props and int(spec.get('msvs_auto_output_file', 1)): | 1147 if output_file_props and int(spec.get('msvs_auto_output_file', 1)): |
1148 vc_tool, msbuild_tool, out_dir, suffix = output_file_props | 1148 vc_tool, msbuild_tool, out_dir, suffix = output_file_props |
1149 out_dir = spec.get('product_dir', out_dir) | 1149 out_dir = spec.get('product_dir', out_dir) |
1150 product_extension = spec.get('product_extension') | 1150 product_extension = spec.get('product_extension') |
1151 if product_extension: | 1151 if product_extension: |
1152 suffix = '.' + product_extension | 1152 suffix = '.' + product_extension |
1153 prefix = spec.get('product_prefix', '') | 1153 prefix = spec.get('product_prefix', '') |
1154 product_name = spec.get('product_name', '$(ProjectName)') | 1154 product_name = spec.get('product_name', '$(ProjectName)') |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 prepared_attrs[a] = source_attrs[a] | 1247 prepared_attrs[a] = source_attrs[a] |
1248 # Add props files. | 1248 # Add props files. |
1249 vsprops_dirs = config.get('msvs_props', []) | 1249 vsprops_dirs = config.get('msvs_props', []) |
1250 vsprops_dirs = _FixPaths(vsprops_dirs) | 1250 vsprops_dirs = _FixPaths(vsprops_dirs) |
1251 if vsprops_dirs: | 1251 if vsprops_dirs: |
1252 prepared_attrs['InheritedPropertySheets'] = ';'.join(vsprops_dirs) | 1252 prepared_attrs['InheritedPropertySheets'] = ';'.join(vsprops_dirs) |
1253 # Set configuration type. | 1253 # Set configuration type. |
1254 prepared_attrs['ConfigurationType'] = config_type | 1254 prepared_attrs['ConfigurationType'] = config_type |
1255 output_dir = prepared_attrs.get('OutputDirectory', | 1255 output_dir = prepared_attrs.get('OutputDirectory', |
1256 '$(SolutionDir)$(ConfigurationName)') | 1256 '$(SolutionDir)$(ConfigurationName)') |
1257 prepared_attrs['OutputDirectory'] = _FixPath(output_dir) | 1257 prepared_attrs['OutputDirectory'] = _FixPath(output_dir)+"\\" |
1258 if 'IntermediateDirectory' not in prepared_attrs: | 1258 if 'IntermediateDirectory' not in prepared_attrs: |
1259 intermediate = '$(ConfigurationName)\\obj\\$(ProjectName)' | 1259 intermediate = '$(ConfigurationName)\\obj\\$(ProjectName)' |
1260 prepared_attrs['IntermediateDirectory'] = _FixPath(intermediate) | 1260 prepared_attrs['IntermediateDirectory'] = _FixPath(intermediate)+"\\" |
1261 return prepared_attrs | 1261 return prepared_attrs |
1262 | 1262 |
1263 | 1263 |
1264 def _AddNormalizedSources(sources_set, sources_array): | 1264 def _AddNormalizedSources(sources_set, sources_array): |
1265 sources = [_NormalizedSource(s) for s in sources_array] | 1265 sources = [_NormalizedSource(s) for s in sources_array] |
1266 sources_set.update(set(sources)) | 1266 sources_set.update(set(sources)) |
1267 | 1267 |
1268 | 1268 |
1269 def _PrepareListOfSources(spec, gyp_file): | 1269 def _PrepareListOfSources(spec, gyp_file): |
1270 """Prepare list of sources and excluded sources. | 1270 """Prepare list of sources and excluded sources. |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 action_spec.extend( | 3122 action_spec.extend( |
3123 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3123 # TODO(jeanluc) 'Document' for all or just if as_sources? |
3124 [['FileType', 'Document'], | 3124 [['FileType', 'Document'], |
3125 ['Command', command], | 3125 ['Command', command], |
3126 ['Message', description], | 3126 ['Message', description], |
3127 ['Outputs', outputs] | 3127 ['Outputs', outputs] |
3128 ]) | 3128 ]) |
3129 if additional_inputs: | 3129 if additional_inputs: |
3130 action_spec.append(['AdditionalInputs', additional_inputs]) | 3130 action_spec.append(['AdditionalInputs', additional_inputs]) |
3131 actions_spec.append(action_spec) | 3131 actions_spec.append(action_spec) |
OLD | NEW |