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

Side by Side Diff: build/gyp_v8

Issue 1237803003: Use msvs toolchain from depot_tools. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adding a landmine Created 5 years, 1 month 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 | « build/gyp_environment.py ('k') | build/standalone.gypi » ('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 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 # This script is wrapper for V8 that adds some support for how GYP 30 # This script is wrapper for V8 that adds some support for how GYP
31 # is invoked by V8 beyond what can be done in the gclient hooks. 31 # is invoked by V8 beyond what can be done in the gclient hooks.
32 32
33 import argparse
33 import glob 34 import glob
34 import gyp_environment 35 import gyp_environment
35 import os 36 import os
36 import platform 37 import platform
37 import shlex 38 import shlex
38 import subprocess 39 import subprocess
39 import sys 40 import sys
41 import vs_toolchain
40 42
41 script_dir = os.path.dirname(os.path.realpath(__file__)) 43 script_dir = os.path.dirname(os.path.realpath(__file__))
42 v8_root = os.path.abspath(os.path.join(script_dir, os.pardir)) 44 v8_root = os.path.abspath(os.path.join(script_dir, os.pardir))
43 45
44 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib')) 46 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib'))
45 import gyp 47 import gyp
46 48
47 # Add paths so that pymod_do_main(...) can import files. 49 # Add paths so that pymod_do_main(...) can import files.
48 sys.path.insert( 50 sys.path.insert(
49 1, os.path.abspath(os.path.join(v8_root, 'tools', 'generate_shim_headers'))) 51 1, os.path.abspath(os.path.join(v8_root, 'tools', 'generate_shim_headers')))
50 52
51 53
54 def GetOutputDirectory():
55 """Returns the output directory that GYP will use."""
56
57 # Handle command line generator flags.
58 parser = argparse.ArgumentParser()
59 parser.add_argument('-G', dest='genflags', default=[], action='append')
60 genflags = parser.parse_known_args()[0].genflags
61
62 # Handle generator flags from the environment.
63 genflags += shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))
64
65 needle = 'output_dir='
66 for item in genflags:
67 if item.startswith(needle):
68 return item[len(needle):]
69
70 return 'out'
71
72
52 def additional_include_files(args=[]): 73 def additional_include_files(args=[]):
53 """ 74 """
54 Returns a list of additional (.gypi) files to include, without 75 Returns a list of additional (.gypi) files to include, without
55 duplicating ones that are already specified on the command line. 76 duplicating ones that are already specified on the command line.
56 """ 77 """
57 # Determine the include files specified on the command line. 78 # Determine the include files specified on the command line.
58 # This doesn't cover all the different option formats you can use, 79 # This doesn't cover all the different option formats you can use,
59 # but it's mainly intended to avoid duplicating flags on the automatic 80 # but it's mainly intended to avoid duplicating flags on the automatic
60 # makefile regeneration which only uses this format. 81 # makefile regeneration which only uses this format.
61 specified_includes = set() 82 specified_includes = set()
(...skipping 13 matching lines...) Expand all
75 supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi')) 96 supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi'))
76 for supplement in supplements: 97 for supplement in supplements:
77 AddInclude(supplement) 98 AddInclude(supplement)
78 99
79 return result 100 return result
80 101
81 102
82 def run_gyp(args): 103 def run_gyp(args):
83 rc = gyp.main(args) 104 rc = gyp.main(args)
84 105
106 vs2013_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
107 if vs2013_runtime_dll_dirs:
108 x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
109 vs_toolchain.CopyVsRuntimeDlls(
110 os.path.join(v8_root, GetOutputDirectory()),
111 (x86_runtime, x64_runtime))
112
85 if rc != 0: 113 if rc != 0:
86 print 'Error running GYP' 114 print 'Error running GYP'
87 sys.exit(rc) 115 sys.exit(rc)
88 116
89 117
90 if __name__ == '__main__': 118 if __name__ == '__main__':
91 args = sys.argv[1:] 119 args = sys.argv[1:]
92 120
93 gyp_environment.set_environment() 121 gyp_environment.set_environment()
94 122
(...skipping 28 matching lines...) Expand all
123 # to enfore syntax checking. 151 # to enfore syntax checking.
124 syntax_check = os.environ.get('V8_GYP_SYNTAX_CHECK') 152 syntax_check = os.environ.get('V8_GYP_SYNTAX_CHECK')
125 if syntax_check and int(syntax_check): 153 if syntax_check and int(syntax_check):
126 args.append('--check') 154 args.append('--check')
127 155
128 print 'Updating projects from gyp files...' 156 print 'Updating projects from gyp files...'
129 sys.stdout.flush() 157 sys.stdout.flush()
130 158
131 # Generate for the architectures supported on the given platform. 159 # Generate for the architectures supported on the given platform.
132 gyp_args = list(args) 160 gyp_args = list(args)
161 gyp_args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()])
133 gyp_generators = os.environ.get('GYP_GENERATORS', '') 162 gyp_generators = os.environ.get('GYP_GENERATORS', '')
134 if platform.system() == 'Linux' and gyp_generators != 'ninja': 163 if platform.system() == 'Linux' and gyp_generators != 'ninja':
135 # Work around for crbug.com/331475. 164 # Work around for crbug.com/331475.
136 for f in glob.glob(os.path.join(v8_root, 'out', 'Makefile.*')): 165 for f in glob.glob(os.path.join(v8_root, 'out', 'Makefile.*')):
137 os.unlink(f) 166 os.unlink(f)
138 # --generator-output defines where the Makefile goes. 167 # --generator-output defines where the Makefile goes.
139 gyp_args.append('--generator-output=out') 168 gyp_args.append('--generator-output=out')
140 # -Goutput_dir defines where the build output goes, relative to the 169 # -Goutput_dir defines where the build output goes, relative to the
141 # Makefile. Set it to . so that the build output doesn't end up in out/out. 170 # Makefile. Set it to . so that the build output doesn't end up in out/out.
142 gyp_args.append('-Goutput_dir=.') 171 gyp_args.append('-Goutput_dir=.')
143 172
144 gyp_defines = os.environ.get('GYP_DEFINES', '') 173 gyp_defines = os.environ.get('GYP_DEFINES', '')
145 174
146 # Automatically turn on crosscompile support for platforms that need it. 175 # Automatically turn on crosscompile support for platforms that need it.
147 if all(('ninja' in gyp_generators, 176 if all(('ninja' in gyp_generators,
148 'OS=android' in gyp_defines, 177 'OS=android' in gyp_defines,
149 'GYP_CROSSCOMPILE' not in os.environ)): 178 'GYP_CROSSCOMPILE' not in os.environ)):
150 os.environ['GYP_CROSSCOMPILE'] = '1' 179 os.environ['GYP_CROSSCOMPILE'] = '1'
151 180
152 run_gyp(gyp_args) 181 run_gyp(gyp_args)
OLDNEW
« no previous file with comments | « build/gyp_environment.py ('k') | build/standalone.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698