Hal Canary | 181ec2f | 2018-01-24 13:42:38 -0500 | [diff] [blame] | 1 | #! /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 | |
| 7 | import os |
| 8 | import sys |
| 9 | |
Hal Canary | ff2742e | 2018-01-30 11:35:47 -0500 | [diff] [blame] | 10 | fmt = ''' |
| 11 | target_cpu = "{arch}" |
| 12 | is_debug = false |
| 13 | ndk = "{ndk}" |
| 14 | ndk_api = 26 |
Hal Canary | ff2742e | 2018-01-30 11:35:47 -0500 | [diff] [blame] | 15 | skia_enable_fontmgr_empty = true |
| 16 | skia_enable_pdf = false |
| 17 | skia_use_dng_sdk = false |
| 18 | skia_use_expat = false |
| 19 | skia_use_icu = false |
| 20 | skia_use_libheif = false |
| 21 | skia_use_lua = false |
| 22 | skia_use_piex = false |
| 23 | skia_use_skcms = false |
Hal Canary | 181ec2f | 2018-01-24 13:42:38 -0500 | [diff] [blame] | 24 | ''' |
| 25 | |
| 26 | def 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 | |
| 32 | def 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 | |
| 39 | if __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 | |