• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 The ANGLE Project Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5config("libpng_config") {
6  include_dirs = [ "src" ]
7  cflags = []
8  if (is_clang) {
9    cflags += [ "-Wno-tautological-constant-out-of-range-compare" ]
10  }
11  if (is_apple) {
12    # TODO(crbug.com/41492875): this can be removed once libpng is updated to include
13    # https://github.com/pnggroup/libpng/commit/893b8113f04d408cc6177c6de19c9889a48faa24
14    cflags += [ "-fno-define-target-os-macros" ]
15  }
16}
17
18static_library("libpng") {
19  sources = [
20    "src/png.c",
21    "src/pngerror.c",
22    "src/pngget.c",
23    "src/pngmem.c",
24    "src/pngpread.c",
25    "src/pngread.c",
26    "src/pngrio.c",
27    "src/pngrtran.c",
28    "src/pngrutil.c",
29    "src/pngset.c",
30    "src/pngtrans.c",
31    "src/pngwio.c",
32    "src/pngwrite.c",
33    "src/pngwtran.c",
34    "src/pngwutil.c",
35  ]
36
37  # Note: currently pnglibconf.h defines this, but if it gets dropped in a
38  # future roll, needs to be added here for the other defines to work.
39  # defines = [ "PNG_SET_OPTION_SUPPORTED" ]
40  if (current_cpu == "x86" || current_cpu == "x64") {
41    sources += [
42      "src/intel/filter_sse2_intrinsics.c",
43      "src/intel/intel_init.c",
44    ]
45    defines = [ "PNG_INTEL_SSE_OPT=1" ]
46  } else if (target_cpu == "arm" || target_cpu == "arm64") {
47    sources += [
48      "src/arm/arm_init.c",
49      "src/arm/filter_neon_intrinsics.c",
50      "src/arm/palette_neon_intrinsics.c",
51    ]
52    defines = [
53      "PNG_ARM_NEON_OPT=2",
54      "PNG_ARM_NEON_IMPLEMENTATION=1",
55    ]
56  }
57  if (is_win) {
58    cflags = [ "/wd4028" ]
59  }
60  configs -= [ "//build/config/compiler:chromium_code" ]
61  configs += [ "//build/config/compiler:no_chromium_code" ]
62  public_configs = [ ":libpng_config" ]
63  deps = [ "//third_party/zlib:zlib" ]
64}
65