blob: 93f8990ccc0a416cccfca0fcd6b421d18e939ac1 [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_chromium_config") {
35 defines = [ "NO_MAIN_THREAD_WRAPPING" ]
36}
37
38config("rtc_base_all_dependent_config") {
39 if (is_ios) {
40 libs = [
41 "CFNetwork.framework",
42 "Security.framework",
43 "SystemConfiguration.framework",
44 "UIKit.framework",
45 ]
46 }
47 if (is_mac) {
48 libs = [
49 "Cocoa.framework",
50 "Foundation.framework",
51 "IOKit.framework",
52 "Security.framework",
53 "SystemConfiguration.framework",
54 ]
55 }
56}
57
58if (!rtc_build_ssl) {
59 config("external_ssl_library") {
60 assert(rtc_ssl_root != "",
61 "You must specify rtc_ssl_root when rtc_build_ssl==0.")
62 include_dirs = [ rtc_ssl_root ]
63 }
64}
65
66source_set("protobuf_utils") {
67 sources = [
68 "protobuf_utils.h",
69 ]
70 if (rtc_enable_protobuf) {
71 public_deps = [
72 "//third_party/protobuf:protobuf_lite",
73 ]
74 }
75}
76
77source_set("compile_assert_c") {
78 sources = [
79 "compile_assert_c.h",
80 ]
81}
82
mbonadeibc378472017-09-11 03:43:34 -070083rtc_source_set("rtc_base_approved") {
84 public_deps = [
85 ":rtc_base_approved_generic",
86 ]
87 if (is_mac && !build_with_chromium) {
88 public_deps += [ ":rtc_base_approved_objc" ]
89 }
90}
91
Henrik Kjellanderc0362762017-06-29 08:03:04 +020092# The subset of rtc_base approved for use outside of libjingle.
mbonadeibc378472017-09-11 03:43:34 -070093rtc_source_set("rtc_base_approved_generic") {
94 visibility = [
95 ":rtc_base_approved",
96 ":rtc_base_approved_objc",
97 ]
98
Henrik Kjellanderc0362762017-06-29 08:03:04 +020099 # TODO(kjellander): Remove (bugs.webrtc.org/7480)
100 # Enabling GN check triggers a cyclic dependency caused by rate_limiter.cc:
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800101 # :rtc_base_approved -> ../system_wrappers -> :rtc_base_approved
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200102 check_includes = false
103 defines = []
104 libs = []
105 deps = []
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200106
107 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200108 "arraysize.h",
109 "atomicops.h",
110 "base64.cc",
111 "base64.h",
112 "basictypes.h",
113 "bind.h",
114 "bitbuffer.cc",
115 "bitbuffer.h",
116 "buffer.h",
117 "bufferqueue.cc",
118 "bufferqueue.h",
119 "bytebuffer.cc",
120 "bytebuffer.h",
121 "byteorder.h",
122 "checks.cc",
123 "checks.h",
124 "constructormagic.h",
125 "copyonwritebuffer.cc",
126 "copyonwritebuffer.h",
127 "criticalsection.cc",
128 "criticalsection.h",
129 "deprecation.h",
130 "event.cc",
131 "event.h",
132 "event_tracer.cc",
133 "event_tracer.h",
134 "file.cc",
135 "file.h",
136 "flags.cc",
137 "flags.h",
138 "format_macros.h",
139 "function_view.h",
140 "ignore_wundef.h",
141 "location.cc",
142 "location.h",
143 "mod_ops.h",
ilnika79cc282017-08-23 05:24:10 -0700144 "moving_max_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200145 "onetimeevent.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200146 "pathutils.cc",
147 "pathutils.h",
148 "platform_file.cc",
149 "platform_file.h",
150 "platform_thread.cc",
151 "platform_thread.h",
152 "platform_thread_types.h",
153 "ptr_util.h",
154 "race_checker.cc",
155 "race_checker.h",
156 "random.cc",
157 "random.h",
158 "rate_limiter.cc",
159 "rate_limiter.h",
160 "rate_statistics.cc",
161 "rate_statistics.h",
162 "ratetracker.cc",
163 "ratetracker.h",
164 "refcount.h",
165 "refcountedobject.h",
166 "safe_compare.h",
167 "safe_conversions.h",
168 "safe_conversions_impl.h",
169 "safe_minmax.h",
170 "sanitizer.h",
171 "scoped_ref_ptr.h",
172 "string_to_number.cc",
173 "string_to_number.h",
174 "stringencode.cc",
175 "stringencode.h",
176 "stringize_macros.h",
177 "stringutils.cc",
178 "stringutils.h",
179 "swap_queue.h",
180 "template_util.h",
181 "thread_annotations.h",
182 "thread_checker.h",
183 "thread_checker_impl.cc",
184 "thread_checker_impl.h",
185 "timestampaligner.cc",
186 "timestampaligner.h",
187 "timeutils.cc",
188 "timeutils.h",
189 "trace_event.h",
190 "type_traits.h",
191 ]
192
193 deps += [ "..:webrtc_common" ]
194
195 if (is_android) {
196 libs += [ "log" ]
197 }
198
199 if (is_posix) {
200 sources += [ "file_posix.cc" ]
201 }
202
203 if (is_win) {
204 sources += [ "file_win.cc" ]
205 }
206
207 if (build_with_chromium) {
208 # Dependency on chromium's logging (in //base).
209 deps += [ "//base:base" ]
210 sources += [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200211 "../../webrtc_overrides/rtc_base/logging.cc",
212 "../../webrtc_overrides/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200213 ]
214 } else {
215 sources += [
216 "logging.cc",
217 "logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200218 ]
219 }
220 if (is_component_build && is_win) {
221 # Copy the VS runtime DLLs into the isolate so that they don't have to be
222 # preinstalled on the target machine. The debug runtimes have a "d" at
223 # the end.
224 # This is a copy of https://codereview.chromium.org/1783973002.
225 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
226 # so we don't have to copy their changes and risk breakages.
227 # See http://crbug.com/653569
228 if (is_debug) {
229 vcrt_suffix = "d"
230 } else {
231 vcrt_suffix = ""
232 }
233
234 # These runtime files are copied to the output directory by the
235 # vs_toolchain script that runs as part of toolchain configuration.
236 data = [
237 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
238 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
239 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
240
241 # Universal Windows 10 CRT files
242 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
243 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
244 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
245 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
246 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
248 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
249 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
250 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
251 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
254 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
256 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
259 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
261 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
264 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
266 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
279 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
280 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
281 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
282 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
283 ]
284 if (is_asan) {
285 if (current_cpu == "x64") {
286 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
287 } else {
288 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
289 }
290 }
291 }
292 if (is_nacl) {
293 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
294 }
295}
296
mbonadeibc378472017-09-11 03:43:34 -0700297if (is_mac && !build_with_chromium) {
298 config("rtc_base_approved_objc_all_dependent_config") {
299 visibility = [ ":rtc_base_approved_objc" ]
300 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
301 }
302
303 rtc_source_set("rtc_base_approved_objc") {
304 visibility = [ ":rtc_base_approved" ]
305 all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
306 sources = [
307 "logging_mac.mm",
308 ]
309 deps = [
310 ":rtc_base_approved_generic",
311 ]
312 }
313}
314
perkj650fdae2017-08-25 05:00:11 -0700315rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700316 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200317 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700318 ]
319 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700320 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200321 ]
322
perkj650fdae2017-08-25 05:00:11 -0700323 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700324 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700325 }
326}
327
328# WebRTC targets must not directly depend on rtc_task_queue_api or
329# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
330# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
331# to the default implemenation in rtc_task_queue_impl or if an externally
332# provided implementation should be used. An external implementation should
333# depend on rtc_task_queue_api.
334rtc_source_set("rtc_task_queue_api") {
nisse75dd6d42017-09-19 08:28:00 -0700335 sources = [
336 "task_queue.h",
337 ]
perkj650fdae2017-08-25 05:00:11 -0700338 deps = [
339 ":rtc_base_approved",
340 ]
341}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200342
perkj650fdae2017-08-25 05:00:11 -0700343rtc_source_set("rtc_task_queue_impl") {
344 deps = [
345 ":rtc_base_approved",
346 ":rtc_task_queue_api",
347 ]
348 if (build_with_chromium) {
349 sources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200350 "../../webrtc_overrides/rtc_base/task_queue.cc",
perkj650fdae2017-08-25 05:00:11 -0700351 ]
352 } else {
353 if (rtc_build_libevent) {
354 deps += [ "//base/third_party/libevent" ]
355 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200356 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700357 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200358 "task_queue_libevent.cc",
359 "task_queue_posix.cc",
perkj650fdae2017-08-25 05:00:11 -0700360 "task_queue_posix.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200361 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200362 } else {
363 if (is_mac || is_ios) {
perkj650fdae2017-08-25 05:00:11 -0700364 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200365 "task_queue_gcd.cc",
366 "task_queue_posix.cc",
367 ]
368 }
369 if (is_win) {
perkj650fdae2017-08-25 05:00:11 -0700370 sources = [
371 "task_queue_win.cc",
372 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200373 }
374 }
375 }
376}
377
378rtc_static_library("sequenced_task_checker") {
379 sources = [
380 "sequenced_task_checker.h",
381 "sequenced_task_checker_impl.cc",
382 "sequenced_task_checker_impl.h",
383 ]
384 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700385 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200386 ":rtc_task_queue",
387 ]
388}
389
390rtc_static_library("weak_ptr") {
391 sources = [
392 "weak_ptr.cc",
393 "weak_ptr.h",
394 ]
395 deps = [
396 ":rtc_base_approved",
397 ":sequenced_task_checker",
398 ]
399}
400
401rtc_static_library("rtc_numerics") {
402 sources = [
403 "numerics/exp_filter.cc",
404 "numerics/exp_filter.h",
405 "numerics/percentile_filter.h",
406 ]
407 deps = [
408 ":rtc_base_approved",
409 ]
410}
411
412config("rtc_base_warnings_config") {
413 if (is_win && is_clang) {
414 cflags = [
415 # Disable warnings failing when compiling with Clang on Windows.
416 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
417 "-Wno-sign-compare",
418 "-Wno-missing-braces",
419 ]
420 }
421}
422
423rtc_source_set("rtc_json") {
424 defines = []
425 sources = [
426 "json.cc",
427 "json.h",
428 ]
429 if (rtc_build_json) {
430 public_deps = [
431 "//third_party/jsoncpp",
432 ]
433 } else {
434 include_dirs = [ "$rtc_jsoncpp_root" ]
435
436 # When defined changes the include path for json.h to where it is
437 # expected to be when building json outside of the standalone build.
438 defines += [ "WEBRTC_EXTERNAL_JSON" ]
439 }
440}
441
mbonadei9c5e5112017-09-05 05:17:02 -0700442rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700443 public_deps = [
444 ":rtc_base_generic",
445 ]
446 if (is_win) {
447 sources = [
448 "noop.cc",
449 ]
450 }
451 if (is_ios || is_mac) {
452 sources = [
453 "noop.mm",
454 ]
455 public_deps += [ ":rtc_base_objc" ]
456 }
457}
458
459if (is_ios || is_mac) {
460 rtc_source_set("rtc_base_objc") {
461 sources = [
462 "thread_darwin.mm",
463 ]
464 deps = [
465 ":rtc_base_generic",
466 ]
467 visibility = [ ":rtc_base" ]
468 }
469}
470
471rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200472 cflags = []
473 cflags_cc = []
474 libs = []
475 defines = []
476 deps = [
477 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700478 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200479 ]
480 public_deps = [
481 ":rtc_base_approved",
482 ]
483 public_configs = []
484
485 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
486
487 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200488 "asyncinvoker-inl.h",
489 "asyncinvoker.cc",
490 "asyncinvoker.h",
491 "asyncpacketsocket.cc",
492 "asyncpacketsocket.h",
493 "asyncresolverinterface.cc",
494 "asyncresolverinterface.h",
495 "asyncsocket.cc",
496 "asyncsocket.h",
497 "asynctcpsocket.cc",
498 "asynctcpsocket.h",
499 "asyncudpsocket.cc",
500 "asyncudpsocket.h",
501 "crc32.cc",
502 "crc32.h",
503 "cryptstring.cc",
504 "cryptstring.h",
505 "filerotatingstream.cc",
506 "filerotatingstream.h",
507 "fileutils.cc",
508 "fileutils.h",
509 "gunit_prod.h",
510 "helpers.cc",
511 "helpers.h",
512 "httpbase.cc",
513 "httpbase.h",
514 "httpcommon-inl.h",
515 "httpcommon.cc",
516 "httpcommon.h",
517 "ipaddress.cc",
518 "ipaddress.h",
519 "messagedigest.cc",
520 "messagedigest.h",
521 "messagehandler.cc",
522 "messagehandler.h",
523 "messagequeue.cc",
524 "messagequeue.h",
525 "nethelpers.cc",
526 "nethelpers.h",
527 "network.cc",
528 "network.h",
529 "networkmonitor.cc",
530 "networkmonitor.h",
531 "nullsocketserver.cc",
532 "nullsocketserver.h",
533 "openssl.h",
534 "openssladapter.cc",
535 "openssladapter.h",
536 "openssldigest.cc",
537 "openssldigest.h",
538 "opensslidentity.cc",
539 "opensslidentity.h",
540 "opensslstreamadapter.cc",
541 "opensslstreamadapter.h",
542 "physicalsocketserver.cc",
543 "physicalsocketserver.h",
544 "proxyinfo.cc",
545 "proxyinfo.h",
546 "ratelimiter.cc",
547 "ratelimiter.h",
548 "rtccertificate.cc",
549 "rtccertificate.h",
550 "rtccertificategenerator.cc",
551 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700552 "signalthread.cc",
553 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200554 "sigslot.cc",
555 "sigslot.h",
556 "socket.h",
557 "socketadapters.cc",
558 "socketadapters.h",
559 "socketaddress.cc",
560 "socketaddress.h",
561 "socketaddresspair.cc",
562 "socketaddresspair.h",
563 "socketfactory.h",
564 "socketserver.h",
565 "socketstream.cc",
566 "socketstream.h",
567 "ssladapter.cc",
568 "ssladapter.h",
569 "sslfingerprint.cc",
570 "sslfingerprint.h",
571 "sslidentity.cc",
572 "sslidentity.h",
573 "sslstreamadapter.cc",
574 "sslstreamadapter.h",
575 "stream.cc",
576 "stream.h",
577 "thread.cc",
578 "thread.h",
579 ]
580
mbonadei310e32b2017-09-07 07:36:28 -0700581 visibility = [
582 ":rtc_base",
583 ":rtc_base_objc",
584 ]
585
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200586 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
587 # compiler settings.
588 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
589 configs += [ "//build/config/compiler:no_chromium_code" ]
590 if (!is_win) {
591 cflags += [ "-Wno-uninitialized" ]
592 }
593
594 if (build_with_chromium) {
595 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200596 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200597 }
598 include_dirs = [ "../../boringssl/src/include" ]
599 public_configs += [ ":rtc_base_chromium_config" ]
600 } else {
601 configs += [ ":rtc_base_warnings_config" ]
602 sources += [
603 "callback.h",
604 "logsinks.cc",
605 "logsinks.h",
606 "mathutils.h",
607 "optionsfile.cc",
608 "optionsfile.h",
609 "rollingaccumulator.h",
610 "sslroots.h",
611 "transformadapter.cc",
612 "transformadapter.h",
613 "window.h",
614 ]
615
616 if (is_win) {
617 sources += [
618 "win32socketinit.cc",
619 "win32socketinit.h",
620 "win32socketserver.cc",
621 "win32socketserver.h",
622 ]
623 }
624 } # !build_with_chromium
625
626 if (rtc_build_ssl) {
627 deps += [ "//third_party/boringssl" ]
628 } else {
629 configs += [ ":external_ssl_library" ]
630 }
631
632 if (is_android) {
633 sources += [
634 "ifaddrs-android.cc",
635 "ifaddrs-android.h",
636 ]
637
638 libs += [
639 "log",
640 "GLESv2",
641 ]
642 }
643
644 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700645 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200646 }
647
648 if (use_x11) {
649 libs += [
650 "dl",
651 "rt",
652 "Xext",
653 "X11",
654 "Xcomposite",
655 "Xrender",
656 ]
657 }
658
659 if (is_linux) {
660 libs += [
661 "dl",
662 "rt",
663 ]
664 }
665
666 if (is_mac) {
667 sources += [
668 "macutils.cc",
669 "macutils.h",
670 ]
671 libs += [
672 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
673 "ApplicationServices.framework",
674 ]
675 }
676
677 if (is_win) {
678 sources += [
679 "win32.cc",
680 "win32.h",
681 "win32filesystem.cc",
682 "win32filesystem.h",
683 "win32securityerrors.cc",
684 "win32window.cc",
685 "win32window.h",
686 ]
687
688 libs += [
689 "crypt32.lib",
690 "iphlpapi.lib",
691 "secur32.lib",
692 ]
693
694 cflags += [
695 # Suppress warnings about WIN32_LEAN_AND_MEAN.
696 "/wd4005",
697 "/wd4703",
698 ]
699
700 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
701 }
702
703 if (is_posix) {
704 sources += [
705 "ifaddrs_converter.cc",
706 "ifaddrs_converter.h",
707 "unixfilesystem.cc",
708 "unixfilesystem.h",
709 ]
710 }
711
712 if (is_nacl) {
713 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
714 defines += [ "timezone=_timezone" ]
715 sources -= [ "ifaddrs_converter.cc" ]
716 }
717 if (is_win && is_clang) {
718 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
719 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
720 }
721}
722
723rtc_source_set("gtest_prod") {
724 sources = [
725 "gtest_prod_util.h",
726 ]
727}
728
729config("rtc_base_tests_utils_exported_config") {
730 defines = [ "GTEST_RELATIVE_PATH" ]
731}
732
733config("rtc_base_tests_utils_warnings_config") {
734 if (is_win && is_clang) {
735 cflags = [
736 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
737 "-Wno-reorder",
738 "-Wno-sign-compare",
739 ]
740 }
741}
742
743rtc_source_set("rtc_base_tests_utils") {
744 testonly = true
745 sources = [
746 # Also use this as a convenient dumping ground for misc files that are
747 # included by multiple targets below.
748 "cpu_time.cc",
749 "cpu_time.h",
750 "fakeclock.cc",
751 "fakeclock.h",
752 "fakenetwork.h",
753 "fakesslidentity.h",
754 "firewallsocketserver.cc",
755 "firewallsocketserver.h",
756 "gunit.h",
757 "httpserver.cc",
758 "httpserver.h",
759 "md5.cc",
760 "md5.h",
761 "md5digest.cc",
762 "md5digest.h",
763 "memory_usage.cc",
764 "memory_usage.h",
765 "natserver.cc",
766 "natserver.h",
767 "natsocketfactory.cc",
768 "natsocketfactory.h",
769 "nattypes.cc",
770 "nattypes.h",
771 "proxyserver.cc",
772 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200773 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200774 "sha1.cc",
775 "sha1.h",
776 "sha1digest.cc",
777 "sha1digest.h",
778 "sigslottester.h",
779 "sigslottester.h.pump",
780 "testbase64.h",
781 "testclient.cc",
782 "testclient.h",
783 "testechoserver.h",
784 "testutils.h",
785 "timedelta.h",
786 "virtualsocketserver.cc",
787 "virtualsocketserver.h",
788 ]
789 configs += [ ":rtc_base_tests_utils_warnings_config" ]
790 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
791 deps = [
792 ":rtc_base",
793 "../test:field_trial",
794 "../test:test_support",
795 ]
796 public_deps = [
797 "//testing/gmock",
798 "//testing/gtest",
799 ]
800
801 if (!build_with_chromium && is_clang) {
802 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
803 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
804 }
805}
806
807if (rtc_include_tests) {
808 rtc_source_set("rtc_base_tests_main") {
809 testonly = true
810 sources = [
811 "unittest_main.cc",
812 ]
813 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
814 deps = [
815 ":rtc_base",
816 ":rtc_base_approved",
817 ":rtc_base_tests_utils",
818 "../test:field_trial",
819 "../test:test_support",
820 ]
821
822 public_deps = [
823 "//testing/gmock",
824 "//testing/gtest",
825 ]
826
827 if (!build_with_chromium && is_clang) {
828 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
829 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
830 }
831 }
832
833 rtc_source_set("rtc_base_nonparallel_tests") {
834 testonly = true
835
836 # Skip restricting visibility on mobile platforms since the tests on those
837 # gets additional generated targets which would require many lines here to
838 # cover (which would be confusing to read and hard to maintain).
839 if (!is_android && !is_ios) {
840 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800841 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200842 }
843 sources = [
844 "cpu_time_unittest.cc",
845 "filerotatingstream_unittest.cc",
846 "nullsocketserver_unittest.cc",
847 "physicalsocketserver_unittest.cc",
848 "socket_unittest.cc",
849 "socket_unittest.h",
850 "socketaddress_unittest.cc",
851 ]
852 deps = [
853 ":rtc_base",
854 ":rtc_base_tests_main",
855 ":rtc_base_tests_utils",
856 "../system_wrappers:system_wrappers",
857 "../test:test_support",
858 "//testing/gtest",
859 ]
860 if (is_win) {
861 sources += [ "win32socketserver_unittest.cc" ]
862 }
863
864 if (!build_with_chromium && is_clang) {
865 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
866 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
867 }
868 }
869
870 rtc_source_set("rtc_base_approved_unittests") {
871 testonly = true
872
873 # Skip restricting visibility on mobile platforms since the tests on those
874 # gets additional generated targets which would require many lines here to
875 # cover (which would be confusing to read and hard to maintain).
876 if (!is_android && !is_ios) {
877 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800878 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200879 }
880 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200881 "atomicops_unittest.cc",
882 "base64_unittest.cc",
883 "basictypes_unittest.cc",
884 "bind_unittest.cc",
885 "bitbuffer_unittest.cc",
886 "buffer_unittest.cc",
887 "bufferqueue_unittest.cc",
888 "bytebuffer_unittest.cc",
889 "byteorder_unittest.cc",
890 "copyonwritebuffer_unittest.cc",
891 "criticalsection_unittest.cc",
892 "event_tracer_unittest.cc",
893 "event_unittest.cc",
894 "file_unittest.cc",
895 "function_view_unittest.cc",
896 "logging_unittest.cc",
897 "md5digest_unittest.cc",
898 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700899 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200900 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200901 "pathutils_unittest.cc",
902 "platform_thread_unittest.cc",
903 "random_unittest.cc",
904 "rate_limiter_unittest.cc",
905 "rate_statistics_unittest.cc",
906 "ratetracker_unittest.cc",
907 "refcountedobject_unittest.cc",
908 "safe_compare_unittest.cc",
909 "safe_minmax_unittest.cc",
910 "string_to_number_unittest.cc",
911 "stringencode_unittest.cc",
912 "stringize_macros_unittest.cc",
913 "stringutils_unittest.cc",
914 "swap_queue_unittest.cc",
915 "thread_annotations_unittest.cc",
916 "thread_checker_unittest.cc",
917 "timestampaligner_unittest.cc",
918 "timeutils_unittest.cc",
919 "virtualsocket_unittest.cc",
920 ]
921 deps = [
922 ":rtc_base",
923 ":rtc_base_approved",
924 ":rtc_base_tests_main",
925 ":rtc_base_tests_utils",
926 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700927 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200928 "../system_wrappers:system_wrappers",
929 "../test:test_support",
930 ]
931 if (!build_with_chromium && is_clang) {
932 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
933 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
934 }
935 }
936
937 rtc_source_set("rtc_task_queue_unittests") {
938 testonly = true
939
940 # Skip restricting visibility on mobile platforms since the tests on those
941 # gets additional generated targets which would require many lines here to
942 # cover (which would be confusing to read and hard to maintain).
943 if (!is_android && !is_ios) {
944 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800945 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200946 }
947 sources = [
948 "task_queue_unittest.cc",
949 ]
950 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700951 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200952 ":rtc_base_tests_main",
953 ":rtc_base_tests_utils",
954 ":rtc_task_queue",
955 "../test:test_support",
956 ]
957 if (!build_with_chromium && is_clang) {
958 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
959 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
960 }
961 }
962
963 rtc_source_set("sequenced_task_checker_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 "sequenced_task_checker_unittest.cc",
975 ]
976 deps = [
977 ":rtc_base_approved",
978 ":rtc_base_tests_main",
979 ":rtc_task_queue",
980 ":sequenced_task_checker",
981 "../test:test_support",
982 ]
983 }
984
985 rtc_source_set("weak_ptr_unittests") {
986 testonly = true
987
988 # Skip restricting visibility on mobile platforms since the tests on those
989 # gets additional generated targets which would require many lines here to
990 # cover (which would be confusing to read and hard to maintain).
991 if (!is_android && !is_ios) {
992 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800993 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200994 }
995 sources = [
996 "weak_ptr_unittest.cc",
997 ]
998 deps = [
999 ":rtc_base_tests_main",
1000 ":rtc_base_tests_utils",
1001 ":rtc_task_queue",
1002 ":weak_ptr",
1003 "../test:test_support",
1004 ]
1005 }
1006
1007 rtc_source_set("rtc_numerics_unittests") {
1008 testonly = true
1009
1010 # Skip restricting visibility on mobile platforms since the tests on those
1011 # gets additional generated targets which would require many lines here to
1012 # cover (which would be confusing to read and hard to maintain).
1013 if (!is_android && !is_ios) {
1014 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001015 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001016 }
1017 sources = [
1018 "numerics/exp_filter_unittest.cc",
1019 "numerics/percentile_filter_unittest.cc",
1020 ]
1021 deps = [
1022 ":rtc_base_approved",
1023 ":rtc_base_tests_main",
1024 ":rtc_numerics",
1025 "../test:test_support",
1026 ]
1027 }
1028
1029 config("rtc_base_unittests_config") {
1030 if (is_clang) {
1031 cflags = [ "-Wno-unused-const-variable" ]
1032 }
1033 }
1034 rtc_source_set("rtc_base_unittests") {
1035 testonly = true
1036
1037 # Skip restricting visibility on mobile platforms since the tests on those
1038 # gets additional generated targets which would require many lines here to
1039 # cover (which would be confusing to read and hard to maintain).
1040 if (!is_android && !is_ios) {
1041 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001042 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001043 }
1044 sources = [
1045 "callback_unittest.cc",
1046 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001047 "helpers_unittest.cc",
1048 "httpbase_unittest.cc",
1049 "httpcommon_unittest.cc",
1050 "httpserver_unittest.cc",
1051 "ipaddress_unittest.cc",
1052 "memory_usage_unittest.cc",
1053 "messagedigest_unittest.cc",
1054 "messagequeue_unittest.cc",
1055 "nat_unittest.cc",
1056 "network_unittest.cc",
1057 "optionsfile_unittest.cc",
1058 "proxy_unittest.cc",
1059 "ptr_util_unittest.cc",
1060 "ratelimiter_unittest.cc",
1061 "rollingaccumulator_unittest.cc",
1062 "rtccertificate_unittest.cc",
1063 "rtccertificategenerator_unittest.cc",
1064 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001065 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001066 "sigslot_unittest.cc",
1067 "sigslottester_unittest.cc",
1068 "stream_unittest.cc",
1069 "testclient_unittest.cc",
1070 "thread_unittest.cc",
1071 ]
1072 if (is_win) {
1073 sources += [
1074 "win32_unittest.cc",
1075 "win32window_unittest.cc",
1076 ]
1077 }
1078 if (is_mac) {
1079 sources += [ "macutils_unittest.cc" ]
1080 }
1081 if (is_posix) {
1082 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001083 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001084 "ssladapter_unittest.cc",
1085 "sslidentity_unittest.cc",
1086 "sslstreamadapter_unittest.cc",
1087 ]
1088 }
1089 deps = [
1090 ":rtc_base_tests_main",
1091 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001092 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001093 "../test:test_support",
1094 ]
1095 public_deps = [
1096 ":rtc_base",
1097 ]
1098 configs += [ ":rtc_base_unittests_config" ]
1099 if (!build_with_chromium && is_clang) {
1100 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1101 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1102 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001103 if (build_with_chromium) {
1104 include_dirs = [ "../../boringssl/src/include" ]
1105 }
1106 if (rtc_build_ssl) {
1107 deps += [ "//third_party/boringssl" ]
1108 } else {
1109 configs += [ ":external_ssl_library" ]
1110 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001111 }
1112}
1113
Henrik Kjellander73e21802017-06-20 08:38:58 +02001114if (is_android) {
1115 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001116 java_files = [
1117 "java/src/org/webrtc/ContextUtils.java",
1118 "java/src/org/webrtc/Logging.java",
1119 "java/src/org/webrtc/Size.java",
1120 "java/src/org/webrtc/ThreadUtils.java",
1121 ]
charujain474acce2017-08-25 06:21:52 -07001122
1123 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1124 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001125 }
1126}