OLD | NEW |
1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 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 """Utility functions shared amongst the Windows generators.""" | 5 """Utility functions shared amongst the Windows generators.""" |
6 | 6 |
7 import copy | 7 import copy |
8 import os | 8 import os |
9 | 9 |
10 | 10 |
11 _TARGET_TYPE_EXT = { | 11 # A dictionary mapping supported target types to extensions. |
12 'executable': '.exe', | 12 TARGET_TYPE_EXT = { |
13 'loadable_module': '.dll', | 13 'executable': 'exe', |
14 'shared_library': '.dll', | 14 'loadable_module': 'dll', |
| 15 'shared_library': 'dll', |
| 16 'static_library': 'lib', |
15 } | 17 } |
16 | 18 |
17 | 19 |
18 def _GetLargePdbShimCcPath(): | 20 def _GetLargePdbShimCcPath(): |
19 """Returns the path of the large_pdb_shim.cc file.""" | 21 """Returns the path of the large_pdb_shim.cc file.""" |
20 this_dir = os.path.abspath(os.path.dirname(__file__)) | 22 this_dir = os.path.abspath(os.path.dirname(__file__)) |
21 src_dir = os.path.abspath(os.path.join(this_dir, '..', '..')) | 23 src_dir = os.path.abspath(os.path.join(this_dir, '..', '..')) |
22 win_data_dir = os.path.join(src_dir, 'data', 'win') | 24 win_data_dir = os.path.join(src_dir, 'data', 'win') |
23 large_pdb_shim_cc = os.path.join(win_data_dir, 'large-pdb-shim.cc') | 25 large_pdb_shim_cc = os.path.join(win_data_dir, 'large-pdb-shim.cc') |
24 return large_pdb_shim_cc | 26 return large_pdb_shim_cc |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if pdb_path: | 152 if pdb_path: |
151 return pdb_path | 153 return pdb_path |
152 | 154 |
153 variables = target_dict.get('variables', {}) | 155 variables = target_dict.get('variables', {}) |
154 pdb_path = variables.get('msvs_large_pdb_path', None) | 156 pdb_path = variables.get('msvs_large_pdb_path', None) |
155 if pdb_path: | 157 if pdb_path: |
156 return pdb_path | 158 return pdb_path |
157 | 159 |
158 | 160 |
159 pdb_base = target_dict.get('product_name', target_dict['target_name']) | 161 pdb_base = target_dict.get('product_name', target_dict['target_name']) |
160 pdb_base = '%s%s.pdb' % (pdb_base, _TARGET_TYPE_EXT[target_dict['type']]) | 162 pdb_base = '%s.%s.pdb' % (pdb_base, TARGET_TYPE_EXT[target_dict['type']]) |
161 pdb_path = vars['PRODUCT_DIR'] + '/' + pdb_base | 163 pdb_path = vars['PRODUCT_DIR'] + '/' + pdb_base |
162 | 164 |
163 return pdb_path | 165 return pdb_path |
164 | 166 |
165 | 167 |
166 def InsertLargePdbShims(target_list, target_dicts, vars): | 168 def InsertLargePdbShims(target_list, target_dicts, vars): |
167 """Insert a shim target that forces the linker to use 4KB pagesize PDBs. | 169 """Insert a shim target that forces the linker to use 4KB pagesize PDBs. |
168 | 170 |
169 This is a workaround for targets with PDBs greater than 1GB in size, the | 171 This is a workaround for targets with PDBs greater than 1GB in size, the |
170 limit for the 1KB pagesize PDBs created by the linker by default. | 172 limit for the 1KB pagesize PDBs created by the linker by default. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 # the dependency generation works as expected in ninja. | 261 # the dependency generation works as expected in ninja. |
260 target_list.insert(0, full_copy_target_name) | 262 target_list.insert(0, full_copy_target_name) |
261 target_list.insert(0, full_shim_target_name) | 263 target_list.insert(0, full_shim_target_name) |
262 target_dicts[full_copy_target_name] = copy_dict | 264 target_dicts[full_copy_target_name] = copy_dict |
263 target_dicts[full_shim_target_name] = shim_dict | 265 target_dicts[full_shim_target_name] = shim_dict |
264 | 266 |
265 # Update the original target to depend on the shim target. | 267 # Update the original target to depend on the shim target. |
266 target_dict.setdefault('dependencies', []).append(full_shim_target_name) | 268 target_dict.setdefault('dependencies', []).append(full_shim_target_name) |
267 | 269 |
268 return (target_list, target_dicts) | 270 return (target_list, target_dicts) |
OLD | NEW |