Index: build/vs_toolchain.py |
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py |
index ddff24a43882a3f35eaffeb637a1be2b2a0b3785..35d99da0bc1a830db7d20f61764238451e3a40ac 100755 |
--- a/build/vs_toolchain.py |
+++ b/build/vs_toolchain.py |
@@ -8,6 +8,7 @@ import json |
import os |
import pipes |
import shutil |
+import stat |
import subprocess |
import sys |
@@ -74,6 +75,16 @@ def SetEnvironmentAndGetRuntimeDllDirs(): |
os.environ['GYP_MSVS_OVERRIDE_PATH'] = DetectVisualStudioPath() |
if not 'GYP_MSVS_VERSION' in os.environ: |
os.environ['GYP_MSVS_VERSION'] = GetVisualStudioVersion() |
+ # When using an installed toolchain these files aren't needed in the output |
+ # directory in order to run binaries locally, but they are needed in order |
+ # to create isolates or the mini_installer. Copying them to the output |
+ # directory ensures that they are available when needed. |
+ if os.access('C:/Windows/SysWOW64', os.F_OK): |
+ # Default 64-bit and 32-bit system directories on 64-bit Windows. |
+ vs_runtime_dll_dirs = [ 'C:/Windows/System32', 'C:/Windows/SysWOW64' ] |
scottmg
2016/05/31 21:57:44
Hmm, I'm confused. I would have thought it was x86
brucedawson
2016/05/31 23:32:18
I'm not sure. That's worrisome that gyp and gn beh
|
+ else: |
+ # Default 32-bit system directories on 32-bit Windows. |
+ vs_runtime_dll_dirs = [ None, 'C:/Windows/System32' ] |
return vs_runtime_dll_dirs |
@@ -164,8 +175,12 @@ def _CopyRuntimeImpl(target, source, verbose=True): |
if verbose: |
print 'Copying %s to %s...' % (source, target) |
if os.path.exists(target): |
+ # Make the file writable so that we can delete it now. |
+ os.chmod(target, stat.S_IWRITE) |
os.unlink(target) |
shutil.copy2(source, target) |
+ # Make the file writable so that we can overwrite or delete it later. |
+ os.chmod(target, stat.S_IWRITE) |
def _CopyRuntime2013(target_dir, source_dir, dll_pattern): |
@@ -186,8 +201,16 @@ def _CopyRuntime2015(target_dir, source_dir, dll_pattern, suffix): |
target = os.path.join(target_dir, dll) |
source = os.path.join(source_dir, dll) |
_CopyRuntimeImpl(target, source) |
- ucrt_src_dir = os.path.join(source_dir, 'api-ms-win-*.dll') |
- for ucrt_src_file in glob.glob(ucrt_src_dir): |
+ # OS installs of Visual Studio (and all installs of Windows 10) put the |
+ # universal CRT files in c:\Windows\System32\downlevel - look for them there |
+ # to support DEPOT_TOOLS_WIN_TOOLCHAIN=0. |
+ if os.path.exists(os.path.join(source_dir, 'downlevel')): |
+ ucrt_src_dir = os.path.join(source_dir, 'downlevel', 'api-ms-win-*.dll') |
scottmg
2016/05/31 21:57:44
Maybe ucrt_src_pattern or _glob instead.
brucedawson
2016/05/31 23:32:18
Done.
|
+ else: |
+ ucrt_src_dir = os.path.join(source_dir, 'api-ms-win-*.dll') |
+ ucrt_files = glob.glob(ucrt_src_dir) |
+ assert len(ucrt_files) > 0 |
+ for ucrt_src_file in ucrt_files: |
file_part = os.path.basename(ucrt_src_file) |
ucrt_dst_file = os.path.join(target_dir, file_part) |
_CopyRuntimeImpl(ucrt_dst_file, ucrt_src_file, False) |