blob: a9e82e510bfd14be537640787f4dd3452d055e4a [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
298rtc_static_library("rtc_task_queue") {
299 public_deps = [
300 ":rtc_base_approved",
301 ]
302
303 if (build_with_chromium) {
304 sources = [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700305 "../../webrtc_overrides/webrtc/rtc_base/task_queue.cc",
306 "../../webrtc_overrides/webrtc/rtc_base/task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200307 ]
308 } else {
309 sources = [
310 "task_queue.h",
311 "task_queue_posix.h",
312 ]
313 if (rtc_build_libevent) {
314 deps = [
315 "//base/third_party/libevent",
316 ]
317 }
318
319 if (rtc_enable_libevent) {
320 sources += [
321 "task_queue_libevent.cc",
322 "task_queue_posix.cc",
323 ]
324 all_dependent_configs = [ ":enable_libevent_config" ]
325 } else {
326 if (is_mac || is_ios) {
327 sources += [
328 "task_queue_gcd.cc",
329 "task_queue_posix.cc",
330 ]
331 }
332 if (is_win) {
333 sources += [ "task_queue_win.cc" ]
334 }
335 }
336 }
337}
338
339rtc_static_library("sequenced_task_checker") {
340 sources = [
341 "sequenced_task_checker.h",
342 "sequenced_task_checker_impl.cc",
343 "sequenced_task_checker_impl.h",
344 ]
345 deps = [
346 ":rtc_task_queue",
347 ]
348}
349
350rtc_static_library("weak_ptr") {
351 sources = [
352 "weak_ptr.cc",
353 "weak_ptr.h",
354 ]
355 deps = [
356 ":rtc_base_approved",
357 ":sequenced_task_checker",
358 ]
359}
360
361rtc_static_library("rtc_numerics") {
362 sources = [
363 "numerics/exp_filter.cc",
364 "numerics/exp_filter.h",
365 "numerics/percentile_filter.h",
366 ]
367 deps = [
368 ":rtc_base_approved",
369 ]
370}
371
372config("rtc_base_warnings_config") {
373 if (is_win && is_clang) {
374 cflags = [
375 # Disable warnings failing when compiling with Clang on Windows.
376 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
377 "-Wno-sign-compare",
378 "-Wno-missing-braces",
379 ]
380 }
381}
382
383rtc_source_set("rtc_json") {
384 defines = []
385 sources = [
386 "json.cc",
387 "json.h",
388 ]
389 if (rtc_build_json) {
390 public_deps = [
391 "//third_party/jsoncpp",
392 ]
393 } else {
394 include_dirs = [ "$rtc_jsoncpp_root" ]
395
396 # When defined changes the include path for json.h to where it is
397 # expected to be when building json outside of the standalone build.
398 defines += [ "WEBRTC_EXTERNAL_JSON" ]
399 }
400}
401
402rtc_static_library("rtc_base") {
403 cflags = []
404 cflags_cc = []
405 libs = []
406 defines = []
407 deps = [
408 "..:webrtc_common",
409 ]
410 public_deps = [
411 ":rtc_base_approved",
412 ]
413 public_configs = []
414
415 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
416
417 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200418 "asyncinvoker-inl.h",
419 "asyncinvoker.cc",
420 "asyncinvoker.h",
421 "asyncpacketsocket.cc",
422 "asyncpacketsocket.h",
423 "asyncresolverinterface.cc",
424 "asyncresolverinterface.h",
425 "asyncsocket.cc",
426 "asyncsocket.h",
427 "asynctcpsocket.cc",
428 "asynctcpsocket.h",
429 "asyncudpsocket.cc",
430 "asyncudpsocket.h",
431 "crc32.cc",
432 "crc32.h",
433 "cryptstring.cc",
434 "cryptstring.h",
435 "filerotatingstream.cc",
436 "filerotatingstream.h",
437 "fileutils.cc",
438 "fileutils.h",
439 "gunit_prod.h",
440 "helpers.cc",
441 "helpers.h",
442 "httpbase.cc",
443 "httpbase.h",
444 "httpcommon-inl.h",
445 "httpcommon.cc",
446 "httpcommon.h",
447 "ipaddress.cc",
448 "ipaddress.h",
449 "messagedigest.cc",
450 "messagedigest.h",
451 "messagehandler.cc",
452 "messagehandler.h",
453 "messagequeue.cc",
454 "messagequeue.h",
455 "nethelpers.cc",
456 "nethelpers.h",
457 "network.cc",
458 "network.h",
459 "networkmonitor.cc",
460 "networkmonitor.h",
461 "nullsocketserver.cc",
462 "nullsocketserver.h",
463 "openssl.h",
464 "openssladapter.cc",
465 "openssladapter.h",
466 "openssldigest.cc",
467 "openssldigest.h",
468 "opensslidentity.cc",
469 "opensslidentity.h",
470 "opensslstreamadapter.cc",
471 "opensslstreamadapter.h",
472 "physicalsocketserver.cc",
473 "physicalsocketserver.h",
474 "proxyinfo.cc",
475 "proxyinfo.h",
476 "ratelimiter.cc",
477 "ratelimiter.h",
478 "rtccertificate.cc",
479 "rtccertificate.h",
480 "rtccertificategenerator.cc",
481 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700482 "signalthread.cc",
483 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200484 "sigslot.cc",
485 "sigslot.h",
486 "socket.h",
487 "socketadapters.cc",
488 "socketadapters.h",
489 "socketaddress.cc",
490 "socketaddress.h",
491 "socketaddresspair.cc",
492 "socketaddresspair.h",
493 "socketfactory.h",
494 "socketserver.h",
495 "socketstream.cc",
496 "socketstream.h",
497 "ssladapter.cc",
498 "ssladapter.h",
499 "sslfingerprint.cc",
500 "sslfingerprint.h",
501 "sslidentity.cc",
502 "sslidentity.h",
503 "sslstreamadapter.cc",
504 "sslstreamadapter.h",
505 "stream.cc",
506 "stream.h",
507 "thread.cc",
508 "thread.h",
509 ]
510
511 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
512 # compiler settings.
513 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
514 configs += [ "//build/config/compiler:no_chromium_code" ]
515 if (!is_win) {
516 cflags += [ "-Wno-uninitialized" ]
517 }
518
519 if (build_with_chromium) {
520 if (is_win) {
ehmaldonadof6a861a2017-07-19 10:40:47 -0700521 sources += [ "../../webrtc_overrides/webrtc/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200522 }
523 include_dirs = [ "../../boringssl/src/include" ]
524 public_configs += [ ":rtc_base_chromium_config" ]
525 } else {
526 configs += [ ":rtc_base_warnings_config" ]
527 sources += [
528 "callback.h",
529 "logsinks.cc",
530 "logsinks.h",
531 "mathutils.h",
532 "optionsfile.cc",
533 "optionsfile.h",
534 "rollingaccumulator.h",
535 "sslroots.h",
536 "transformadapter.cc",
537 "transformadapter.h",
538 "window.h",
539 ]
540
541 if (is_win) {
542 sources += [
543 "win32socketinit.cc",
544 "win32socketinit.h",
545 "win32socketserver.cc",
546 "win32socketserver.h",
547 ]
548 }
549 } # !build_with_chromium
550
551 if (rtc_build_ssl) {
552 deps += [ "//third_party/boringssl" ]
553 } else {
554 configs += [ ":external_ssl_library" ]
555 }
556
557 if (is_android) {
558 sources += [
559 "ifaddrs-android.cc",
560 "ifaddrs-android.h",
561 ]
562
563 libs += [
564 "log",
565 "GLESv2",
566 ]
567 }
568
569 if (is_ios || is_mac) {
570 sources += [
571 "macifaddrs_converter.cc",
572 "thread_darwin.mm",
573 ]
574 }
575
576 if (use_x11) {
577 libs += [
578 "dl",
579 "rt",
580 "Xext",
581 "X11",
582 "Xcomposite",
583 "Xrender",
584 ]
585 }
586
587 if (is_linux) {
588 libs += [
589 "dl",
590 "rt",
591 ]
592 }
593
594 if (is_mac) {
595 sources += [
596 "macutils.cc",
597 "macutils.h",
598 ]
599 libs += [
600 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
601 "ApplicationServices.framework",
602 ]
603 }
604
605 if (is_win) {
606 sources += [
607 "win32.cc",
608 "win32.h",
609 "win32filesystem.cc",
610 "win32filesystem.h",
611 "win32securityerrors.cc",
612 "win32window.cc",
613 "win32window.h",
614 ]
615
616 libs += [
617 "crypt32.lib",
618 "iphlpapi.lib",
619 "secur32.lib",
620 ]
621
622 cflags += [
623 # Suppress warnings about WIN32_LEAN_AND_MEAN.
624 "/wd4005",
625 "/wd4703",
626 ]
627
628 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
629 }
630
631 if (is_posix) {
632 sources += [
633 "ifaddrs_converter.cc",
634 "ifaddrs_converter.h",
635 "unixfilesystem.cc",
636 "unixfilesystem.h",
637 ]
638 }
639
640 if (is_nacl) {
641 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
642 defines += [ "timezone=_timezone" ]
643 sources -= [ "ifaddrs_converter.cc" ]
644 }
645 if (is_win && is_clang) {
646 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
647 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
648 }
649}
650
651rtc_source_set("gtest_prod") {
652 sources = [
653 "gtest_prod_util.h",
654 ]
655}
656
657config("rtc_base_tests_utils_exported_config") {
658 defines = [ "GTEST_RELATIVE_PATH" ]
659}
660
661config("rtc_base_tests_utils_warnings_config") {
662 if (is_win && is_clang) {
663 cflags = [
664 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
665 "-Wno-reorder",
666 "-Wno-sign-compare",
667 ]
668 }
669}
670
671rtc_source_set("rtc_base_tests_utils") {
672 testonly = true
673 sources = [
674 # Also use this as a convenient dumping ground for misc files that are
675 # included by multiple targets below.
676 "cpu_time.cc",
677 "cpu_time.h",
678 "fakeclock.cc",
679 "fakeclock.h",
680 "fakenetwork.h",
681 "fakesslidentity.h",
682 "firewallsocketserver.cc",
683 "firewallsocketserver.h",
684 "gunit.h",
685 "httpserver.cc",
686 "httpserver.h",
687 "md5.cc",
688 "md5.h",
689 "md5digest.cc",
690 "md5digest.h",
691 "memory_usage.cc",
692 "memory_usage.h",
693 "natserver.cc",
694 "natserver.h",
695 "natsocketfactory.cc",
696 "natsocketfactory.h",
697 "nattypes.cc",
698 "nattypes.h",
699 "proxyserver.cc",
700 "proxyserver.h",
701 "sha1.cc",
702 "sha1.h",
703 "sha1digest.cc",
704 "sha1digest.h",
705 "sigslottester.h",
706 "sigslottester.h.pump",
707 "testbase64.h",
708 "testclient.cc",
709 "testclient.h",
710 "testechoserver.h",
711 "testutils.h",
712 "timedelta.h",
713 "virtualsocketserver.cc",
714 "virtualsocketserver.h",
715 ]
716 configs += [ ":rtc_base_tests_utils_warnings_config" ]
717 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
718 deps = [
719 ":rtc_base",
720 "../test:field_trial",
721 "../test:test_support",
722 ]
723 public_deps = [
724 "//testing/gmock",
725 "//testing/gtest",
726 ]
727
728 if (!build_with_chromium && is_clang) {
729 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
730 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
731 }
732}
733
734if (rtc_include_tests) {
735 rtc_source_set("rtc_base_tests_main") {
736 testonly = true
737 sources = [
738 "unittest_main.cc",
739 ]
740 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
741 deps = [
742 ":rtc_base",
743 ":rtc_base_approved",
744 ":rtc_base_tests_utils",
745 "../test:field_trial",
746 "../test:test_support",
747 ]
748
749 public_deps = [
750 "//testing/gmock",
751 "//testing/gtest",
752 ]
753
754 if (!build_with_chromium && is_clang) {
755 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
756 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
757 }
758 }
759
760 rtc_source_set("rtc_base_nonparallel_tests") {
761 testonly = true
762
763 # Skip restricting visibility on mobile platforms since the tests on those
764 # gets additional generated targets which would require many lines here to
765 # cover (which would be confusing to read and hard to maintain).
766 if (!is_android && !is_ios) {
767 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800768 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200769 }
770 sources = [
771 "cpu_time_unittest.cc",
772 "filerotatingstream_unittest.cc",
773 "nullsocketserver_unittest.cc",
774 "physicalsocketserver_unittest.cc",
775 "socket_unittest.cc",
776 "socket_unittest.h",
777 "socketaddress_unittest.cc",
778 ]
779 deps = [
780 ":rtc_base",
781 ":rtc_base_tests_main",
782 ":rtc_base_tests_utils",
783 "../system_wrappers:system_wrappers",
784 "../test:test_support",
785 "//testing/gtest",
786 ]
787 if (is_win) {
788 sources += [ "win32socketserver_unittest.cc" ]
789 }
790
791 if (!build_with_chromium && is_clang) {
792 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
793 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
794 }
795 }
796
797 rtc_source_set("rtc_base_approved_unittests") {
798 testonly = true
799
800 # Skip restricting visibility on mobile platforms since the tests on those
801 # gets additional generated targets which would require many lines here to
802 # cover (which would be confusing to read and hard to maintain).
803 if (!is_android && !is_ios) {
804 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800805 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200806 }
807 sources = [
808 "array_view_unittest.cc",
809 "atomicops_unittest.cc",
810 "base64_unittest.cc",
811 "basictypes_unittest.cc",
812 "bind_unittest.cc",
813 "bitbuffer_unittest.cc",
814 "buffer_unittest.cc",
815 "bufferqueue_unittest.cc",
816 "bytebuffer_unittest.cc",
817 "byteorder_unittest.cc",
818 "copyonwritebuffer_unittest.cc",
819 "criticalsection_unittest.cc",
820 "event_tracer_unittest.cc",
821 "event_unittest.cc",
822 "file_unittest.cc",
823 "function_view_unittest.cc",
824 "logging_unittest.cc",
825 "md5digest_unittest.cc",
826 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700827 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200828 "onetimeevent_unittest.cc",
829 "optional_unittest.cc",
830 "pathutils_unittest.cc",
831 "platform_thread_unittest.cc",
832 "random_unittest.cc",
833 "rate_limiter_unittest.cc",
834 "rate_statistics_unittest.cc",
835 "ratetracker_unittest.cc",
836 "refcountedobject_unittest.cc",
837 "safe_compare_unittest.cc",
838 "safe_minmax_unittest.cc",
839 "string_to_number_unittest.cc",
840 "stringencode_unittest.cc",
841 "stringize_macros_unittest.cc",
842 "stringutils_unittest.cc",
843 "swap_queue_unittest.cc",
844 "thread_annotations_unittest.cc",
845 "thread_checker_unittest.cc",
846 "timestampaligner_unittest.cc",
847 "timeutils_unittest.cc",
848 "virtualsocket_unittest.cc",
849 ]
850 deps = [
851 ":rtc_base",
852 ":rtc_base_approved",
853 ":rtc_base_tests_main",
854 ":rtc_base_tests_utils",
855 ":rtc_task_queue",
856 "../system_wrappers:system_wrappers",
857 "../test:test_support",
858 ]
859 if (!build_with_chromium && is_clang) {
860 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
861 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
862 }
863 }
864
865 rtc_source_set("rtc_task_queue_unittests") {
866 testonly = true
867
868 # Skip restricting visibility on mobile platforms since the tests on those
869 # gets additional generated targets which would require many lines here to
870 # cover (which would be confusing to read and hard to maintain).
871 if (!is_android && !is_ios) {
872 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800873 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200874 }
875 sources = [
876 "task_queue_unittest.cc",
877 ]
878 deps = [
879 ":rtc_base_tests_main",
880 ":rtc_base_tests_utils",
881 ":rtc_task_queue",
882 "../test:test_support",
883 ]
884 if (!build_with_chromium && is_clang) {
885 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
886 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
887 }
888 }
889
890 rtc_source_set("sequenced_task_checker_unittests") {
891 testonly = true
892
893 # Skip restricting visibility on mobile platforms since the tests on those
894 # gets additional generated targets which would require many lines here to
895 # cover (which would be confusing to read and hard to maintain).
896 if (!is_android && !is_ios) {
897 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800898 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200899 }
900 sources = [
901 "sequenced_task_checker_unittest.cc",
902 ]
903 deps = [
904 ":rtc_base_approved",
905 ":rtc_base_tests_main",
906 ":rtc_task_queue",
907 ":sequenced_task_checker",
908 "../test:test_support",
909 ]
910 }
911
912 rtc_source_set("weak_ptr_unittests") {
913 testonly = true
914
915 # Skip restricting visibility on mobile platforms since the tests on those
916 # gets additional generated targets which would require many lines here to
917 # cover (which would be confusing to read and hard to maintain).
918 if (!is_android && !is_ios) {
919 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800920 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200921 }
922 sources = [
923 "weak_ptr_unittest.cc",
924 ]
925 deps = [
926 ":rtc_base_tests_main",
927 ":rtc_base_tests_utils",
928 ":rtc_task_queue",
929 ":weak_ptr",
930 "../test:test_support",
931 ]
932 }
933
934 rtc_source_set("rtc_numerics_unittests") {
935 testonly = true
936
937 # Skip restricting visibility on mobile platforms since the tests on those
938 # gets additional generated targets which would require many lines here to
939 # cover (which would be confusing to read and hard to maintain).
940 if (!is_android && !is_ios) {
941 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800942 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200943 }
944 sources = [
945 "numerics/exp_filter_unittest.cc",
946 "numerics/percentile_filter_unittest.cc",
947 ]
948 deps = [
949 ":rtc_base_approved",
950 ":rtc_base_tests_main",
951 ":rtc_numerics",
952 "../test:test_support",
953 ]
954 }
955
956 config("rtc_base_unittests_config") {
957 if (is_clang) {
958 cflags = [ "-Wno-unused-const-variable" ]
959 }
960 }
961 rtc_source_set("rtc_base_unittests") {
962 testonly = true
963
964 # Skip restricting visibility on mobile platforms since the tests on those
965 # gets additional generated targets which would require many lines here to
966 # cover (which would be confusing to read and hard to maintain).
967 if (!is_android && !is_ios) {
968 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800969 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200970 }
971 sources = [
972 "callback_unittest.cc",
973 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200974 "helpers_unittest.cc",
975 "httpbase_unittest.cc",
976 "httpcommon_unittest.cc",
977 "httpserver_unittest.cc",
978 "ipaddress_unittest.cc",
979 "memory_usage_unittest.cc",
980 "messagedigest_unittest.cc",
981 "messagequeue_unittest.cc",
982 "nat_unittest.cc",
983 "network_unittest.cc",
984 "optionsfile_unittest.cc",
985 "proxy_unittest.cc",
986 "ptr_util_unittest.cc",
987 "ratelimiter_unittest.cc",
988 "rollingaccumulator_unittest.cc",
989 "rtccertificate_unittest.cc",
990 "rtccertificategenerator_unittest.cc",
991 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -0700992 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200993 "sigslot_unittest.cc",
994 "sigslottester_unittest.cc",
995 "stream_unittest.cc",
996 "testclient_unittest.cc",
997 "thread_unittest.cc",
998 ]
999 if (is_win) {
1000 sources += [
1001 "win32_unittest.cc",
1002 "win32window_unittest.cc",
1003 ]
1004 }
1005 if (is_mac) {
1006 sources += [ "macutils_unittest.cc" ]
1007 }
1008 if (is_posix) {
1009 sources += [
1010 "ssladapter_unittest.cc",
1011 "sslidentity_unittest.cc",
1012 "sslstreamadapter_unittest.cc",
1013 ]
1014 }
1015 deps = [
1016 ":rtc_base_tests_main",
1017 ":rtc_base_tests_utils",
1018 "../test:test_support",
1019 ]
1020 public_deps = [
1021 ":rtc_base",
1022 ]
1023 configs += [ ":rtc_base_unittests_config" ]
1024 if (!build_with_chromium && is_clang) {
1025 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1026 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1027 }
1028 }
1029}
1030
Henrik Kjellander73e21802017-06-20 08:38:58 +02001031if (is_android) {
1032 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001033 java_files = [
1034 "java/src/org/webrtc/ContextUtils.java",
1035 "java/src/org/webrtc/Logging.java",
1036 "java/src/org/webrtc/Size.java",
1037 "java/src/org/webrtc/ThreadUtils.java",
1038 ]
Henrik Kjellander73e21802017-06-20 08:38:58 +02001039 }
1040}