Make src/effects explicitly optional.
authorMike Klein <mtklein@chromium.org>
Thu, 9 Feb 2017 17:24:07 +0000 (12:24 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 9 Feb 2017 19:30:25 +0000 (19:30 +0000)
This adds a GN argument to disable src/effects, which can cut about 1M
off libskia.  It's not the first place you'd go to trim code size, but
after turning off easy big things like Ganesh, it starts looking big.

I tested that fiddle builds and links.  It uses Skia but not effects.
Most of our test apps use effects and can't build in this new mode.

Change-Id: I9b5d6e9289a87bc08eedf6d202d0eabe754da41a
Reviewed-on: https://skia-review.googlesource.com/8263
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

BUILD.gn
src/ports/SkGlobalInitialization_none.cpp [new file with mode: 0644]

index 656ed5e..471b3fd 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -28,6 +28,7 @@ declare_args() {
   skia_android_serial = ""
   skia_enable_android_framework_defines = false
   skia_enable_discrete_gpu = true
+  skia_enable_effects = true
   skia_enable_gpu = true
   skia_enable_pdf = true
   skia_enable_splicer = is_skia_standalone && sanitize != "MSAN" && !is_ios
@@ -322,6 +323,13 @@ template("optional") {
   }
 }
 
+optional("effects") {
+  enabled = skia_enable_effects
+  sources =
+      skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
+  sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
+}
+
 optional("fontmgr_android") {
   enabled = fontmgr_android_enabled
 
@@ -543,6 +551,7 @@ component("skia") {
     ":armv7",
     ":avx",
     ":crc32",
+    ":effects",
     ":fontmgr_android",
     ":fontmgr_custom",
     ":fontmgr_fontconfig",
@@ -571,7 +580,6 @@ component("skia") {
 
   sources = []
   sources += skia_core_sources
-  sources += skia_effects_sources
   sources += skia_sksl_sources
   sources += skia_utils_sources
   sources += skia_xps_sources
@@ -595,7 +603,6 @@ component("skia") {
     "src/codec/SkWbmpCodec.cpp",
     "src/images/SkImageEncoder.cpp",
     "src/ports/SkDiscardableMemory_none.cpp",
-    "src/ports/SkGlobalInitialization_default.cpp",
     "src/ports/SkImageGenerator_skia.cpp",
     "src/ports/SkMemory_malloc.cpp",
     "src/ports/SkOSFile_stdio.cpp",
diff --git a/src/ports/SkGlobalInitialization_none.cpp b/src/ports/SkGlobalInitialization_none.cpp
new file mode 100644 (file)
index 0000000..07d1825
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkFlattenable.h"
+
+void SkFlattenable::PrivateInitializer::InitEffects() {}