| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/chromecast_build.gni") | 5 import("//build/config/chromecast_build.gni") |
| 6 | 6 |
| 7 config("libpng_config") { | 7 config("libpng_config") { |
| 8 include_dirs = [ "." ] | 8 include_dirs = [ "." ] |
| 9 | 9 |
| 10 defines = [ | 10 defines = [] |
| 11 "CHROME_PNG_WRITE_SUPPORT", | |
| 12 "PNG_USER_CONFIG", | |
| 13 ] | |
| 14 | |
| 15 if (is_android || is_chromecast) { | |
| 16 #'toolsets': ['target', 'host'], | |
| 17 defines += [ "CHROME_PNG_READ_PACK_SUPPORT" ] # Required by freetype. | |
| 18 } | |
| 19 | 11 |
| 20 if (is_win) { | 12 if (is_win) { |
| 21 if (is_component_build) { | 13 if (is_component_build) { |
| 22 defines += [ | 14 defines += [ |
| 23 "PNG_USE_DLL", | 15 "PNG_USE_DLL", |
| 24 "PNG_NO_MODULEDEF", | 16 "PNG_NO_MODULEDEF", |
| 25 ] | 17 ] |
| 26 } | 18 } |
| 27 } | 19 } |
| 28 } | 20 } |
| 29 | 21 |
| 30 # Must be in a config because of how GN orders flags (otherwise -Wall will | 22 # Must be in a config because of how GN orders flags (otherwise -Wall will |
| 31 # appear after this, and turn it back on). | 23 # appear after this, and turn it back on). |
| 32 config("clang_warnings") { | 24 config("clang_warnings") { |
| 33 if (is_clang) { | 25 if (is_clang) { |
| 34 # Upstream uses self-assignment to avoid warnings. | 26 # Upstream uses self-assignment to avoid warnings. |
| 35 cflags = [ "-Wno-self-assign" ] | 27 cflags = [ |
| 28 # libpng checks that the width is not greater than PNG_SIZE_MAX. |
| 29 # On platforms where size_t is 64-bits, this comparison will always |
| 30 # be false. |
| 31 "-Wno-tautological-constant-out-of-range-compare", |
| 32 ] |
| 36 } | 33 } |
| 37 } | 34 } |
| 38 | 35 |
| 39 source_set("libpng_sources") { | 36 source_set("libpng_sources") { |
| 40 sources = [ | 37 sources = [ |
| 41 "png.c", | 38 "png.c", |
| 42 "png.h", | 39 "png.h", |
| 43 "pngconf.h", | 40 "pngconf.h", |
| 44 "pngerror.c", | 41 "pngerror.c", |
| 45 "pnggccrd.c", | |
| 46 "pngget.c", | 42 "pngget.c", |
| 43 "pnginfo.h", |
| 44 "pnglibconf.h", |
| 47 "pngmem.c", | 45 "pngmem.c", |
| 48 "pngpread.c", | 46 "pngpread.c", |
| 47 "pngprefix.h", |
| 48 "pngpriv.h", |
| 49 "pngread.c", | 49 "pngread.c", |
| 50 "pngrio.c", | 50 "pngrio.c", |
| 51 "pngrtran.c", | 51 "pngrtran.c", |
| 52 "pngrutil.c", | 52 "pngrutil.c", |
| 53 "pngset.c", | 53 "pngset.c", |
| 54 "pngstruct.h", |
| 54 "pngtrans.c", | 55 "pngtrans.c", |
| 55 "pngusr.h", | |
| 56 "pngvcrd.c", | |
| 57 "pngwio.c", | 56 "pngwio.c", |
| 58 "pngwrite.c", | 57 "pngwrite.c", |
| 59 "pngwtran.c", | 58 "pngwtran.c", |
| 60 "pngwutil.c", | 59 "pngwutil.c", |
| 61 ] | 60 ] |
| 62 | 61 |
| 62 defines = [] |
| 63 |
| 64 if (current_cpu == "x86" || current_cpu == "x64") { |
| 65 sources += [ |
| 66 "contrib/intel/filter_sse2_intrinsics.c", |
| 67 "contrib/intel/intel_init.c", |
| 68 ] |
| 69 defines += [ "PNG_INTEL_SSE_OPT=1" ] |
| 70 } else if (current_cpu == "arm" || current_cpu == "arm64") { |
| 71 sources += [ |
| 72 "arm/arm_init.c", |
| 73 "arm/filter_neon_intrinsics.c", |
| 74 ] |
| 75 defines += [ |
| 76 "PNG_ARM_NEON_OPT=2", |
| 77 "PNG_ARM_NEON_IMPLEMENTATION=1", |
| 78 ] |
| 79 } |
| 80 |
| 63 configs -= [ "//build/config/compiler:chromium_code" ] | 81 configs -= [ "//build/config/compiler:chromium_code" ] |
| 64 configs += [ "//build/config/compiler:no_chromium_code" ] | 82 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 65 | 83 |
| 66 if (is_win && is_component_build) { | 84 if (is_win && is_component_build) { |
| 67 defines = [ "PNG_BUILD_DLL" ] | 85 defines += [ "PNG_BUILD_DLL" ] |
| 68 } | 86 } |
| 69 | 87 |
| 70 public_configs = [ ":libpng_config" ] | 88 public_configs = [ ":libpng_config" ] |
| 71 | 89 |
| 72 public_deps = [ | 90 public_deps = [ |
| 73 "//third_party/zlib", | 91 "//third_party/zlib", |
| 74 ] | 92 ] |
| 75 | 93 |
| 76 configs += [ ":clang_warnings" ] | 94 configs += [ ":clang_warnings" ] |
| 77 } | 95 } |
| 78 | 96 |
| 79 if (is_win) { | 97 if (is_win) { |
| 80 component("libpng") { | 98 component("libpng") { |
| 81 public_deps = [ | 99 public_deps = [ |
| 82 ":libpng_sources", | 100 ":libpng_sources", |
| 83 ] | 101 ] |
| 84 } | 102 } |
| 85 } else { | 103 } else { |
| 86 group("libpng") { | 104 group("libpng") { |
| 87 public_deps = [ | 105 public_deps = [ |
| 88 ":libpng_sources", | 106 ":libpng_sources", |
| 89 ] | 107 ] |
| 90 } | 108 } |
| 91 } | 109 } |
| OLD | NEW |