Index: third_party/libpng/BUILD.gn |
diff --git a/third_party/libpng/BUILD.gn b/third_party/libpng/BUILD.gn |
index 365c4558000df86c36ba7e1678bcb38fb89c2021..5c61dcac8c198721c9f155a1760ef5bef6abef89 100644 |
--- a/third_party/libpng/BUILD.gn |
+++ b/third_party/libpng/BUILD.gn |
@@ -7,15 +7,7 @@ import("//build/config/chromecast_build.gni") |
config("libpng_config") { |
include_dirs = [ "." ] |
- defines = [ |
- "CHROME_PNG_WRITE_SUPPORT", |
- "PNG_USER_CONFIG", |
- ] |
- |
- if (is_android || is_chromecast) { |
- #'toolsets': ['target', 'host'], |
- defines += [ "CHROME_PNG_READ_PACK_SUPPORT" ] # Required by freetype. |
- } |
+ defines = [] |
if (is_win) { |
if (is_component_build) { |
@@ -32,7 +24,12 @@ config("libpng_config") { |
config("clang_warnings") { |
if (is_clang) { |
# Upstream uses self-assignment to avoid warnings. |
- cflags = [ "-Wno-self-assign" ] |
+ cflags = [ |
+ # libpng checks that the width is not greater than PNG_SIZE_MAX. |
+ # On platforms where size_t is 64-bits, this comparison will always |
+ # be false. |
+ "-Wno-tautological-constant-out-of-range-compare", |
+ ] |
} |
} |
@@ -42,29 +39,50 @@ source_set("libpng_sources") { |
"png.h", |
"pngconf.h", |
"pngerror.c", |
- "pnggccrd.c", |
"pngget.c", |
+ "pnginfo.h", |
+ "pnglibconf.h", |
"pngmem.c", |
"pngpread.c", |
+ "pngprefix.h", |
+ "pngpriv.h", |
"pngread.c", |
"pngrio.c", |
"pngrtran.c", |
"pngrutil.c", |
"pngset.c", |
+ "pngstruct.h", |
"pngtrans.c", |
- "pngusr.h", |
- "pngvcrd.c", |
"pngwio.c", |
"pngwrite.c", |
"pngwtran.c", |
"pngwutil.c", |
] |
+ defines = [] |
+ |
+ if (current_cpu == "x86" || current_cpu == "x64") { |
+ sources += [ |
+ "contrib/intel/filter_sse2_intrinsics.c", |
+ "contrib/intel/intel_init.c", |
+ ] |
+ defines += [ "PNG_INTEL_SSE_OPT=1" ] |
+ } else if (current_cpu == "arm" || current_cpu == "arm64") { |
+ sources += [ |
+ "arm/arm_init.c", |
+ "arm/filter_neon_intrinsics.c", |
+ ] |
+ defines += [ |
+ "PNG_ARM_NEON_OPT=2", |
+ "PNG_ARM_NEON_IMPLEMENTATION=1", |
+ ] |
+ } |
+ |
configs -= [ "//build/config/compiler:chromium_code" ] |
configs += [ "//build/config/compiler:no_chromium_code" ] |
if (is_win && is_component_build) { |
- defines = [ "PNG_BUILD_DLL" ] |
+ defines += [ "PNG_BUILD_DLL" ] |
} |
public_configs = [ ":libpng_config" ] |