proposed gn_to_bp fixes
authorMike Klein <mtklein@chromium.org>
Mon, 12 Dec 2016 14:03:56 +0000 (09:03 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Mon, 12 Dec 2016 15:18:22 +0000 (15:18 +0000)
in response to 5784

Change-Id: I3ad34a30743e7ffbd04767668c288a4f884eb19c
Reviewed-on: https://skia-review.googlesource.com/5732
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

BUILD.gn
gn/gn_to_bp.py

index c687ded..c2258c0 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -12,6 +12,7 @@ if (!defined(is_skia_standalone)) {
 
 declare_args() {
   skia_use_angle = false
+  skia_use_cpufeatures = is_android
   skia_use_expat = true
   skia_use_fontconfig = is_linux
   skia_use_freetype = is_android || is_fuchsia || is_linux
@@ -92,7 +93,6 @@ config("skia_private") {
     "include/private",
     "src/c",
     "src/codec",
-    "src/config",
     "src/core",
     "src/effects",
     "src/effects/gradients",
@@ -640,10 +640,10 @@ component("skia") {
   }
 
   if (is_android) {
-    deps += [
-      "//third_party/cpu-features",
-      "//third_party/expat",
-    ]
+    if (skia_use_cpufeatures) {
+      deps += [ "//third_party/cpu-features" ]
+    }
+    deps += [ "//third_party/expat" ]
     sources += [ "src/ports/SkDebug_android.cpp" ]
     libs += [
       "EGL",
index bb75b83..1791697 100644 (file)
@@ -81,7 +81,7 @@ cc_library {
       "libz",
   ],
   static_libs: [
-      "cpufeatures",  // TODO: use this for CRC32 detection
+      //"cpufeatures",  // TODO: use this for CRC32 detection
       "libsfntly",
       "libwebp-decode",
       "libwebp-encode",
@@ -92,6 +92,8 @@ cc_library {
 # We'll run GN to get the main source lists and include directories for Skia.
 gn_args = {
   'skia_enable_vulkan_debug_layers': 'false',
+  'skia_use_cpufeatures':            'false',
+  'skia_use_system_expat':           'true',
   'skia_use_vulkan':                 'true',
   'target_cpu':                      '"none"',
   'target_os':                       '"android"',
@@ -114,6 +116,8 @@ export_includes = strip_slashes(js['targets']['//:public']['include_dirs'])
 for dep in js['targets']['//:skia']['deps']:
   if 'third_party' in dep:
     continue   # We've handled all third-party DEPS as static or shared_libs.
+  if 'none' in dep:
+    continue   # We'll handle all cpu-specific sources manually later.
   srcs.extend(strip_slashes(js['targets'][dep].get('sources', [])))
 
 # No need to list headers.
@@ -123,7 +127,6 @@ srcs = [s for s in srcs if not s.endswith('.h')]
 # Start with the defines :skia uses, minus a couple.  We'll add more in a bit.
 defines = [str(d) for d in js['targets']['//:skia']['defines']]
 defines.remove('SKIA_IMPLEMENTATION=1')  # Only libskia should have this define.
-defines.remove('XML_STATIC')       # On Android, libexpat is dynamically linked.
 
 # For architecture specific files, it's easier to just read the same source
 # that GN does (opts.gni) rather than re-run GN once for each architecture.
@@ -191,10 +194,10 @@ with open('Android.bp', 'w') as f:
   })
 
 #... and all the #defines we want to put in SkUserConfig.h.
-with open('SkUserConfig.h', 'w') as f:
+with open('include/config/SkUserConfig.h', 'w') as f:
   print >>f, '// This file is autogenerated by gn_to_bp.py.'
   print >>f, '#ifndef SkUserConfig_DEFINED'
   print >>f, '#define SkUserConfig_DEFINED'
   for define in sorted(defines):
-    print >>f, '  #define', define
+    print >>f, '  #define', define.replace('=', ' ')
   print >>f, '#endif//SkUserConfig_DEFINED'