• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6declare_args() {
7  skia_use_system_libpng = is_official_build
8}
9
10import("../third_party.gni")
11
12if (skia_use_system_libpng) {
13  system("libpng") {
14    libs = [ "png" ]
15  }
16} else {
17  third_party("libpng") {
18    public_include_dirs = [
19      ".",
20      "../externals/libpng",
21    ]
22
23    defines = [ "PNG_SET_OPTION_SUPPORTED" ]
24    deps = [
25      "//third_party/zlib",
26    ]
27    sources = [
28      "../externals/libpng/png.c",
29      "../externals/libpng/pngerror.c",
30      "../externals/libpng/pngget.c",
31      "../externals/libpng/pngmem.c",
32      "../externals/libpng/pngpread.c",
33      "../externals/libpng/pngread.c",
34      "../externals/libpng/pngrio.c",
35      "../externals/libpng/pngrtran.c",
36      "../externals/libpng/pngrutil.c",
37      "../externals/libpng/pngset.c",
38      "../externals/libpng/pngtrans.c",
39      "../externals/libpng/pngwio.c",
40      "../externals/libpng/pngwrite.c",
41      "../externals/libpng/pngwtran.c",
42      "../externals/libpng/pngwutil.c",
43    ]
44
45    if (current_cpu == "arm" || current_cpu == "arm64") {
46      sources += [
47        "../externals/libpng/arm/arm_init.c",
48        "../externals/libpng/arm/filter_neon_intrinsics.c",
49      ]
50    }
51
52    if (current_cpu == "x86" || current_cpu == "x64") {
53      defines += [ "PNG_INTEL_SSE" ]
54      sources += [
55        "../externals/libpng/intel/filter_sse2_intrinsics.c",
56        "../externals/libpng/intel/intel_init.c",
57      ]
58    }
59  }
60}
61