aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/libpng/BUILD.gn
blob: 2b2d72a0e64cce360d3c8639cd484191a629069c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

declare_args() {
  skia_use_system_libpng = is_official_build
}

import("../third_party.gni")

if (skia_use_system_libpng) {
  system("libpng") {
    libs = [ "png" ]
  }
} else {
  third_party("libpng") {
    public_include_dirs = [
      ".",
      "../externals/libpng",
    ]

    defines = [ "PNG_SET_OPTION_SUPPORTED" ]
    deps = [
      "//third_party/zlib",
    ]
    sources = [
      "../externals/libpng/png.c",
      "../externals/libpng/pngerror.c",
      "../externals/libpng/pngget.c",
      "../externals/libpng/pngmem.c",
      "../externals/libpng/pngpread.c",
      "../externals/libpng/pngread.c",
      "../externals/libpng/pngrio.c",
      "../externals/libpng/pngrtran.c",
      "../externals/libpng/pngrutil.c",
      "../externals/libpng/pngset.c",
      "../externals/libpng/pngtrans.c",
      "../externals/libpng/pngwio.c",
      "../externals/libpng/pngwrite.c",
      "../externals/libpng/pngwtran.c",
      "../externals/libpng/pngwutil.c",
    ]

    if (current_cpu == "arm" || current_cpu == "arm64") {
      sources += [
        "../externals/libpng/arm/arm_init.c",
        "../externals/libpng/arm/filter_neon_intrinsics.c",
      ]
    }

    if (current_cpu == "x86" || current_cpu == "x64") {
      defines += [ "PNG_INTEL_SSE" ]
      sources += [
        "../externals/libpng/intel/filter_sse2_intrinsics.c",
        "../externals/libpng/intel/intel_init.c",
      ]
    }
  }
}