mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
GN: Add GN test targets.
BUG=libyuv:523 R=fbarchard@google.com, kjellander@chromium.org, magjed@chromium.org Review URL: https://codereview.chromium.org/2317073002 .
This commit is contained in:
parent
48e8f8e739
commit
d8fe1ad6bb
4
.gitignore
vendored
4
.gitignore
vendored
@ -28,6 +28,7 @@ pin-log.txt
|
|||||||
/third_party/BUILD.gn
|
/third_party/BUILD.gn
|
||||||
/third_party/catapult
|
/third_party/catapult
|
||||||
/third_party/ced
|
/third_party/ced
|
||||||
|
/third_party/class-dump
|
||||||
/third_party/closure_compiler
|
/third_party/closure_compiler
|
||||||
/third_party/drmemory
|
/third_party/drmemory
|
||||||
/third_party/gflags/src
|
/third_party/gflags/src
|
||||||
@ -49,12 +50,15 @@ pin-log.txt
|
|||||||
/third_party/mockito
|
/third_party/mockito
|
||||||
/third_party/modp_b64
|
/third_party/modp_b64
|
||||||
/third_party/ow2_asm
|
/third_party/ow2_asm
|
||||||
|
/third_party/proguard
|
||||||
/third_party/protobuf
|
/third_party/protobuf
|
||||||
/third_party/requests
|
/third_party/requests
|
||||||
/third_party/robolectric
|
/third_party/robolectric
|
||||||
/third_party/sqlite4java
|
/third_party/sqlite4java
|
||||||
|
/third_party/tcmalloc
|
||||||
/third_party/WebKit
|
/third_party/WebKit
|
||||||
/third_party/yasm
|
/third_party/yasm
|
||||||
|
/third_party/zlib
|
||||||
/tools/android
|
/tools/android
|
||||||
/tools/clang
|
/tools/clang
|
||||||
/tools/generate_library_loader
|
/tools/generate_library_loader
|
||||||
|
|||||||
163
BUILD.gn
163
BUILD.gn
@ -6,18 +6,19 @@
|
|||||||
# in the file PATENTS. All contributing project authors may
|
# in the file PATENTS. All contributing project authors may
|
||||||
# be found in the AUTHORS file in the root of the source tree.
|
# be found in the AUTHORS file in the root of the source tree.
|
||||||
|
|
||||||
import("//build/config/arm.gni")
|
import("libyuv.gni")
|
||||||
import("//build/config/sanitizers/sanitizers.gni")
|
import("//testing/test.gni")
|
||||||
|
|
||||||
config("libyuv_config") {
|
config("libyuv_config") {
|
||||||
include_dirs = [
|
include_dirs = [ "include" ]
|
||||||
".",
|
if (is_android && current_cpu=="arm64") {
|
||||||
"include",
|
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") {
|
static_library("libyuv") {
|
||||||
sources = [
|
sources = [
|
||||||
# Headers
|
# Headers
|
||||||
@ -79,7 +80,7 @@ static_library("libyuv") {
|
|||||||
"source/video_common.cc",
|
"source/video_common.cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
public_configs = [ ":libyuv_config" ]
|
public_configs = [ ":libyuv_config" ]
|
||||||
|
|
||||||
defines = []
|
defines = []
|
||||||
deps = []
|
deps = []
|
||||||
@ -89,7 +90,7 @@ static_library("libyuv") {
|
|||||||
deps += [ "//third_party:jpeg" ]
|
deps += [ "//third_party:jpeg" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_neon) {
|
if (libyuv_use_neon) {
|
||||||
deps += [ ":libyuv_neon" ]
|
deps += [ ":libyuv_neon" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ static_library("libyuv") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_neon) {
|
if (libyuv_use_neon) {
|
||||||
static_library("libyuv_neon") {
|
static_library("libyuv_neon") {
|
||||||
sources = [
|
sources = [
|
||||||
# ARM Source Files
|
# ARM Source Files
|
||||||
@ -122,3 +123,143 @@ if (use_neon) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (libyuv_include_tests) {
|
||||||
|
config("libyuv_unittest_warnings_config") {
|
||||||
|
if (!is_win) {
|
||||||
|
cflags = [
|
||||||
|
# TODO(fbarchard): Fix sign and unused variable warnings.
|
||||||
|
"-Wno-sign-compare",
|
||||||
|
"-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") {
|
||||||
|
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") {
|
||||||
|
# TODO(fbarchard): Enable Neon. See https://crbug.com/646279
|
||||||
|
defines = [ "LIBYUV_DISABLE_NEON" ]
|
||||||
|
}
|
||||||
|
if (!is_ios && !libyuv_disable_jpeg) {
|
||||||
|
defines = [ "HAVE_JPEG" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
executable("cpuid") {
|
||||||
|
sources = [
|
||||||
|
# sources
|
||||||
|
"util/cpuid.c"
|
||||||
|
]
|
||||||
|
deps = [ ":libyuv" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -14,5 +14,9 @@
|
|||||||
mac_sdk_min_build_override = "10.11"
|
mac_sdk_min_build_override = "10.11"
|
||||||
mac_deployment_target_build_override = "10.7"
|
mac_deployment_target_build_override = "10.7"
|
||||||
|
|
||||||
|
# Variable that can be used to support multiple build scenarios, like having
|
||||||
|
# Chromium specific targets in a client project's GN file etc.
|
||||||
|
build_with_chromium = false
|
||||||
|
|
||||||
# Some non-Chromium builds don't support building java targets.
|
# Some non-Chromium builds don't support building java targets.
|
||||||
enable_java_templates = true
|
enable_java_templates = true
|
||||||
|
|||||||
19
build_overrides/gtest.gni
Normal file
19
build_overrides/gtest.gni
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Copyright (c) 2016 The LibYuv project authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Use of this source code is governed by a BSD-style license
|
||||||
|
# that can be found in the LICENSE file in the root of the source
|
||||||
|
# tree. An additional intellectual property rights grant can be found
|
||||||
|
# in the file PATENTS. All contributing project authors may
|
||||||
|
# be found in the AUTHORS file in the root of the source tree.
|
||||||
|
|
||||||
|
# Include support for registering main function in multi-process tests.
|
||||||
|
gtest_include_multiprocess = true
|
||||||
|
|
||||||
|
# Include support for platform-specific operations across unit tests.
|
||||||
|
gtest_include_platform_test = true
|
||||||
|
|
||||||
|
# Exclude support for testing Objective C code on OS X and iOS.
|
||||||
|
gtest_include_objc_support = true
|
||||||
|
|
||||||
|
# Exclude support for flushing coverage files on iOS.
|
||||||
|
gtest_include_ios_coverage = true
|
||||||
17
libyuv.gni
Normal file
17
libyuv.gni
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Copyright 2016 The LibYuv Project Authors. All rights reserved.
|
||||||
|
#
|
||||||
|
# Use of this source code is governed by a BSD-style license
|
||||||
|
# that can be found in the LICENSE file in the root of the source
|
||||||
|
# tree. An additional intellectual property rights grant can be found
|
||||||
|
# in the file PATENTS. All contributing project authors may
|
||||||
|
# be found in the AUTHORS file in the root of the source tree.
|
||||||
|
|
||||||
|
import("//build_overrides/build.gni")
|
||||||
|
import("//build/config/arm.gni")
|
||||||
|
|
||||||
|
declare_args() {
|
||||||
|
libyuv_include_tests = !build_with_chromium
|
||||||
|
libyuv_disable_jpeg = false
|
||||||
|
libyuv_use_neon = (current_cpu == "arm64" ||
|
||||||
|
(current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon)))
|
||||||
|
}
|
||||||
@ -45,6 +45,8 @@ DIRECTORIES = [
|
|||||||
'third_party/libjpeg_turbo',
|
'third_party/libjpeg_turbo',
|
||||||
'third_party/llvm-build',
|
'third_party/llvm-build',
|
||||||
'third_party/lss',
|
'third_party/lss',
|
||||||
|
'third_party/proguard',
|
||||||
|
'third_party/tcmalloc',
|
||||||
'third_party/yasm',
|
'third_party/yasm',
|
||||||
'third_party/WebKit', # TODO(kjellander): Remove, see webrtc:5629.
|
'third_party/WebKit', # TODO(kjellander): Remove, see webrtc:5629.
|
||||||
'tools/clang',
|
'tools/clang',
|
||||||
@ -89,6 +91,7 @@ if 'android' in target_os:
|
|||||||
'third_party/requests',
|
'third_party/requests',
|
||||||
'third_party/robolectric',
|
'third_party/robolectric',
|
||||||
'third_party/sqlite4java',
|
'third_party/sqlite4java',
|
||||||
|
'third_party/zlib',
|
||||||
'tools/android',
|
'tools/android',
|
||||||
'tools/grit',
|
'tools/grit',
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user