blob: 902024f3f1afd3e4e786fb54e91a3655571a1e69 [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
perkj650fdae2017-08-25 05:00:11 -0700292rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700293 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200294 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700295 ]
296 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700297 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200298 ]
299
perkj650fdae2017-08-25 05:00:11 -0700300 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700301 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700302 }
303}
304
305# WebRTC targets must not directly depend on rtc_task_queue_api or
306# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
307# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
308# to the default implemenation in rtc_task_queue_impl or if an externally
309# provided implementation should be used. An external implementation should
310# depend on rtc_task_queue_api.
311rtc_source_set("rtc_task_queue_api") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200312 if (build_with_chromium) {
313 sources = [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700314 "../../webrtc_overrides/webrtc/rtc_base/task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200315 ]
316 } else {
317 sources = [
318 "task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200319 ]
perkj650fdae2017-08-25 05:00:11 -0700320 }
321 deps = [
322 ":rtc_base_approved",
323 ]
324}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200325
perkj650fdae2017-08-25 05:00:11 -0700326rtc_source_set("rtc_task_queue_impl") {
327 deps = [
328 ":rtc_base_approved",
329 ":rtc_task_queue_api",
330 ]
331 if (build_with_chromium) {
332 sources = [
333 "../../webrtc_overrides/webrtc/rtc_base/task_queue.cc",
334 ]
335 } else {
336 if (rtc_build_libevent) {
337 deps += [ "//base/third_party/libevent" ]
338 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200339 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700340 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200341 "task_queue_libevent.cc",
342 "task_queue_posix.cc",
perkj650fdae2017-08-25 05:00:11 -0700343 "task_queue_posix.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200344 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200345 } else {
346 if (is_mac || is_ios) {
perkj650fdae2017-08-25 05:00:11 -0700347 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200348 "task_queue_gcd.cc",
349 "task_queue_posix.cc",
350 ]
351 }
352 if (is_win) {
perkj650fdae2017-08-25 05:00:11 -0700353 sources = [
354 "task_queue_win.cc",
355 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200356 }
357 }
358 }
359}
360
361rtc_static_library("sequenced_task_checker") {
362 sources = [
363 "sequenced_task_checker.h",
364 "sequenced_task_checker_impl.cc",
365 "sequenced_task_checker_impl.h",
366 ]
367 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700368 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200369 ":rtc_task_queue",
370 ]
371}
372
373rtc_static_library("weak_ptr") {
374 sources = [
375 "weak_ptr.cc",
376 "weak_ptr.h",
377 ]
378 deps = [
379 ":rtc_base_approved",
380 ":sequenced_task_checker",
381 ]
382}
383
384rtc_static_library("rtc_numerics") {
385 sources = [
386 "numerics/exp_filter.cc",
387 "numerics/exp_filter.h",
388 "numerics/percentile_filter.h",
389 ]
390 deps = [
391 ":rtc_base_approved",
392 ]
393}
394
395config("rtc_base_warnings_config") {
396 if (is_win && is_clang) {
397 cflags = [
398 # Disable warnings failing when compiling with Clang on Windows.
399 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
400 "-Wno-sign-compare",
401 "-Wno-missing-braces",
402 ]
403 }
404}
405
406rtc_source_set("rtc_json") {
407 defines = []
408 sources = [
409 "json.cc",
410 "json.h",
411 ]
412 if (rtc_build_json) {
413 public_deps = [
414 "//third_party/jsoncpp",
415 ]
416 } else {
417 include_dirs = [ "$rtc_jsoncpp_root" ]
418
419 # When defined changes the include path for json.h to where it is
420 # expected to be when building json outside of the standalone build.
421 defines += [ "WEBRTC_EXTERNAL_JSON" ]
422 }
423}
424
mbonadei9c5e5112017-09-05 05:17:02 -0700425rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700426 public_deps = [
427 ":rtc_base_generic",
428 ]
429 if (is_win) {
430 sources = [
431 "noop.cc",
432 ]
433 }
434 if (is_ios || is_mac) {
435 sources = [
436 "noop.mm",
437 ]
438 public_deps += [ ":rtc_base_objc" ]
439 }
440}
441
442if (is_ios || is_mac) {
443 rtc_source_set("rtc_base_objc") {
444 sources = [
445 "thread_darwin.mm",
446 ]
447 deps = [
448 ":rtc_base_generic",
449 ]
450 visibility = [ ":rtc_base" ]
451 }
452}
453
454rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200455 cflags = []
456 cflags_cc = []
457 libs = []
458 defines = []
459 deps = [
460 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700461 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200462 ]
463 public_deps = [
464 ":rtc_base_approved",
465 ]
466 public_configs = []
467
468 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
469
470 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200471 "asyncinvoker-inl.h",
472 "asyncinvoker.cc",
473 "asyncinvoker.h",
474 "asyncpacketsocket.cc",
475 "asyncpacketsocket.h",
476 "asyncresolverinterface.cc",
477 "asyncresolverinterface.h",
478 "asyncsocket.cc",
479 "asyncsocket.h",
480 "asynctcpsocket.cc",
481 "asynctcpsocket.h",
482 "asyncudpsocket.cc",
483 "asyncudpsocket.h",
484 "crc32.cc",
485 "crc32.h",
486 "cryptstring.cc",
487 "cryptstring.h",
488 "filerotatingstream.cc",
489 "filerotatingstream.h",
490 "fileutils.cc",
491 "fileutils.h",
492 "gunit_prod.h",
493 "helpers.cc",
494 "helpers.h",
495 "httpbase.cc",
496 "httpbase.h",
497 "httpcommon-inl.h",
498 "httpcommon.cc",
499 "httpcommon.h",
500 "ipaddress.cc",
501 "ipaddress.h",
502 "messagedigest.cc",
503 "messagedigest.h",
504 "messagehandler.cc",
505 "messagehandler.h",
506 "messagequeue.cc",
507 "messagequeue.h",
508 "nethelpers.cc",
509 "nethelpers.h",
510 "network.cc",
511 "network.h",
512 "networkmonitor.cc",
513 "networkmonitor.h",
514 "nullsocketserver.cc",
515 "nullsocketserver.h",
516 "openssl.h",
517 "openssladapter.cc",
518 "openssladapter.h",
519 "openssldigest.cc",
520 "openssldigest.h",
521 "opensslidentity.cc",
522 "opensslidentity.h",
523 "opensslstreamadapter.cc",
524 "opensslstreamadapter.h",
525 "physicalsocketserver.cc",
526 "physicalsocketserver.h",
527 "proxyinfo.cc",
528 "proxyinfo.h",
529 "ratelimiter.cc",
530 "ratelimiter.h",
531 "rtccertificate.cc",
532 "rtccertificate.h",
533 "rtccertificategenerator.cc",
534 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700535 "signalthread.cc",
536 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200537 "sigslot.cc",
538 "sigslot.h",
539 "socket.h",
540 "socketadapters.cc",
541 "socketadapters.h",
542 "socketaddress.cc",
543 "socketaddress.h",
544 "socketaddresspair.cc",
545 "socketaddresspair.h",
546 "socketfactory.h",
547 "socketserver.h",
548 "socketstream.cc",
549 "socketstream.h",
550 "ssladapter.cc",
551 "ssladapter.h",
552 "sslfingerprint.cc",
553 "sslfingerprint.h",
554 "sslidentity.cc",
555 "sslidentity.h",
556 "sslstreamadapter.cc",
557 "sslstreamadapter.h",
558 "stream.cc",
559 "stream.h",
560 "thread.cc",
561 "thread.h",
562 ]
563
mbonadei310e32b2017-09-07 07:36:28 -0700564 visibility = [
565 ":rtc_base",
566 ":rtc_base_objc",
567 ]
568
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200569 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
570 # compiler settings.
571 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
572 configs += [ "//build/config/compiler:no_chromium_code" ]
573 if (!is_win) {
574 cflags += [ "-Wno-uninitialized" ]
575 }
576
577 if (build_with_chromium) {
578 if (is_win) {
ehmaldonadof6a861a2017-07-19 10:40:47 -0700579 sources += [ "../../webrtc_overrides/webrtc/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200580 }
581 include_dirs = [ "../../boringssl/src/include" ]
582 public_configs += [ ":rtc_base_chromium_config" ]
583 } else {
584 configs += [ ":rtc_base_warnings_config" ]
585 sources += [
586 "callback.h",
587 "logsinks.cc",
588 "logsinks.h",
589 "mathutils.h",
590 "optionsfile.cc",
591 "optionsfile.h",
592 "rollingaccumulator.h",
593 "sslroots.h",
594 "transformadapter.cc",
595 "transformadapter.h",
596 "window.h",
597 ]
598
599 if (is_win) {
600 sources += [
601 "win32socketinit.cc",
602 "win32socketinit.h",
603 "win32socketserver.cc",
604 "win32socketserver.h",
605 ]
606 }
607 } # !build_with_chromium
608
609 if (rtc_build_ssl) {
610 deps += [ "//third_party/boringssl" ]
611 } else {
612 configs += [ ":external_ssl_library" ]
613 }
614
615 if (is_android) {
616 sources += [
617 "ifaddrs-android.cc",
618 "ifaddrs-android.h",
619 ]
620
621 libs += [
622 "log",
623 "GLESv2",
624 ]
625 }
626
627 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700628 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200629 }
630
631 if (use_x11) {
632 libs += [
633 "dl",
634 "rt",
635 "Xext",
636 "X11",
637 "Xcomposite",
638 "Xrender",
639 ]
640 }
641
642 if (is_linux) {
643 libs += [
644 "dl",
645 "rt",
646 ]
647 }
648
649 if (is_mac) {
650 sources += [
651 "macutils.cc",
652 "macutils.h",
653 ]
654 libs += [
655 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
656 "ApplicationServices.framework",
657 ]
658 }
659
660 if (is_win) {
661 sources += [
662 "win32.cc",
663 "win32.h",
664 "win32filesystem.cc",
665 "win32filesystem.h",
666 "win32securityerrors.cc",
667 "win32window.cc",
668 "win32window.h",
669 ]
670
671 libs += [
672 "crypt32.lib",
673 "iphlpapi.lib",
674 "secur32.lib",
675 ]
676
677 cflags += [
678 # Suppress warnings about WIN32_LEAN_AND_MEAN.
679 "/wd4005",
680 "/wd4703",
681 ]
682
683 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
684 }
685
686 if (is_posix) {
687 sources += [
688 "ifaddrs_converter.cc",
689 "ifaddrs_converter.h",
690 "unixfilesystem.cc",
691 "unixfilesystem.h",
692 ]
693 }
694
695 if (is_nacl) {
696 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
697 defines += [ "timezone=_timezone" ]
698 sources -= [ "ifaddrs_converter.cc" ]
699 }
700 if (is_win && is_clang) {
701 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
702 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
703 }
704}
705
706rtc_source_set("gtest_prod") {
707 sources = [
708 "gtest_prod_util.h",
709 ]
710}
711
712config("rtc_base_tests_utils_exported_config") {
713 defines = [ "GTEST_RELATIVE_PATH" ]
714}
715
716config("rtc_base_tests_utils_warnings_config") {
717 if (is_win && is_clang) {
718 cflags = [
719 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
720 "-Wno-reorder",
721 "-Wno-sign-compare",
722 ]
723 }
724}
725
726rtc_source_set("rtc_base_tests_utils") {
727 testonly = true
728 sources = [
729 # Also use this as a convenient dumping ground for misc files that are
730 # included by multiple targets below.
731 "cpu_time.cc",
732 "cpu_time.h",
733 "fakeclock.cc",
734 "fakeclock.h",
735 "fakenetwork.h",
736 "fakesslidentity.h",
737 "firewallsocketserver.cc",
738 "firewallsocketserver.h",
739 "gunit.h",
740 "httpserver.cc",
741 "httpserver.h",
742 "md5.cc",
743 "md5.h",
744 "md5digest.cc",
745 "md5digest.h",
746 "memory_usage.cc",
747 "memory_usage.h",
748 "natserver.cc",
749 "natserver.h",
750 "natsocketfactory.cc",
751 "natsocketfactory.h",
752 "nattypes.cc",
753 "nattypes.h",
754 "proxyserver.cc",
755 "proxyserver.h",
756 "sha1.cc",
757 "sha1.h",
758 "sha1digest.cc",
759 "sha1digest.h",
760 "sigslottester.h",
761 "sigslottester.h.pump",
762 "testbase64.h",
763 "testclient.cc",
764 "testclient.h",
765 "testechoserver.h",
766 "testutils.h",
767 "timedelta.h",
768 "virtualsocketserver.cc",
769 "virtualsocketserver.h",
770 ]
771 configs += [ ":rtc_base_tests_utils_warnings_config" ]
772 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
773 deps = [
774 ":rtc_base",
775 "../test:field_trial",
776 "../test:test_support",
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
789if (rtc_include_tests) {
790 rtc_source_set("rtc_base_tests_main") {
791 testonly = true
792 sources = [
793 "unittest_main.cc",
794 ]
795 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
796 deps = [
797 ":rtc_base",
798 ":rtc_base_approved",
799 ":rtc_base_tests_utils",
800 "../test:field_trial",
801 "../test:test_support",
802 ]
803
804 public_deps = [
805 "//testing/gmock",
806 "//testing/gtest",
807 ]
808
809 if (!build_with_chromium && is_clang) {
810 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
811 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
812 }
813 }
814
815 rtc_source_set("rtc_base_nonparallel_tests") {
816 testonly = true
817
818 # Skip restricting visibility on mobile platforms since the tests on those
819 # gets additional generated targets which would require many lines here to
820 # cover (which would be confusing to read and hard to maintain).
821 if (!is_android && !is_ios) {
822 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800823 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200824 }
825 sources = [
826 "cpu_time_unittest.cc",
827 "filerotatingstream_unittest.cc",
828 "nullsocketserver_unittest.cc",
829 "physicalsocketserver_unittest.cc",
830 "socket_unittest.cc",
831 "socket_unittest.h",
832 "socketaddress_unittest.cc",
833 ]
834 deps = [
835 ":rtc_base",
836 ":rtc_base_tests_main",
837 ":rtc_base_tests_utils",
838 "../system_wrappers:system_wrappers",
839 "../test:test_support",
840 "//testing/gtest",
841 ]
842 if (is_win) {
843 sources += [ "win32socketserver_unittest.cc" ]
844 }
845
846 if (!build_with_chromium && is_clang) {
847 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
848 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
849 }
850 }
851
852 rtc_source_set("rtc_base_approved_unittests") {
853 testonly = true
854
855 # Skip restricting visibility on mobile platforms since the tests on those
856 # gets additional generated targets which would require many lines here to
857 # cover (which would be confusing to read and hard to maintain).
858 if (!is_android && !is_ios) {
859 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800860 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200861 }
862 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200863 "atomicops_unittest.cc",
864 "base64_unittest.cc",
865 "basictypes_unittest.cc",
866 "bind_unittest.cc",
867 "bitbuffer_unittest.cc",
868 "buffer_unittest.cc",
869 "bufferqueue_unittest.cc",
870 "bytebuffer_unittest.cc",
871 "byteorder_unittest.cc",
872 "copyonwritebuffer_unittest.cc",
873 "criticalsection_unittest.cc",
874 "event_tracer_unittest.cc",
875 "event_unittest.cc",
876 "file_unittest.cc",
877 "function_view_unittest.cc",
878 "logging_unittest.cc",
879 "md5digest_unittest.cc",
880 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700881 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200882 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200883 "pathutils_unittest.cc",
884 "platform_thread_unittest.cc",
885 "random_unittest.cc",
886 "rate_limiter_unittest.cc",
887 "rate_statistics_unittest.cc",
888 "ratetracker_unittest.cc",
889 "refcountedobject_unittest.cc",
890 "safe_compare_unittest.cc",
891 "safe_minmax_unittest.cc",
892 "string_to_number_unittest.cc",
893 "stringencode_unittest.cc",
894 "stringize_macros_unittest.cc",
895 "stringutils_unittest.cc",
896 "swap_queue_unittest.cc",
897 "thread_annotations_unittest.cc",
898 "thread_checker_unittest.cc",
899 "timestampaligner_unittest.cc",
900 "timeutils_unittest.cc",
901 "virtualsocket_unittest.cc",
902 ]
903 deps = [
904 ":rtc_base",
905 ":rtc_base_approved",
906 ":rtc_base_tests_main",
907 ":rtc_base_tests_utils",
908 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700909 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200910 "../system_wrappers:system_wrappers",
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("rtc_task_queue_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 "task_queue_unittest.cc",
931 ]
932 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700933 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200934 ":rtc_base_tests_main",
935 ":rtc_base_tests_utils",
936 ":rtc_task_queue",
937 "../test:test_support",
938 ]
939 if (!build_with_chromium && is_clang) {
940 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
941 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
942 }
943 }
944
945 rtc_source_set("sequenced_task_checker_unittests") {
946 testonly = true
947
948 # Skip restricting visibility on mobile platforms since the tests on those
949 # gets additional generated targets which would require many lines here to
950 # cover (which would be confusing to read and hard to maintain).
951 if (!is_android && !is_ios) {
952 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800953 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200954 }
955 sources = [
956 "sequenced_task_checker_unittest.cc",
957 ]
958 deps = [
959 ":rtc_base_approved",
960 ":rtc_base_tests_main",
961 ":rtc_task_queue",
962 ":sequenced_task_checker",
963 "../test:test_support",
964 ]
965 }
966
967 rtc_source_set("weak_ptr_unittests") {
968 testonly = true
969
970 # Skip restricting visibility on mobile platforms since the tests on those
971 # gets additional generated targets which would require many lines here to
972 # cover (which would be confusing to read and hard to maintain).
973 if (!is_android && !is_ios) {
974 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800975 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200976 }
977 sources = [
978 "weak_ptr_unittest.cc",
979 ]
980 deps = [
981 ":rtc_base_tests_main",
982 ":rtc_base_tests_utils",
983 ":rtc_task_queue",
984 ":weak_ptr",
985 "../test:test_support",
986 ]
987 }
988
989 rtc_source_set("rtc_numerics_unittests") {
990 testonly = true
991
992 # Skip restricting visibility on mobile platforms since the tests on those
993 # gets additional generated targets which would require many lines here to
994 # cover (which would be confusing to read and hard to maintain).
995 if (!is_android && !is_ios) {
996 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800997 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200998 }
999 sources = [
1000 "numerics/exp_filter_unittest.cc",
1001 "numerics/percentile_filter_unittest.cc",
1002 ]
1003 deps = [
1004 ":rtc_base_approved",
1005 ":rtc_base_tests_main",
1006 ":rtc_numerics",
1007 "../test:test_support",
1008 ]
1009 }
1010
1011 config("rtc_base_unittests_config") {
1012 if (is_clang) {
1013 cflags = [ "-Wno-unused-const-variable" ]
1014 }
1015 }
1016 rtc_source_set("rtc_base_unittests") {
1017 testonly = true
1018
1019 # Skip restricting visibility on mobile platforms since the tests on those
1020 # gets additional generated targets which would require many lines here to
1021 # cover (which would be confusing to read and hard to maintain).
1022 if (!is_android && !is_ios) {
1023 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001024 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001025 }
1026 sources = [
1027 "callback_unittest.cc",
1028 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001029 "helpers_unittest.cc",
1030 "httpbase_unittest.cc",
1031 "httpcommon_unittest.cc",
1032 "httpserver_unittest.cc",
1033 "ipaddress_unittest.cc",
1034 "memory_usage_unittest.cc",
1035 "messagedigest_unittest.cc",
1036 "messagequeue_unittest.cc",
1037 "nat_unittest.cc",
1038 "network_unittest.cc",
1039 "optionsfile_unittest.cc",
1040 "proxy_unittest.cc",
1041 "ptr_util_unittest.cc",
1042 "ratelimiter_unittest.cc",
1043 "rollingaccumulator_unittest.cc",
1044 "rtccertificate_unittest.cc",
1045 "rtccertificategenerator_unittest.cc",
1046 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001047 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001048 "sigslot_unittest.cc",
1049 "sigslottester_unittest.cc",
1050 "stream_unittest.cc",
1051 "testclient_unittest.cc",
1052 "thread_unittest.cc",
1053 ]
1054 if (is_win) {
1055 sources += [
1056 "win32_unittest.cc",
1057 "win32window_unittest.cc",
1058 ]
1059 }
1060 if (is_mac) {
1061 sources += [ "macutils_unittest.cc" ]
1062 }
1063 if (is_posix) {
1064 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001065 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001066 "ssladapter_unittest.cc",
1067 "sslidentity_unittest.cc",
1068 "sslstreamadapter_unittest.cc",
1069 ]
1070 }
1071 deps = [
1072 ":rtc_base_tests_main",
1073 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001074 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001075 "../test:test_support",
1076 ]
1077 public_deps = [
1078 ":rtc_base",
1079 ]
1080 configs += [ ":rtc_base_unittests_config" ]
1081 if (!build_with_chromium && is_clang) {
1082 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1083 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1084 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001085 if (build_with_chromium) {
1086 include_dirs = [ "../../boringssl/src/include" ]
1087 }
1088 if (rtc_build_ssl) {
1089 deps += [ "//third_party/boringssl" ]
1090 } else {
1091 configs += [ ":external_ssl_library" ]
1092 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001093 }
1094}
1095
Henrik Kjellander73e21802017-06-20 08:38:58 +02001096if (is_android) {
1097 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001098 java_files = [
1099 "java/src/org/webrtc/ContextUtils.java",
1100 "java/src/org/webrtc/Logging.java",
1101 "java/src/org/webrtc/Size.java",
1102 "java/src/org/webrtc/ThreadUtils.java",
1103 ]
charujain474acce2017-08-25 06:21:52 -07001104
1105 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1106 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001107 }
1108}