Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: build/vs_toolchain.py

Issue 2884613003: Update merge_pgc_files.py in preparation for VS2017 (Closed)
Patch Set: Copy pgomgr's dependencies. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/win/merge_pgc_files.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import glob 6 import glob
7 import json 7 import json
8 import os 8 import os
9 import pipes 9 import pipes
10 import platform 10 import platform
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 ucrt_files = glob.glob(os.path.join(ucrt_dll_dirs, 'api-ms-win-*.dll')) 211 ucrt_files = glob.glob(os.path.join(ucrt_dll_dirs, 'api-ms-win-*.dll'))
212 assert len(ucrt_files) > 0 212 assert len(ucrt_files) > 0
213 for ucrt_src_file in ucrt_files: 213 for ucrt_src_file in ucrt_files:
214 file_part = os.path.basename(ucrt_src_file) 214 file_part = os.path.basename(ucrt_src_file)
215 ucrt_dst_file = os.path.join(target_dir, file_part) 215 ucrt_dst_file = os.path.join(target_dir, file_part)
216 _CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False) 216 _CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False)
217 _CopyRuntimeImpl(os.path.join(target_dir, 'ucrtbase' + suffix), 217 _CopyRuntimeImpl(os.path.join(target_dir, 'ucrtbase' + suffix),
218 os.path.join(source_dir, 'ucrtbase' + suffix)) 218 os.path.join(source_dir, 'ucrtbase' + suffix))
219 219
220 220
221 def _FindVCToolsRoot():
scottmg 2017/05/19 20:25:10 Since you're calling this ouside of this script, i
Sébastien Marchand 2017/05/19 22:30:37 Done.
222 """In VS2017 the PGO runtime dependencies are located in
223 {toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/Host{target_cpu}/{target_cpu}/, the
224 {version_number} part is likely to change in case of a minor update of the
225 toolchain so we don't hardcode this value here (except for the major number).
226
227 This returns the '{toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/' path.
228
229 This function should only be called when using VS2017.
230 """
231 assert GetVisualStudioVersion() == '2017'
232 vc_tools_msvc_root = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'),
scottmg 2017/05/19 20:25:10 (I know you just moved this, but since it's in a s
Sébastien Marchand 2017/05/19 22:30:37 Sure, asserting seems like a good-enough solution.
233 'VC', 'Tools', 'MSVC')
234 for directory in os.listdir(vc_tools_msvc_root):
235 if not os.path.isdir(os.path.join(vc_tools_msvc_root, directory)):
236 continue
237 if re.match('14\.\d+\.\d+', directory):
238 return os.path.join(vc_tools_msvc_root, directory, 'bin')
239 return
240
241
221 def _CopyPGORuntime(target_dir, target_cpu): 242 def _CopyPGORuntime(target_dir, target_cpu):
222 """Copy the runtime dependencies required during a PGO build. 243 """Copy the runtime dependencies required during a PGO build.
223 """ 244 """
224 env_version = GetVisualStudioVersion() 245 env_version = GetVisualStudioVersion()
225 # These dependencies will be in a different location depending on the version 246 # These dependencies will be in a different location depending on the version
226 # of the toolchain. 247 # of the toolchain.
227 if env_version == '2015': 248 if env_version == '2015':
228 pgo_x86_runtime_dir = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'), 249 pgo_x86_runtime_dir = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'),
229 'VC', 'bin') 250 'VC', 'bin')
230 pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64') 251 pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64')
231 elif env_version == '2017': 252 elif env_version == '2017':
232 # In VS2017 the PGO runtime dependencies are located in 253 pgo_runtime_root = _FindVCToolsRoot()
233 # {toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/Host{target_cpu}/{target_cpu}/,
234 # the {version_number} part is likely to change in case of a minor update of
235 # the toolchain so we don't hardcode this value here (except for the major
236 # number).
237 vc_tools_msvc_root = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'),
238 'VC', 'Tools', 'MSVC')
239 pgo_runtime_root = None
240 for directory in os.listdir(vc_tools_msvc_root):
241 if not os.path.isdir(os.path.join(vc_tools_msvc_root, directory)):
242 continue
243 if re.match('14\.\d+\.\d+', directory):
244 pgo_runtime_root = os.path.join(vc_tools_msvc_root, directory, 'bin')
245 break
246 assert pgo_runtime_root 254 assert pgo_runtime_root
247 # There's no version of pgosweep.exe in HostX64/x86, so we use the copy 255 # There's no version of pgosweep.exe in HostX64/x86, so we use the copy
248 # from HostX86/x86. 256 # from HostX86/x86.
249 pgo_x86_runtime_dir = os.path.join(pgo_runtime_root, 'HostX86', 'x86') 257 pgo_x86_runtime_dir = os.path.join(pgo_runtime_root, 'HostX86', 'x86')
250 pgo_x64_runtime_dir = os.path.join(pgo_runtime_root, 'HostX64', 'x64') 258 pgo_x64_runtime_dir = os.path.join(pgo_runtime_root, 'HostX64', 'x64')
251 else: 259 else:
252 raise Exception('Unexpected toolchain version: %s.' % env_version) 260 raise Exception('Unexpected toolchain version: %s.' % env_version)
253 261
254 # We need to copy 2 runtime dependencies used during the profiling step: 262 # We need to copy 2 runtime dependencies used during the profiling step:
255 # - pgort140.dll: runtime library required to run the instrumented image. 263 # - pgort140.dll: runtime library required to run the instrumented image.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 'copy_dlls': CopyDlls, 438 'copy_dlls': CopyDlls,
431 } 439 }
432 if len(sys.argv) < 2 or sys.argv[1] not in commands: 440 if len(sys.argv) < 2 or sys.argv[1] not in commands:
433 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) 441 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands)
434 return 1 442 return 1
435 return commands[sys.argv[1]](*sys.argv[2:]) 443 return commands[sys.argv[1]](*sys.argv[2:])
436 444
437 445
438 if __name__ == '__main__': 446 if __name__ == '__main__':
439 sys.exit(main()) 447 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | build/win/merge_pgc_files.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698