Index: build/gyp_v8 |
diff --git a/build/gyp_v8 b/build/gyp_v8 |
index 8a8ffa1bdda388bca6649e3e3e61f936170308f1..8813f2c12162ba9386ff11f7e1bf79899b7a87a0 100755 |
--- a/build/gyp_v8 |
+++ b/build/gyp_v8 |
@@ -30,6 +30,7 @@ |
# This script is wrapper for V8 that adds some support for how GYP |
# is invoked by V8 beyond what can be done in the gclient hooks. |
+import argparse |
import glob |
import gyp_environment |
import os |
@@ -37,6 +38,7 @@ import platform |
import shlex |
import subprocess |
import sys |
+import vs_toolchain |
script_dir = os.path.dirname(os.path.realpath(__file__)) |
v8_root = os.path.abspath(os.path.join(script_dir, os.pardir)) |
@@ -49,6 +51,25 @@ sys.path.insert( |
1, os.path.abspath(os.path.join(v8_root, 'tools', 'generate_shim_headers'))) |
+def GetOutputDirectory(): |
+ """Returns the output directory that GYP will use.""" |
+ |
+ # Handle command line generator flags. |
+ parser = argparse.ArgumentParser() |
+ parser.add_argument('-G', dest='genflags', default=[], action='append') |
+ genflags = parser.parse_known_args()[0].genflags |
+ |
+ # Handle generator flags from the environment. |
+ genflags += shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')) |
+ |
+ needle = 'output_dir=' |
+ for item in genflags: |
+ if item.startswith(needle): |
+ return item[len(needle):] |
+ |
+ return 'out' |
+ |
+ |
def additional_include_files(args=[]): |
""" |
Returns a list of additional (.gypi) files to include, without |
@@ -82,6 +103,13 @@ def additional_include_files(args=[]): |
def run_gyp(args): |
rc = gyp.main(args) |
+ vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() |
+ if vs2013_runtime_dll_dirs: |
+ x64_runtime, x86_runtime = vs2013_runtime_dll_dirs |
+ vs_toolchain.CopyVsRuntimeDlls( |
+ os.path.join(v8_root, GetOutputDirectory()), |
+ (x86_runtime, x64_runtime)) |
+ |
if rc != 0: |
print 'Error running GYP' |
sys.exit(rc) |
@@ -130,6 +158,7 @@ if __name__ == '__main__': |
# Generate for the architectures supported on the given platform. |
gyp_args = list(args) |
+ gyp_args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) |
gyp_generators = os.environ.get('GYP_GENERATORS', '') |
if platform.system() == 'Linux' and gyp_generators != 'ninja': |
# Work around for crbug.com/331475. |