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

Unified Diff: build/vs_toolchain.py

Issue 2884613003: Update merge_pgc_files.py in preparation for VS2017 (Closed)
Patch Set: raise 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/win/merge_pgc_files.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/vs_toolchain.py
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py
index 0ff51815212da7198fc521eedaf1f45ffefe5cd6..61a3559859f7d38e0d5d21ea2c27eaaef3eab1f7 100755
--- a/build/vs_toolchain.py
+++ b/build/vs_toolchain.py
@@ -218,6 +218,28 @@ def _CopyUCRTRuntime(target_dir, source_dir, target_cpu, dll_pattern, suffix):
os.path.join(source_dir, 'ucrtbase' + suffix))
+def FindVCToolsRoot():
+ """In VS2017 the PGO runtime dependencies are located in
+ {toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/Host{target_cpu}/{target_cpu}/, the
+ {version_number} part is likely to change in case of a minor update of the
+ toolchain so we don't hardcode this value here (except for the major number).
+
+ This returns the '{toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/' path.
+
+ This function should only be called when using VS2017.
+ """
+ assert GetVisualStudioVersion() == '2017'
+ assert ('GYP_MSVS_OVERRIDE_PATH' in os.environ)
+ vc_tools_msvc_root = os.path.join(os.environ['GYP_MSVS_OVERRIDE_PATH'],
+ 'VC', 'Tools', 'MSVC')
+ for directory in os.listdir(vc_tools_msvc_root):
+ if not os.path.isdir(os.path.join(vc_tools_msvc_root, directory)):
+ continue
+ if re.match('14\.\d+\.\d+', directory):
+ return os.path.join(vc_tools_msvc_root, directory, 'bin')
+ raise Exception('Unable to find the VC tools directory.')
+
+
def _CopyPGORuntime(target_dir, target_cpu):
"""Copy the runtime dependencies required during a PGO build.
"""
@@ -229,20 +251,7 @@ def _CopyPGORuntime(target_dir, target_cpu):
'VC', 'bin')
pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64')
elif env_version == '2017':
- # In VS2017 the PGO runtime dependencies are located in
- # {toolchain_root}/VC/Tools/MSVC/{x.y.z}/bin/Host{target_cpu}/{target_cpu}/,
- # the {version_number} part is likely to change in case of a minor update of
- # the toolchain so we don't hardcode this value here (except for the major
- # number).
- vc_tools_msvc_root = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'),
- 'VC', 'Tools', 'MSVC')
- pgo_runtime_root = None
- for directory in os.listdir(vc_tools_msvc_root):
- if not os.path.isdir(os.path.join(vc_tools_msvc_root, directory)):
- continue
- if re.match('14\.\d+\.\d+', directory):
- pgo_runtime_root = os.path.join(vc_tools_msvc_root, directory, 'bin')
- break
+ pgo_runtime_root = FindVCToolsRoot()
assert pgo_runtime_root
# There's no version of pgosweep.exe in HostX64/x86, so we use the copy
# from HostX86/x86.
« 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