aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn/gn_to_bp.py
diff options
context:
space:
mode:
authorGravatar Derek Sollenberger <djsollen@google.com>2017-09-21 14:25:14 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-25 13:29:53 +0000
commit5a932166e872dab74382f9cf23c9309a3b339638 (patch)
tree2cf54e09d39e8eb76c7d0318eb08641436d2779a /gn/gn_to_bp.py
parent0e4e410ac8042d880923f87c8a7c325539896344 (diff)
Update the Android.bp to expose a static library
This CL will enable Android to statically link libskia into libhwui while still exposing the symbols needed by other components of the system. Bug: b/31971097 Change-Id: Ib6c87331dbe456e247b46a34c38da4863dfe02f0 Reviewed-on: https://skia-review.googlesource.com/49766 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Derek Sollenberger <djsollen@google.com>
Diffstat (limited to 'gn/gn_to_bp.py')
-rw-r--r--gn/gn_to_bp.py86
1 files changed, 27 insertions, 59 deletions
diff --git a/gn/gn_to_bp.py b/gn/gn_to_bp.py
index 56fa3cc784..f0a28a8941 100644
--- a/gn/gn_to_bp.py
+++ b/gn/gn_to_bp.py
@@ -14,51 +14,19 @@ import string
import subprocess
import tempfile
-tool_cflags = [
- '-Wno-unused-parameter',
-]
-
-# It's easier to maintain one list instead of separate lists.
-tool_shared_libs = [
- 'liblog',
- 'libGLESv2',
- 'libEGL',
- 'libvulkan',
- 'libz',
- 'libjpeg',
- 'libpng',
- 'libicuuc',
- 'libicui18n',
- 'libexpat',
- 'libft2',
- 'libheif',
- 'libdng_sdk',
- 'libpiex',
- 'libcutils',
- 'libnativewindow',
-]
-
-# The ordering here is important: libsfntly needs to come after libskia.
-tool_static_libs = [
- 'libarect',
- 'libjsoncpp',
- 'libskia',
- 'libsfntly',
- 'libwebp-decode',
- 'libwebp-encode',
-]
-
# 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 gn_to_bp.py.
-cc_library {
+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",
],
@@ -119,6 +87,11 @@ cc_library {
},
},
+ defaults: ["skia_deps"],
+}
+
+cc_defaults {
+ name: "skia_deps",
shared_libs: [
"libEGL",
"libGLESv2",
@@ -143,13 +116,28 @@ cc_library {
"libwebp-decode",
"libwebp-encode",
],
+ group_static_libs: true,
+}
+
+cc_defaults {
+ name: "skia_tool_deps",
+ defaults: [
+ "skia_deps"
+ ],
+ static_libs: [
+ "libjsoncpp",
+ "libskia",
+ ],
+ cflags: [
+ "-Wno-unused-parameter"
+ ],
}
cc_test {
name: "skia_dm",
- cflags: [
- $tool_cflags
+ defaults: [
+ "skia_tool_deps"
],
local_include_dirs: [
@@ -159,21 +147,13 @@ cc_test {
srcs: [
$dm_srcs
],
-
- shared_libs: [
- $tool_shared_libs
- ],
-
- static_libs: [
- $tool_static_libs
- ],
}
cc_test {
name: "skia_nanobench",
- cflags: [
- $tool_cflags
+ defaults: [
+ "skia_tool_deps"
],
local_include_dirs: [
@@ -183,14 +163,6 @@ cc_test {
srcs: [
$nanobench_srcs
],
-
- shared_libs: [
- $tool_shared_libs
- ],
-
- static_libs: [
- $tool_static_libs
- ],
}''')
# We'll run GN to get the main source lists and include directories for Skia.
@@ -299,10 +271,6 @@ with open('Android.bp', 'w') as f:
defs['sse42'] +
defs['avx' ])),
- 'tool_cflags' : bpfmt(8, tool_cflags),
- 'tool_shared_libs' : bpfmt(8, tool_shared_libs),
- 'tool_static_libs' : bpfmt(8, tool_static_libs, False),
-
'dm_includes' : bpfmt(8, dm_includes),
'dm_srcs' : bpfmt(8, dm_srcs),