blob: 21009a0c1d214b89994b55f5c1c558f51c30a945 [file] [log] [blame]
Hal Canary181ec2f2018-01-24 13:42:38 -05001#! /usr/bin/env python
2
3# Copyright 2018 Google Inc.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7import os
8import sys
9
Hal Canaryff2742e2018-01-30 11:35:47 -050010fmt = '''
11target_cpu = "{arch}"
12is_debug = false
13ndk = "{ndk}"
14ndk_api = 26
Hal Canaryff2742e2018-01-30 11:35:47 -050015skia_enable_fontmgr_empty = true
16skia_enable_pdf = false
17skia_use_dng_sdk = false
18skia_use_expat = false
19skia_use_icu = false
20skia_use_libheif = false
21skia_use_lua = false
22skia_use_piex = false
23skia_use_skcms = false
Hal Canary181ec2f2018-01-24 13:42:38 -050024'''
25
26def make_args_gn(out_dir, ndk, arch):
27 if not os.path.exists(out_dir):
28 os.makedirs(out_dir)
29 with open(os.path.join(out_dir, 'args.gn'), 'w') as o:
30 o.write(fmt.format(ndk=os.path.abspath(ndk), arch=arch))
31
32def usage():
33 sys.stderr.write(
34 'Usage:\n' +
35 ' {} TARGET_BUILD_DIR ANDROID_NDK_DIR ARCHITECTURE\n\n'.format(sys.argv[0]) +
36 'ARCHITECTURE should be "arm" "arm64" "x86" or "x64"\n\n')
37 exit(1)
38
39if __name__ == '__main__':
40 if len(sys.argv) != 4:
41 usage()
42 build, android_ndk, arch = sys.argv[1:4]
43 if len(build) == 0 or len(arch) == 0 or not os.path.isdir(android_ndk):
44 usage()
45 make_args_gn(build, android_ndk, arch)
46
47