Allow most third_party targets to use system libraries if asked.
authorMike Klein <mtklein@chromium.org>
Tue, 1 Nov 2016 15:46:10 +0000 (11:46 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 1 Nov 2016 16:17:38 +0000 (16:17 +0000)
This extends the pattern in freetype2 to expat, icu, libjpeg-turbo, libpng, libwebp, and zlib, and gives all these an arg to control which to use.

Homebrew doesn't have dng_sdk, piex, or sftnly, or I'd have done the same for them too.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4260

DOCS_PREVIEW= https://skia.org/?cl=4260

Change-Id: I82e780502bf2217336e791787f172a6fc8f55460
Reviewed-on: https://skia-review.googlesource.com/4260
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Hal Canary <halcanary@google.com>
BUILD.gn
site/user/quick/gn.md
third_party/expat/BUILD.gn
third_party/freetype2/BUILD.gn
third_party/icu/BUILD.gn
third_party/libjpeg-turbo/BUILD.gn
third_party/libpng/BUILD.gn
third_party/libwebp/BUILD.gn
third_party/third_party.gni
third_party/zlib/BUILD.gn

index f5ad42f..2244530 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -16,12 +16,12 @@ declare_args() {
   skia_use_fontconfig = is_linux
   skia_use_freetype = is_android || is_fuchsia || is_linux
   skia_use_gdi = false
+  skia_use_icu = !is_fuchsia && !is_win  # TODO: Windows
   skia_use_libjpeg_turbo = true
   skia_use_libpng = true
   skia_use_libwebp = !is_fuchsia
   skia_use_mesa = false
-  skia_use_raw = !is_win
-  skia_use_sfntly = !is_fuchsia && !is_win  # TODO: icu on Windows, re-enable this.
+  skia_use_piex = !is_win
   skia_use_zlib = true
 
   skia_enable_android_framework_defines = false
@@ -30,8 +30,10 @@ declare_args() {
   skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
   skia_vulkan_sdk = getenv("VULKAN_SDK")
 }
-
 declare_args() {
+  skia_use_dng_sdk = !is_win && skia_use_libjpeg_turbo && skia_use_zlib
+  skia_use_sfntly = skia_use_icu
+
   if (is_android) {
     skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
   } else {
@@ -452,7 +454,7 @@ optional("png") {
 }
 
 optional("raw") {
-  enabled = skia_use_raw && skia_use_libjpeg_turbo && skia_use_zlib
+  enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
   public_defines = [ "SK_CODEC_DECODES_RAW" ]
 
   deps = [
index c35b519..b948332 100644 (file)
@@ -123,3 +123,23 @@ project descriptions.  This is not meant for any purpose beyond development.
 <!--?prettify lang=sh?-->
 
     gn gen out/config --ide=json --json-ide-script=../../gn/gn_to_cmake.py
+
+Third-party Dependencies
+------------------------
+
+Skia offers several features that make use of third-party libraries, like
+libpng, libwebp, or libjpeg-turbo to decode images, or ICU and sftnly to subset
+fonts.  All these third-party dependencies are optional, and can be controlled
+by a GN argument that looks something like `skia_use_foo` for appropriate
+`foo`.
+
+Most of these third-party dependencies can also be satisfied by pre-built
+system libraries.  If `skia_use_foo` is enabled, turn on `skia_use_system_foo`
+to build and link Skia against the headers and libaries found on the normal
+system paths.  Remember, you can use `extra_cflags` and `extra_ldflags` to add
+include or library paths if needed.
+
+By default Skia will attempt to build and embed its own copies of these
+third-party libraries.  This configuration is for development and testing only.
+We do not recommend shipping Skia this way.  Note however, this is the only
+configuration of Skia that receives significant testing.
index b493a21..3277389 100644 (file)
@@ -4,19 +4,26 @@
 # found in the LICENSE file.
 
 declare_args() {
+  skia_use_system_expat = false
 }
 
 import("../third_party.gni")
 
-third_party("expat") {
-  public_defines = [ "XML_STATIC" ]
-  public_include_dirs = [ "../externals/expat/lib" ]
+if (skia_use_system_expat) {
+  system("expat") {
+    libs = [ "expat" ]
+  }
+} else {
+  third_party("expat") {
+    public_defines = [ "XML_STATIC" ]
+    public_include_dirs = [ "../externals/expat/lib" ]
 
-  defines = [ "HAVE_MEMMOVE" ]
+    defines = [ "HAVE_MEMMOVE" ]
 
-  sources = [
-    "../externals/expat/lib/xmlparse.c",
-    "../externals/expat/lib/xmlrole.c",
-    "../externals/expat/lib/xmltok.c",
-  ]
+    sources = [
+      "../externals/expat/lib/xmlparse.c",
+      "../externals/expat/lib/xmlrole.c",
+      "../externals/expat/lib/xmltok.c",
+    ]
+  }
 }
index 3ac5dd2..89b64e4 100644 (file)
@@ -4,12 +4,18 @@
 # found in the LICENSE file.
 
 declare_args() {
+  # TODO: false?  i.e. build from source all the time for testing?
+  skia_use_system_freetype2 = !(is_android || sanitize == "MSAN")
 }
 
 import("../third_party.gni")
 
-# TODO: build from source all the time?
-if (is_android || sanitize == "MSAN") {
+if (skia_use_system_freetype2) {
+  system("freetype2") {
+    include_dirs = [ "/usr/include/freetype2" ]
+    libs = [ "freetype" ]
+  }
+} else {
   third_party("freetype2") {
     public_include_dirs = [ "../externals/freetype/include" ]
 
@@ -53,12 +59,4 @@ if (is_android || sanitize == "MSAN") {
       "../externals/freetype/src/truetype/truetype.c",
     ]
   }
-} else {
-  config("system_freetype2") {
-    include_dirs = [ "/usr/include/freetype2" ]
-    libs = [ "freetype" ]
-  }
-  group("freetype2") {
-    public_configs = [ ":system_freetype2" ]
-  }
 }
index 9342c8f..e3815ee 100644 (file)
 # found in the LICENSE file.
 
 declare_args() {
+  skia_use_system_icu = false
 }
 
 import("../third_party.gni")
 
-third_party("icu") {
-  public_include_dirs = [ "../externals/icu/source/common" ]
-  configs -= [ "//gn:no_rtti" ]
-  if (!is_win) {
-    libs = [ "dl" ]
+if (skia_use_system_icu) {
+  system("icu") {
+    libs = [ "icuuc" ]
+  }
+} else {
+  third_party("icu") {
+    public_include_dirs = [ "../externals/icu/source/common" ]
+    configs -= [ "//gn:no_rtti" ]
+    if (!is_win) {
+      libs = [ "dl" ]
+    }
+    defines = [
+      # http://userguide.icu-project.org/howtouseicu
+      "U_COMMON_IMPLEMENTATION",
+      "U_STATIC_IMPLEMENTATION",
+    ]
+    sources = [
+      "../externals/icu/source/common/appendable.cpp",
+      "../externals/icu/source/common/bmpset.cpp",
+      "../externals/icu/source/common/brkeng.cpp",
+      "../externals/icu/source/common/brkiter.cpp",
+      "../externals/icu/source/common/bytestream.cpp",
+      "../externals/icu/source/common/bytestrie.cpp",
+      "../externals/icu/source/common/bytestriebuilder.cpp",
+      "../externals/icu/source/common/bytestrieiterator.cpp",
+      "../externals/icu/source/common/caniter.cpp",
+      "../externals/icu/source/common/chariter.cpp",
+      "../externals/icu/source/common/charstr.cpp",
+      "../externals/icu/source/common/cmemory.c",
+      "../externals/icu/source/common/cstring.c",
+      "../externals/icu/source/common/cwchar.c",
+      "../externals/icu/source/common/dictbe.cpp",
+      "../externals/icu/source/common/dictionarydata.cpp",
+      "../externals/icu/source/common/dtintrv.cpp",
+      "../externals/icu/source/common/errorcode.cpp",
+      "../externals/icu/source/common/filteredbrk.cpp",
+      "../externals/icu/source/common/filterednormalizer2.cpp",
+      "../externals/icu/source/common/icudataver.c",
+      "../externals/icu/source/common/icuplug.cpp",
+      "../externals/icu/source/common/listformatter.cpp",
+      "../externals/icu/source/common/loadednormalizer2impl.cpp",
+      "../externals/icu/source/common/locavailable.cpp",
+      "../externals/icu/source/common/locbased.cpp",
+      "../externals/icu/source/common/locdispnames.cpp",
+      "../externals/icu/source/common/locid.cpp",
+      "../externals/icu/source/common/loclikely.cpp",
+      "../externals/icu/source/common/locmap.c",
+      "../externals/icu/source/common/locresdata.cpp",
+      "../externals/icu/source/common/locutil.cpp",
+      "../externals/icu/source/common/messagepattern.cpp",
+      "../externals/icu/source/common/normalizer2.cpp",
+      "../externals/icu/source/common/normalizer2impl.cpp",
+      "../externals/icu/source/common/normlzr.cpp",
+      "../externals/icu/source/common/parsepos.cpp",
+      "../externals/icu/source/common/patternprops.cpp",
+      "../externals/icu/source/common/pluralmap.cpp",
+      "../externals/icu/source/common/propname.cpp",
+      "../externals/icu/source/common/propsvec.c",
+      "../externals/icu/source/common/punycode.cpp",
+      "../externals/icu/source/common/putil.cpp",
+      "../externals/icu/source/common/rbbi.cpp",
+      "../externals/icu/source/common/rbbidata.cpp",
+      "../externals/icu/source/common/rbbinode.cpp",
+      "../externals/icu/source/common/rbbirb.cpp",
+      "../externals/icu/source/common/rbbiscan.cpp",
+      "../externals/icu/source/common/rbbisetb.cpp",
+      "../externals/icu/source/common/rbbistbl.cpp",
+      "../externals/icu/source/common/rbbitblb.cpp",
+      "../externals/icu/source/common/resbund.cpp",
+      "../externals/icu/source/common/resbund_cnv.cpp",
+      "../externals/icu/source/common/resource.cpp",
+      "../externals/icu/source/common/ruleiter.cpp",
+      "../externals/icu/source/common/schriter.cpp",
+      "../externals/icu/source/common/serv.cpp",
+      "../externals/icu/source/common/servlk.cpp",
+      "../externals/icu/source/common/servlkf.cpp",
+      "../externals/icu/source/common/servls.cpp",
+      "../externals/icu/source/common/servnotf.cpp",
+      "../externals/icu/source/common/servrbf.cpp",
+      "../externals/icu/source/common/servslkf.cpp",
+      "../externals/icu/source/common/sharedobject.cpp",
+      "../externals/icu/source/common/simplepatternformatter.cpp",
+      "../externals/icu/source/common/stringpiece.cpp",
+      "../externals/icu/source/common/stringtriebuilder.cpp",
+      "../externals/icu/source/common/uarrsort.c",
+      "../externals/icu/source/common/ubidi.c",
+      "../externals/icu/source/common/ubidi_props.c",
+      "../externals/icu/source/common/ubidiln.c",
+      "../externals/icu/source/common/ubidiwrt.c",
+      "../externals/icu/source/common/ubrk.cpp",
+      "../externals/icu/source/common/ucase.cpp",
+      "../externals/icu/source/common/ucasemap.cpp",
+      "../externals/icu/source/common/ucasemap_titlecase_brkiter.cpp",
+      "../externals/icu/source/common/ucat.c",
+      "../externals/icu/source/common/uchar.c",
+      "../externals/icu/source/common/ucharstrie.cpp",
+      "../externals/icu/source/common/ucharstriebuilder.cpp",
+      "../externals/icu/source/common/ucharstrieiterator.cpp",
+      "../externals/icu/source/common/uchriter.cpp",
+      "../externals/icu/source/common/ucln_cmn.cpp",
+      "../externals/icu/source/common/ucmndata.c",
+      "../externals/icu/source/common/ucnv.c",
+      "../externals/icu/source/common/ucnv2022.cpp",
+      "../externals/icu/source/common/ucnv_bld.cpp",
+      "../externals/icu/source/common/ucnv_cb.c",
+      "../externals/icu/source/common/ucnv_cnv.c",
+      "../externals/icu/source/common/ucnv_ct.c",
+      "../externals/icu/source/common/ucnv_err.c",
+      "../externals/icu/source/common/ucnv_ext.cpp",
+      "../externals/icu/source/common/ucnv_io.cpp",
+      "../externals/icu/source/common/ucnv_lmb.c",
+      "../externals/icu/source/common/ucnv_set.c",
+      "../externals/icu/source/common/ucnv_u16.c",
+      "../externals/icu/source/common/ucnv_u32.c",
+      "../externals/icu/source/common/ucnv_u7.c",
+      "../externals/icu/source/common/ucnv_u8.c",
+      "../externals/icu/source/common/ucnvbocu.cpp",
+      "../externals/icu/source/common/ucnvdisp.c",
+      "../externals/icu/source/common/ucnvhz.c",
+      "../externals/icu/source/common/ucnvisci.c",
+      "../externals/icu/source/common/ucnvlat1.c",
+      "../externals/icu/source/common/ucnvmbcs.cpp",
+      "../externals/icu/source/common/ucnvscsu.c",
+      "../externals/icu/source/common/ucnvsel.cpp",
+      "../externals/icu/source/common/ucol_swp.cpp",
+      "../externals/icu/source/common/udata.cpp",
+      "../externals/icu/source/common/udatamem.c",
+      "../externals/icu/source/common/udataswp.c",
+      "../externals/icu/source/common/uenum.c",
+      "../externals/icu/source/common/uhash.c",
+      "../externals/icu/source/common/uhash_us.cpp",
+      "../externals/icu/source/common/uidna.cpp",
+      "../externals/icu/source/common/uinit.cpp",
+      "../externals/icu/source/common/uinvchar.c",
+      "../externals/icu/source/common/uiter.cpp",
+      "../externals/icu/source/common/ulist.c",
+      "../externals/icu/source/common/ulistformatter.cpp",
+      "../externals/icu/source/common/uloc.cpp",
+      "../externals/icu/source/common/uloc_keytype.cpp",
+      "../externals/icu/source/common/uloc_tag.c",
+      "../externals/icu/source/common/umapfile.c",
+      "../externals/icu/source/common/umath.c",
+      "../externals/icu/source/common/umutex.cpp",
+      "../externals/icu/source/common/unames.cpp",
+      "../externals/icu/source/common/unifiedcache.cpp",
+      "../externals/icu/source/common/unifilt.cpp",
+      "../externals/icu/source/common/unifunct.cpp",
+      "../externals/icu/source/common/uniset.cpp",
+      "../externals/icu/source/common/uniset_closure.cpp",
+      "../externals/icu/source/common/uniset_props.cpp",
+      "../externals/icu/source/common/unisetspan.cpp",
+      "../externals/icu/source/common/unistr.cpp",
+      "../externals/icu/source/common/unistr_case.cpp",
+      "../externals/icu/source/common/unistr_case_locale.cpp",
+      "../externals/icu/source/common/unistr_cnv.cpp",
+      "../externals/icu/source/common/unistr_props.cpp",
+      "../externals/icu/source/common/unistr_titlecase_brkiter.cpp",
+      "../externals/icu/source/common/unorm.cpp",
+      "../externals/icu/source/common/unormcmp.cpp",
+      "../externals/icu/source/common/uobject.cpp",
+      "../externals/icu/source/common/uprops.cpp",
+      "../externals/icu/source/common/ures_cnv.c",
+      "../externals/icu/source/common/uresbund.cpp",
+      "../externals/icu/source/common/uresdata.cpp",
+      "../externals/icu/source/common/uresource.cpp",
+      "../externals/icu/source/common/usc_impl.c",
+      "../externals/icu/source/common/uscript.c",
+      "../externals/icu/source/common/uscript_props.cpp",
+      "../externals/icu/source/common/uset.cpp",
+      "../externals/icu/source/common/uset_props.cpp",
+      "../externals/icu/source/common/usetiter.cpp",
+      "../externals/icu/source/common/ushape.cpp",
+      "../externals/icu/source/common/usprep.cpp",
+      "../externals/icu/source/common/ustack.cpp",
+      "../externals/icu/source/common/ustr_cnv.cpp",
+      "../externals/icu/source/common/ustr_titlecase_brkiter.cpp",
+      "../externals/icu/source/common/ustr_wcs.cpp",
+      "../externals/icu/source/common/ustrcase.cpp",
+      "../externals/icu/source/common/ustrcase_locale.cpp",
+      "../externals/icu/source/common/ustrenum.cpp",
+      "../externals/icu/source/common/ustrfmt.c",
+      "../externals/icu/source/common/ustring.cpp",
+      "../externals/icu/source/common/ustrtrns.cpp",
+      "../externals/icu/source/common/utext.cpp",
+      "../externals/icu/source/common/utf_impl.c",
+      "../externals/icu/source/common/util.cpp",
+      "../externals/icu/source/common/util_props.cpp",
+      "../externals/icu/source/common/utrace.c",
+      "../externals/icu/source/common/utrie.cpp",
+      "../externals/icu/source/common/utrie2.cpp",
+      "../externals/icu/source/common/utrie2_builder.cpp",
+      "../externals/icu/source/common/uts46.cpp",
+      "../externals/icu/source/common/utypes.c",
+      "../externals/icu/source/common/uvector.cpp",
+      "../externals/icu/source/common/uvectr32.cpp",
+      "../externals/icu/source/common/uvectr64.cpp",
+      "../externals/icu/source/common/wintz.c",
+    ]
+    sources += [ "../externals/icu/$current_os/icudtl_dat.S" ]
   }
-  defines = [
-    # http://userguide.icu-project.org/howtouseicu
-    "U_COMMON_IMPLEMENTATION",
-    "U_STATIC_IMPLEMENTATION",
-  ]
-  sources = [
-    "../externals/icu/source/common/appendable.cpp",
-    "../externals/icu/source/common/bmpset.cpp",
-    "../externals/icu/source/common/brkeng.cpp",
-    "../externals/icu/source/common/brkiter.cpp",
-    "../externals/icu/source/common/bytestream.cpp",
-    "../externals/icu/source/common/bytestrie.cpp",
-    "../externals/icu/source/common/bytestriebuilder.cpp",
-    "../externals/icu/source/common/bytestrieiterator.cpp",
-    "../externals/icu/source/common/caniter.cpp",
-    "../externals/icu/source/common/chariter.cpp",
-    "../externals/icu/source/common/charstr.cpp",
-    "../externals/icu/source/common/cmemory.c",
-    "../externals/icu/source/common/cstring.c",
-    "../externals/icu/source/common/cwchar.c",
-    "../externals/icu/source/common/dictbe.cpp",
-    "../externals/icu/source/common/dictionarydata.cpp",
-    "../externals/icu/source/common/dtintrv.cpp",
-    "../externals/icu/source/common/errorcode.cpp",
-    "../externals/icu/source/common/filteredbrk.cpp",
-    "../externals/icu/source/common/filterednormalizer2.cpp",
-    "../externals/icu/source/common/icudataver.c",
-    "../externals/icu/source/common/icuplug.cpp",
-    "../externals/icu/source/common/listformatter.cpp",
-    "../externals/icu/source/common/loadednormalizer2impl.cpp",
-    "../externals/icu/source/common/locavailable.cpp",
-    "../externals/icu/source/common/locbased.cpp",
-    "../externals/icu/source/common/locdispnames.cpp",
-    "../externals/icu/source/common/locid.cpp",
-    "../externals/icu/source/common/loclikely.cpp",
-    "../externals/icu/source/common/locmap.c",
-    "../externals/icu/source/common/locresdata.cpp",
-    "../externals/icu/source/common/locutil.cpp",
-    "../externals/icu/source/common/messagepattern.cpp",
-    "../externals/icu/source/common/normalizer2.cpp",
-    "../externals/icu/source/common/normalizer2impl.cpp",
-    "../externals/icu/source/common/normlzr.cpp",
-    "../externals/icu/source/common/parsepos.cpp",
-    "../externals/icu/source/common/patternprops.cpp",
-    "../externals/icu/source/common/pluralmap.cpp",
-    "../externals/icu/source/common/propname.cpp",
-    "../externals/icu/source/common/propsvec.c",
-    "../externals/icu/source/common/punycode.cpp",
-    "../externals/icu/source/common/putil.cpp",
-    "../externals/icu/source/common/rbbi.cpp",
-    "../externals/icu/source/common/rbbidata.cpp",
-    "../externals/icu/source/common/rbbinode.cpp",
-    "../externals/icu/source/common/rbbirb.cpp",
-    "../externals/icu/source/common/rbbiscan.cpp",
-    "../externals/icu/source/common/rbbisetb.cpp",
-    "../externals/icu/source/common/rbbistbl.cpp",
-    "../externals/icu/source/common/rbbitblb.cpp",
-    "../externals/icu/source/common/resbund.cpp",
-    "../externals/icu/source/common/resbund_cnv.cpp",
-    "../externals/icu/source/common/resource.cpp",
-    "../externals/icu/source/common/ruleiter.cpp",
-    "../externals/icu/source/common/schriter.cpp",
-    "../externals/icu/source/common/serv.cpp",
-    "../externals/icu/source/common/servlk.cpp",
-    "../externals/icu/source/common/servlkf.cpp",
-    "../externals/icu/source/common/servls.cpp",
-    "../externals/icu/source/common/servnotf.cpp",
-    "../externals/icu/source/common/servrbf.cpp",
-    "../externals/icu/source/common/servslkf.cpp",
-    "../externals/icu/source/common/sharedobject.cpp",
-    "../externals/icu/source/common/simplepatternformatter.cpp",
-    "../externals/icu/source/common/stringpiece.cpp",
-    "../externals/icu/source/common/stringtriebuilder.cpp",
-    "../externals/icu/source/common/uarrsort.c",
-    "../externals/icu/source/common/ubidi.c",
-    "../externals/icu/source/common/ubidi_props.c",
-    "../externals/icu/source/common/ubidiln.c",
-    "../externals/icu/source/common/ubidiwrt.c",
-    "../externals/icu/source/common/ubrk.cpp",
-    "../externals/icu/source/common/ucase.cpp",
-    "../externals/icu/source/common/ucasemap.cpp",
-    "../externals/icu/source/common/ucasemap_titlecase_brkiter.cpp",
-    "../externals/icu/source/common/ucat.c",
-    "../externals/icu/source/common/uchar.c",
-    "../externals/icu/source/common/ucharstrie.cpp",
-    "../externals/icu/source/common/ucharstriebuilder.cpp",
-    "../externals/icu/source/common/ucharstrieiterator.cpp",
-    "../externals/icu/source/common/uchriter.cpp",
-    "../externals/icu/source/common/ucln_cmn.cpp",
-    "../externals/icu/source/common/ucmndata.c",
-    "../externals/icu/source/common/ucnv.c",
-    "../externals/icu/source/common/ucnv2022.cpp",
-    "../externals/icu/source/common/ucnv_bld.cpp",
-    "../externals/icu/source/common/ucnv_cb.c",
-    "../externals/icu/source/common/ucnv_cnv.c",
-    "../externals/icu/source/common/ucnv_ct.c",
-    "../externals/icu/source/common/ucnv_err.c",
-    "../externals/icu/source/common/ucnv_ext.cpp",
-    "../externals/icu/source/common/ucnv_io.cpp",
-    "../externals/icu/source/common/ucnv_lmb.c",
-    "../externals/icu/source/common/ucnv_set.c",
-    "../externals/icu/source/common/ucnv_u16.c",
-    "../externals/icu/source/common/ucnv_u32.c",
-    "../externals/icu/source/common/ucnv_u7.c",
-    "../externals/icu/source/common/ucnv_u8.c",
-    "../externals/icu/source/common/ucnvbocu.cpp",
-    "../externals/icu/source/common/ucnvdisp.c",
-    "../externals/icu/source/common/ucnvhz.c",
-    "../externals/icu/source/common/ucnvisci.c",
-    "../externals/icu/source/common/ucnvlat1.c",
-    "../externals/icu/source/common/ucnvmbcs.cpp",
-    "../externals/icu/source/common/ucnvscsu.c",
-    "../externals/icu/source/common/ucnvsel.cpp",
-    "../externals/icu/source/common/ucol_swp.cpp",
-    "../externals/icu/source/common/udata.cpp",
-    "../externals/icu/source/common/udatamem.c",
-    "../externals/icu/source/common/udataswp.c",
-    "../externals/icu/source/common/uenum.c",
-    "../externals/icu/source/common/uhash.c",
-    "../externals/icu/source/common/uhash_us.cpp",
-    "../externals/icu/source/common/uidna.cpp",
-    "../externals/icu/source/common/uinit.cpp",
-    "../externals/icu/source/common/uinvchar.c",
-    "../externals/icu/source/common/uiter.cpp",
-    "../externals/icu/source/common/ulist.c",
-    "../externals/icu/source/common/ulistformatter.cpp",
-    "../externals/icu/source/common/uloc.cpp",
-    "../externals/icu/source/common/uloc_keytype.cpp",
-    "../externals/icu/source/common/uloc_tag.c",
-    "../externals/icu/source/common/umapfile.c",
-    "../externals/icu/source/common/umath.c",
-    "../externals/icu/source/common/umutex.cpp",
-    "../externals/icu/source/common/unames.cpp",
-    "../externals/icu/source/common/unifiedcache.cpp",
-    "../externals/icu/source/common/unifilt.cpp",
-    "../externals/icu/source/common/unifunct.cpp",
-    "../externals/icu/source/common/uniset.cpp",
-    "../externals/icu/source/common/uniset_closure.cpp",
-    "../externals/icu/source/common/uniset_props.cpp",
-    "../externals/icu/source/common/unisetspan.cpp",
-    "../externals/icu/source/common/unistr.cpp",
-    "../externals/icu/source/common/unistr_case.cpp",
-    "../externals/icu/source/common/unistr_case_locale.cpp",
-    "../externals/icu/source/common/unistr_cnv.cpp",
-    "../externals/icu/source/common/unistr_props.cpp",
-    "../externals/icu/source/common/unistr_titlecase_brkiter.cpp",
-    "../externals/icu/source/common/unorm.cpp",
-    "../externals/icu/source/common/unormcmp.cpp",
-    "../externals/icu/source/common/uobject.cpp",
-    "../externals/icu/source/common/uprops.cpp",
-    "../externals/icu/source/common/ures_cnv.c",
-    "../externals/icu/source/common/uresbund.cpp",
-    "../externals/icu/source/common/uresdata.cpp",
-    "../externals/icu/source/common/uresource.cpp",
-    "../externals/icu/source/common/usc_impl.c",
-    "../externals/icu/source/common/uscript.c",
-    "../externals/icu/source/common/uscript_props.cpp",
-    "../externals/icu/source/common/uset.cpp",
-    "../externals/icu/source/common/uset_props.cpp",
-    "../externals/icu/source/common/usetiter.cpp",
-    "../externals/icu/source/common/ushape.cpp",
-    "../externals/icu/source/common/usprep.cpp",
-    "../externals/icu/source/common/ustack.cpp",
-    "../externals/icu/source/common/ustr_cnv.cpp",
-    "../externals/icu/source/common/ustr_titlecase_brkiter.cpp",
-    "../externals/icu/source/common/ustr_wcs.cpp",
-    "../externals/icu/source/common/ustrcase.cpp",
-    "../externals/icu/source/common/ustrcase_locale.cpp",
-    "../externals/icu/source/common/ustrenum.cpp",
-    "../externals/icu/source/common/ustrfmt.c",
-    "../externals/icu/source/common/ustring.cpp",
-    "../externals/icu/source/common/ustrtrns.cpp",
-    "../externals/icu/source/common/utext.cpp",
-    "../externals/icu/source/common/utf_impl.c",
-    "../externals/icu/source/common/util.cpp",
-    "../externals/icu/source/common/util_props.cpp",
-    "../externals/icu/source/common/utrace.c",
-    "../externals/icu/source/common/utrie.cpp",
-    "../externals/icu/source/common/utrie2.cpp",
-    "../externals/icu/source/common/utrie2_builder.cpp",
-    "../externals/icu/source/common/uts46.cpp",
-    "../externals/icu/source/common/utypes.c",
-    "../externals/icu/source/common/uvector.cpp",
-    "../externals/icu/source/common/uvectr32.cpp",
-    "../externals/icu/source/common/uvectr64.cpp",
-    "../externals/icu/source/common/wintz.c",
-  ]
-  sources += [ "../externals/icu/$current_os/icudtl_dat.S" ]
 }
index 95a381b..c0382a7 100644 (file)
@@ -4,58 +4,65 @@
 # found in the LICENSE file.
 
 declare_args() {
+  skia_use_system_libjpeg_turbo = false
 }
 
 import("../third_party.gni")
 
-third_party("libjpeg") {
-  public_include_dirs = [ "../externals/libjpeg-turbo" ]
+if (skia_use_system_libjpeg_turbo) {
+  system("libjpeg") {
+    libs = [ "jpeg" ]
+  }
+} else {
+  third_party("libjpeg") {
+    public_include_dirs = [ "../externals/libjpeg-turbo" ]
 
-  defines = [ "TURBO_FOR_WINDOWS" ]
+    defines = [ "TURBO_FOR_WINDOWS" ]
 
-  sources = [
-    "../externals/libjpeg-turbo/jcapimin.c",
-    "../externals/libjpeg-turbo/jcapistd.c",
-    "../externals/libjpeg-turbo/jccoefct.c",
-    "../externals/libjpeg-turbo/jccolor.c",
-    "../externals/libjpeg-turbo/jcdctmgr.c",
-    "../externals/libjpeg-turbo/jchuff.c",
-    "../externals/libjpeg-turbo/jcinit.c",
-    "../externals/libjpeg-turbo/jcmainct.c",
-    "../externals/libjpeg-turbo/jcmarker.c",
-    "../externals/libjpeg-turbo/jcmaster.c",
-    "../externals/libjpeg-turbo/jcomapi.c",
-    "../externals/libjpeg-turbo/jcparam.c",
-    "../externals/libjpeg-turbo/jcphuff.c",
-    "../externals/libjpeg-turbo/jcprepct.c",
-    "../externals/libjpeg-turbo/jcsample.c",
-    "../externals/libjpeg-turbo/jdapimin.c",
-    "../externals/libjpeg-turbo/jdapistd.c",
-    "../externals/libjpeg-turbo/jdcoefct.c",
-    "../externals/libjpeg-turbo/jdcolor.c",
-    "../externals/libjpeg-turbo/jddctmgr.c",
-    "../externals/libjpeg-turbo/jdhuff.c",
-    "../externals/libjpeg-turbo/jdinput.c",
-    "../externals/libjpeg-turbo/jdmainct.c",
-    "../externals/libjpeg-turbo/jdmarker.c",
-    "../externals/libjpeg-turbo/jdmaster.c",
-    "../externals/libjpeg-turbo/jdmerge.c",
-    "../externals/libjpeg-turbo/jdphuff.c",
-    "../externals/libjpeg-turbo/jdpostct.c",
-    "../externals/libjpeg-turbo/jdsample.c",
-    "../externals/libjpeg-turbo/jerror.c",
-    "../externals/libjpeg-turbo/jfdctflt.c",
-    "../externals/libjpeg-turbo/jfdctfst.c",
-    "../externals/libjpeg-turbo/jfdctint.c",
-    "../externals/libjpeg-turbo/jidctflt.c",
-    "../externals/libjpeg-turbo/jidctfst.c",
-    "../externals/libjpeg-turbo/jidctint.c",
-    "../externals/libjpeg-turbo/jidctred.c",
-    "../externals/libjpeg-turbo/jmemmgr.c",
-    "../externals/libjpeg-turbo/jmemnobs.c",
-    "../externals/libjpeg-turbo/jquant1.c",
-    "../externals/libjpeg-turbo/jquant2.c",
-    "../externals/libjpeg-turbo/jsimd_none.c",
-    "../externals/libjpeg-turbo/jutils.c",
-  ]
+    sources = [
+      "../externals/libjpeg-turbo/jcapimin.c",
+      "../externals/libjpeg-turbo/jcapistd.c",
+      "../externals/libjpeg-turbo/jccoefct.c",
+      "../externals/libjpeg-turbo/jccolor.c",
+      "../externals/libjpeg-turbo/jcdctmgr.c",
+      "../externals/libjpeg-turbo/jchuff.c",
+      "../externals/libjpeg-turbo/jcinit.c",
+      "../externals/libjpeg-turbo/jcmainct.c",
+      "../externals/libjpeg-turbo/jcmarker.c",
+      "../externals/libjpeg-turbo/jcmaster.c",
+      "../externals/libjpeg-turbo/jcomapi.c",
+      "../externals/libjpeg-turbo/jcparam.c",
+      "../externals/libjpeg-turbo/jcphuff.c",
+      "../externals/libjpeg-turbo/jcprepct.c",
+      "../externals/libjpeg-turbo/jcsample.c",
+      "../externals/libjpeg-turbo/jdapimin.c",
+      "../externals/libjpeg-turbo/jdapistd.c",
+      "../externals/libjpeg-turbo/jdcoefct.c",
+      "../externals/libjpeg-turbo/jdcolor.c",
+      "../externals/libjpeg-turbo/jddctmgr.c",
+      "../externals/libjpeg-turbo/jdhuff.c",
+      "../externals/libjpeg-turbo/jdinput.c",
+      "../externals/libjpeg-turbo/jdmainct.c",
+      "../externals/libjpeg-turbo/jdmarker.c",
+      "../externals/libjpeg-turbo/jdmaster.c",
+      "../externals/libjpeg-turbo/jdmerge.c",
+      "../externals/libjpeg-turbo/jdphuff.c",
+      "../externals/libjpeg-turbo/jdpostct.c",
+      "../externals/libjpeg-turbo/jdsample.c",
+      "../externals/libjpeg-turbo/jerror.c",
+      "../externals/libjpeg-turbo/jfdctflt.c",
+      "../externals/libjpeg-turbo/jfdctfst.c",
+      "../externals/libjpeg-turbo/jfdctint.c",
+      "../externals/libjpeg-turbo/jidctflt.c",
+      "../externals/libjpeg-turbo/jidctfst.c",
+      "../externals/libjpeg-turbo/jidctint.c",
+      "../externals/libjpeg-turbo/jidctred.c",
+      "../externals/libjpeg-turbo/jmemmgr.c",
+      "../externals/libjpeg-turbo/jmemnobs.c",
+      "../externals/libjpeg-turbo/jquant1.c",
+      "../externals/libjpeg-turbo/jquant2.c",
+      "../externals/libjpeg-turbo/jsimd_none.c",
+      "../externals/libjpeg-turbo/jutils.c",
+    ]
+  }
 }
index 5cd8655..2e3c01c 100644 (file)
@@ -4,38 +4,45 @@
 # found in the LICENSE file.
 
 declare_args() {
+  skia_use_system_libpng = false
 }
 
 import("../third_party.gni")
 
-third_party("libpng") {
-  public_include_dirs = [ "." ]
-
-  deps = [
-    "//third_party/zlib",
-  ]
-  sources = [
-    "png.c",
-    "pngerror.c",
-    "pngget.c",
-    "pngmem.c",
-    "pngpread.c",
-    "pngread.c",
-    "pngrio.c",
-    "pngrtran.c",
-    "pngrutil.c",
-    "pngset.c",
-    "pngtrans.c",
-    "pngwio.c",
-    "pngwrite.c",
-    "pngwtran.c",
-    "pngwutil.c",
-  ]
+if (skia_use_system_libpng) {
+  system("libpng") {
+    libs = [ "png" ]
+  }
+} else {
+  third_party("libpng") {
+    public_include_dirs = [ "." ]
 
-  if (current_cpu == "arm" || current_cpu == "arm64") {
-    sources += [
-      "arm/arm_init.c",
-      "arm/filter_neon_intrinsics.c",
+    deps = [
+      "//third_party/zlib",
     ]
+    sources = [
+      "png.c",
+      "pngerror.c",
+      "pngget.c",
+      "pngmem.c",
+      "pngpread.c",
+      "pngread.c",
+      "pngrio.c",
+      "pngrtran.c",
+      "pngrutil.c",
+      "pngset.c",
+      "pngtrans.c",
+      "pngwio.c",
+      "pngwrite.c",
+      "pngwtran.c",
+      "pngwutil.c",
+    ]
+
+    if (current_cpu == "arm" || current_cpu == "arm64") {
+      sources += [
+        "arm/arm_init.c",
+        "arm/filter_neon_intrinsics.c",
+      ]
+    }
   }
 }
index ec51cd3..e7dc336 100644 (file)
 # found in the LICENSE file.
 
 declare_args() {
+  skia_use_system_libwebp = false
 }
 
 import("../third_party.gni")
 
-third_party("libwebp") {
-  public_include_dirs = [ "../externals/libwebp/src" ]
-
-  if (is_android) {
-    deps = [
-      "//third_party/cpu-features",
+if (skia_use_system_libwebp) {
+  system("libwebp") {
+    libs = [
+      "webp",
+      "webpdemux",
     ]
   }
+} else {
+  third_party("libwebp") {
+    public_include_dirs = [ "../externals/libwebp/src" ]
+
+    if (is_android) {
+      deps = [
+        "//third_party/cpu-features",
+      ]
+    }
 
-  defines = [
-    # WebP naturally decodes to RGB_565, and we work with BGR_565.
-    # This makes WebP decode to BGR_565 when we ask for RGB_565.
-    # (It also swaps the color order for 4444, but we don't care today.)
-    # TODO: swizzle ourself in SkWebpCodec instead of requiring this non-standard libwebp.
-    "WEBP_SWAP_16BIT_CSP",
-  ]
+    defines = [
+      # WebP naturally decodes to RGB_565, and we work with BGR_565.
+      # This makes WebP decode to BGR_565 when we ask for RGB_565.
+      # (It also swaps the color order for 4444, but we don't care today.)
+      # TODO: swizzle ourself in SkWebpCodec instead of requiring this non-standard libwebp.
+      "WEBP_SWAP_16BIT_CSP",
+    ]
 
-  sources = [
-    "../externals/libwebp/src/dec/alpha.c",
-    "../externals/libwebp/src/dec/buffer.c",
-    "../externals/libwebp/src/dec/frame.c",
-    "../externals/libwebp/src/dec/idec.c",
-    "../externals/libwebp/src/dec/io.c",
-    "../externals/libwebp/src/dec/quant.c",
-    "../externals/libwebp/src/dec/tree.c",
-    "../externals/libwebp/src/dec/vp8.c",
-    "../externals/libwebp/src/dec/vp8l.c",
-    "../externals/libwebp/src/dec/webp.c",
-    "../externals/libwebp/src/demux/demux.c",
-    "../externals/libwebp/src/dsp/alpha_processing.c",
-    "../externals/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/alpha_processing_sse2.c",
-    "../externals/libwebp/src/dsp/alpha_processing_sse41.c",
-    "../externals/libwebp/src/dsp/argb.c",
-    "../externals/libwebp/src/dsp/argb_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/argb_sse2.c",
-    "../externals/libwebp/src/dsp/cost.c",
-    "../externals/libwebp/src/dsp/cost_mips32.c",
-    "../externals/libwebp/src/dsp/cost_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/cost_sse2.c",
-    "../externals/libwebp/src/dsp/cpu.c",
-    "../externals/libwebp/src/dsp/dec.c",
-    "../externals/libwebp/src/dsp/dec_clip_tables.c",
-    "../externals/libwebp/src/dsp/dec_mips32.c",
-    "../externals/libwebp/src/dsp/dec_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/dec_neon.c",
-    "../externals/libwebp/src/dsp/dec_sse2.c",
-    "../externals/libwebp/src/dsp/dec_sse41.c",
-    "../externals/libwebp/src/dsp/enc.c",
-    "../externals/libwebp/src/dsp/enc_avx2.c",
-    "../externals/libwebp/src/dsp/enc_mips32.c",
-    "../externals/libwebp/src/dsp/enc_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/enc_neon.c",
-    "../externals/libwebp/src/dsp/enc_sse2.c",
-    "../externals/libwebp/src/dsp/enc_sse41.c",
-    "../externals/libwebp/src/dsp/filters.c",
-    "../externals/libwebp/src/dsp/filters_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/filters_sse2.c",
-    "../externals/libwebp/src/dsp/lossless.c",
-    "../externals/libwebp/src/dsp/lossless_enc.c",
-    "../externals/libwebp/src/dsp/lossless_enc_mips32.c",
-    "../externals/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/lossless_enc_neon.c",
-    "../externals/libwebp/src/dsp/lossless_enc_sse2.c",
-    "../externals/libwebp/src/dsp/lossless_enc_sse41.c",
-    "../externals/libwebp/src/dsp/lossless_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/lossless_neon.c",
-    "../externals/libwebp/src/dsp/lossless_sse2.c",
-    "../externals/libwebp/src/dsp/rescaler.c",
-    "../externals/libwebp/src/dsp/rescaler_mips32.c",
-    "../externals/libwebp/src/dsp/rescaler_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/rescaler_neon.c",
-    "../externals/libwebp/src/dsp/rescaler_sse2.c",
-    "../externals/libwebp/src/dsp/upsampling.c",
-    "../externals/libwebp/src/dsp/upsampling_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/upsampling_neon.c",
-    "../externals/libwebp/src/dsp/upsampling_sse2.c",
-    "../externals/libwebp/src/dsp/yuv.c",
-    "../externals/libwebp/src/dsp/yuv_mips32.c",
-    "../externals/libwebp/src/dsp/yuv_mips_dsp_r2.c",
-    "../externals/libwebp/src/dsp/yuv_sse2.c",
-    "../externals/libwebp/src/enc/alpha.c",
-    "../externals/libwebp/src/enc/analysis.c",
-    "../externals/libwebp/src/enc/backward_references.c",
-    "../externals/libwebp/src/enc/config.c",
-    "../externals/libwebp/src/enc/cost.c",
-    "../externals/libwebp/src/enc/filter.c",
-    "../externals/libwebp/src/enc/frame.c",
-    "../externals/libwebp/src/enc/histogram.c",
-    "../externals/libwebp/src/enc/iterator.c",
-    "../externals/libwebp/src/enc/near_lossless.c",
-    "../externals/libwebp/src/enc/picture.c",
-    "../externals/libwebp/src/enc/picture_csp.c",
-    "../externals/libwebp/src/enc/picture_psnr.c",
-    "../externals/libwebp/src/enc/picture_rescale.c",
-    "../externals/libwebp/src/enc/picture_tools.c",
-    "../externals/libwebp/src/enc/quant.c",
-    "../externals/libwebp/src/enc/syntax.c",
-    "../externals/libwebp/src/enc/token.c",
-    "../externals/libwebp/src/enc/tree.c",
-    "../externals/libwebp/src/enc/vp8l.c",
-    "../externals/libwebp/src/enc/webpenc.c",
-    "../externals/libwebp/src/utils/bit_reader.c",
-    "../externals/libwebp/src/utils/bit_writer.c",
-    "../externals/libwebp/src/utils/color_cache.c",
-    "../externals/libwebp/src/utils/filters.c",
-    "../externals/libwebp/src/utils/huffman.c",
-    "../externals/libwebp/src/utils/huffman_encode.c",
-    "../externals/libwebp/src/utils/quant_levels.c",
-    "../externals/libwebp/src/utils/quant_levels_dec.c",
-    "../externals/libwebp/src/utils/random.c",
-    "../externals/libwebp/src/utils/rescaler.c",
-    "../externals/libwebp/src/utils/thread.c",
-    "../externals/libwebp/src/utils/utils.c",
-  ]
+    sources = [
+      "../externals/libwebp/src/dec/alpha.c",
+      "../externals/libwebp/src/dec/buffer.c",
+      "../externals/libwebp/src/dec/frame.c",
+      "../externals/libwebp/src/dec/idec.c",
+      "../externals/libwebp/src/dec/io.c",
+      "../externals/libwebp/src/dec/quant.c",
+      "../externals/libwebp/src/dec/tree.c",
+      "../externals/libwebp/src/dec/vp8.c",
+      "../externals/libwebp/src/dec/vp8l.c",
+      "../externals/libwebp/src/dec/webp.c",
+      "../externals/libwebp/src/demux/demux.c",
+      "../externals/libwebp/src/dsp/alpha_processing.c",
+      "../externals/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/alpha_processing_sse2.c",
+      "../externals/libwebp/src/dsp/alpha_processing_sse41.c",
+      "../externals/libwebp/src/dsp/argb.c",
+      "../externals/libwebp/src/dsp/argb_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/argb_sse2.c",
+      "../externals/libwebp/src/dsp/cost.c",
+      "../externals/libwebp/src/dsp/cost_mips32.c",
+      "../externals/libwebp/src/dsp/cost_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/cost_sse2.c",
+      "../externals/libwebp/src/dsp/cpu.c",
+      "../externals/libwebp/src/dsp/dec.c",
+      "../externals/libwebp/src/dsp/dec_clip_tables.c",
+      "../externals/libwebp/src/dsp/dec_mips32.c",
+      "../externals/libwebp/src/dsp/dec_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/dec_neon.c",
+      "../externals/libwebp/src/dsp/dec_sse2.c",
+      "../externals/libwebp/src/dsp/dec_sse41.c",
+      "../externals/libwebp/src/dsp/enc.c",
+      "../externals/libwebp/src/dsp/enc_avx2.c",
+      "../externals/libwebp/src/dsp/enc_mips32.c",
+      "../externals/libwebp/src/dsp/enc_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/enc_neon.c",
+      "../externals/libwebp/src/dsp/enc_sse2.c",
+      "../externals/libwebp/src/dsp/enc_sse41.c",
+      "../externals/libwebp/src/dsp/filters.c",
+      "../externals/libwebp/src/dsp/filters_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/filters_sse2.c",
+      "../externals/libwebp/src/dsp/lossless.c",
+      "../externals/libwebp/src/dsp/lossless_enc.c",
+      "../externals/libwebp/src/dsp/lossless_enc_mips32.c",
+      "../externals/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/lossless_enc_neon.c",
+      "../externals/libwebp/src/dsp/lossless_enc_sse2.c",
+      "../externals/libwebp/src/dsp/lossless_enc_sse41.c",
+      "../externals/libwebp/src/dsp/lossless_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/lossless_neon.c",
+      "../externals/libwebp/src/dsp/lossless_sse2.c",
+      "../externals/libwebp/src/dsp/rescaler.c",
+      "../externals/libwebp/src/dsp/rescaler_mips32.c",
+      "../externals/libwebp/src/dsp/rescaler_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/rescaler_neon.c",
+      "../externals/libwebp/src/dsp/rescaler_sse2.c",
+      "../externals/libwebp/src/dsp/upsampling.c",
+      "../externals/libwebp/src/dsp/upsampling_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/upsampling_neon.c",
+      "../externals/libwebp/src/dsp/upsampling_sse2.c",
+      "../externals/libwebp/src/dsp/yuv.c",
+      "../externals/libwebp/src/dsp/yuv_mips32.c",
+      "../externals/libwebp/src/dsp/yuv_mips_dsp_r2.c",
+      "../externals/libwebp/src/dsp/yuv_sse2.c",
+      "../externals/libwebp/src/enc/alpha.c",
+      "../externals/libwebp/src/enc/analysis.c",
+      "../externals/libwebp/src/enc/backward_references.c",
+      "../externals/libwebp/src/enc/config.c",
+      "../externals/libwebp/src/enc/cost.c",
+      "../externals/libwebp/src/enc/filter.c",
+      "../externals/libwebp/src/enc/frame.c",
+      "../externals/libwebp/src/enc/histogram.c",
+      "../externals/libwebp/src/enc/iterator.c",
+      "../externals/libwebp/src/enc/near_lossless.c",
+      "../externals/libwebp/src/enc/picture.c",
+      "../externals/libwebp/src/enc/picture_csp.c",
+      "../externals/libwebp/src/enc/picture_psnr.c",
+      "../externals/libwebp/src/enc/picture_rescale.c",
+      "../externals/libwebp/src/enc/picture_tools.c",
+      "../externals/libwebp/src/enc/quant.c",
+      "../externals/libwebp/src/enc/syntax.c",
+      "../externals/libwebp/src/enc/token.c",
+      "../externals/libwebp/src/enc/tree.c",
+      "../externals/libwebp/src/enc/vp8l.c",
+      "../externals/libwebp/src/enc/webpenc.c",
+      "../externals/libwebp/src/utils/bit_reader.c",
+      "../externals/libwebp/src/utils/bit_writer.c",
+      "../externals/libwebp/src/utils/color_cache.c",
+      "../externals/libwebp/src/utils/filters.c",
+      "../externals/libwebp/src/utils/huffman.c",
+      "../externals/libwebp/src/utils/huffman_encode.c",
+      "../externals/libwebp/src/utils/quant_levels.c",
+      "../externals/libwebp/src/utils/quant_levels_dec.c",
+      "../externals/libwebp/src/utils/random.c",
+      "../externals/libwebp/src/utils/rescaler.c",
+      "../externals/libwebp/src/utils/thread.c",
+      "../externals/libwebp/src/utils/utils.c",
+    ]
+  }
 }
index 5764c97..7aaf635 100644 (file)
@@ -26,3 +26,12 @@ template("third_party") {
 set_defaults("third_party") {
   configs = default_configs - [ "//gn:warnings" ]
 }
+
+template("system") {
+  config(target_name + "_public") {
+    forward_variables_from(invoker, "*", [])
+  }
+  group(target_name) {
+    public_configs = [ ":" + target_name + "_public" ]
+  }
+}
index 8909ea5..e7776f5 100644 (file)
@@ -4,29 +4,36 @@
 # found in the LICENSE file.
 
 declare_args() {
+  skia_use_system_zlib = false
 }
 
 import("../third_party.gni")
 
-third_party("zlib") {
-  public_include_dirs = [ "../externals/zlib" ]
+if (skia_use_system_zlib) {
+  system("zlib") {
+    libs = [ "z" ]
+  }
+} else {
+  third_party("zlib") {
+    public_include_dirs = [ "../externals/zlib" ]
 
-  sources = [
-    "../externals/zlib/adler32.c",
-    "../externals/zlib/compress.c",
-    "../externals/zlib/crc32.c",
-    "../externals/zlib/deflate.c",
-    "../externals/zlib/gzclose.c",
-    "../externals/zlib/gzlib.c",
-    "../externals/zlib/gzread.c",
-    "../externals/zlib/gzwrite.c",
-    "../externals/zlib/infback.c",
-    "../externals/zlib/inffast.c",
-    "../externals/zlib/inflate.c",
-    "../externals/zlib/inftrees.c",
-    "../externals/zlib/simd_stub.c",
-    "../externals/zlib/trees.c",
-    "../externals/zlib/uncompr.c",
-    "../externals/zlib/zutil.c",
-  ]
+    sources = [
+      "../externals/zlib/adler32.c",
+      "../externals/zlib/compress.c",
+      "../externals/zlib/crc32.c",
+      "../externals/zlib/deflate.c",
+      "../externals/zlib/gzclose.c",
+      "../externals/zlib/gzlib.c",
+      "../externals/zlib/gzread.c",
+      "../externals/zlib/gzwrite.c",
+      "../externals/zlib/infback.c",
+      "../externals/zlib/inffast.c",
+      "../externals/zlib/inflate.c",
+      "../externals/zlib/inftrees.c",
+      "../externals/zlib/simd_stub.c",
+      "../externals/zlib/trees.c",
+      "../externals/zlib/uncompr.c",
+      "../externals/zlib/zutil.c",
+    ]
+  }
 }