Chromium Code Reviews| Index: BUILD.gn |
| diff --git a/BUILD.gn b/BUILD.gn |
| index fed8a68c0d58b15c02df72450e0193997143de3c..e440a408d39075bc94d95b233807bc4dd07818a0 100644 |
| --- a/BUILD.gn |
| +++ b/BUILD.gn |
| @@ -6,18 +6,19 @@ |
| # in the file PATENTS. All contributing project authors may |
| # be found in the AUTHORS file in the root of the source tree. |
| -import("//build/config/arm.gni") |
| -import("//build/config/sanitizers/sanitizers.gni") |
| +import("libyuv.gni") |
| +import("//testing/test.gni") |
| config("libyuv_config") { |
| - include_dirs = [ |
| - ".", |
| - "include", |
| - ] |
| + include_dirs = [ "include" ] |
| + if (is_android && current_cpu=="arm64") { |
| + ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64" ] |
| + } |
| + if (is_android && current_cpu != "arm64") { |
| + ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker" ] |
| + } |
| } |
| -use_neon = current_cpu == "arm64" || (current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon)) |
| - |
| static_library("libyuv") { |
| sources = [ |
| # Headers |
| @@ -79,7 +80,7 @@ static_library("libyuv") { |
| "source/video_common.cc", |
| ] |
| - public_configs = [ ":libyuv_config" ] |
| + public_configs = [ ":libyuv_config" ] |
| defines = [] |
| deps = [] |
| @@ -89,7 +90,7 @@ static_library("libyuv") { |
| deps += [ "//third_party:jpeg" ] |
| } |
| - if (use_neon) { |
| + if (libyuv_use_neon) { |
| deps += [ ":libyuv_neon" ] |
| } |
| @@ -100,7 +101,7 @@ static_library("libyuv") { |
| } |
| } |
| -if (use_neon) { |
| +if (libyuv_use_neon) { |
| static_library("libyuv_neon") { |
| sources = [ |
| # ARM Source Files |
| @@ -122,3 +123,141 @@ if (use_neon) { |
| } |
| } |
| } |
| + |
| +if (libyuv_include_tests) { |
| + config("libyuv_unittest_warnings_config") { |
| + if (!is_win) { |
| + cflags = [ |
| + "-Wno-sign-compare", |
|
fbarchard1
2016/09/12 18:59:45
// todo(fbarchard): fix sign and unused variable w
|
| + "-Wno-unused-variable" |
| + ] |
| + } |
| + if (is_win) { |
| + cflags = [ |
| + "/wd4245", # signed/unsigned mismatch |
| + "/wd4189", # local variable is initialized but not referenced |
| + ] |
| + } |
| + } |
| + config("libyuv_unittest_config") { |
| + defines = [ "GTEST_RELATIVE_PATH" ] |
| + } |
| + |
| + test("libyuv_unittest") { |
|
fbarchard1
2016/09/12 18:59:45
should this be yuv_unittest for android?
kjellander_chromium
2016/09/12 20:14:57
No need - that naming was just a workaround for ht
|
| + testonly = true |
| + |
| + sources = [ |
| + # headers |
| + "unit_test/unit_test.h", |
| + # sources |
| + "unit_test/basictypes_test.cc", |
| + "unit_test/compare_test.cc", |
| + "unit_test/color_test.cc", |
| + "unit_test/convert_test.cc", |
| + "unit_test/cpu_test.cc", |
| + "unit_test/math_test.cc", |
| + "unit_test/planar_test.cc", |
| + "unit_test/rotate_argb_test.cc", |
| + "unit_test/rotate_test.cc", |
| + "unit_test/scale_argb_test.cc", |
| + "unit_test/scale_test.cc", |
| + "unit_test/unit_test.cc", |
| + "unit_test/video_common_test.cc", |
| + ] |
| + |
| + deps = [ |
| + ":libyuv", |
| + "//testing/gtest", |
| + "//third_party/gflags", |
| + ] |
| + |
| + configs += [ ":libyuv_unittest_warnings_config" ] |
| + |
| + public_deps = [ "//testing/gtest" ] |
| + public_configs = [ ":libyuv_unittest_config" ] |
| + |
| + defines = [] |
| + |
| + if (is_linux) { |
| + cflags = [ "-fexceptions" ] |
| + } |
| + if (is_ios && target_cpu=="arm64") { |
| + defines += [ "LIBYUV_DISABLE_NEON" ] |
| + } |
| + if (is_ios) { |
| + configs -= [ "//build/config/compiler:default_symbols" ] |
| + configs += [ "//build/config/compiler:symbols" ] |
| + cflags = [ "-Wno-sometimes-uninitialized" ] |
| + } |
| + if (!is_ios && !libyuv_disable_jpeg) { |
| + defines += [ "HAVE_JPEG" ] |
| + } |
| + if (is_android) { |
| + deps += [ "//testing/android/native_test:native_test_native_code" ] |
| + } |
| + |
| + # TODO(YangZhang): These lines can be removed when high accuracy |
| + # YUV to RGB to Neon is ported. |
| + if ((target_cpu=="armv7" || target_cpu=="armv7s" || |
| + (target_cpu=="arm" && arm_version >= 7) || target_cpu=="arm64") && |
| + (arm_use_neon || arm_optionally_use_neon)) { |
| + defines += [ "LIBYUV_NEON" ] |
| + } |
| + |
| + defines += [ |
| + # Enable the following 3 macros to turn off assembly for specified CPU. |
| + # "LIBYUV_DISABLE_X86", |
| + # "LIBYUV_DISABLE_NEON", |
| + # "LIBYUV_DISABLE_MIPS", |
| + # Enable the following macro to build libyuv as a shared library (dll). |
| + # "LIBYUV_USING_SHARED_LIBRARY" |
| + ] |
| + } |
| + |
| + executable("compare") { |
| + sources = [ |
| + # sources |
| + "util/compare.cc" |
| + ] |
| + deps = [ ":libyuv" ] |
| + if (is_linux) { |
| + cflags = [ "-fexceptions" ] |
| + } |
| + } |
| + |
| + executable("convert") { |
| + sources = [ |
| + # sources |
| + "util/convert.cc" |
| + ] |
| + deps = [ ":libyuv" ] |
| + if (is_linux) { |
| + cflags = [ "-fexceptions" ] |
| + } |
| + } |
| + |
| + executable("psnr") { |
| + sources = [ |
| + # sources |
| + "util/psnr_main.cc", |
| + "util/psnr.cc", |
| + "util/ssim.cc" |
| + ] |
| + deps = [ ":libyuv" ] |
| + |
| + if (is_ios && target_cpu=="arm64") { |
| + defines = [ "LIBYUV_DISABLE_NEON" ] |
|
fbarchard1
2016/09/12 18:59:45
enable? why is neon disabled for ios?
kjellander_chromium
2016/09/12 20:14:57
This is just to keep things identical to https://c
fbarchard1
2016/09/12 22:53:15
That needs a TODO or a bug to get Neon enabled. I
|
| + } |
| + if (!is_ios && !libyuv_disable_jpeg) { |
| + defines = [ "HAVE_JPEG" ] |
| + } |
| + } |
| + |
| + executable("cpuid") { |
|
fbarchard1
2016/09/12 18:59:45
can you document how to launch cpuid, psnr and con
kjellander_chromium
2016/09/12 20:14:57
I think we can wait with that to another CL, and n
fbarchard1
2016/09/12 22:53:15
The cpuid binary just needs to be pushed and run w
|
| + sources = [ |
| + # sources |
| + "util/cpuid.c" |
| + ] |
| + deps = [ ":libyuv" ] |
| + } |
| +} |