OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/arm.gni") | 5 import("//build/config/arm.gni") |
| 6 import("//testing/test.gni") |
6 | 7 |
7 # If fixed point implementation shall be used (otherwise float). | 8 # If fixed point implementation shall be used (otherwise float). |
8 use_opus_fixed_point = cpu_arch == "arm" || cpu_arch == "arm64" | 9 use_opus_fixed_point = cpu_arch == "arm" || cpu_arch == "arm64" |
9 | 10 |
10 # If ARM optimizations shall be used to accelerate performance. | 11 # If ARM optimizations shall be used to accelerate performance. |
11 use_opus_arm_optimization = cpu_arch == "arm" | 12 use_opus_arm_optimization = cpu_arch == "arm" |
12 | 13 |
13 # If OPUS Run Time CPU Detections (RTCD) shall be used. | 14 # If OPUS Run Time CPU Detections (RTCD) shall be used. |
14 # Based on the conditions in celt/arm/armcpu.c: | 15 # Based on the conditions in celt/arm/armcpu.c: |
15 # defined(_MSC_VER) || defined(__linux__). | 16 # defined(_MSC_VER) || defined(__linux__). |
16 use_opus_rtcd = cpu_arch == "arm" && (is_win || is_android || is_linux) | 17 use_opus_rtcd = cpu_arch == "arm" && (is_win || is_android || is_linux) |
17 | 18 |
18 config("opus_config") { | 19 config("opus_config") { |
19 include_dirs = [ "src/include" ] | 20 include_dirs = [ "src/include" ] |
20 } | 21 } |
21 | 22 |
| 23 config("opus_test_config") { |
| 24 include_dirs = [ |
| 25 "src/celt", |
| 26 "src/silk", |
| 27 ] |
| 28 |
| 29 if (is_win) { |
| 30 defines = [ "inline=__inline" ] |
| 31 } |
| 32 if (is_android) { |
| 33 libs = [ "log" ] |
| 34 } |
| 35 if (is_clang) { |
| 36 cflags = [ "-Wno-absolute-value" ] |
| 37 } |
| 38 } |
| 39 |
22 if (use_opus_rtcd) { | 40 if (use_opus_rtcd) { |
23 action("convert_rtcd_assembler") { | 41 action("convert_rtcd_assembler") { |
24 script = "convert_rtcd_assembler.py" | 42 script = "convert_rtcd_assembler.py" |
25 outputs = [ | 43 outputs = [ |
26 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", | 44 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", |
27 ] | 45 ] |
28 args = [ | 46 args = [ |
29 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir), | 47 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir), |
30 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s", | 48 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s", |
31 root_build_dir), | 49 root_build_dir), |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 154 } |
137 } | 155 } |
138 } | 156 } |
139 | 157 |
140 executable("opus_compare") { | 158 executable("opus_compare") { |
141 sources = [ | 159 sources = [ |
142 "src/src/opus_compare.c", | 160 "src/src/opus_compare.c", |
143 ] | 161 ] |
144 | 162 |
145 configs -= [ "//build/config/compiler:chromium_code" ] | 163 configs -= [ "//build/config/compiler:chromium_code" ] |
146 configs += [ "//build/config/compiler:no_chromium_code" ] | 164 configs += [ |
147 | 165 "//build/config/compiler:no_chromium_code", |
148 include_dirs = [ | 166 ":opus_test_config", |
149 "src/celt", | |
150 "src/silk", | |
151 ] | 167 ] |
152 | 168 |
153 if (is_win) { | |
154 defines = [ "inline=__inline" ] | |
155 } | |
156 if (is_android) { | |
157 libs = [ "log" ] | |
158 } | |
159 if (is_clang) { | |
160 cflags = [ "-Wno-absolute-value" ] | |
161 } | |
162 | |
163 deps = [ | 169 deps = [ |
164 ":opus", | 170 ":opus", |
165 ] | 171 ] |
166 } | 172 } |
167 | 173 |
168 executable("opus_demo") { | 174 executable("opus_demo") { |
169 sources = [ | 175 sources = [ |
170 "src/src/opus_demo.c", | 176 "src/src/opus_demo.c", |
171 ] | 177 ] |
172 | 178 |
173 configs -= [ "//build/config/compiler:chromium_code" ] | 179 configs -= [ "//build/config/compiler:chromium_code" ] |
174 configs += [ "//build/config/compiler:no_chromium_code" ] | 180 configs += [ |
175 | 181 "//build/config/compiler:no_chromium_code", |
176 include_dirs = [ | 182 ":opus_test_config", |
177 "src/celt", | |
178 "src/silk", | |
179 ] | 183 ] |
180 | 184 |
181 if (is_win) { | 185 deps = [ |
182 defines = [ "inline=__inline" ] | 186 ":opus", |
183 } | 187 ] |
184 if (is_android) { | 188 } |
185 libs = [ "log" ] | 189 |
186 } | 190 test("test_opus_api") { |
187 if (is_clang) { | 191 sources = [ |
188 cflags = [ "-Wno-absolute-value" ] | 192 "src/tests/test_opus_api.c", |
| 193 ] |
| 194 |
| 195 configs -= [ "//build/config/compiler:chromium_code" ] |
| 196 configs += [ |
| 197 "//build/config/compiler:no_chromium_code", |
| 198 ":opus_test_config", |
| 199 ] |
| 200 |
| 201 deps = [ |
| 202 ":opus", |
| 203 ] |
| 204 } |
| 205 |
| 206 test("test_opus_encode") { |
| 207 sources = [ |
| 208 "src/tests/test_opus_encode.c", |
| 209 ] |
| 210 |
| 211 configs -= [ "//build/config/compiler:chromium_code" ] |
| 212 configs += [ |
| 213 "//build/config/compiler:no_chromium_code", |
| 214 ":opus_test_config", |
| 215 ] |
| 216 |
| 217 deps = [ |
| 218 ":opus", |
| 219 ] |
| 220 } |
| 221 |
| 222 test("test_opus_decode") { |
| 223 sources = [ |
| 224 "src/tests/test_opus_decode.c", |
| 225 ] |
| 226 |
| 227 configs -= [ "//build/config/compiler:chromium_code" ] |
| 228 configs += [ |
| 229 "//build/config/compiler:no_chromium_code", |
| 230 ":opus_test_config", |
| 231 ] |
| 232 |
| 233 # test_opus_decode passes a null pointer to opus_decode() for an argument |
| 234 # marked as requiring a non-null value by the nonnull function attribute, |
| 235 # and expects opus_decode() to fail. Disable the -Wnonnull option to avoid |
| 236 # a compilation error if -Werror is specified. |
| 237 if (is_posix) { |
| 238 cflags = [ "-Wno-nonnull" ] |
189 } | 239 } |
190 | 240 |
191 deps = [ | 241 deps = [ |
192 ":opus", | 242 ":opus", |
193 ] | 243 ] |
194 } | 244 } |
| 245 |
| 246 test("test_opus_padding") { |
| 247 sources = [ |
| 248 "src/tests/test_opus_padding.c", |
| 249 ] |
| 250 |
| 251 configs -= [ "//build/config/compiler:chromium_code" ] |
| 252 configs += [ |
| 253 "//build/config/compiler:no_chromium_code", |
| 254 ":opus_test_config", |
| 255 ] |
| 256 |
| 257 deps = [ |
| 258 ":opus", |
| 259 ] |
| 260 } |
OLD | NEW |