blob: 1914b27439ce921317a7a958c0e46dc708c731d3 [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") {
mbonadei95c8f652017-08-27 23:40:10 -0700299 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200300 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700301 ]
302 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700303 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200304 ]
305
perkj650fdae2017-08-25 05:00:11 -0700306 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700307 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700308 }
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 = [
mbonadei95c8f652017-08-27 23:40:10 -0700375 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200376 ":rtc_task_queue",
377 ]
378}
379
380rtc_static_library("weak_ptr") {
381 sources = [
382 "weak_ptr.cc",
383 "weak_ptr.h",
384 ]
385 deps = [
386 ":rtc_base_approved",
387 ":sequenced_task_checker",
388 ]
389}
390
391rtc_static_library("rtc_numerics") {
392 sources = [
393 "numerics/exp_filter.cc",
394 "numerics/exp_filter.h",
395 "numerics/percentile_filter.h",
396 ]
397 deps = [
398 ":rtc_base_approved",
399 ]
400}
401
402config("rtc_base_warnings_config") {
403 if (is_win && is_clang) {
404 cflags = [
405 # Disable warnings failing when compiling with Clang on Windows.
406 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
407 "-Wno-sign-compare",
408 "-Wno-missing-braces",
409 ]
410 }
411}
412
413rtc_source_set("rtc_json") {
414 defines = []
415 sources = [
416 "json.cc",
417 "json.h",
418 ]
419 if (rtc_build_json) {
420 public_deps = [
421 "//third_party/jsoncpp",
422 ]
423 } else {
424 include_dirs = [ "$rtc_jsoncpp_root" ]
425
426 # When defined changes the include path for json.h to where it is
427 # expected to be when building json outside of the standalone build.
428 defines += [ "WEBRTC_EXTERNAL_JSON" ]
429 }
430}
431
432rtc_static_library("rtc_base") {
433 cflags = []
434 cflags_cc = []
435 libs = []
436 defines = []
437 deps = [
438 "..:webrtc_common",
439 ]
440 public_deps = [
441 ":rtc_base_approved",
442 ]
443 public_configs = []
444
445 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
446
447 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200448 "asyncinvoker-inl.h",
449 "asyncinvoker.cc",
450 "asyncinvoker.h",
451 "asyncpacketsocket.cc",
452 "asyncpacketsocket.h",
453 "asyncresolverinterface.cc",
454 "asyncresolverinterface.h",
455 "asyncsocket.cc",
456 "asyncsocket.h",
457 "asynctcpsocket.cc",
458 "asynctcpsocket.h",
459 "asyncudpsocket.cc",
460 "asyncudpsocket.h",
461 "crc32.cc",
462 "crc32.h",
463 "cryptstring.cc",
464 "cryptstring.h",
465 "filerotatingstream.cc",
466 "filerotatingstream.h",
467 "fileutils.cc",
468 "fileutils.h",
469 "gunit_prod.h",
470 "helpers.cc",
471 "helpers.h",
472 "httpbase.cc",
473 "httpbase.h",
474 "httpcommon-inl.h",
475 "httpcommon.cc",
476 "httpcommon.h",
477 "ipaddress.cc",
478 "ipaddress.h",
479 "messagedigest.cc",
480 "messagedigest.h",
481 "messagehandler.cc",
482 "messagehandler.h",
483 "messagequeue.cc",
484 "messagequeue.h",
485 "nethelpers.cc",
486 "nethelpers.h",
487 "network.cc",
488 "network.h",
489 "networkmonitor.cc",
490 "networkmonitor.h",
491 "nullsocketserver.cc",
492 "nullsocketserver.h",
493 "openssl.h",
494 "openssladapter.cc",
495 "openssladapter.h",
496 "openssldigest.cc",
497 "openssldigest.h",
498 "opensslidentity.cc",
499 "opensslidentity.h",
500 "opensslstreamadapter.cc",
501 "opensslstreamadapter.h",
502 "physicalsocketserver.cc",
503 "physicalsocketserver.h",
504 "proxyinfo.cc",
505 "proxyinfo.h",
506 "ratelimiter.cc",
507 "ratelimiter.h",
508 "rtccertificate.cc",
509 "rtccertificate.h",
510 "rtccertificategenerator.cc",
511 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700512 "signalthread.cc",
513 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200514 "sigslot.cc",
515 "sigslot.h",
516 "socket.h",
517 "socketadapters.cc",
518 "socketadapters.h",
519 "socketaddress.cc",
520 "socketaddress.h",
521 "socketaddresspair.cc",
522 "socketaddresspair.h",
523 "socketfactory.h",
524 "socketserver.h",
525 "socketstream.cc",
526 "socketstream.h",
527 "ssladapter.cc",
528 "ssladapter.h",
529 "sslfingerprint.cc",
530 "sslfingerprint.h",
531 "sslidentity.cc",
532 "sslidentity.h",
533 "sslstreamadapter.cc",
534 "sslstreamadapter.h",
535 "stream.cc",
536 "stream.h",
537 "thread.cc",
538 "thread.h",
539 ]
540
541 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
542 # compiler settings.
543 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
544 configs += [ "//build/config/compiler:no_chromium_code" ]
545 if (!is_win) {
546 cflags += [ "-Wno-uninitialized" ]
547 }
548
549 if (build_with_chromium) {
550 if (is_win) {
ehmaldonadof6a861a2017-07-19 10:40:47 -0700551 sources += [ "../../webrtc_overrides/webrtc/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200552 }
553 include_dirs = [ "../../boringssl/src/include" ]
554 public_configs += [ ":rtc_base_chromium_config" ]
555 } else {
556 configs += [ ":rtc_base_warnings_config" ]
557 sources += [
558 "callback.h",
559 "logsinks.cc",
560 "logsinks.h",
561 "mathutils.h",
562 "optionsfile.cc",
563 "optionsfile.h",
564 "rollingaccumulator.h",
565 "sslroots.h",
566 "transformadapter.cc",
567 "transformadapter.h",
568 "window.h",
569 ]
570
571 if (is_win) {
572 sources += [
573 "win32socketinit.cc",
574 "win32socketinit.h",
575 "win32socketserver.cc",
576 "win32socketserver.h",
577 ]
578 }
579 } # !build_with_chromium
580
581 if (rtc_build_ssl) {
582 deps += [ "//third_party/boringssl" ]
583 } else {
584 configs += [ ":external_ssl_library" ]
585 }
586
587 if (is_android) {
588 sources += [
589 "ifaddrs-android.cc",
590 "ifaddrs-android.h",
591 ]
592
593 libs += [
594 "log",
595 "GLESv2",
596 ]
597 }
598
599 if (is_ios || is_mac) {
600 sources += [
601 "macifaddrs_converter.cc",
602 "thread_darwin.mm",
603 ]
604 }
605
606 if (use_x11) {
607 libs += [
608 "dl",
609 "rt",
610 "Xext",
611 "X11",
612 "Xcomposite",
613 "Xrender",
614 ]
615 }
616
617 if (is_linux) {
618 libs += [
619 "dl",
620 "rt",
621 ]
622 }
623
624 if (is_mac) {
625 sources += [
626 "macutils.cc",
627 "macutils.h",
628 ]
629 libs += [
630 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
631 "ApplicationServices.framework",
632 ]
633 }
634
635 if (is_win) {
636 sources += [
637 "win32.cc",
638 "win32.h",
639 "win32filesystem.cc",
640 "win32filesystem.h",
641 "win32securityerrors.cc",
642 "win32window.cc",
643 "win32window.h",
644 ]
645
646 libs += [
647 "crypt32.lib",
648 "iphlpapi.lib",
649 "secur32.lib",
650 ]
651
652 cflags += [
653 # Suppress warnings about WIN32_LEAN_AND_MEAN.
654 "/wd4005",
655 "/wd4703",
656 ]
657
658 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
659 }
660
661 if (is_posix) {
662 sources += [
663 "ifaddrs_converter.cc",
664 "ifaddrs_converter.h",
665 "unixfilesystem.cc",
666 "unixfilesystem.h",
667 ]
668 }
669
670 if (is_nacl) {
671 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
672 defines += [ "timezone=_timezone" ]
673 sources -= [ "ifaddrs_converter.cc" ]
674 }
675 if (is_win && is_clang) {
676 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
677 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
678 }
679}
680
681rtc_source_set("gtest_prod") {
682 sources = [
683 "gtest_prod_util.h",
684 ]
685}
686
687config("rtc_base_tests_utils_exported_config") {
688 defines = [ "GTEST_RELATIVE_PATH" ]
689}
690
691config("rtc_base_tests_utils_warnings_config") {
692 if (is_win && is_clang) {
693 cflags = [
694 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
695 "-Wno-reorder",
696 "-Wno-sign-compare",
697 ]
698 }
699}
700
701rtc_source_set("rtc_base_tests_utils") {
702 testonly = true
703 sources = [
704 # Also use this as a convenient dumping ground for misc files that are
705 # included by multiple targets below.
706 "cpu_time.cc",
707 "cpu_time.h",
708 "fakeclock.cc",
709 "fakeclock.h",
710 "fakenetwork.h",
711 "fakesslidentity.h",
712 "firewallsocketserver.cc",
713 "firewallsocketserver.h",
714 "gunit.h",
715 "httpserver.cc",
716 "httpserver.h",
717 "md5.cc",
718 "md5.h",
719 "md5digest.cc",
720 "md5digest.h",
721 "memory_usage.cc",
722 "memory_usage.h",
723 "natserver.cc",
724 "natserver.h",
725 "natsocketfactory.cc",
726 "natsocketfactory.h",
727 "nattypes.cc",
728 "nattypes.h",
729 "proxyserver.cc",
730 "proxyserver.h",
731 "sha1.cc",
732 "sha1.h",
733 "sha1digest.cc",
734 "sha1digest.h",
735 "sigslottester.h",
736 "sigslottester.h.pump",
737 "testbase64.h",
738 "testclient.cc",
739 "testclient.h",
740 "testechoserver.h",
741 "testutils.h",
742 "timedelta.h",
743 "virtualsocketserver.cc",
744 "virtualsocketserver.h",
745 ]
746 configs += [ ":rtc_base_tests_utils_warnings_config" ]
747 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
748 deps = [
749 ":rtc_base",
750 "../test:field_trial",
751 "../test:test_support",
752 ]
753 public_deps = [
754 "//testing/gmock",
755 "//testing/gtest",
756 ]
757
758 if (!build_with_chromium && is_clang) {
759 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
760 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
761 }
762}
763
764if (rtc_include_tests) {
765 rtc_source_set("rtc_base_tests_main") {
766 testonly = true
767 sources = [
768 "unittest_main.cc",
769 ]
770 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
771 deps = [
772 ":rtc_base",
773 ":rtc_base_approved",
774 ":rtc_base_tests_utils",
775 "../test:field_trial",
776 "../test:test_support",
777 ]
778
779 public_deps = [
780 "//testing/gmock",
781 "//testing/gtest",
782 ]
783
784 if (!build_with_chromium && is_clang) {
785 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
786 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
787 }
788 }
789
790 rtc_source_set("rtc_base_nonparallel_tests") {
791 testonly = true
792
793 # Skip restricting visibility on mobile platforms since the tests on those
794 # gets additional generated targets which would require many lines here to
795 # cover (which would be confusing to read and hard to maintain).
796 if (!is_android && !is_ios) {
797 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800798 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200799 }
800 sources = [
801 "cpu_time_unittest.cc",
802 "filerotatingstream_unittest.cc",
803 "nullsocketserver_unittest.cc",
804 "physicalsocketserver_unittest.cc",
805 "socket_unittest.cc",
806 "socket_unittest.h",
807 "socketaddress_unittest.cc",
808 ]
809 deps = [
810 ":rtc_base",
811 ":rtc_base_tests_main",
812 ":rtc_base_tests_utils",
813 "../system_wrappers:system_wrappers",
814 "../test:test_support",
815 "//testing/gtest",
816 ]
817 if (is_win) {
818 sources += [ "win32socketserver_unittest.cc" ]
819 }
820
821 if (!build_with_chromium && is_clang) {
822 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
823 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
824 }
825 }
826
827 rtc_source_set("rtc_base_approved_unittests") {
828 testonly = true
829
830 # Skip restricting visibility on mobile platforms since the tests on those
831 # gets additional generated targets which would require many lines here to
832 # cover (which would be confusing to read and hard to maintain).
833 if (!is_android && !is_ios) {
834 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800835 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200836 }
837 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200838 "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",
kwiberg529662a2017-09-04 05:43:17 -0700885 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200886 "../system_wrappers:system_wrappers",
887 "../test:test_support",
888 ]
889 if (!build_with_chromium && is_clang) {
890 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
891 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
892 }
893 }
894
895 rtc_source_set("rtc_task_queue_unittests") {
896 testonly = true
897
898 # Skip restricting visibility on mobile platforms since the tests on those
899 # gets additional generated targets which would require many lines here to
900 # cover (which would be confusing to read and hard to maintain).
901 if (!is_android && !is_ios) {
902 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800903 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200904 }
905 sources = [
906 "task_queue_unittest.cc",
907 ]
908 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700909 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200910 ":rtc_base_tests_main",
911 ":rtc_base_tests_utils",
912 ":rtc_task_queue",
913 "../test:test_support",
914 ]
915 if (!build_with_chromium && is_clang) {
916 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
917 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
918 }
919 }
920
921 rtc_source_set("sequenced_task_checker_unittests") {
922 testonly = true
923
924 # Skip restricting visibility on mobile platforms since the tests on those
925 # gets additional generated targets which would require many lines here to
926 # cover (which would be confusing to read and hard to maintain).
927 if (!is_android && !is_ios) {
928 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800929 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200930 }
931 sources = [
932 "sequenced_task_checker_unittest.cc",
933 ]
934 deps = [
935 ":rtc_base_approved",
936 ":rtc_base_tests_main",
937 ":rtc_task_queue",
938 ":sequenced_task_checker",
939 "../test:test_support",
940 ]
941 }
942
943 rtc_source_set("weak_ptr_unittests") {
944 testonly = true
945
946 # Skip restricting visibility on mobile platforms since the tests on those
947 # gets additional generated targets which would require many lines here to
948 # cover (which would be confusing to read and hard to maintain).
949 if (!is_android && !is_ios) {
950 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800951 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200952 }
953 sources = [
954 "weak_ptr_unittest.cc",
955 ]
956 deps = [
957 ":rtc_base_tests_main",
958 ":rtc_base_tests_utils",
959 ":rtc_task_queue",
960 ":weak_ptr",
961 "../test:test_support",
962 ]
963 }
964
965 rtc_source_set("rtc_numerics_unittests") {
966 testonly = true
967
968 # Skip restricting visibility on mobile platforms since the tests on those
969 # gets additional generated targets which would require many lines here to
970 # cover (which would be confusing to read and hard to maintain).
971 if (!is_android && !is_ios) {
972 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800973 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200974 }
975 sources = [
976 "numerics/exp_filter_unittest.cc",
977 "numerics/percentile_filter_unittest.cc",
978 ]
979 deps = [
980 ":rtc_base_approved",
981 ":rtc_base_tests_main",
982 ":rtc_numerics",
983 "../test:test_support",
984 ]
985 }
986
987 config("rtc_base_unittests_config") {
988 if (is_clang) {
989 cflags = [ "-Wno-unused-const-variable" ]
990 }
991 }
992 rtc_source_set("rtc_base_unittests") {
993 testonly = true
994
995 # Skip restricting visibility on mobile platforms since the tests on those
996 # gets additional generated targets which would require many lines here to
997 # cover (which would be confusing to read and hard to maintain).
998 if (!is_android && !is_ios) {
999 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001000 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001001 }
1002 sources = [
1003 "callback_unittest.cc",
1004 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001005 "helpers_unittest.cc",
1006 "httpbase_unittest.cc",
1007 "httpcommon_unittest.cc",
1008 "httpserver_unittest.cc",
1009 "ipaddress_unittest.cc",
1010 "memory_usage_unittest.cc",
1011 "messagedigest_unittest.cc",
1012 "messagequeue_unittest.cc",
1013 "nat_unittest.cc",
1014 "network_unittest.cc",
1015 "optionsfile_unittest.cc",
1016 "proxy_unittest.cc",
1017 "ptr_util_unittest.cc",
1018 "ratelimiter_unittest.cc",
1019 "rollingaccumulator_unittest.cc",
1020 "rtccertificate_unittest.cc",
1021 "rtccertificategenerator_unittest.cc",
1022 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001023 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001024 "sigslot_unittest.cc",
1025 "sigslottester_unittest.cc",
1026 "stream_unittest.cc",
1027 "testclient_unittest.cc",
1028 "thread_unittest.cc",
1029 ]
1030 if (is_win) {
1031 sources += [
1032 "win32_unittest.cc",
1033 "win32window_unittest.cc",
1034 ]
1035 }
1036 if (is_mac) {
1037 sources += [ "macutils_unittest.cc" ]
1038 }
1039 if (is_posix) {
1040 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001041 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001042 "ssladapter_unittest.cc",
1043 "sslidentity_unittest.cc",
1044 "sslstreamadapter_unittest.cc",
1045 ]
1046 }
1047 deps = [
1048 ":rtc_base_tests_main",
1049 ":rtc_base_tests_utils",
1050 "../test:test_support",
1051 ]
1052 public_deps = [
1053 ":rtc_base",
1054 ]
1055 configs += [ ":rtc_base_unittests_config" ]
1056 if (!build_with_chromium && is_clang) {
1057 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1058 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1059 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001060 if (build_with_chromium) {
1061 include_dirs = [ "../../boringssl/src/include" ]
1062 }
1063 if (rtc_build_ssl) {
1064 deps += [ "//third_party/boringssl" ]
1065 } else {
1066 configs += [ ":external_ssl_library" ]
1067 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001068 }
1069}
1070
Henrik Kjellander73e21802017-06-20 08:38:58 +02001071if (is_android) {
1072 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001073 java_files = [
1074 "java/src/org/webrtc/ContextUtils.java",
1075 "java/src/org/webrtc/Logging.java",
1076 "java/src/org/webrtc/Size.java",
1077 "java/src/org/webrtc/ThreadUtils.java",
1078 ]
charujain474acce2017-08-25 06:21:52 -07001079
1080 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1081 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001082 }
1083}