blob: 860f93a89b62b63797bc7d0f9a055d48334fed3c [file] [log] [blame]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +00001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
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
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
kjellander@webrtc.org7497fa72014-06-28 18:05:22 +00009# TODO(kjellander): Rebase this to webrtc/build/common.gypi changes after r6330.
10
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000011import("//build/config/linux/pkg_config.gni")
Peter Boström62e9bda2015-11-23 15:12:06 +010012import("//build/config/sanitizers/sanitizers.gni")
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000013import("build/webrtc.gni")
Bjorn Terelius36411852015-07-30 12:45:18 +020014import("//third_party/protobuf/proto_library.gni")
sakal80a5bf12016-09-16 07:22:17 -070015if (is_android) {
16 import("//build/config/android/config.gni")
17 import("//build/config/android/rules.gni")
18}
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000019
20# Contains the defines and includes in common.gypi that are duplicated both as
21# target_defaults and direct_dependent_settings.
22config("common_inherited_config") {
23 defines = []
Johan Ahlers9ddac182016-07-22 08:57:23 +020024 cflags = []
25 ldflags = []
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000026 if (build_with_mozilla) {
27 defines += [ "WEBRTC_MOZILLA_BUILD" ]
28 }
29 if (build_with_chromium) {
kjellanderf0e174a2016-05-30 06:27:50 -070030 defines = [
31 # TODO(kjellander): Cleanup unused ones and move defines closer to
32 # the source when webrtc:4256 is completed.
33 "FEATURE_ENABLE_SSL",
34 "FEATURE_ENABLE_VOICEMAIL",
35 "EXPAT_RELATIVE_PATH",
36 "GTEST_RELATIVE_PATH",
37 "NO_MAIN_THREAD_WRAPPING",
38 "NO_SOUND_SYSTEM",
39 "WEBRTC_CHROMIUM_BUILD",
40 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000041 include_dirs = [
henrikgee2bf412015-09-30 03:48:52 -070042 # The overrides must be included first as that is the mechanism for
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000043 # selecting the override headers in Chromium.
henrikgee2bf412015-09-30 03:48:52 -070044 "../webrtc_overrides",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020045
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000046 # Allow includes to be prefixed with webrtc/ in case it is not an
47 # immediate subdirectory of the top-level.
48 "..",
49 ]
50 }
51 if (is_posix) {
52 defines += [ "WEBRTC_POSIX" ]
53 }
54 if (is_ios) {
55 defines += [
56 "WEBRTC_MAC",
57 "WEBRTC_IOS",
58 ]
59 }
60 if (is_linux) {
61 defines += [ "WEBRTC_LINUX" ]
62 }
63 if (is_mac) {
64 defines += [ "WEBRTC_MAC" ]
65 }
66 if (is_win) {
kjellanderf0e174a2016-05-30 06:27:50 -070067 defines += [
68 "WEBRTC_WIN",
69 "_CRT_SECURE_NO_WARNINGS", # Suppress warnings about _vsnprinf
70 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000071 }
72 if (is_android) {
73 defines += [
74 "WEBRTC_LINUX",
75 "WEBRTC_ANDROID",
76 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000077 }
kjellanderf0e174a2016-05-30 06:27:50 -070078 if (is_chromeos) {
79 defines += [ "CHROMEOS" ]
80 }
81
Johan Ahlers9ddac182016-07-22 08:57:23 +020082 if (rtc_sanitize_coverage != "") {
83 assert(is_clang, "sanitizer coverage requires clang")
84 cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
85 ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
86 }
87
kjellanderf0e174a2016-05-30 06:27:50 -070088 # TODO(GYP): Support these in GN.
89 # if (is_bsd) {
90 # defines += [ "BSD" ]
91 # }
92 # if (is_openbsd) {
93 # defines += [ "OPENBSD" ]
94 # }
95 # if (is_freebsd) {
96 # defines += [ "FREEBSD" ]
97 # }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000098}
99
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000100if (rtc_have_dbus_glib) {
kjellander@webrtc.org7497fa72014-06-28 18:05:22 +0000101 pkg_config("dbus-glib") {
102 packages = [ "dbus-glib-1" ]
103 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000104}
105
106config("common_config") {
kjellander@webrtc.org79ee97c2014-09-04 14:10:49 +0000107 cflags = []
108 cflags_cc = []
kjellanderf0e174a2016-05-30 06:27:50 -0700109 defines = []
110
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000111 if (rtc_restrict_logging) {
kjellanderf0e174a2016-05-30 06:27:50 -0700112 defines += [ "WEBRTC_RESTRICT_LOGGING" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000113 }
114
kjellander82a94492016-06-12 22:12:01 -0700115 if (rtc_include_internal_audio_device) {
116 defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
117 }
118
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000119 if (rtc_have_dbus_glib) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000120 defines += [ "HAVE_DBUS_GLIB" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200121
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000122 # TODO(kjellander): Investigate this, it seems like include <dbus/dbus.h>
123 # is still not found even if the execution of
124 # build/config/linux/pkg-config.py dbus-glib-1 returns correct include
125 # dirs on Linux.
126 all_dependent_configs = [ "dbus-glib" ]
127 }
128
kjellanderc76dc952016-06-03 03:09:32 -0700129 if (rtc_relative_path) {
130 defines += [ "EXPAT_RELATIVE_PATH" ]
131 }
132
phoglund33603522016-10-05 06:52:22 -0700133 if (!rtc_libvpx_build_vp9) {
134 defines += [ "RTC_DISABLE_VP9" ]
135 }
136
brettw@chromium.org9fe11012014-09-09 19:15:33 +0000137 if (build_with_chromium) {
kjellanderf0e174a2016-05-30 06:27:50 -0700138 defines += [
139 # NOTICE: Since common_inherited_config is used in public_configs for our
140 # targets, there's no point including the defines in that config here.
141 # TODO(kjellander): Cleanup unused ones and move defines closer to the
142 # source when webrtc:4256 is completed.
143 "ENABLE_EXTERNAL_AUTH",
144 "HAVE_OPENSSL_SSL_H",
145 "HAVE_SCTP",
146 "HAVE_SRTP",
147 "HAVE_WEBRTC_VIDEO",
148 "HAVE_WEBRTC_VOICE",
149 "LOGGING_INSIDE_WEBRTC",
150 "SRTP_RELATIVE_PATH",
151 "SSL_USE_OPENSSL",
152 "USE_WEBRTC_DEV_BRANCH",
153 ]
brettw@chromium.org9fe11012014-09-09 19:15:33 +0000154 } else {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000155 if (is_posix) {
156 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
157 # for targets that can handle it. For Android/arm64 right now
158 # there will be an "enumeral and non-enumeral type in conditional
159 # expression" warning in android_tools/ndk_experimental"s version
160 # of stlport.
161 # See: https://code.google.com/p/chromium/issues/detail?id=379699
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000162 if (current_cpu != "arm64" || !is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000163 cflags = [
164 "-Wextra",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200165
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000166 # We need to repeat some flags from Chromium"s common.gypi
167 # here that get overridden by -Wextra.
168 "-Wno-unused-parameter",
169 "-Wno-missing-field-initializers",
170 "-Wno-strict-overflow",
171 ]
172 cflags_cc = [
173 "-Wnon-virtual-dtor",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200174
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000175 # This is enabled for clang; enable for gcc as well.
176 "-Woverloaded-virtual",
177 ]
178 }
179 }
180
181 if (is_clang) {
kjellander3f032cf2016-04-27 07:13:46 -0700182 cflags += [
183 "-Wimplicit-fallthrough",
184 "-Wthread-safety",
nisse4996eaa2016-05-10 23:28:10 -0700185 "-Winconsistent-missing-override",
kwiberg77eab702016-09-28 17:42:01 -0700186 "-Wundef",
kjellander3f032cf2016-04-27 07:13:46 -0700187 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000188 }
189 }
190
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000191 if (current_cpu == "arm64") {
Andrew MacDonaldcb7f8ce2015-05-19 22:20:17 -0700192 defines += [ "WEBRTC_ARCH_ARM64" ]
193 defines += [ "WEBRTC_HAS_NEON" ]
tkchin@webrtc.org14146e42014-10-31 00:14:39 +0000194 }
195
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000196 if (current_cpu == "arm") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000197 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000198 if (arm_version >= 7) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000199 defines += [ "WEBRTC_ARCH_ARM_V7" ]
200 if (arm_use_neon) {
Andrew MacDonaldcb7f8ce2015-05-19 22:20:17 -0700201 defines += [ "WEBRTC_HAS_NEON" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000202 }
203 }
204 }
205
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000206 if (current_cpu == "mipsel") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000207 defines += [ "MIPS32_LE" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000208 if (mips_float_abi == "hard") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000209 defines += [ "MIPS_FPU_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000210 }
kjellander@webrtc.orgacb80852015-01-25 19:17:56 +0000211 if (mips_arch_variant == "r2") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000212 defines += [ "MIPS32_R2_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000213 }
214 if (mips_dsp_rev == 1) {
215 defines += [ "MIPS_DSP_R1_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000216 } else if (mips_dsp_rev == 2) {
217 defines += [
218 "MIPS_DSP_R1_LE",
219 "MIPS_DSP_R2_LE",
220 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000221 }
222 }
223
Henrik Kjellanderc0c7d2e2015-09-07 12:57:42 +0200224 if (is_android && !is_clang) {
Henrik Kjellander5bfc6cb2015-09-21 16:50:45 +0200225 # The Android NDK doesn"t provide optimized versions of these
226 # functions. Ensure they are disabled for all compilers.
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000227 cflags += [
228 "-fno-builtin-cos",
229 "-fno-builtin-sin",
230 "-fno-builtin-cosf",
231 "-fno-builtin-sinf",
232 ]
233 }
katrielcbf81d682016-05-26 01:03:02 -0700234
metzmanf89a5712016-07-25 02:14:09 -0700235 if (use_libfuzzer || use_drfuzz || use_afl) {
katrielcbf81d682016-05-26 01:03:02 -0700236 # Used in Chromium's overrides to disable logging
237 defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
238 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000239}
240
kjellander3bcedd32016-06-08 01:14:15 -0700241config("common_objc") {
tkchin2ddfdba2016-08-07 21:37:45 -0700242 libs = [ "Foundation.framework" ]
kjellander3bcedd32016-06-08 01:14:15 -0700243 precompiled_header = "sdk/objc/WebRTC-Prefix.pch"
244 precompiled_source = "sdk/objc/WebRTC-Prefix.pch"
245}
246
Nico Weber3ab32dc2016-08-02 09:53:25 -0400247if (!is_ios || !build_with_chromium) {
kjellanderee996962016-09-27 12:13:13 -0700248 rtc_static_library("webrtc") {
Nico Weber3ab32dc2016-08-02 09:53:25 -0400249 sources = [
kjellanderee996962016-09-27 12:13:13 -0700250 # TODO(kjellander): Remove this whenever possible. GN's static_library
251 # target type requires at least one object to avoid errors linking.
252 "build/no_op_function.cc",
Nico Weber3ab32dc2016-08-02 09:53:25 -0400253 "call.h",
254 "config.h",
255 "transport.h",
kjellander94cee312016-06-10 01:56:57 -0700256 ]
Bjorn Terelius36411852015-07-30 12:45:18 +0200257
Nico Weber3ab32dc2016-08-02 09:53:25 -0400258 defines = []
Nico Weber3ab32dc2016-08-02 09:53:25 -0400259
260 deps = [
261 ":webrtc_common",
262 "audio",
263 "base:rtc_base",
264 "call",
265 "common_audio",
266 "common_video",
267 "modules",
hbos615d3012016-08-24 01:33:13 -0700268 "stats",
Nico Weber3ab32dc2016-08-02 09:53:25 -0400269 "system_wrappers",
kjellanderda3303f2016-10-12 20:50:17 -0700270 "tools",
Nico Weber3ab32dc2016-08-02 09:53:25 -0400271 "video",
272 "voice_engine",
273 ]
274
275 if (build_with_chromium) {
276 deps += [ "modules/video_capture" ]
277 } else {
278 # TODO(kjellander): Enable for Chromium as well when bugs.webrtc.org/4256
279 # is fixed. Right now it's not possible due to circular dependencies.
280 deps += [
281 "api",
282 "media",
283 "p2p",
284 "pc",
285 ]
286 }
287
288 if (rtc_enable_protobuf) {
289 defines += [ "ENABLE_RTC_EVENT_LOG" ]
skvladcc91d282016-10-03 18:31:22 -0700290 deps += [ "logging:rtc_event_log_proto" ]
Nico Weber3ab32dc2016-08-02 09:53:25 -0400291 }
Bjorn Terelius36411852015-07-30 12:45:18 +0200292 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000293}
294
kjellanderb62dbbe2016-09-23 00:38:52 -0700295rtc_static_library("webrtc_common") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000296 sources = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000297 "common_types.cc",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000298 "common_types.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000299 "config.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200300 "config.h",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000301 "typedefs.h",
mflodman7056be92016-10-07 07:07:28 +0200302 "voice_engine_configurations.h",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000303 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000304
aluebs688e3082016-01-14 04:32:46 -0800305 if (is_clang && !is_nacl) {
306 # Suppress warnings from Chrome's Clang plugins.
307 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700308 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
aluebs688e3082016-01-14 04:32:46 -0800309 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000310}
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000311
metzmanf89a5712016-07-25 02:14:09 -0700312if (use_libfuzzer || use_drfuzz || use_afl) {
Peter Boström1e0cfd92015-12-17 14:28:16 +0100313 # This target is only here for gn to discover fuzzer build targets under
314 # webrtc/test/fuzzers/.
315 group("webrtc_fuzzers_dummy") {
Peter Boström62e9bda2015-11-23 15:12:06 +0100316 testonly = true
317 deps = [
Peter Boström1e0cfd92015-12-17 14:28:16 +0100318 "test/fuzzers:webrtc_fuzzer_main",
Peter Boström62e9bda2015-11-23 15:12:06 +0100319 ]
320 }
321}
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200322
kjellander@webrtc.orgaff499c2016-06-06 23:04:31 +0200323if (rtc_include_tests) {
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200324 config("rtc_unittests_config") {
325 # GN orders flags on a target before flags from configs. The default config
326 # adds -Wall, and this flag have to be after -Wall -- so they need to
327 # come from a config and can"t be on the target directly.
328 if (is_clang) {
329 cflags = [
330 "-Wno-missing-braces",
331 "-Wno-sign-compare",
332 "-Wno-unused-const-variable",
333 ]
334 }
335 }
336
ehmaldonado38a21322016-09-02 04:10:34 -0700337 rtc_test("rtc_unittests") {
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200338 testonly = true
339 sources = [
Honghai Zhangd93f50c2016-10-05 11:47:22 -0700340 "api/fakemetricsobserver.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200341 "base/array_view_unittest.cc",
342 "base/atomicops_unittest.cc",
343 "base/autodetectproxy_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200344 "base/base64_unittest.cc",
345 "base/basictypes_unittest.cc",
346 "base/bind_unittest.cc",
347 "base/bitbuffer_unittest.cc",
348 "base/buffer_unittest.cc",
349 "base/bufferqueue_unittest.cc",
350 "base/bytebuffer_unittest.cc",
351 "base/byteorder_unittest.cc",
352 "base/callback_unittest.cc",
353 "base/copyonwritebuffer_unittest.cc",
354 "base/crc32_unittest.cc",
355 "base/criticalsection_unittest.cc",
356 "base/event_tracer_unittest.cc",
357 "base/event_unittest.cc",
358 "base/exp_filter_unittest.cc",
Viktor Palmkvist4ec6a0c2016-09-02 13:38:32 +0200359 "base/file_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200360 "base/filerotatingstream_unittest.cc",
361 "base/fileutils_unittest.cc",
kwiberg24c7c122016-09-28 11:57:10 -0700362 "base/function_view_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200363 "base/helpers_unittest.cc",
364 "base/httpbase_unittest.cc",
365 "base/httpcommon_unittest.cc",
366 "base/httpserver_unittest.cc",
367 "base/ipaddress_unittest.cc",
368 "base/logging_unittest.cc",
369 "base/md5digest_unittest.cc",
370 "base/messagedigest_unittest.cc",
371 "base/messagequeue_unittest.cc",
372 "base/mod_ops_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200373 "base/nat_unittest.cc",
374 "base/network_unittest.cc",
375 "base/onetimeevent_unittest.cc",
376 "base/optional_unittest.cc",
377 "base/optionsfile_unittest.cc",
378 "base/pathutils_unittest.cc",
379 "base/platform_thread_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200380 "base/proxy_unittest.cc",
381 "base/proxydetect_unittest.cc",
382 "base/random_unittest.cc",
sprangcd349d92016-07-13 09:11:28 -0700383 "base/rate_limiter_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200384 "base/rate_statistics_unittest.cc",
385 "base/ratelimiter_unittest.cc",
386 "base/ratetracker_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200387 "base/rollingaccumulator_unittest.cc",
388 "base/rtccertificate_unittest.cc",
389 "base/rtccertificategenerator_unittest.cc",
390 "base/scopedptrcollection_unittest.cc",
perkj9c16fe82016-07-12 15:04:07 -0700391 "base/sequenced_task_checker_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200392 "base/sha1digest_unittest.cc",
393 "base/sharedexclusivelock_unittest.cc",
394 "base/signalthread_unittest.cc",
395 "base/sigslot_unittest.cc",
396 "base/sigslottester.h",
397 "base/sigslottester.h.pump",
398 "base/stream_unittest.cc",
399 "base/stringencode_unittest.cc",
400 "base/stringutils_unittest.cc",
401 "base/swap_queue_unittest.cc",
402
403 # TODO(ronghuawu): Reenable this test.
404 # "systeminfo_unittest.cc",
405 "base/task_queue_unittest.cc",
406 "base/task_unittest.cc",
407 "base/testclient_unittest.cc",
408 "base/thread_checker_unittest.cc",
409 "base/thread_unittest.cc",
nisse191b3592016-06-22 08:36:53 -0700410 "base/timestampaligner_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200411 "base/timeutils_unittest.cc",
412 "base/urlencode_unittest.cc",
perkj8ff860a2016-10-03 00:30:04 -0700413 "base/weak_ptr_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200414
415 # TODO(ronghuawu): Reenable this test.
416 # "windowpicker_unittest.cc",
kjellander3283cf92016-10-13 06:35:45 -0700417 "p2p/base/asyncstuntcpsocket_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200418 "p2p/base/dtlstransportchannel_unittest.cc",
419 "p2p/base/fakeportallocator.h",
420 "p2p/base/faketransportcontroller.h",
421 "p2p/base/p2ptransportchannel_unittest.cc",
422 "p2p/base/port_unittest.cc",
423 "p2p/base/portallocator_unittest.cc",
424 "p2p/base/pseudotcp_unittest.cc",
425 "p2p/base/relayport_unittest.cc",
426 "p2p/base/relayserver_unittest.cc",
427 "p2p/base/stun_unittest.cc",
428 "p2p/base/stunport_unittest.cc",
429 "p2p/base/stunrequest_unittest.cc",
430 "p2p/base/stunserver_unittest.cc",
431 "p2p/base/tcpport_unittest.cc",
432 "p2p/base/testrelayserver.h",
433 "p2p/base/teststunserver.h",
434 "p2p/base/testturnserver.h",
435 "p2p/base/transport_unittest.cc",
436 "p2p/base/transportcontroller_unittest.cc",
437 "p2p/base/transportdescriptionfactory_unittest.cc",
438 "p2p/base/turnport_unittest.cc",
Taylor Brandstetter734262c2016-08-01 16:37:14 -0700439 "p2p/base/turnserver_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200440 "p2p/client/basicportallocator_unittest.cc",
441 "p2p/stunprober/stunprober_unittest.cc",
442 ]
443
444 if (is_linux) {
445 sources += [
446 "base/latebindingsymboltable_unittest.cc",
447
448 # TODO(ronghuawu): Reenable this test.
449 # "linux_unittest.cc",
450 "base/linuxfdwalk_unittest.cc",
451 ]
452 }
453
454 if (is_win) {
455 sources += [
456 "base/win32_unittest.cc",
457 "base/win32regkey_unittest.cc",
458 "base/win32window_unittest.cc",
459 "base/win32windowpicker_unittest.cc",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200460 ]
461 }
462
463 if (is_mac) {
464 sources += [ "base/macutils_unittest.cc" ]
465 }
466
467 if (is_posix) {
468 sources += [
469 "base/ssladapter_unittest.cc",
470 "base/sslidentity_unittest.cc",
471 "base/sslstreamadapter_unittest.cc",
472 ]
473 }
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200474 if (rtc_use_quic) {
475 sources += [
476 "p2p/quic/quicconnectionhelper_unittest.cc",
477 "p2p/quic/quicsession_unittest.cc",
478 "p2p/quic/quictransport_unittest.cc",
479 "p2p/quic/quictransportchannel_unittest.cc",
480 "p2p/quic/reliablequicstream_unittest.cc",
481 ]
482 }
483
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700484 configs += [ ":rtc_unittests_config" ]
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200485
486 if (is_clang) {
487 # Suppress warnings from the Chromium Clang plugin.
488 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700489 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200490 }
491
492 deps = [
493 "base:rtc_base",
kjellander82a94492016-06-12 22:12:01 -0700494 "base:rtc_base_tests_utils",
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200495 "base:rtc_task_queue",
496 "p2p:libstunprober",
497 "p2p:rtc_p2p",
498 "//testing/gmock",
499 "//testing/gtest",
500 ]
501
skvlade9cac752016-09-19 14:42:02 -0700502 if (rtc_enable_protobuf) {
skvladcc91d282016-10-03 18:31:22 -0700503 deps += [ "logging:rtc_event_log_tests" ]
skvlade9cac752016-09-19 14:42:02 -0700504 }
505
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200506 if (is_android) {
507 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700508 shard_timeout = 900
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200509 }
kjellander3bcedd32016-06-08 01:14:15 -0700510
511 if (is_ios || (is_mac && mac_deployment_target == "10.7")) {
512 deps += [
513 "sdk:rtc_sdk_peerconnection_objc",
514 "system_wrappers:system_wrappers_default",
515 ]
516 sources += [
517 "sdk/objc/Framework/UnitTests/RTCConfigurationTest.mm",
518 "sdk/objc/Framework/UnitTests/RTCDataChannelConfigurationTest.mm",
519 "sdk/objc/Framework/UnitTests/RTCIceCandidateTest.mm",
520 "sdk/objc/Framework/UnitTests/RTCIceServerTest.mm",
521 "sdk/objc/Framework/UnitTests/RTCMediaConstraintsTest.mm",
522 "sdk/objc/Framework/UnitTests/RTCSessionDescriptionTest.mm",
523 ]
524
525 # TODO(tkchin): Cleanup this warning.
526 cflags = [ "-Wno-objc-property-no-attribute" ]
527
528 # |-ObjC| flag needed to make sure category method implementations
529 # are included:
530 # https://developer.apple.com/library/mac/qa/qa1490/_index.html
531 ldflags = [ "-ObjC" ]
532 }
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200533 }
Peter Boström02083222016-06-14 12:52:54 +0200534
ehmaldonado38a21322016-09-02 04:10:34 -0700535 rtc_test("xmllite_xmpp_unittests") {
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700536 configs += [ ":rtc_unittests_config" ]
charujain604fc112016-08-04 01:16:39 -0700537
538 if (is_clang) {
539 # Suppress warnings from the Chromium Clang plugin.
540 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700541 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
charujain604fc112016-08-04 01:16:39 -0700542 }
543
544 deps = [
545 "base:rtc_base_tests_utils",
546 "libjingle/xmllite:rtc_xmllite",
547 "libjingle/xmpp:rtc_xmpp",
548 "//testing/gtest",
549 ]
550
551 sources = [
552 "libjingle/xmllite/qname_unittest.cc",
553 "libjingle/xmllite/xmlbuilder_unittest.cc",
554 "libjingle/xmllite/xmlelement_unittest.cc",
555 "libjingle/xmllite/xmlnsstack_unittest.cc",
556 "libjingle/xmllite/xmlparser_unittest.cc",
557 "libjingle/xmllite/xmlprinter_unittest.cc",
558 "libjingle/xmpp/fakexmppclient.h",
559 "libjingle/xmpp/hangoutpubsubclient_unittest.cc",
560 "libjingle/xmpp/jid_unittest.cc",
561 "libjingle/xmpp/mucroomconfigtask_unittest.cc",
562 "libjingle/xmpp/mucroomdiscoverytask_unittest.cc",
563 "libjingle/xmpp/mucroomlookuptask_unittest.cc",
564 "libjingle/xmpp/mucroomuniquehangoutidtask_unittest.cc",
565 "libjingle/xmpp/pingtask_unittest.cc",
566 "libjingle/xmpp/pubsubclient_unittest.cc",
567 "libjingle/xmpp/pubsubtasks_unittest.cc",
568 "libjingle/xmpp/util_unittest.cc",
569 "libjingle/xmpp/util_unittest.h",
570 "libjingle/xmpp/xmppengine_unittest.cc",
571 "libjingle/xmpp/xmpplogintask_unittest.cc",
572 "libjingle/xmpp/xmppstanzaparser_unittest.cc",
573 ]
574 }
575
Peter Boström02083222016-06-14 12:52:54 +0200576 # TODO(pbos): Rename test suite, this is no longer "just" for video targets.
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700577 video_engine_tests_resources = [
578 "//resources/foreman_cif_short.yuv",
579 "//resources/voice_engine/audio_long16.pcm",
580 ]
kjellander32c4a202016-08-30 02:53:49 -0700581
582 if (is_ios) {
583 bundle_data("video_engine_tests_bundle_data") {
584 testonly = true
585 sources = video_engine_tests_resources
586 outputs = [
587 "{{bundle_resources_dir}}/{{source_file_part}}",
588 ]
589 }
590 }
591
ehmaldonado38a21322016-09-02 04:10:34 -0700592 rtc_test("video_engine_tests") {
Peter Boström02083222016-06-14 12:52:54 +0200593 testonly = true
594 deps = [
595 "audio:audio_tests",
596 "call:call_tests",
597 "modules/video_capture",
598 "test:test_common",
599 "test:test_main",
600 "video:video_tests",
601 ]
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700602 data = video_engine_tests_resources
Peter Boström02083222016-06-14 12:52:54 +0200603 if (is_clang) {
604 # Suppress warnings from the Chromium Clang plugin.
605 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700606 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
Peter Boström02083222016-06-14 12:52:54 +0200607 }
sakal714dd4e2016-08-15 02:29:11 -0700608 if (is_android) {
sakal010f0922016-08-18 00:41:59 -0700609 deps += [ "//testing/android/native_test:native_test_native_code" ]
kjellander28a0ffd2016-08-24 07:48:42 -0700610 shard_timeout = 900
611 }
kjellander32c4a202016-08-30 02:53:49 -0700612
613 if (is_ios) {
614 deps += [ ":video_engine_tests_bundle_data" ]
sakal714dd4e2016-08-15 02:29:11 -0700615 }
Peter Boström02083222016-06-14 12:52:54 +0200616 }
Peter Boströmac968bd2016-06-27 19:31:39 +0200617
ehmaldonado38a21322016-09-02 04:10:34 -0700618 rtc_source_set("video_quality_test") {
ehmaldonado529f83c2016-07-27 08:14:32 -0700619 testonly = true
ehmaldonado529f83c2016-07-27 08:14:32 -0700620 sources = [
621 "video/video_quality_test.cc",
622 "video/video_quality_test.h",
623 ]
624 deps = [
625 ":webrtc",
626 "system_wrappers",
627 "//testing/gtest",
628 ]
629 if (!is_android) {
630 deps += [ "modules/video_capture:video_capture_internal_impl" ]
631 }
632 if (is_clang) {
633 # Suppress warnings from the Chromium Clang plugin.
634 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700635 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
ehmaldonado529f83c2016-07-27 08:14:32 -0700636 }
637 }
638
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700639 webrtc_perf_tests_resources = [
640 "//resources/audio_coding/speech_mono_16kHz.pcm",
641 "//resources/audio_coding/testfile32kHz.pcm",
642 "//resources/ConferenceMotion_1280_720_50.yuv",
643 "//resources/difficult_photo_1850_1110.yuv",
644 "//resources/foreman_cif.yuv",
645 "//resources/google-wifi-3mbps.rx",
646 "//resources/paris_qcif.yuv",
647 "//resources/photo_1850_1110.yuv",
648 "//resources/presentation_1850_1110.yuv",
649 "//resources/verizon4g-downlink.rx",
650 "//resources/voice_engine/audio_long16.pcm",
651 "//resources/web_screenshot_1850_1110.yuv",
652 ]
kjellander32c4a202016-08-30 02:53:49 -0700653
654 if (is_ios) {
655 bundle_data("webrtc_perf_tests_bundle_data") {
656 testonly = true
657 sources = webrtc_perf_tests_resources
658 outputs = [
659 "{{bundle_resources_dir}}/{{source_file_part}}",
660 ]
661 }
662 }
663
charujainbb723e52016-09-13 05:52:48 -0700664 rtc_executable("webrtc_tests") {
665 testonly = true
666 deps = [
667 ":webrtc",
668 "modules/video_capture:video_capture_internal_impl",
669 "test",
670 ]
671 }
672
673 rtc_executable("video_loopback") {
674 testonly = true
675 sources = [
676 "test/run_test.h",
677 "video/video_loopback.cc",
678 ]
679
680 if (is_mac) {
681 sources += [ "test/mac/run_test.mm" ]
682 } else {
683 sources += [ "test/run_test.cc" ]
684 }
685 deps = [
686 ":video_quality_test",
687 "system_wrappers:metrics_default",
688 "test:field_trial",
689 "test:test_common",
690 "test:test_renderer",
691 "//testing/gmock",
692 "//testing/gtest",
693 "//third_party/gflags",
694 ]
695 if (is_clang && !is_nacl) {
696 # Suppress warnings from Chrome's Clang plugins.
697 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
698 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
699 }
700 }
701
ehmaldonado38a21322016-09-02 04:10:34 -0700702 rtc_test("webrtc_perf_tests") {
ehmaldonado529f83c2016-07-27 08:14:32 -0700703 testonly = true
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700704 configs += [ ":rtc_unittests_config" ]
ehmaldonado25f32e72016-08-31 08:22:09 -0700705
ehmaldonado529f83c2016-07-27 08:14:32 -0700706 sources = [
707 "call/call_perf_tests.cc",
708 "call/rampup_tests.cc",
709 "call/rampup_tests.h",
710 "modules/audio_coding/neteq/test/neteq_performance_unittest.cc",
711 "modules/audio_processing/audio_processing_performance_unittest.cc",
712 "modules/audio_processing/level_controller/level_controller_complexity_unittest.cc",
713 "modules/remote_bitrate_estimator/remote_bitrate_estimators_test.cc",
714 "video/full_stack.cc",
715 ]
716 deps = [
717 ":video_quality_test",
718 ":webrtc",
719 "modules/audio_coding:neteq_test_support",
720 "modules/audio_processing",
721 "modules/audio_processing:audioproc_test_utils",
terelius3dcfd642016-10-07 00:39:56 -0700722 "modules/remote_bitrate_estimator:bwe_simulator_lib",
ehmaldonado529f83c2016-07-27 08:14:32 -0700723 "modules/rtp_rtcp",
ehmaldonado529f83c2016-07-27 08:14:32 -0700724 "test:test_common",
725 "test:test_main",
726 "test:test_renderer",
727 "voice_engine",
728 "//testing/gmock",
729 "//testing/gtest",
730 ]
peahd29e3ea2016-09-13 21:42:39 -0700731
732 if (rtc_enable_intelligibility_enhancer) {
733 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
734 } else {
735 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
736 }
737
ehmaldonado3a7f35b2016-09-14 05:10:01 -0700738 data = webrtc_perf_tests_resources
ehmaldonado529f83c2016-07-27 08:14:32 -0700739 if (is_android) {
740 deps += [ "//testing/android/native_test:native_test_native_code" ]
sakal714dd4e2016-08-15 02:29:11 -0700741 shard_timeout = 2700
ehmaldonado529f83c2016-07-27 08:14:32 -0700742 }
kjellander32c4a202016-08-30 02:53:49 -0700743 if (is_ios) {
744 deps += [ ":webrtc_perf_tests_bundle_data" ]
745 }
ehmaldonado529f83c2016-07-27 08:14:32 -0700746 if (is_clang) {
747 # Suppress warnings from the Chromium Clang plugin.
748 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700749 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
ehmaldonado529f83c2016-07-27 08:14:32 -0700750 }
751 }
752
ehmaldonado38a21322016-09-02 04:10:34 -0700753 rtc_test("webrtc_nonparallel_tests") {
Peter Boströmac968bd2016-06-27 19:31:39 +0200754 testonly = true
ehmaldonado7a2ce0b2016-09-05 01:35:44 -0700755 configs += [ ":rtc_unittests_config" ]
Peter Boströmac968bd2016-06-27 19:31:39 +0200756 sources = [
757 "base/nullsocketserver_unittest.cc",
danilchapb7b9dca2016-08-05 05:55:43 -0700758 "base/physicalsocketserver_unittest.cc",
759 "base/socket_unittest.cc",
760 "base/socket_unittest.h",
Peter Boströmac968bd2016-06-27 19:31:39 +0200761 "base/socketaddress_unittest.cc",
762 "base/virtualsocket_unittest.cc",
763 ]
764 deps = [
765 "base:rtc_base",
766 "base:rtc_base_tests_utils",
767 "//testing/gtest",
768 ]
769 if (is_win) {
danilchapb7b9dca2016-08-05 05:55:43 -0700770 sources += [ "base/win32socketserver_unittest.cc" ]
Peter Boströmac968bd2016-06-27 19:31:39 +0200771 }
772 if (is_android) {
773 deps += [ "//testing/android/native_test:native_test_support" ]
sakal714dd4e2016-08-15 02:29:11 -0700774 shard_timeout = 900
Peter Boströmac968bd2016-06-27 19:31:39 +0200775 }
776
Peter Boströmac968bd2016-06-27 19:31:39 +0200777 if (is_clang) {
778 # Suppress warnings from the Chromium Clang plugin.
779 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
ehmaldonado38a21322016-09-02 04:10:34 -0700780 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
Peter Boströmac968bd2016-06-27 19:31:39 +0200781 }
782 }
sakal80a5bf12016-09-16 07:22:17 -0700783
784 if (is_android) {
785 junit_binary("android_junit_tests") {
kjellander4bb04982016-09-19 08:53:23 -0700786 java_files = [
787 "androidjunit/src/org/webrtc/CameraEnumerationTest.java",
788 "examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java",
789 "examples/androidjunit/src/org/appspot/apprtc/TCPChannelClientTest.java",
790 ]
sakal80a5bf12016-09-16 07:22:17 -0700791
792 deps = [
ehmaldonadoeb5040a2016-09-30 00:20:06 -0700793 "//base:base_java_test_support",
sakal80a5bf12016-09-16 07:22:17 -0700794 "//webrtc/api:libjingle_peerconnection_java",
795 "//webrtc/api:libjingle_peerconnection_jni",
Magnus Jedvertc1815cf2016-09-27 10:10:41 +0200796 "//webrtc/examples:AppRTCMobile_javalib",
sakal80a5bf12016-09-16 07:22:17 -0700797 ]
798 }
799 }
kjellander@webrtc.org3ee56142016-06-03 15:57:02 +0200800}