blob: cead4158adb38f73fdd9bd74953ff05378f8bc4b [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
10fmt = '''ndk = "{ndk}"
11ndk_api = 26
12target_cpu = "{arch}"
13skia_embed_resources = true
14is_debug = false
15skia_enable_pdf = false
16'''
17
18def make_args_gn(out_dir, ndk, arch):
19 if not os.path.exists(out_dir):
20 os.makedirs(out_dir)
21 with open(os.path.join(out_dir, 'args.gn'), 'w') as o:
22 o.write(fmt.format(ndk=os.path.abspath(ndk), arch=arch))
23
24def usage():
25 sys.stderr.write(
26 'Usage:\n' +
27 ' {} TARGET_BUILD_DIR ANDROID_NDK_DIR ARCHITECTURE\n\n'.format(sys.argv[0]) +
28 'ARCHITECTURE should be "arm" "arm64" "x86" or "x64"\n\n')
29 exit(1)
30
31if __name__ == '__main__':
32 if len(sys.argv) != 4:
33 usage()
34 build, android_ndk, arch = sys.argv[1:4]
35 if len(build) == 0 or len(arch) == 0 or not os.path.isdir(android_ndk):
36 usage()
37 make_args_gn(build, android_ndk, arch)
38
39