OLD | NEW |
1 # Copyright 2014 The LibYuv Project Authors. All rights reserved. | 1 # Copyright 2014 The LibYuv Project Authors. All rights reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 import("//build/config/arm.gni") | 9 import("libyuv.gni") |
10 import("//build/config/sanitizers/sanitizers.gni") | 10 import("//testing/test.gni") |
11 | 11 |
12 config("libyuv_config") { | 12 config("libyuv_config") { |
13 include_dirs = [ | 13 include_dirs = [ "include" ] |
14 ".", | 14 if (is_android && current_cpu=="arm64") { |
15 "include", | 15 ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64" ] |
16 ] | 16 } |
| 17 if (is_android && current_cpu != "arm64") { |
| 18 ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker" ] |
| 19 } |
17 } | 20 } |
18 | 21 |
19 use_neon = current_cpu == "arm64" || (current_cpu == "arm" && (arm_use_neon || a
rm_optionally_use_neon)) | |
20 | |
21 static_library("libyuv") { | 22 static_library("libyuv") { |
22 sources = [ | 23 sources = [ |
23 # Headers | 24 # Headers |
24 "include/libyuv.h", | 25 "include/libyuv.h", |
25 "include/libyuv/basic_types.h", | 26 "include/libyuv/basic_types.h", |
26 "include/libyuv/compare.h", | 27 "include/libyuv/compare.h", |
27 "include/libyuv/convert.h", | 28 "include/libyuv/convert.h", |
28 "include/libyuv/convert_argb.h", | 29 "include/libyuv/convert_argb.h", |
29 "include/libyuv/convert_from.h", | 30 "include/libyuv/convert_from.h", |
30 "include/libyuv/convert_from_argb.h", | 31 "include/libyuv/convert_from_argb.h", |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 "source/scale.cc", | 73 "source/scale.cc", |
73 "source/scale_any.cc", | 74 "source/scale_any.cc", |
74 "source/scale_argb.cc", | 75 "source/scale_argb.cc", |
75 "source/scale_common.cc", | 76 "source/scale_common.cc", |
76 "source/scale_mips.cc", | 77 "source/scale_mips.cc", |
77 "source/scale_gcc.cc", | 78 "source/scale_gcc.cc", |
78 "source/scale_win.cc", | 79 "source/scale_win.cc", |
79 "source/video_common.cc", | 80 "source/video_common.cc", |
80 ] | 81 ] |
81 | 82 |
82 public_configs = [ ":libyuv_config" ] | 83 public_configs = [ ":libyuv_config" ] |
83 | 84 |
84 defines = [] | 85 defines = [] |
85 deps = [] | 86 deps = [] |
86 | 87 |
87 if (!is_ios) { | 88 if (!is_ios) { |
88 defines += [ "HAVE_JPEG" ] | 89 defines += [ "HAVE_JPEG" ] |
89 deps += [ "//third_party:jpeg" ] | 90 deps += [ "//third_party:jpeg" ] |
90 } | 91 } |
91 | 92 |
92 if (use_neon) { | 93 if (libyuv_use_neon) { |
93 deps += [ ":libyuv_neon" ] | 94 deps += [ ":libyuv_neon" ] |
94 } | 95 } |
95 | 96 |
96 if (is_nacl) { | 97 if (is_nacl) { |
97 # Always enable optimization under NaCl to workaround crbug.com/538243 . | 98 # Always enable optimization under NaCl to workaround crbug.com/538243 . |
98 configs -= [ "//build/config/compiler:default_optimization" ] | 99 configs -= [ "//build/config/compiler:default_optimization" ] |
99 configs += [ "//build/config/compiler:optimize_max" ] | 100 configs += [ "//build/config/compiler:optimize_max" ] |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 if (use_neon) { | 104 if (libyuv_use_neon) { |
104 static_library("libyuv_neon") { | 105 static_library("libyuv_neon") { |
105 sources = [ | 106 sources = [ |
106 # ARM Source Files | 107 # ARM Source Files |
107 "source/compare_neon.cc", | 108 "source/compare_neon.cc", |
108 "source/compare_neon64.cc", | 109 "source/compare_neon64.cc", |
109 "source/rotate_neon.cc", | 110 "source/rotate_neon.cc", |
110 "source/rotate_neon64.cc", | 111 "source/rotate_neon64.cc", |
111 "source/row_neon.cc", | 112 "source/row_neon.cc", |
112 "source/row_neon64.cc", | 113 "source/row_neon64.cc", |
113 "source/scale_neon.cc", | 114 "source/scale_neon.cc", |
114 "source/scale_neon64.cc", | 115 "source/scale_neon64.cc", |
115 ] | 116 ] |
116 | 117 |
117 public_configs = [ ":libyuv_config" ] | 118 public_configs = [ ":libyuv_config" ] |
118 | 119 |
119 if (current_cpu != "arm64") { | 120 if (current_cpu != "arm64") { |
120 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] | 121 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
121 cflags = [ "-mfpu=neon" ] | 122 cflags = [ "-mfpu=neon" ] |
122 } | 123 } |
123 } | 124 } |
124 } | 125 } |
| 126 |
| 127 if (libyuv_include_tests) { |
| 128 config("libyuv_unittest_warnings_config") { |
| 129 if (!is_win) { |
| 130 cflags = [ |
| 131 # TODO(fbarchard): Fix sign and unused variable warnings. |
| 132 "-Wno-sign-compare", |
| 133 "-Wno-unused-variable" |
| 134 ] |
| 135 } |
| 136 if (is_win) { |
| 137 cflags = [ |
| 138 "/wd4245", # signed/unsigned mismatch |
| 139 "/wd4189", # local variable is initialized but not referenced |
| 140 ] |
| 141 } |
| 142 } |
| 143 config("libyuv_unittest_config") { |
| 144 defines = [ "GTEST_RELATIVE_PATH" ] |
| 145 } |
| 146 |
| 147 test("libyuv_unittest") { |
| 148 testonly = true |
| 149 |
| 150 sources = [ |
| 151 # headers |
| 152 "unit_test/unit_test.h", |
| 153 # sources |
| 154 "unit_test/basictypes_test.cc", |
| 155 "unit_test/compare_test.cc", |
| 156 "unit_test/color_test.cc", |
| 157 "unit_test/convert_test.cc", |
| 158 "unit_test/cpu_test.cc", |
| 159 "unit_test/math_test.cc", |
| 160 "unit_test/planar_test.cc", |
| 161 "unit_test/rotate_argb_test.cc", |
| 162 "unit_test/rotate_test.cc", |
| 163 "unit_test/scale_argb_test.cc", |
| 164 "unit_test/scale_test.cc", |
| 165 "unit_test/unit_test.cc", |
| 166 "unit_test/video_common_test.cc", |
| 167 ] |
| 168 |
| 169 deps = [ |
| 170 ":libyuv", |
| 171 "//testing/gtest", |
| 172 "//third_party/gflags", |
| 173 ] |
| 174 |
| 175 configs += [ ":libyuv_unittest_warnings_config" ] |
| 176 |
| 177 public_deps = [ "//testing/gtest" ] |
| 178 public_configs = [ ":libyuv_unittest_config" ] |
| 179 |
| 180 defines = [] |
| 181 |
| 182 if (is_linux) { |
| 183 cflags = [ "-fexceptions" ] |
| 184 } |
| 185 if (is_ios && target_cpu=="arm64") { |
| 186 defines += [ "LIBYUV_DISABLE_NEON" ] |
| 187 } |
| 188 if (is_ios) { |
| 189 configs -= [ "//build/config/compiler:default_symbols" ] |
| 190 configs += [ "//build/config/compiler:symbols" ] |
| 191 cflags = [ "-Wno-sometimes-uninitialized" ] |
| 192 } |
| 193 if (!is_ios && !libyuv_disable_jpeg) { |
| 194 defines += [ "HAVE_JPEG" ] |
| 195 } |
| 196 if (is_android) { |
| 197 deps += [ "//testing/android/native_test:native_test_native_code" ] |
| 198 } |
| 199 |
| 200 # TODO(YangZhang): These lines can be removed when high accuracy |
| 201 # YUV to RGB to Neon is ported. |
| 202 if ((target_cpu=="armv7" || target_cpu=="armv7s" || |
| 203 (target_cpu=="arm" && arm_version >= 7) || target_cpu=="arm64") && |
| 204 (arm_use_neon || arm_optionally_use_neon)) { |
| 205 defines += [ "LIBYUV_NEON" ] |
| 206 } |
| 207 |
| 208 defines += [ |
| 209 # Enable the following 3 macros to turn off assembly for specified CPU. |
| 210 # "LIBYUV_DISABLE_X86", |
| 211 # "LIBYUV_DISABLE_NEON", |
| 212 # "LIBYUV_DISABLE_MIPS", |
| 213 # Enable the following macro to build libyuv as a shared library (dll). |
| 214 # "LIBYUV_USING_SHARED_LIBRARY" |
| 215 ] |
| 216 } |
| 217 |
| 218 executable("compare") { |
| 219 sources = [ |
| 220 # sources |
| 221 "util/compare.cc" |
| 222 ] |
| 223 deps = [ ":libyuv" ] |
| 224 if (is_linux) { |
| 225 cflags = [ "-fexceptions" ] |
| 226 } |
| 227 } |
| 228 |
| 229 executable("convert") { |
| 230 sources = [ |
| 231 # sources |
| 232 "util/convert.cc" |
| 233 ] |
| 234 deps = [ ":libyuv" ] |
| 235 if (is_linux) { |
| 236 cflags = [ "-fexceptions" ] |
| 237 } |
| 238 } |
| 239 |
| 240 executable("psnr") { |
| 241 sources = [ |
| 242 # sources |
| 243 "util/psnr_main.cc", |
| 244 "util/psnr.cc", |
| 245 "util/ssim.cc" |
| 246 ] |
| 247 deps = [ ":libyuv" ] |
| 248 |
| 249 if (is_ios && target_cpu=="arm64") { |
| 250 # TODO(fbarchard): Enable Neon. See https://crbug.com/646279 |
| 251 defines = [ "LIBYUV_DISABLE_NEON" ] |
| 252 } |
| 253 if (!is_ios && !libyuv_disable_jpeg) { |
| 254 defines = [ "HAVE_JPEG" ] |
| 255 } |
| 256 } |
| 257 |
| 258 executable("cpuid") { |
| 259 sources = [ |
| 260 # sources |
| 261 "util/cpuid.c" |
| 262 ] |
| 263 deps = [ ":libyuv" ] |
| 264 } |
| 265 } |
OLD | NEW |