Index: third_party/libwebp/BUILD.gn |
diff --git a/third_party/libwebp/BUILD.gn b/third_party/libwebp/BUILD.gn |
index 1abef4e19ea55abdc0b7734c2968e8a668e2d0e5..13a4f3788bed2317d94ca91e4690409dba612146 100644 |
--- a/third_party/libwebp/BUILD.gn |
+++ b/third_party/libwebp/BUILD.gn |
@@ -2,10 +2,16 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+import("//build/config/arm.gni") |
+ |
config("libwebp_config") { |
include_dirs = [ "." ] |
} |
+use_dsp_neon = (cpu_arch == "arm64" || |
+ (cpu_arch == "arm" && arm_version >= 7 && |
+ (arm_use_neon || arm_optionally_use_neon))) |
+ |
source_set("libwebp_dec") { |
sources = [ |
"dec/alpha.c", |
@@ -25,13 +31,14 @@ source_set("libwebp_dec") { |
deps = [ |
":libwebp_dsp", |
-# TODO(GYP): |
-# ":libwebp_dsp_neon", |
":libwebp_utils", |
] |
all_dependent_configs = [ |
":libwebp_config" |
] |
+ if (use_dsp_neon) { |
+ deps += [ ":libwebp_dsp_neon"] |
+ } |
} |
source_set("libwebp_demux") { |
@@ -89,42 +96,28 @@ source_set("libwebp_dsp") { |
# ], |
} |
+if (use_dsp_neon) { |
+ |
+source_set("libwebp_dsp_neon") { |
+ sources = [ |
+ "dsp/dec_neon.c", |
+ "dsp/enc_neon.c", |
+ "dsp/lossless_neon.c", |
+ "dsp/upsampling_neon.c", |
+ ] |
+ |
+ include_dirs = [ "." ] |
+ |
+ if (cpu_arch == "arm") { |
+ # behavior similar to *.c.neon in an Android.mk |
+ configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
+ cflags = [ "-mfpu=neon" ] |
+ } else if (cpu_arch == "arm64") { |
+ # avoid an ICE with gcc-4.9: b/15574841 |
+ cflags = [ "-frename-registers" ] |
+ } |
+ |
# TODO(GYP): |
-# 'variables': { |
-# 'neon_sources': [ |
-# "dsp/dec_neon.c", |
-# "dsp/enc_neon.c", |
-# "dsp/lossless_neon.c", |
-# "dsp/upsampling_neon.c", |
-# ] |
-# }, |
-# { |
-# 'target_name': 'libwebp_dsp_neon', |
-# 'conditions': [ |
-# ['target_arch == "arm" and arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', { |
-# 'type': 'static_library', |
-# 'include_dirs': ['.'], |
-# 'sources': [ |
-# '<@(neon_sources)' |
-# ], |
-# # behavior similar to *.c.neon in an Android.mk |
-# 'cflags!': [ '-mfpu=vfpv3-d16' ], |
-# 'cflags': [ '-mfpu=neon' ], |
-# },{ |
-# 'conditions': [ |
-# ['target_arch == "arm64"', { |
-# 'type': 'static_library', |
-# 'include_dirs': ['.'], |
-# 'sources': [ |
-# '<@(neon_sources)' |
-# ], |
-# # avoid an ICE with gcc-4.9: b/15574841 |
-# 'cflags': [ '-frename-registers' ], |
-# },{ # "target_arch != "arm|arm64" or arm_version < 7" |
-# 'type': 'none', |
-# }], |
-# ], |
-# }], |
# ['order_profiling != 0', { |
# 'target_conditions' : [ |
# ['_toolset=="target"', { |
@@ -134,6 +127,9 @@ source_set("libwebp_dsp") { |
# }], |
# ], |
# } |
+} |
+ |
+} # use_dsp_neon |
source_set("libwebp_enc") { |
sources = [ |
@@ -194,12 +190,13 @@ group("libwebp") { |
":libwebp_dec", |
":libwebp_demux", |
":libwebp_dsp", |
-# TODO(GYP): |
-# ":libwebp_dsp_neon", |
":libwebp_enc", |
":libwebp_utils", |
] |
direct_dependent_configs = [ |
":libwebp_config" |
] |
+ if (use_dsp_neon) { |
+ deps += [ ":libwebp_dsp_neon" ] |
+ } |
} |