aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/skqp/generate_gn_args
diff options
context:
space:
mode:
Diffstat (limited to 'tools/skqp/generate_gn_args')
-rwxr-xr-xtools/skqp/generate_gn_args48
1 files changed, 30 insertions, 18 deletions
diff --git a/tools/skqp/generate_gn_args b/tools/skqp/generate_gn_args
index c527208c04..6a5c97490b 100755
--- a/tools/skqp/generate_gn_args
+++ b/tools/skqp/generate_gn_args
@@ -4,6 +4,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import argparse
import os
import sys
@@ -11,7 +12,7 @@ fmt = '''
target_cpu = "{arch}"
is_debug = false
ndk = "{ndk}"
-ndk_api = 26
+ndk_api = {api_level}
skia_enable_fontmgr_empty = true
skia_enable_pdf = false
skia_skqp_global_error_tolerance = 4
@@ -22,27 +23,38 @@ skia_use_libheif = false
skia_use_lua = false
skia_use_piex = false
skia_use_skcms = false
+skia_skqp_enable_driver_correctness_workarounds = {enable_workarounds}
'''
-def make_args_gn(out_dir, ndk, arch):
+def parse_args():
+ parser = argparse.ArgumentParser(description='Generate args.gn file.')
+ parser.add_argument('target_build_dir')
+ parser.add_argument('android_ndk_dir' )
+ parser.add_argument('--arch', metavar='architecture', default='arm',
+ help='defaults to "arm", valid values: "arm" "arm64" "x86" "x64"')
+ parser.add_argument('--api_level', type=int, metavar='api_level',
+ default=26, help='android API level, defaults to 26')
+ parser.add_argument('--enable_workarounds', default=False,
+ action='store_true', help="enable GPU work-arounds, defaults to false")
+
+ # parse the args and convert enable_workarounds to string.
+ args = parser.parse_args()
+ args.enable_workarounds = 'true' if args.enable_workarounds else 'false'
+ return args
+
+def make_args_gn(out_dir, ndk, arch, api_level, enable_workarounds):
if not os.path.exists(out_dir):
os.makedirs(out_dir)
with open(os.path.join(out_dir, 'args.gn'), 'w') as o:
- o.write(fmt.format(ndk=os.path.abspath(ndk), arch=arch))
-
-def usage():
- sys.stderr.write(
- 'Usage:\n' +
- ' {} TARGET_BUILD_DIR ANDROID_NDK_DIR ARCHITECTURE\n\n'.format(sys.argv[0]) +
- 'ARCHITECTURE should be "arm" "arm64" "x86" or "x64"\n\n')
- exit(1)
+ o.write(fmt.format(ndk=os.path.abspath(ndk),
+ arch=arch,
+ api_level=api_level,
+ enable_workarounds=enable_workarounds))
if __name__ == '__main__':
- if len(sys.argv) != 4:
- usage()
- build, android_ndk, arch = sys.argv[1:4]
- if len(build) == 0 or len(arch) == 0 or not os.path.isdir(android_ndk):
- usage()
- make_args_gn(build, android_ndk, arch)
-
-
+ args = parse_args()
+ make_args_gn(args.target_build_dir,
+ args.android_ndk_dir,
+ args.arch,
+ args.api_level,
+ args.enable_workarounds)