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

Side by Side Diff: build/gyp_chromium

Issue 137573002: win: Find and use toolchain installed by depot_tools (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # This script is wrapper for Chromium that adds some support for how GYP 7 # This script is wrapper for Chromium that adds some support for how GYP
8 # is invoked by Chromium beyond what can be done in the gclient hooks. 8 # is invoked by Chromium beyond what can be done in the gclient hooks.
9 9
10 import glob 10 import glob
11 import gyp_helper 11 import gyp_helper
12 import os 12 import os
13 import pipes 13 import pipes
14 import shlex 14 import shlex
15 import subprocess 15 import subprocess
16 import string 16 import string
17 import sys 17 import sys
18 18
19 script_dir = os.path.dirname(os.path.realpath(__file__)) 19 script_dir = os.path.dirname(os.path.realpath(__file__))
20 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir)) 20 chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
21 21
22 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) 22 sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
23 import gyp 23 import gyp
24 24
25 # Assume this file is in a one-level-deep subdirectory of the source root. 25 # Assume this file is in a one-level-deep subdirectory of the source root.
26 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 26 SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
27 27
28 # Add paths so that pymod_do_main(...) can import files. 28 # Add paths so that pymod_do_main(...) can import files.
29 sys.path.insert(1, os.path.join(chrome_src, 'tools'))
29 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'generate_shim_headers')) 30 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'generate_shim_headers'))
30 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) 31 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit'))
31 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) 32 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build'))
32 sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build')) 33 sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build'))
33 sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src', 34 sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src',
34 'build_tools')) 35 'build_tools'))
35 sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build')) 36 sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build'))
36 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'liblouis')) 37 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'liblouis'))
37 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit', 38 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit',
38 'Source', 'build', 'scripts')) 39 'Source', 'build', 'scripts'))
39 40
41 import find_depot_tools
42
40 # On Windows, Psyco shortens warm runs of build/gyp_chromium by about 43 # On Windows, Psyco shortens warm runs of build/gyp_chromium by about
41 # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 44 # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70
42 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco 45 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco
43 # maxes out at about 158 MB vs. 132 MB without it. 46 # maxes out at about 158 MB vs. 132 MB without it.
44 # 47 #
45 # Psyco uses native libraries, so we need to load a different 48 # Psyco uses native libraries, so we need to load a different
46 # installation depending on which OS we are running under. It has not 49 # installation depending on which OS we are running under. It has not
47 # been tested whether using Psyco on our Mac and Linux builds is worth 50 # been tested whether using Psyco on our Mac and Linux builds is worth
48 # it (the GYP running time is a lot shorter, so the JIT startup cost 51 # it (the GYP running time is a lot shorter, so the JIT startup cost
49 # may not be worth it). 52 # may not be worth it).
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 # . set the env var only if it hasn't been set yet 325 # . set the env var only if it hasn't been set yet
323 # . chromium.gyp_env has been applied to os.environ at this point already 326 # . chromium.gyp_env has been applied to os.environ at this point already
324 if sys.platform.startswith('linux') and not os.environ.get('GYP_GENERATORS'): 327 if sys.platform.startswith('linux') and not os.environ.get('GYP_GENERATORS'):
325 os.environ['GYP_GENERATORS'] = 'ninja' 328 os.environ['GYP_GENERATORS'] = 'ninja'
326 if sys.platform.startswith('win') and not os.environ.get('GYP_GENERATORS'): 329 if sys.platform.startswith('win') and not os.environ.get('GYP_GENERATORS'):
327 os.environ['GYP_GENERATORS'] = 'ninja' 330 os.environ['GYP_GENERATORS'] = 'ninja'
328 elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \ 331 elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \
329 not 'OS=ios' in os.environ.get('GYP_DEFINES', []): 332 not 'OS=ios' in os.environ.get('GYP_DEFINES', []):
330 os.environ['GYP_GENERATORS'] = 'ninja' 333 os.environ['GYP_GENERATORS'] = 'ninja'
331 334
332 # If using ninja on windows, and not opting out of the the automatic 335 # If using ninja on windows, and the automatic toolchain has been installed
333 # toolchain, then set up variables for the automatic toolchain. Opt-out is 336 # by depot_tools, then use it.
334 # on by default, for now.
335 if (sys.platform in ('win32', 'cygwin') and 337 if (sys.platform in ('win32', 'cygwin') and
336 os.environ.get('GYP_GENERATORS') == 'ninja' and 338 os.environ.get('GYP_GENERATORS') == 'ninja'):
337 os.environ.get('GYP_MSVS_USE_SYSTEM_TOOLCHAIN', '1') != '1'): 339 depot_tools_path = find_depot_tools.add_depot_tools_to_path()
338 # For now, call the acquisition script here so that there's only one
339 # opt-in step required. This will be moved to a separate DEPS step once
340 # it's on by default.
341 subprocess.check_call([
342 sys.executable,
343 os.path.normpath(os.path.join(script_dir, '..', 'tools', 'win',
344 'toolchain',
345 'get_toolchain_if_necessary.py'))])
346 toolchain = os.path.normpath(os.path.join( 340 toolchain = os.path.normpath(os.path.join(
347 script_dir, '..', 'third_party', 'win_toolchain', 'files')) 341 depot_tools_path, 'win_toolchain', 'vs2013_files'))
348 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain 342 if os.path.isdir(toolchain):
349 os.environ['GYP_MSVS_VERSION'] = '2013' 343 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain
350 # We need to make sure windows_sdk_path is set to the automated toolchain 344 os.environ['GYP_MSVS_VERSION'] = '2013'
351 # values in GYP_DEFINES, but don't want to override any other values there. 345 # We need to make sure windows_sdk_path is set to the automated
352 gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES')) 346 # toolchain values in GYP_DEFINES, but don't want to override any other
353 win8sdk = os.path.join(toolchain, 'win8sdk') 347 # values there.
354 gyp_defines_dict['windows_sdk_path'] = win8sdk 348 gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES'))
355 os.environ['WINDOWSSDKDIR'] = win8sdk 349 win8sdk = os.path.join(toolchain, 'win8sdk')
356 os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v))) 350 gyp_defines_dict['windows_sdk_path'] = win8sdk
357 for k, v in gyp_defines_dict.iteritems()) 351 os.environ['WINDOWSSDKDIR'] = win8sdk
358 # Include the VS runtime in the PATH in case it's not machine-installed. 352 os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v)))
359 runtime_path = ';'.join( 353 for k, v in gyp_defines_dict.iteritems())
360 os.path.normpath(os.path.join( 354 # Include the VS runtime in the PATH in case it's not machine-installed.
361 script_dir, '..', 'third_party', 'win_toolchain', 'files', s)) 355 runtime_path = ';'.join(os.path.normpath(os.path.join(toolchain, s))
362 for s in ('sys64', 'sys32')) 356 for s in ('sys64', 'sys32'))
363 os.environ['PATH'] = runtime_path + os.environ['PATH'] 357 os.environ['PATH'] = runtime_path + ';' + os.environ['PATH']
364 print('Using automatic toolchain in %s.' % toolchain) 358 print('Using automatic toolchain in %s.' % toolchain)
365 359
366 # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check 360 # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check
367 # to enfore syntax checking. 361 # to enfore syntax checking.
368 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') 362 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK')
369 if syntax_check and int(syntax_check): 363 if syntax_check and int(syntax_check):
370 args.append('--check') 364 args.append('--check')
371 365
372 supplemental_includes = GetSupplementalFiles() 366 supplemental_includes = GetSupplementalFiles()
373 if not RunGN(supplemental_includes): 367 if not RunGN(supplemental_includes):
374 sys.exit(1) 368 sys.exit(1)
375 args.extend( 369 args.extend(
376 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) 370 ['-I' + i for i in additional_include_files(supplemental_includes, args)])
377 371
378 print 'Updating projects from gyp files...' 372 print 'Updating projects from gyp files...'
379 sys.stdout.flush() 373 sys.stdout.flush()
380 374
381 # Off we go... 375 # Off we go...
382 sys.exit(gyp.main(args)) 376 sys.exit(gyp.main(args))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698