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