blob: 6676fdf2eaf81043016c105a9cd83f150f701d4a [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",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200140 "pathutils.cc",
141 "pathutils.h",
142 "platform_file.cc",
143 "platform_file.h",
144 "platform_thread.cc",
145 "platform_thread.h",
146 "platform_thread_types.h",
147 "ptr_util.h",
148 "race_checker.cc",
149 "race_checker.h",
150 "random.cc",
151 "random.h",
152 "rate_limiter.cc",
153 "rate_limiter.h",
154 "rate_statistics.cc",
155 "rate_statistics.h",
156 "ratetracker.cc",
157 "ratetracker.h",
158 "refcount.h",
159 "refcountedobject.h",
160 "safe_compare.h",
161 "safe_conversions.h",
162 "safe_conversions_impl.h",
163 "safe_minmax.h",
164 "sanitizer.h",
165 "scoped_ref_ptr.h",
166 "string_to_number.cc",
167 "string_to_number.h",
168 "stringencode.cc",
169 "stringencode.h",
170 "stringize_macros.h",
171 "stringutils.cc",
172 "stringutils.h",
173 "swap_queue.h",
174 "template_util.h",
175 "thread_annotations.h",
176 "thread_checker.h",
177 "thread_checker_impl.cc",
178 "thread_checker_impl.h",
179 "timestampaligner.cc",
180 "timestampaligner.h",
181 "timeutils.cc",
182 "timeutils.h",
183 "trace_event.h",
184 "type_traits.h",
185 ]
186
187 deps += [ "..:webrtc_common" ]
188
189 if (is_android) {
190 libs += [ "log" ]
191 }
192
193 if (is_posix) {
194 sources += [ "file_posix.cc" ]
195 }
196
197 if (is_win) {
198 sources += [ "file_win.cc" ]
199 }
200
201 if (build_with_chromium) {
202 # Dependency on chromium's logging (in //base).
203 deps += [ "//base:base" ]
204 sources += [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700205 "../../webrtc_overrides/webrtc/rtc_base/logging.cc",
206 "../../webrtc_overrides/webrtc/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200207 ]
208 } else {
209 sources += [
210 "logging.cc",
211 "logging.h",
212 "logging_mac.mm",
213 ]
214 }
215 if (is_component_build && is_win) {
216 # Copy the VS runtime DLLs into the isolate so that they don't have to be
217 # preinstalled on the target machine. The debug runtimes have a "d" at
218 # the end.
219 # This is a copy of https://codereview.chromium.org/1783973002.
220 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
221 # so we don't have to copy their changes and risk breakages.
222 # See http://crbug.com/653569
223 if (is_debug) {
224 vcrt_suffix = "d"
225 } else {
226 vcrt_suffix = ""
227 }
228
229 # These runtime files are copied to the output directory by the
230 # vs_toolchain script that runs as part of toolchain configuration.
231 data = [
232 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
233 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
234 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
235
236 # Universal Windows 10 CRT files
237 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
238 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
239 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
240 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
241 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
242 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
243 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
244 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
245 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
246 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
248 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
249 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
250 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
251 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
254 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
256 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
259 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
261 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
266 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
277 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
278 ]
279 if (is_asan) {
280 if (current_cpu == "x64") {
281 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
282 } else {
283 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
284 }
285 }
286 }
287 if (is_nacl) {
288 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
289 }
290}
291
292config("enable_libevent_config") {
293 defines = [ "WEBRTC_BUILD_LIBEVENT" ]
294}
295
perkj650fdae2017-08-25 05:00:11 -0700296rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700297 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200298 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700299 ]
300 public_deps = [
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) {
mbonadei95c8f652017-08-27 23:40:10 -0700305 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700306 }
307}
308
309# WebRTC targets must not directly depend on rtc_task_queue_api or
310# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
311# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
312# to the default implemenation in rtc_task_queue_impl or if an externally
313# provided implementation should be used. An external implementation should
314# depend on rtc_task_queue_api.
315rtc_source_set("rtc_task_queue_api") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200316 if (build_with_chromium) {
317 sources = [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700318 "../../webrtc_overrides/webrtc/rtc_base/task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200319 ]
320 } else {
321 sources = [
322 "task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200323 ]
perkj650fdae2017-08-25 05:00:11 -0700324 }
325 deps = [
326 ":rtc_base_approved",
327 ]
328}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200329
perkj650fdae2017-08-25 05:00:11 -0700330rtc_source_set("rtc_task_queue_impl") {
331 deps = [
332 ":rtc_base_approved",
333 ":rtc_task_queue_api",
334 ]
335 if (build_with_chromium) {
336 sources = [
337 "../../webrtc_overrides/webrtc/rtc_base/task_queue.cc",
338 ]
339 } else {
340 if (rtc_build_libevent) {
341 deps += [ "//base/third_party/libevent" ]
342 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200343 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700344 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200345 "task_queue_libevent.cc",
346 "task_queue_posix.cc",
perkj650fdae2017-08-25 05:00:11 -0700347 "task_queue_posix.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200348 ]
349 all_dependent_configs = [ ":enable_libevent_config" ]
350 } else {
351 if (is_mac || is_ios) {
perkj650fdae2017-08-25 05:00:11 -0700352 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200353 "task_queue_gcd.cc",
354 "task_queue_posix.cc",
355 ]
356 }
357 if (is_win) {
perkj650fdae2017-08-25 05:00:11 -0700358 sources = [
359 "task_queue_win.cc",
360 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200361 }
362 }
363 }
364}
365
366rtc_static_library("sequenced_task_checker") {
367 sources = [
368 "sequenced_task_checker.h",
369 "sequenced_task_checker_impl.cc",
370 "sequenced_task_checker_impl.h",
371 ]
372 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700373 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200374 ":rtc_task_queue",
375 ]
376}
377
378rtc_static_library("weak_ptr") {
379 sources = [
380 "weak_ptr.cc",
381 "weak_ptr.h",
382 ]
383 deps = [
384 ":rtc_base_approved",
385 ":sequenced_task_checker",
386 ]
387}
388
389rtc_static_library("rtc_numerics") {
390 sources = [
391 "numerics/exp_filter.cc",
392 "numerics/exp_filter.h",
393 "numerics/percentile_filter.h",
394 ]
395 deps = [
396 ":rtc_base_approved",
397 ]
398}
399
400config("rtc_base_warnings_config") {
401 if (is_win && is_clang) {
402 cflags = [
403 # Disable warnings failing when compiling with Clang on Windows.
404 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
405 "-Wno-sign-compare",
406 "-Wno-missing-braces",
407 ]
408 }
409}
410
411rtc_source_set("rtc_json") {
412 defines = []
413 sources = [
414 "json.cc",
415 "json.h",
416 ]
417 if (rtc_build_json) {
418 public_deps = [
419 "//third_party/jsoncpp",
420 ]
421 } else {
422 include_dirs = [ "$rtc_jsoncpp_root" ]
423
424 # When defined changes the include path for json.h to where it is
425 # expected to be when building json outside of the standalone build.
426 defines += [ "WEBRTC_EXTERNAL_JSON" ]
427 }
428}
429
mbonadei9c5e5112017-09-05 05:17:02 -0700430rtc_static_library("rtc_base") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200431 cflags = []
432 cflags_cc = []
433 libs = []
434 defines = []
435 deps = [
436 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700437 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200438 ]
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) {
mbonadei9c5e5112017-09-05 05:17:02 -0700599 sources += [
600 "macifaddrs_converter.cc",
601 "thread_darwin.mm",
602 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200603 }
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 = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200837 "atomicops_unittest.cc",
838 "base64_unittest.cc",
839 "basictypes_unittest.cc",
840 "bind_unittest.cc",
841 "bitbuffer_unittest.cc",
842 "buffer_unittest.cc",
843 "bufferqueue_unittest.cc",
844 "bytebuffer_unittest.cc",
845 "byteorder_unittest.cc",
846 "copyonwritebuffer_unittest.cc",
847 "criticalsection_unittest.cc",
848 "event_tracer_unittest.cc",
849 "event_unittest.cc",
850 "file_unittest.cc",
851 "function_view_unittest.cc",
852 "logging_unittest.cc",
853 "md5digest_unittest.cc",
854 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700855 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200856 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200857 "pathutils_unittest.cc",
858 "platform_thread_unittest.cc",
859 "random_unittest.cc",
860 "rate_limiter_unittest.cc",
861 "rate_statistics_unittest.cc",
862 "ratetracker_unittest.cc",
863 "refcountedobject_unittest.cc",
864 "safe_compare_unittest.cc",
865 "safe_minmax_unittest.cc",
866 "string_to_number_unittest.cc",
867 "stringencode_unittest.cc",
868 "stringize_macros_unittest.cc",
869 "stringutils_unittest.cc",
870 "swap_queue_unittest.cc",
871 "thread_annotations_unittest.cc",
872 "thread_checker_unittest.cc",
873 "timestampaligner_unittest.cc",
874 "timeutils_unittest.cc",
875 "virtualsocket_unittest.cc",
876 ]
877 deps = [
878 ":rtc_base",
879 ":rtc_base_approved",
880 ":rtc_base_tests_main",
881 ":rtc_base_tests_utils",
882 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700883 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200884 "../system_wrappers:system_wrappers",
885 "../test:test_support",
886 ]
887 if (!build_with_chromium && is_clang) {
888 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
889 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
890 }
891 }
892
893 rtc_source_set("rtc_task_queue_unittests") {
894 testonly = true
895
896 # Skip restricting visibility on mobile platforms since the tests on those
897 # gets additional generated targets which would require many lines here to
898 # cover (which would be confusing to read and hard to maintain).
899 if (!is_android && !is_ios) {
900 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800901 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200902 }
903 sources = [
904 "task_queue_unittest.cc",
905 ]
906 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700907 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200908 ":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 += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001039 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001040 "ssladapter_unittest.cc",
1041 "sslidentity_unittest.cc",
1042 "sslstreamadapter_unittest.cc",
1043 ]
1044 }
1045 deps = [
1046 ":rtc_base_tests_main",
1047 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001048 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001049 "../test:test_support",
1050 ]
1051 public_deps = [
1052 ":rtc_base",
1053 ]
1054 configs += [ ":rtc_base_unittests_config" ]
1055 if (!build_with_chromium && is_clang) {
1056 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1057 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1058 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001059 if (build_with_chromium) {
1060 include_dirs = [ "../../boringssl/src/include" ]
1061 }
1062 if (rtc_build_ssl) {
1063 deps += [ "//third_party/boringssl" ]
1064 } else {
1065 configs += [ ":external_ssl_library" ]
1066 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001067 }
1068}
1069
Henrik Kjellander73e21802017-06-20 08:38:58 +02001070if (is_android) {
1071 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001072 java_files = [
1073 "java/src/org/webrtc/ContextUtils.java",
1074 "java/src/org/webrtc/Logging.java",
1075 "java/src/org/webrtc/Size.java",
1076 "java/src/org/webrtc/ThreadUtils.java",
1077 ]
charujain474acce2017-08-25 06:21:52 -07001078
1079 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1080 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001081 }
1082}