SkQP: from skqp_gn_args import SkqpGnArgs

This keeps the GN arguments in sync between stand-alone SkQP and CTS SkQP.

Change-Id: I7e8b2ecf47de30555d0f050daa03549e5279a4cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197846
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2019-03-04 17:28:22 -05:00 committed by Skia Commit-Bot
parent 966348413f
commit e6752606a3
3 changed files with 37 additions and 28 deletions

View File

@ -8,22 +8,13 @@ import argparse
import os
import sys
from skqp_gn_args import SkqpGnArgs
fmt = '''
target_cpu = "{arch}"
is_debug = {debug}
ndk = "{android_ndk_dir}"
is_debug = {debug}
ndk_api = {api_level}
skia_enable_fontmgr_empty = true
skia_enable_pdf = false
skia_skqp_global_error_tolerance = 8
skia_use_dng_sdk = false
skia_use_expat = true
skia_use_icu = false
skia_use_libheif = false
skia_use_lua = false
skia_use_piex = false
skia_tools_require_resources = true
extra_cflags = [ "-DSK_ENABLE_DUMP_GPU", "-DSK_BUILD_FOR_SKQP" ]
'''
def parse_args():
@ -47,11 +38,19 @@ def parse_args():
args.android_ndk_dir = os.path.abspath(args.android_ndk_dir)
return args
def write_gn(o, args):
o.write(fmt.format(**args))
for k, v in SkqpGnArgs.iteritems():
o.write('%s = %s\n' % (k,v) )
def make_args_gn(out_dir, args):
if out_dir == '-':
write_gn(sys.stdout, args)
return
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(**args))
write_gn(o, args)
if __name__ == '__main__':
args = parse_args()

View File

@ -23,6 +23,8 @@ sys.path.insert(0, skia_gn_dir)
import gn_to_bp_utils
from skqp_gn_args import SkqpGnArgs
# First we start off with a template for Android.bp,
# with holes for source lists and include directories.
bp = string.Template('''// This file is autogenerated by tools/skqp/gn_to_bp.py.
@ -105,6 +107,7 @@ cc_library_shared {
"libz",
],
static_libs: [
"libexpat",
"libjpeg_static_ndk",
"libpng_ndk",
"libwebp-decode",
@ -120,21 +123,6 @@ gn_args = {
# setup skqp
'is_debug': 'false',
'ndk_api': '26',
'skia_skqp_global_error_tolerance': '8',
'skia_tools_require_resources': 'true',
# setup vulkan
'skia_use_vulkan': 'true',
# enable/disable skia subsystems
'skia_enable_fontmgr_empty': 'true',
'skia_enable_pdf': 'false',
'skia_enable_skottie': 'false',
'skia_use_expat': 'true',
'skia_use_dng_sdk': 'false',
'skia_use_icu': 'false',
'skia_use_lua': 'false',
'skia_use_piex': 'false',
# specify that the Android.bp will supply the necessary components
'skia_use_system_expat': 'true', # removed this when gn is fixed
@ -144,6 +132,9 @@ gn_args = {
'skia_use_system_zlib': 'true',
}
for k, v in SkqpGnArgs.iteritems():
gn_args[k] = v
js = gn_to_bp_utils.GenerateJSONFromGN(gn_args)
def strip_slashes(lst):

View File

@ -0,0 +1,19 @@
# Copyright 2019 Google LLC.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
SkqpGnArgs = {
'extra_cflags': '[ "-DSK_ENABLE_DUMP_GPU", "-DSK_BUILD_FOR_SKQP" ]',
'skia_enable_fontmgr_android': 'false',
'skia_enable_fontmgr_empty': 'true',
'skia_enable_pdf': 'false',
'skia_enable_skottie': 'false',
'skia_skqp_global_error_tolerance': '8',
'skia_tools_require_resources': 'true',
'skia_use_dng_sdk': 'false',
'skia_use_expat': 'true',
'skia_use_icu': 'false',
'skia_use_libheif': 'false',
'skia_use_lua': 'false',
'skia_use_piex': 'false',
'skia_use_vulkan': 'true',
}