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

Side by Side Diff: build_gyp/gyp_pdfium

Issue 1897523002: Use visual studio toolchain from depot_tools for PDFium compilation (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « build_gyp/find_depot_tools.py ('k') | build_gyp/vs_toolchain.py » ('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 2014 PDFium Authors. All rights reserved. 3 # Copyright 2014 PDFium 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 PDFium that adds some support for how GYP 7 # This script is wrapper for PDFium that adds some support for how GYP
8 # is invoked by PDFium beyond what can be done in the gclient hooks. 8 # is invoked by PDFium beyond what can be done in the gclient hooks.
9 9
10 import os 10 import os
11 import platform 11 import platform
12 import sys 12 import sys
13 13
14 script_dir = os.path.dirname(os.path.realpath(__file__)) 14 script_dir = os.path.dirname(os.path.realpath(__file__))
15 pdfium_root = os.path.abspath(os.path.join(script_dir, os.pardir)) 15 pdfium_root = os.path.abspath(os.path.join(script_dir, os.pardir))
16 output_rel_dir = 'out'
16 17
17 sys.path.insert(0, os.path.join(pdfium_root, 'tools', 'gyp', 'pylib')) 18 sys.path.insert(0, os.path.join(pdfium_root, 'tools', 'gyp', 'pylib'))
18 import gyp 19 import gyp
19 20 # vs_toolchain needs to be after gyp path setting since it also uses gyp.
21 import vs_toolchain
20 22
21 def run_gyp(args): 23 def run_gyp(args):
22 rc = gyp.main(args) 24 rc = gyp.main(args)
25
26 # Copy Windows toolchain DLLs.
27 vs_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
28 if vs_runtime_dll_dirs:
29 x64_runtime, x86_runtime = vs_runtime_dll_dirs
30 vs_toolchain.CopyVsRuntimeDlls(
31 os.path.join(pdfium_root, output_rel_dir), (x86_runtime, x64_runtime))
32
23 if rc != 0: 33 if rc != 0:
24 print 'Error running GYP' 34 print 'Error running GYP'
25 sys.exit(rc) 35 sys.exit(rc)
26 36
27 37
28 def main(): 38 def main():
29 args = sys.argv[1:] 39 args = sys.argv[1:]
30 args.append(os.path.join(pdfium_root, 'build_gyp', 'all.gyp')) 40 args.append(os.path.join(pdfium_root, 'build_gyp', 'all.gyp'))
31 41
32 args.append('-I') 42 args.append('-I')
33 args.append(os.path.join(pdfium_root, 'build_gyp', 'standalone.gypi')) 43 args.append(os.path.join(pdfium_root, 'build_gyp', 'standalone.gypi'))
34 44
35 args.extend(['-D', 'gyp_output_dir=out']) 45 args.extend(['-D', 'gyp_output_dir=' + output_rel_dir])
36 46
37 # Set the GYP DEPTH variable to the root of the PDFium project. 47 # Set the GYP DEPTH variable to the root of the PDFium project.
38 args.append('--depth=' + os.path.relpath(pdfium_root)) 48 args.append('--depth=' + os.path.relpath(pdfium_root))
39 49
40 # GYP does not default to ninja, but PDFium should. 50 # GYP does not default to ninja, but PDFium should.
41 if not os.environ.get('GYP_GENERATORS', ''): 51 if not os.environ.get('GYP_GENERATORS', ''):
42 print 'GYP_GENERATORS is not set, defaulting to ninja' 52 print 'GYP_GENERATORS is not set, defaulting to ninja'
43 os.environ['GYP_GENERATORS'] = 'ninja' 53 os.environ['GYP_GENERATORS'] = 'ninja'
44 54
55 # Set up the environment variables.
56 vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
57
45 print 'Updating projects from gyp files...' 58 print 'Updating projects from gyp files...'
46 sys.stdout.flush() 59 sys.stdout.flush()
47 60
48 run_gyp(args) 61 run_gyp(args)
49 62
50 63
51 if __name__ == '__main__': 64 if __name__ == '__main__':
52 sys.exit(main()) 65 sys.exit(main())
OLDNEW
« no previous file with comments | « build_gyp/find_depot_tools.py ('k') | build_gyp/vs_toolchain.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698