Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Side by Side Diff: BUILD.gn

Issue 2317073002: LibYuv GN: Add GN test targets. (Closed)
Patch Set: Update .gitignore Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « .gitignore ('k') | build_overrides/build.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 = [
14 ".", 14 ".",
kjellander_chromium 2016/09/07 14:29:26 No need to include . for GN
15 "include", 15 "include",
16 ] 16 ]
17 if (is_android && current_cpu == "arm64") {
kjellander_chromium 2016/09/07 14:29:26 Is linking failing without these on Android? I see
18 ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64" ]
19 }
20 if (is_android && current_cpu != "arm64") {
21 ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker" ]
22 }
17 } 23 }
18 24
19 use_neon = current_cpu == "arm64" || (current_cpu == "arm" && (arm_use_neon || a rm_optionally_use_neon))
20
21 static_library("libyuv") { 25 static_library("libyuv") {
22 sources = [ 26 sources = [
23 # Headers 27 # Headers
24 "include/libyuv.h", 28 "include/libyuv.h",
25 "include/libyuv/basic_types.h", 29 "include/libyuv/basic_types.h",
26 "include/libyuv/compare.h", 30 "include/libyuv/compare.h",
27 "include/libyuv/convert.h", 31 "include/libyuv/convert.h",
28 "include/libyuv/convert_argb.h", 32 "include/libyuv/convert_argb.h",
29 "include/libyuv/convert_from.h", 33 "include/libyuv/convert_from.h",
30 "include/libyuv/convert_from_argb.h", 34 "include/libyuv/convert_from_argb.h",
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 "source/scale.cc", 76 "source/scale.cc",
73 "source/scale_any.cc", 77 "source/scale_any.cc",
74 "source/scale_argb.cc", 78 "source/scale_argb.cc",
75 "source/scale_common.cc", 79 "source/scale_common.cc",
76 "source/scale_mips.cc", 80 "source/scale_mips.cc",
77 "source/scale_gcc.cc", 81 "source/scale_gcc.cc",
78 "source/scale_win.cc", 82 "source/scale_win.cc",
79 "source/video_common.cc", 83 "source/video_common.cc",
80 ] 84 ]
81 85
82 public_configs = [ ":libyuv_config" ] 86 public_configs = [ ":libyuv_config" ]
83 87
84 defines = [] 88 defines = []
85 deps = [] 89 deps = []
86 90
87 if (!is_ios) { 91 if (!is_ios) {
88 defines += [ "HAVE_JPEG" ] 92 defines += [ "HAVE_JPEG" ]
89 deps += [ "//third_party:jpeg" ] 93 deps += [ "//third_party:jpeg" ]
90 } 94 }
91 95
92 if (use_neon) { 96 if (libyuv_use_neon) {
93 deps += [ ":libyuv_neon" ] 97 deps += [ ":libyuv_neon" ]
94 } 98 }
95 99
96 if (is_nacl) { 100 if (is_nacl) {
97 # Always enable optimization under NaCl to workaround crbug.com/538243 . 101 # Always enable optimization under NaCl to workaround crbug.com/538243 .
98 configs -= [ "//build/config/compiler:default_optimization" ] 102 configs -= [ "//build/config/compiler:default_optimization" ]
99 configs += [ "//build/config/compiler:optimize_max" ] 103 configs += [ "//build/config/compiler:optimize_max" ]
100 } 104 }
101 } 105 }
102 106
103 if (use_neon) { 107 if (libyuv_use_neon) {
104 static_library("libyuv_neon") { 108 static_library("libyuv_neon") {
105 sources = [ 109 sources = [
106 # ARM Source Files 110 # ARM Source Files
107 "source/compare_neon.cc", 111 "source/compare_neon.cc",
108 "source/compare_neon64.cc", 112 "source/compare_neon64.cc",
109 "source/rotate_neon.cc", 113 "source/rotate_neon.cc",
110 "source/rotate_neon64.cc", 114 "source/rotate_neon64.cc",
111 "source/row_neon.cc", 115 "source/row_neon.cc",
112 "source/row_neon64.cc", 116 "source/row_neon64.cc",
113 "source/scale_neon.cc", 117 "source/scale_neon.cc",
114 "source/scale_neon64.cc", 118 "source/scale_neon64.cc",
115 ] 119 ]
116 120
117 public_configs = [ ":libyuv_config" ] 121 public_configs = [ ":libyuv_config" ]
118 122
119 if (current_cpu != "arm64") { 123 if (current_cpu != "arm64") {
120 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] 124 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
121 cflags = [ "-mfpu=neon" ] 125 cflags = [ "-mfpu=neon" ]
122 } 126 }
123 } 127 }
124 } 128 }
129
130 if (libyuv_include_tests) {
131 config("libyuv_unittest_config") {
132 defines = [ "GTEST_RELATIVE_PATH" ]
133 cflags = [
134 "-Wno-sign-compare",
135 "-Wno-unused-variable"
136 ]
137 }
138
139 test("libyuv_unittest") {
140 testonly = true
141
142 sources = [
143 # headers
144 "unit_test/unit_test.h",
145 # sources
146 "unit_test/basictypes_test.cc",
147 "unit_test/compare_test.cc",
148 "unit_test/color_test.cc",
149 "unit_test/convert_test.cc",
150 "unit_test/cpu_test.cc",
151 "unit_test/math_test.cc",
152 "unit_test/planar_test.cc",
153 "unit_test/rotate_argb_test.cc",
154 "unit_test/rotate_test.cc",
155 "unit_test/scale_argb_test.cc",
156 "unit_test/scale_test.cc",
157 "unit_test/unit_test.cc",
158 "unit_test/video_common_test.cc",
159 ]
160
161 deps = [
162 ":libyuv",
163 "//testing/gtest",
164 "//third_party/gflags",
165 ]
166
167 public_deps = [ "//testing/gtest" ]
168 public_configs = [ ":libyuv_unittest_config" ]
169
170 defines = []
171
172 if (is_linux) {
173 cflags = [ "-fexceptions" ]
174 }
175 if (is_ios && target_cpu == "arm64") {
kjellander_chromium 2016/09/07 14:29:26 nit: omit spaces around == (same below)
176 defines += [ "LIBYUV_DISABLE_NEON" ]
177 }
178 if (is_ios) {
179 configs -= [ "//build/config/compiler:default_symbols" ]
180 configs += [ "//build/config/compiler:symbols" ]
181 cflags = [ "-Wno-sometimes-uninitialized" ]
182 }
183 if (!is_ios && !libyuv_disable_jpeg) {
184 defines += [ "HAVE_JPEG" ]
185 }
186 if (is_android) {
187 deps += [ "//testing/android/native_test:native_test_native_code" ]
188 }
189
190 # TODO(YangZhang): These lines can be removed when high accuracy
191 # YUV to RGB to Neon is ported.
192 if ((target_cpu == "armv7" || target_cpu == "armv7s" ||
193 (target_cpu == "arm" && arm_version >= 7) || target_cpu == "arm64") &&
194 (arm_use_neon || arm_optionally_use_neon)) {
195 defines += [ "LIBYUV_NEON" ]
196 }
197
198 defines += [
199 # Enable the following 3 macros to turn off assembly for specified CPU.
200 # "LIBYUV_DISABLE_X86",
201 # "LIBYUV_DISABLE_NEON",
202 # "LIBYUV_DISABLE_MIPS",
203 # Enable the following macro to build libyuv as a shared library (dll).
204 # "LIBYUV_USING_SHARED_LIBRARY"
205 ]
206 }
207
208 executable("compare") {
209 deps = [ ":libyuv" ]
kjellander_chromium 2016/09/07 14:29:26 Please order items according to the GN style guide
210 sources = [
211 # sources
212 "util/compare.cc"
213 ]
214 if (is_linux) {
215 cflags = [ "-fexceptions" ]
216 }
217 }
218
219 executable("convert") {
220 deps = [ ":libyuv" ]
221 sources = [
222 # sources
223 "util/convert.cc"
224 ]
225 if (is_linux) {
226 cflags = [ "-fexceptions" ]
227 }
228 }
229
230 executable("psnr") {
231 deps = [ ":libyuv" ]
232 sources = [
233 # sources
234 "util/psnr_main.cc",
235 "util/psnr.cc",
236 "util/ssim.cc"
237 ]
238
239 if (is_ios && target_cpu == "arm64") {
240 defines = [ "LIBYUV_DISABLE_NEON" ]
241 }
242 if (!is_ios && !libyuv_disable_jpeg) {
243 defines = [ "HAVE_JPEG" ]
244 }
245 }
246
247 executable("cpuid") {
248 deps = [ ":libyuv" ]
249 sources = [
250 # sources
251 "util/cpuid.c"
252 ]
253 }
254 }
OLDNEW
« no previous file with comments | « .gitignore ('k') | build_overrides/build.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698