aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn/gn_to_bp.py
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-10-06 11:53:53 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-06 16:18:34 +0000
commit981a31e6a8bd8d48ee2b56afd6424be8a21042c8 (patch)
treefce1a28f5cf397e1a65ce5167ccf0106bd5304f9 /gn/gn_to_bp.py
parent1265894423f394f7ca60e660168414cfb8fe66b3 (diff)
Generate warning settings for Android framework
Bug: b/66996870 Android wants to build with warnings as errors. Keep the external/skia warnings in sync with other Skia builds by pulling them from the json generated by GN. Fix a couple small errors that show up in the framework build. Uploaded in response to AOSP's https://android-review.googlesource.com/#/c/platform/external/skia/+/498211/ Change-Id: I4d791d43a9b00f9d6b79ecf16839716f241cba99 Reviewed-on: https://skia-review.googlesource.com/55703 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'gn/gn_to_bp.py')
-rw-r--r--gn/gn_to_bp.py35
1 files changed, 27 insertions, 8 deletions
diff --git a/gn/gn_to_bp.py b/gn/gn_to_bp.py
index f0a28a8941..239fb020fd 100644
--- a/gn/gn_to_bp.py
+++ b/gn/gn_to_bp.py
@@ -21,14 +21,11 @@ bp = string.Template('''// This file is autogenerated by gn_to_bp.py.
cc_library_static {
name: "libskia",
cflags: [
- "-fexceptions",
- "-fvisibility=hidden",
- "-Wno-unused-parameter",
- "-U_FORTIFY_SOURCE",
- "-D_FORTIFY_SOURCE=1",
- "-DSKIA_DLL",
- "-DSKIA_IMPLEMENTATION=1",
- "-DATRACE_TAG=ATRACE_TAG_VIEW",
+ $cflags
+ ],
+
+ cppflags:[
+ $cflags_cc
],
export_include_dirs: [
@@ -185,6 +182,8 @@ def strip_slashes(lst):
return {str(p.lstrip('/')) for p in lst}
srcs = strip_slashes(js['targets']['//:skia']['sources'])
+cflags = strip_slashes(js['targets']['//:skia']['cflags'])
+cflags_cc = strip_slashes(js['targets']['//:skia']['cflags_cc'])
local_includes = strip_slashes(js['targets']['//:skia']['include_dirs'])
export_includes = strip_slashes(js['targets']['//:public']['include_dirs'])
@@ -217,6 +216,24 @@ srcs = {s for s in srcs if not s.endswith('.h')}
dm_srcs = {s for s in dm_srcs if not s.endswith('.h')}
nanobench_srcs = {s for s in nanobench_srcs if not s.endswith('.h')}
+# Only use the generated flags related to warnings.
+cflags = {s for s in cflags if s.startswith('-W')}
+cflags_cc = {s for s in cflags_cc if s.startswith('-W')}
+# Add the rest of the flags we want.
+cflags = cflags.union([
+ "-fvisibility=hidden",
+ "-D_FORTIFY_SOURCE=1",
+ "-DSKIA_DLL",
+ "-DSKIA_IMPLEMENTATION=1",
+ "-DATRACE_TAG=ATRACE_TAG_VIEW",
+])
+cflags_cc.add("-fexceptions")
+
+# We need to undefine FORTIFY_SOURCE before we define it. Insert it at the
+# beginning after sorting.
+cflags = sorted(cflags)
+cflags.insert(0, "-U_FORTIFY_SOURCE")
+
# Most defines go into SkUserConfig.h, where they're seen by Skia and its users.
defines = [str(d) for d in js['targets']['//:skia']['defines']]
defines.remove('NDEBUG') # Let the Android build control this.
@@ -259,6 +276,8 @@ with open('Android.bp', 'w') as f:
'export_includes': bpfmt(8, export_includes),
'local_includes': bpfmt(8, local_includes),
'srcs': bpfmt(8, srcs),
+ 'cflags': bpfmt(8, cflags, False),
+ 'cflags_cc': bpfmt(8, cflags_cc),
'arm_srcs': bpfmt(16, scrub(defs['armv7'])),
'arm_neon_srcs': bpfmt(20, scrub(defs['neon'])),