blob: d26d5e7d853ce6f39b5a89f5a87da7ef3ffc01a2 [file] [log] [blame]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
Henrik Kjellander73e21802017-06-20 08:38:58 +02002#
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
Henrik Kjellanderc0362762017-06-29 08:03:04 +02009import("//build/config/crypto.gni")
10import("//build/config/ui.gni")
Henrik Kjellander73e21802017-06-20 08:38:58 +020011import("../webrtc.gni")
12
13if (is_android) {
14 import("//build/config/android/config.gni")
15 import("//build/config/android/rules.gni")
16}
Henrik Kjellanderc0362762017-06-29 08:03:04 +020017if (is_win) {
18 import("//build/config/clang/clang.gni")
19}
Henrik Kjellander73e21802017-06-20 08:38:58 +020020
Henrik Kjellanderc0362762017-06-29 08:03:04 +020021group("base") {
22 public_deps = [
23 ":rtc_base",
24 ":rtc_base_approved",
25 ":rtc_task_queue",
26 ":sequenced_task_checker",
27 ":weak_ptr",
28 ]
Henrik Kjellander73e21802017-06-20 08:38:58 +020029 if (is_android) {
30 public_deps += [ ":base_java" ]
31 }
32}
33
Henrik Kjellanderc0362762017-06-29 08:03:04 +020034config("rtc_base_approved_all_dependent_config") {
35 if (is_mac && !build_with_chromium) {
36 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
37 }
38}
39
40config("rtc_base_chromium_config") {
41 defines = [ "NO_MAIN_THREAD_WRAPPING" ]
42}
43
44config("rtc_base_all_dependent_config") {
45 if (is_ios) {
46 libs = [
47 "CFNetwork.framework",
48 "Security.framework",
49 "SystemConfiguration.framework",
50 "UIKit.framework",
51 ]
52 }
53 if (is_mac) {
54 libs = [
55 "Cocoa.framework",
56 "Foundation.framework",
57 "IOKit.framework",
58 "Security.framework",
59 "SystemConfiguration.framework",
60 ]
61 }
62}
63
64if (!rtc_build_ssl) {
65 config("external_ssl_library") {
66 assert(rtc_ssl_root != "",
67 "You must specify rtc_ssl_root when rtc_build_ssl==0.")
68 include_dirs = [ rtc_ssl_root ]
69 }
70}
71
72source_set("protobuf_utils") {
73 sources = [
74 "protobuf_utils.h",
75 ]
76 if (rtc_enable_protobuf) {
77 public_deps = [
78 "//third_party/protobuf:protobuf_lite",
79 ]
80 }
81}
82
83source_set("compile_assert_c") {
84 sources = [
85 "compile_assert_c.h",
86 ]
87}
88
89# The subset of rtc_base approved for use outside of libjingle.
90rtc_static_library("rtc_base_approved") {
91 # TODO(kjellander): Remove (bugs.webrtc.org/7480)
92 # Enabling GN check triggers a cyclic dependency caused by rate_limiter.cc:
Jianjun Zhu037f3e42017-08-15 21:48:37 +080093 # :rtc_base_approved -> ../system_wrappers -> :rtc_base_approved
Henrik Kjellanderc0362762017-06-29 08:03:04 +020094 check_includes = false
95 defines = []
96 libs = []
97 deps = []
98 all_dependent_configs = [ ":rtc_base_approved_all_dependent_config" ]
99
100 sources = [
101 "array_view.h",
102 "arraysize.h",
103 "atomicops.h",
104 "base64.cc",
105 "base64.h",
106 "basictypes.h",
107 "bind.h",
108 "bitbuffer.cc",
109 "bitbuffer.h",
110 "buffer.h",
111 "bufferqueue.cc",
112 "bufferqueue.h",
113 "bytebuffer.cc",
114 "bytebuffer.h",
115 "byteorder.h",
116 "checks.cc",
117 "checks.h",
118 "constructormagic.h",
119 "copyonwritebuffer.cc",
120 "copyonwritebuffer.h",
121 "criticalsection.cc",
122 "criticalsection.h",
123 "deprecation.h",
124 "event.cc",
125 "event.h",
126 "event_tracer.cc",
127 "event_tracer.h",
128 "file.cc",
129 "file.h",
130 "flags.cc",
131 "flags.h",
132 "format_macros.h",
133 "function_view.h",
134 "ignore_wundef.h",
135 "location.cc",
136 "location.h",
137 "mod_ops.h",
ilnika79cc282017-08-23 05:24:10 -0700138 "moving_max_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200139 "onetimeevent.h",
140 "optional.cc",
141 "optional.h",
142 "pathutils.cc",
143 "pathutils.h",
144 "platform_file.cc",
145 "platform_file.h",
146 "platform_thread.cc",
147 "platform_thread.h",
148 "platform_thread_types.h",
149 "ptr_util.h",
150 "race_checker.cc",
151 "race_checker.h",
152 "random.cc",
153 "random.h",
154 "rate_limiter.cc",
155 "rate_limiter.h",
156 "rate_statistics.cc",
157 "rate_statistics.h",
158 "ratetracker.cc",
159 "ratetracker.h",
160 "refcount.h",
161 "refcountedobject.h",
162 "safe_compare.h",
163 "safe_conversions.h",
164 "safe_conversions_impl.h",
165 "safe_minmax.h",
166 "sanitizer.h",
167 "scoped_ref_ptr.h",
168 "string_to_number.cc",
169 "string_to_number.h",
170 "stringencode.cc",
171 "stringencode.h",
172 "stringize_macros.h",
173 "stringutils.cc",
174 "stringutils.h",
175 "swap_queue.h",
176 "template_util.h",
177 "thread_annotations.h",
178 "thread_checker.h",
179 "thread_checker_impl.cc",
180 "thread_checker_impl.h",
181 "timestampaligner.cc",
182 "timestampaligner.h",
183 "timeutils.cc",
184 "timeutils.h",
185 "trace_event.h",
186 "type_traits.h",
187 ]
188
189 deps += [ "..:webrtc_common" ]
190
191 if (is_android) {
192 libs += [ "log" ]
193 }
194
195 if (is_posix) {
196 sources += [ "file_posix.cc" ]
197 }
198
199 if (is_win) {
200 sources += [ "file_win.cc" ]
201 }
202
203 if (build_with_chromium) {
204 # Dependency on chromium's logging (in //base).
205 deps += [ "//base:base" ]
206 sources += [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700207 "../../webrtc_overrides/webrtc/rtc_base/logging.cc",
208 "../../webrtc_overrides/webrtc/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200209 ]
210 } else {
211 sources += [
212 "logging.cc",
213 "logging.h",
214 "logging_mac.mm",
215 ]
216 }
217 if (is_component_build && is_win) {
218 # Copy the VS runtime DLLs into the isolate so that they don't have to be
219 # preinstalled on the target machine. The debug runtimes have a "d" at
220 # the end.
221 # This is a copy of https://codereview.chromium.org/1783973002.
222 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
223 # so we don't have to copy their changes and risk breakages.
224 # See http://crbug.com/653569
225 if (is_debug) {
226 vcrt_suffix = "d"
227 } else {
228 vcrt_suffix = ""
229 }
230
231 # These runtime files are copied to the output directory by the
232 # vs_toolchain script that runs as part of toolchain configuration.
233 data = [
234 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
235 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
236 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
237
238 # Universal Windows 10 CRT files
239 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
240 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
241 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
242 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
243 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
244 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
245 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
246 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
248 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
249 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
250 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
251 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
256 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
261 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
266 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
279 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
280 ]
281 if (is_asan) {
282 if (current_cpu == "x64") {
283 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
284 } else {
285 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
286 }
287 }
288 }
289 if (is_nacl) {
290 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
291 }
292}
293
294config("enable_libevent_config") {
295 defines = [ "WEBRTC_BUILD_LIBEVENT" ]
296}
297
perkj650fdae2017-08-25 05:00:11 -0700298rtc_source_set("rtc_task_queue") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200299 public_deps = [
300 ":rtc_base_approved",
perkj650fdae2017-08-25 05:00:11 -0700301 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200302 ]
303
perkj650fdae2017-08-25 05:00:11 -0700304 if (rtc_link_task_queue_impl) {
305 deps = [
306 ":rtc_task_queue_impl",
307 ]
308 }
309}
310
311# WebRTC targets must not directly depend on rtc_task_queue_api or
312# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
313# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
314# to the default implemenation in rtc_task_queue_impl or if an externally
315# provided implementation should be used. An external implementation should
316# depend on rtc_task_queue_api.
317rtc_source_set("rtc_task_queue_api") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200318 if (build_with_chromium) {
319 sources = [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700320 "../../webrtc_overrides/webrtc/rtc_base/task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200321 ]
322 } else {
323 sources = [
324 "task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200325 ]
perkj650fdae2017-08-25 05:00:11 -0700326 }
327 deps = [
328 ":rtc_base_approved",
329 ]
330}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200331
perkj650fdae2017-08-25 05:00:11 -0700332rtc_source_set("rtc_task_queue_impl") {
333 deps = [
334 ":rtc_base_approved",
335 ":rtc_task_queue_api",
336 ]
337 if (build_with_chromium) {
338 sources = [
339 "../../webrtc_overrides/webrtc/rtc_base/task_queue.cc",
340 ]
341 } else {
342 if (rtc_build_libevent) {
343 deps += [ "//base/third_party/libevent" ]
344 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200345 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700346 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200347 "task_queue_libevent.cc",
348 "task_queue_posix.cc",
perkj650fdae2017-08-25 05:00:11 -0700349 "task_queue_posix.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200350 ]
351 all_dependent_configs = [ ":enable_libevent_config" ]
352 } else {
353 if (is_mac || is_ios) {
perkj650fdae2017-08-25 05:00:11 -0700354 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200355 "task_queue_gcd.cc",
356 "task_queue_posix.cc",
357 ]
358 }
359 if (is_win) {
perkj650fdae2017-08-25 05:00:11 -0700360 sources = [
361 "task_queue_win.cc",
362 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200363 }
364 }
365 }
366}
367
368rtc_static_library("sequenced_task_checker") {
369 sources = [
370 "sequenced_task_checker.h",
371 "sequenced_task_checker_impl.cc",
372 "sequenced_task_checker_impl.h",
373 ]
374 deps = [
375 ":rtc_task_queue",
376 ]
377}
378
379rtc_static_library("weak_ptr") {
380 sources = [
381 "weak_ptr.cc",
382 "weak_ptr.h",
383 ]
384 deps = [
385 ":rtc_base_approved",
386 ":sequenced_task_checker",
387 ]
388}
389
390rtc_static_library("rtc_numerics") {
391 sources = [
392 "numerics/exp_filter.cc",
393 "numerics/exp_filter.h",
394 "numerics/percentile_filter.h",
395 ]
396 deps = [
397 ":rtc_base_approved",
398 ]
399}
400
401config("rtc_base_warnings_config") {
402 if (is_win && is_clang) {
403 cflags = [
404 # Disable warnings failing when compiling with Clang on Windows.
405 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
406 "-Wno-sign-compare",
407 "-Wno-missing-braces",
408 ]
409 }
410}
411
412rtc_source_set("rtc_json") {
413 defines = []
414 sources = [
415 "json.cc",
416 "json.h",
417 ]
418 if (rtc_build_json) {
419 public_deps = [
420 "//third_party/jsoncpp",
421 ]
422 } else {
423 include_dirs = [ "$rtc_jsoncpp_root" ]
424
425 # When defined changes the include path for json.h to where it is
426 # expected to be when building json outside of the standalone build.
427 defines += [ "WEBRTC_EXTERNAL_JSON" ]
428 }
429}
430
431rtc_static_library("rtc_base") {
432 cflags = []
433 cflags_cc = []
434 libs = []
435 defines = []
436 deps = [
437 "..:webrtc_common",
438 ]
439 public_deps = [
440 ":rtc_base_approved",
441 ]
442 public_configs = []
443
444 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
445
446 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200447 "asyncinvoker-inl.h",
448 "asyncinvoker.cc",
449 "asyncinvoker.h",
450 "asyncpacketsocket.cc",
451 "asyncpacketsocket.h",
452 "asyncresolverinterface.cc",
453 "asyncresolverinterface.h",
454 "asyncsocket.cc",
455 "asyncsocket.h",
456 "asynctcpsocket.cc",
457 "asynctcpsocket.h",
458 "asyncudpsocket.cc",
459 "asyncudpsocket.h",
460 "crc32.cc",
461 "crc32.h",
462 "cryptstring.cc",
463 "cryptstring.h",
464 "filerotatingstream.cc",
465 "filerotatingstream.h",
466 "fileutils.cc",
467 "fileutils.h",
468 "gunit_prod.h",
469 "helpers.cc",
470 "helpers.h",
471 "httpbase.cc",
472 "httpbase.h",
473 "httpcommon-inl.h",
474 "httpcommon.cc",
475 "httpcommon.h",
476 "ipaddress.cc",
477 "ipaddress.h",
478 "messagedigest.cc",
479 "messagedigest.h",
480 "messagehandler.cc",
481 "messagehandler.h",
482 "messagequeue.cc",
483 "messagequeue.h",
484 "nethelpers.cc",
485 "nethelpers.h",
486 "network.cc",
487 "network.h",
488 "networkmonitor.cc",
489 "networkmonitor.h",
490 "nullsocketserver.cc",
491 "nullsocketserver.h",
492 "openssl.h",
493 "openssladapter.cc",
494 "openssladapter.h",
495 "openssldigest.cc",
496 "openssldigest.h",
497 "opensslidentity.cc",
498 "opensslidentity.h",
499 "opensslstreamadapter.cc",
500 "opensslstreamadapter.h",
501 "physicalsocketserver.cc",
502 "physicalsocketserver.h",
503 "proxyinfo.cc",
504 "proxyinfo.h",
505 "ratelimiter.cc",
506 "ratelimiter.h",
507 "rtccertificate.cc",
508 "rtccertificate.h",
509 "rtccertificategenerator.cc",
510 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700511 "signalthread.cc",
512 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200513 "sigslot.cc",
514 "sigslot.h",
515 "socket.h",
516 "socketadapters.cc",
517 "socketadapters.h",
518 "socketaddress.cc",
519 "socketaddress.h",
520 "socketaddresspair.cc",
521 "socketaddresspair.h",
522 "socketfactory.h",
523 "socketserver.h",
524 "socketstream.cc",
525 "socketstream.h",
526 "ssladapter.cc",
527 "ssladapter.h",
528 "sslfingerprint.cc",
529 "sslfingerprint.h",
530 "sslidentity.cc",
531 "sslidentity.h",
532 "sslstreamadapter.cc",
533 "sslstreamadapter.h",
534 "stream.cc",
535 "stream.h",
536 "thread.cc",
537 "thread.h",
538 ]
539
540 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
541 # compiler settings.
542 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
543 configs += [ "//build/config/compiler:no_chromium_code" ]
544 if (!is_win) {
545 cflags += [ "-Wno-uninitialized" ]
546 }
547
548 if (build_with_chromium) {
549 if (is_win) {
ehmaldonadof6a861a2017-07-19 10:40:47 -0700550 sources += [ "../../webrtc_overrides/webrtc/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200551 }
552 include_dirs = [ "../../boringssl/src/include" ]
553 public_configs += [ ":rtc_base_chromium_config" ]
554 } else {
555 configs += [ ":rtc_base_warnings_config" ]
556 sources += [
557 "callback.h",
558 "logsinks.cc",
559 "logsinks.h",
560 "mathutils.h",
561 "optionsfile.cc",
562 "optionsfile.h",
563 "rollingaccumulator.h",
564 "sslroots.h",
565 "transformadapter.cc",
566 "transformadapter.h",
567 "window.h",
568 ]
569
570 if (is_win) {
571 sources += [
572 "win32socketinit.cc",
573 "win32socketinit.h",
574 "win32socketserver.cc",
575 "win32socketserver.h",
576 ]
577 }
578 } # !build_with_chromium
579
580 if (rtc_build_ssl) {
581 deps += [ "//third_party/boringssl" ]
582 } else {
583 configs += [ ":external_ssl_library" ]
584 }
585
586 if (is_android) {
587 sources += [
588 "ifaddrs-android.cc",
589 "ifaddrs-android.h",
590 ]
591
592 libs += [
593 "log",
594 "GLESv2",
595 ]
596 }
597
598 if (is_ios || is_mac) {
599 sources += [
600 "macifaddrs_converter.cc",
601 "thread_darwin.mm",
602 ]
603 }
604
605 if (use_x11) {
606 libs += [
607 "dl",
608 "rt",
609 "Xext",
610 "X11",
611 "Xcomposite",
612 "Xrender",
613 ]
614 }
615
616 if (is_linux) {
617 libs += [
618 "dl",
619 "rt",
620 ]
621 }
622
623 if (is_mac) {
624 sources += [
625 "macutils.cc",
626 "macutils.h",
627 ]
628 libs += [
629 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
630 "ApplicationServices.framework",
631 ]
632 }
633
634 if (is_win) {
635 sources += [
636 "win32.cc",
637 "win32.h",
638 "win32filesystem.cc",
639 "win32filesystem.h",
640 "win32securityerrors.cc",
641 "win32window.cc",
642 "win32window.h",
643 ]
644
645 libs += [
646 "crypt32.lib",
647 "iphlpapi.lib",
648 "secur32.lib",
649 ]
650
651 cflags += [
652 # Suppress warnings about WIN32_LEAN_AND_MEAN.
653 "/wd4005",
654 "/wd4703",
655 ]
656
657 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
658 }
659
660 if (is_posix) {
661 sources += [
662 "ifaddrs_converter.cc",
663 "ifaddrs_converter.h",
664 "unixfilesystem.cc",
665 "unixfilesystem.h",
666 ]
667 }
668
669 if (is_nacl) {
670 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
671 defines += [ "timezone=_timezone" ]
672 sources -= [ "ifaddrs_converter.cc" ]
673 }
674 if (is_win && is_clang) {
675 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
676 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
677 }
678}
679
680rtc_source_set("gtest_prod") {
681 sources = [
682 "gtest_prod_util.h",
683 ]
684}
685
686config("rtc_base_tests_utils_exported_config") {
687 defines = [ "GTEST_RELATIVE_PATH" ]
688}
689
690config("rtc_base_tests_utils_warnings_config") {
691 if (is_win && is_clang) {
692 cflags = [
693 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
694 "-Wno-reorder",
695 "-Wno-sign-compare",
696 ]
697 }
698}
699
700rtc_source_set("rtc_base_tests_utils") {
701 testonly = true
702 sources = [
703 # Also use this as a convenient dumping ground for misc files that are
704 # included by multiple targets below.
705 "cpu_time.cc",
706 "cpu_time.h",
707 "fakeclock.cc",
708 "fakeclock.h",
709 "fakenetwork.h",
710 "fakesslidentity.h",
711 "firewallsocketserver.cc",
712 "firewallsocketserver.h",
713 "gunit.h",
714 "httpserver.cc",
715 "httpserver.h",
716 "md5.cc",
717 "md5.h",
718 "md5digest.cc",
719 "md5digest.h",
720 "memory_usage.cc",
721 "memory_usage.h",
722 "natserver.cc",
723 "natserver.h",
724 "natsocketfactory.cc",
725 "natsocketfactory.h",
726 "nattypes.cc",
727 "nattypes.h",
728 "proxyserver.cc",
729 "proxyserver.h",
730 "sha1.cc",
731 "sha1.h",
732 "sha1digest.cc",
733 "sha1digest.h",
734 "sigslottester.h",
735 "sigslottester.h.pump",
736 "testbase64.h",
737 "testclient.cc",
738 "testclient.h",
739 "testechoserver.h",
740 "testutils.h",
741 "timedelta.h",
742 "virtualsocketserver.cc",
743 "virtualsocketserver.h",
744 ]
745 configs += [ ":rtc_base_tests_utils_warnings_config" ]
746 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
747 deps = [
748 ":rtc_base",
749 "../test:field_trial",
750 "../test:test_support",
751 ]
752 public_deps = [
753 "//testing/gmock",
754 "//testing/gtest",
755 ]
756
757 if (!build_with_chromium && is_clang) {
758 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
759 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
760 }
761}
762
763if (rtc_include_tests) {
764 rtc_source_set("rtc_base_tests_main") {
765 testonly = true
766 sources = [
767 "unittest_main.cc",
768 ]
769 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
770 deps = [
771 ":rtc_base",
772 ":rtc_base_approved",
773 ":rtc_base_tests_utils",
774 "../test:field_trial",
775 "../test:test_support",
776 ]
777
778 public_deps = [
779 "//testing/gmock",
780 "//testing/gtest",
781 ]
782
783 if (!build_with_chromium && is_clang) {
784 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
785 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
786 }
787 }
788
789 rtc_source_set("rtc_base_nonparallel_tests") {
790 testonly = true
791
792 # Skip restricting visibility on mobile platforms since the tests on those
793 # gets additional generated targets which would require many lines here to
794 # cover (which would be confusing to read and hard to maintain).
795 if (!is_android && !is_ios) {
796 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800797 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200798 }
799 sources = [
800 "cpu_time_unittest.cc",
801 "filerotatingstream_unittest.cc",
802 "nullsocketserver_unittest.cc",
803 "physicalsocketserver_unittest.cc",
804 "socket_unittest.cc",
805 "socket_unittest.h",
806 "socketaddress_unittest.cc",
807 ]
808 deps = [
809 ":rtc_base",
810 ":rtc_base_tests_main",
811 ":rtc_base_tests_utils",
812 "../system_wrappers:system_wrappers",
813 "../test:test_support",
814 "//testing/gtest",
815 ]
816 if (is_win) {
817 sources += [ "win32socketserver_unittest.cc" ]
818 }
819
820 if (!build_with_chromium && is_clang) {
821 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
822 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
823 }
824 }
825
826 rtc_source_set("rtc_base_approved_unittests") {
827 testonly = true
828
829 # Skip restricting visibility on mobile platforms since the tests on those
830 # gets additional generated targets which would require many lines here to
831 # cover (which would be confusing to read and hard to maintain).
832 if (!is_android && !is_ios) {
833 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800834 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200835 }
836 sources = [
837 "array_view_unittest.cc",
838 "atomicops_unittest.cc",
839 "base64_unittest.cc",
840 "basictypes_unittest.cc",
841 "bind_unittest.cc",
842 "bitbuffer_unittest.cc",
843 "buffer_unittest.cc",
844 "bufferqueue_unittest.cc",
845 "bytebuffer_unittest.cc",
846 "byteorder_unittest.cc",
847 "copyonwritebuffer_unittest.cc",
848 "criticalsection_unittest.cc",
849 "event_tracer_unittest.cc",
850 "event_unittest.cc",
851 "file_unittest.cc",
852 "function_view_unittest.cc",
853 "logging_unittest.cc",
854 "md5digest_unittest.cc",
855 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700856 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200857 "onetimeevent_unittest.cc",
858 "optional_unittest.cc",
859 "pathutils_unittest.cc",
860 "platform_thread_unittest.cc",
861 "random_unittest.cc",
862 "rate_limiter_unittest.cc",
863 "rate_statistics_unittest.cc",
864 "ratetracker_unittest.cc",
865 "refcountedobject_unittest.cc",
866 "safe_compare_unittest.cc",
867 "safe_minmax_unittest.cc",
868 "string_to_number_unittest.cc",
869 "stringencode_unittest.cc",
870 "stringize_macros_unittest.cc",
871 "stringutils_unittest.cc",
872 "swap_queue_unittest.cc",
873 "thread_annotations_unittest.cc",
874 "thread_checker_unittest.cc",
875 "timestampaligner_unittest.cc",
876 "timeutils_unittest.cc",
877 "virtualsocket_unittest.cc",
878 ]
879 deps = [
880 ":rtc_base",
881 ":rtc_base_approved",
882 ":rtc_base_tests_main",
883 ":rtc_base_tests_utils",
884 ":rtc_task_queue",
885 "../system_wrappers:system_wrappers",
886 "../test:test_support",
887 ]
888 if (!build_with_chromium && is_clang) {
889 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
890 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
891 }
892 }
893
894 rtc_source_set("rtc_task_queue_unittests") {
895 testonly = true
896
897 # Skip restricting visibility on mobile platforms since the tests on those
898 # gets additional generated targets which would require many lines here to
899 # cover (which would be confusing to read and hard to maintain).
900 if (!is_android && !is_ios) {
901 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800902 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200903 }
904 sources = [
905 "task_queue_unittest.cc",
906 ]
907 deps = [
908 ":rtc_base_tests_main",
909 ":rtc_base_tests_utils",
910 ":rtc_task_queue",
911 "../test:test_support",
912 ]
913 if (!build_with_chromium && is_clang) {
914 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
915 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
916 }
917 }
918
919 rtc_source_set("sequenced_task_checker_unittests") {
920 testonly = true
921
922 # Skip restricting visibility on mobile platforms since the tests on those
923 # gets additional generated targets which would require many lines here to
924 # cover (which would be confusing to read and hard to maintain).
925 if (!is_android && !is_ios) {
926 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800927 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200928 }
929 sources = [
930 "sequenced_task_checker_unittest.cc",
931 ]
932 deps = [
933 ":rtc_base_approved",
934 ":rtc_base_tests_main",
935 ":rtc_task_queue",
936 ":sequenced_task_checker",
937 "../test:test_support",
938 ]
939 }
940
941 rtc_source_set("weak_ptr_unittests") {
942 testonly = true
943
944 # Skip restricting visibility on mobile platforms since the tests on those
945 # gets additional generated targets which would require many lines here to
946 # cover (which would be confusing to read and hard to maintain).
947 if (!is_android && !is_ios) {
948 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800949 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200950 }
951 sources = [
952 "weak_ptr_unittest.cc",
953 ]
954 deps = [
955 ":rtc_base_tests_main",
956 ":rtc_base_tests_utils",
957 ":rtc_task_queue",
958 ":weak_ptr",
959 "../test:test_support",
960 ]
961 }
962
963 rtc_source_set("rtc_numerics_unittests") {
964 testonly = true
965
966 # Skip restricting visibility on mobile platforms since the tests on those
967 # gets additional generated targets which would require many lines here to
968 # cover (which would be confusing to read and hard to maintain).
969 if (!is_android && !is_ios) {
970 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800971 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200972 }
973 sources = [
974 "numerics/exp_filter_unittest.cc",
975 "numerics/percentile_filter_unittest.cc",
976 ]
977 deps = [
978 ":rtc_base_approved",
979 ":rtc_base_tests_main",
980 ":rtc_numerics",
981 "../test:test_support",
982 ]
983 }
984
985 config("rtc_base_unittests_config") {
986 if (is_clang) {
987 cflags = [ "-Wno-unused-const-variable" ]
988 }
989 }
990 rtc_source_set("rtc_base_unittests") {
991 testonly = true
992
993 # Skip restricting visibility on mobile platforms since the tests on those
994 # gets additional generated targets which would require many lines here to
995 # cover (which would be confusing to read and hard to maintain).
996 if (!is_android && !is_ios) {
997 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800998 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200999 }
1000 sources = [
1001 "callback_unittest.cc",
1002 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001003 "helpers_unittest.cc",
1004 "httpbase_unittest.cc",
1005 "httpcommon_unittest.cc",
1006 "httpserver_unittest.cc",
1007 "ipaddress_unittest.cc",
1008 "memory_usage_unittest.cc",
1009 "messagedigest_unittest.cc",
1010 "messagequeue_unittest.cc",
1011 "nat_unittest.cc",
1012 "network_unittest.cc",
1013 "optionsfile_unittest.cc",
1014 "proxy_unittest.cc",
1015 "ptr_util_unittest.cc",
1016 "ratelimiter_unittest.cc",
1017 "rollingaccumulator_unittest.cc",
1018 "rtccertificate_unittest.cc",
1019 "rtccertificategenerator_unittest.cc",
1020 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001021 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001022 "sigslot_unittest.cc",
1023 "sigslottester_unittest.cc",
1024 "stream_unittest.cc",
1025 "testclient_unittest.cc",
1026 "thread_unittest.cc",
1027 ]
1028 if (is_win) {
1029 sources += [
1030 "win32_unittest.cc",
1031 "win32window_unittest.cc",
1032 ]
1033 }
1034 if (is_mac) {
1035 sources += [ "macutils_unittest.cc" ]
1036 }
1037 if (is_posix) {
1038 sources += [
1039 "ssladapter_unittest.cc",
1040 "sslidentity_unittest.cc",
1041 "sslstreamadapter_unittest.cc",
1042 ]
1043 }
1044 deps = [
1045 ":rtc_base_tests_main",
1046 ":rtc_base_tests_utils",
1047 "../test:test_support",
1048 ]
1049 public_deps = [
1050 ":rtc_base",
1051 ]
1052 configs += [ ":rtc_base_unittests_config" ]
1053 if (!build_with_chromium && is_clang) {
1054 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1055 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1056 }
1057 }
1058}
1059
Henrik Kjellander73e21802017-06-20 08:38:58 +02001060if (is_android) {
1061 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001062 java_files = [
1063 "java/src/org/webrtc/ContextUtils.java",
1064 "java/src/org/webrtc/Logging.java",
1065 "java/src/org/webrtc/Size.java",
1066 "java/src/org/webrtc/ThreadUtils.java",
1067 ]
Henrik Kjellander73e21802017-06-20 08:38:58 +02001068 }
1069}