blob: 7a76b7e6ee2bbfd016c6b39e29f671052efe1ee2 [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 = [
108 "array_view.h",
109 "arraysize.h",
110 "atomicops.h",
111 "base64.cc",
112 "base64.h",
113 "basictypes.h",
114 "bind.h",
115 "bitbuffer.cc",
116 "bitbuffer.h",
117 "buffer.h",
118 "bufferqueue.cc",
119 "bufferqueue.h",
120 "bytebuffer.cc",
121 "bytebuffer.h",
122 "byteorder.h",
123 "checks.cc",
124 "checks.h",
125 "constructormagic.h",
126 "copyonwritebuffer.cc",
127 "copyonwritebuffer.h",
128 "criticalsection.cc",
129 "criticalsection.h",
130 "deprecation.h",
131 "event.cc",
132 "event.h",
133 "event_tracer.cc",
134 "event_tracer.h",
135 "file.cc",
136 "file.h",
137 "flags.cc",
138 "flags.h",
139 "format_macros.h",
140 "function_view.h",
141 "ignore_wundef.h",
142 "location.cc",
143 "location.h",
144 "mod_ops.h",
ilnika79cc282017-08-23 05:24:10 -0700145 "moving_max_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200146 "onetimeevent.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200147 "pathutils.cc",
148 "pathutils.h",
149 "platform_file.cc",
150 "platform_file.h",
151 "platform_thread.cc",
152 "platform_thread.h",
153 "platform_thread_types.h",
154 "ptr_util.h",
155 "race_checker.cc",
156 "race_checker.h",
157 "random.cc",
158 "random.h",
159 "rate_limiter.cc",
160 "rate_limiter.h",
161 "rate_statistics.cc",
162 "rate_statistics.h",
163 "ratetracker.cc",
164 "ratetracker.h",
165 "refcount.h",
166 "refcountedobject.h",
167 "safe_compare.h",
168 "safe_conversions.h",
169 "safe_conversions_impl.h",
170 "safe_minmax.h",
171 "sanitizer.h",
172 "scoped_ref_ptr.h",
173 "string_to_number.cc",
174 "string_to_number.h",
175 "stringencode.cc",
176 "stringencode.h",
177 "stringize_macros.h",
178 "stringutils.cc",
179 "stringutils.h",
180 "swap_queue.h",
181 "template_util.h",
182 "thread_annotations.h",
183 "thread_checker.h",
184 "thread_checker_impl.cc",
185 "thread_checker_impl.h",
186 "timestampaligner.cc",
187 "timestampaligner.h",
188 "timeutils.cc",
189 "timeutils.h",
190 "trace_event.h",
191 "type_traits.h",
192 ]
193
194 deps += [ "..:webrtc_common" ]
195
196 if (is_android) {
197 libs += [ "log" ]
198 }
199
200 if (is_posix) {
201 sources += [ "file_posix.cc" ]
202 }
203
204 if (is_win) {
205 sources += [ "file_win.cc" ]
206 }
207
208 if (build_with_chromium) {
209 # Dependency on chromium's logging (in //base).
210 deps += [ "//base:base" ]
211 sources += [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200212 "../../webrtc_overrides/rtc_base/logging.cc",
213 "../../webrtc_overrides/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200214 ]
215 } else {
216 sources += [
217 "logging.cc",
218 "logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200219 ]
220 }
221 if (is_component_build && is_win) {
222 # Copy the VS runtime DLLs into the isolate so that they don't have to be
223 # preinstalled on the target machine. The debug runtimes have a "d" at
224 # the end.
225 # This is a copy of https://codereview.chromium.org/1783973002.
226 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
227 # so we don't have to copy their changes and risk breakages.
228 # See http://crbug.com/653569
229 if (is_debug) {
230 vcrt_suffix = "d"
231 } else {
232 vcrt_suffix = ""
233 }
234
235 # These runtime files are copied to the output directory by the
236 # vs_toolchain script that runs as part of toolchain configuration.
237 data = [
238 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
239 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
240 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
241
242 # Universal Windows 10 CRT files
243 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
244 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
245 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
246 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
248 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
249 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
250 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
251 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
255 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
256 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
260 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
261 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
265 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
266 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
279 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
280 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
281 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
282 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
283 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
284 ]
285 if (is_asan) {
286 if (current_cpu == "x64") {
287 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
288 } else {
289 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
290 }
291 }
292 }
293 if (is_nacl) {
294 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
295 }
296}
297
mbonadeibc378472017-09-11 03:43:34 -0700298if (is_mac && !build_with_chromium) {
299 config("rtc_base_approved_objc_all_dependent_config") {
300 visibility = [ ":rtc_base_approved_objc" ]
301 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
302 }
303
304 rtc_source_set("rtc_base_approved_objc") {
305 visibility = [ ":rtc_base_approved" ]
306 all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
307 sources = [
308 "logging_mac.mm",
309 ]
310 deps = [
311 ":rtc_base_approved_generic",
312 ]
313 }
314}
315
perkj650fdae2017-08-25 05:00:11 -0700316rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700317 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200318 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700319 ]
320 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700321 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200322 ]
323
perkj650fdae2017-08-25 05:00:11 -0700324 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700325 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700326 }
327}
328
329# WebRTC targets must not directly depend on rtc_task_queue_api or
330# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
331# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
332# to the default implemenation in rtc_task_queue_impl or if an externally
333# provided implementation should be used. An external implementation should
334# depend on rtc_task_queue_api.
335rtc_source_set("rtc_task_queue_api") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200336 if (build_with_chromium) {
337 sources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200338 "../../webrtc_overrides/rtc_base/task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200339 ]
340 } else {
341 sources = [
342 "task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200343 ]
perkj650fdae2017-08-25 05:00:11 -0700344 }
345 deps = [
346 ":rtc_base_approved",
347 ]
348}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200349
perkj650fdae2017-08-25 05:00:11 -0700350rtc_source_set("rtc_task_queue_impl") {
351 deps = [
352 ":rtc_base_approved",
353 ":rtc_task_queue_api",
354 ]
355 if (build_with_chromium) {
356 sources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200357 "../../webrtc_overrides/rtc_base/task_queue.cc",
perkj650fdae2017-08-25 05:00:11 -0700358 ]
359 } else {
360 if (rtc_build_libevent) {
361 deps += [ "//base/third_party/libevent" ]
362 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200363 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700364 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200365 "task_queue_libevent.cc",
366 "task_queue_posix.cc",
perkj650fdae2017-08-25 05:00:11 -0700367 "task_queue_posix.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200368 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200369 } else {
370 if (is_mac || is_ios) {
perkj650fdae2017-08-25 05:00:11 -0700371 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200372 "task_queue_gcd.cc",
373 "task_queue_posix.cc",
374 ]
375 }
376 if (is_win) {
perkj650fdae2017-08-25 05:00:11 -0700377 sources = [
378 "task_queue_win.cc",
379 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200380 }
381 }
382 }
383}
384
385rtc_static_library("sequenced_task_checker") {
386 sources = [
387 "sequenced_task_checker.h",
388 "sequenced_task_checker_impl.cc",
389 "sequenced_task_checker_impl.h",
390 ]
391 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700392 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200393 ":rtc_task_queue",
394 ]
395}
396
397rtc_static_library("weak_ptr") {
398 sources = [
399 "weak_ptr.cc",
400 "weak_ptr.h",
401 ]
402 deps = [
403 ":rtc_base_approved",
404 ":sequenced_task_checker",
405 ]
406}
407
408rtc_static_library("rtc_numerics") {
409 sources = [
410 "numerics/exp_filter.cc",
411 "numerics/exp_filter.h",
412 "numerics/percentile_filter.h",
413 ]
414 deps = [
415 ":rtc_base_approved",
416 ]
417}
418
419config("rtc_base_warnings_config") {
420 if (is_win && is_clang) {
421 cflags = [
422 # Disable warnings failing when compiling with Clang on Windows.
423 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
424 "-Wno-sign-compare",
425 "-Wno-missing-braces",
426 ]
427 }
428}
429
430rtc_source_set("rtc_json") {
431 defines = []
432 sources = [
433 "json.cc",
434 "json.h",
435 ]
436 if (rtc_build_json) {
437 public_deps = [
438 "//third_party/jsoncpp",
439 ]
440 } else {
441 include_dirs = [ "$rtc_jsoncpp_root" ]
442
443 # When defined changes the include path for json.h to where it is
444 # expected to be when building json outside of the standalone build.
445 defines += [ "WEBRTC_EXTERNAL_JSON" ]
446 }
447}
448
mbonadei9c5e5112017-09-05 05:17:02 -0700449rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700450 public_deps = [
451 ":rtc_base_generic",
452 ]
453 if (is_win) {
454 sources = [
455 "noop.cc",
456 ]
457 }
458 if (is_ios || is_mac) {
459 sources = [
460 "noop.mm",
461 ]
462 public_deps += [ ":rtc_base_objc" ]
463 }
464}
465
466if (is_ios || is_mac) {
467 rtc_source_set("rtc_base_objc") {
468 sources = [
469 "thread_darwin.mm",
470 ]
471 deps = [
472 ":rtc_base_generic",
473 ]
474 visibility = [ ":rtc_base" ]
475 }
476}
477
478rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200479 cflags = []
480 cflags_cc = []
481 libs = []
482 defines = []
483 deps = [
484 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700485 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200486 ]
487 public_deps = [
488 ":rtc_base_approved",
489 ]
490 public_configs = []
491
492 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
493
494 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200495 "asyncinvoker-inl.h",
496 "asyncinvoker.cc",
497 "asyncinvoker.h",
498 "asyncpacketsocket.cc",
499 "asyncpacketsocket.h",
500 "asyncresolverinterface.cc",
501 "asyncresolverinterface.h",
502 "asyncsocket.cc",
503 "asyncsocket.h",
504 "asynctcpsocket.cc",
505 "asynctcpsocket.h",
506 "asyncudpsocket.cc",
507 "asyncudpsocket.h",
508 "crc32.cc",
509 "crc32.h",
510 "cryptstring.cc",
511 "cryptstring.h",
512 "filerotatingstream.cc",
513 "filerotatingstream.h",
514 "fileutils.cc",
515 "fileutils.h",
516 "gunit_prod.h",
517 "helpers.cc",
518 "helpers.h",
519 "httpbase.cc",
520 "httpbase.h",
521 "httpcommon-inl.h",
522 "httpcommon.cc",
523 "httpcommon.h",
524 "ipaddress.cc",
525 "ipaddress.h",
526 "messagedigest.cc",
527 "messagedigest.h",
528 "messagehandler.cc",
529 "messagehandler.h",
530 "messagequeue.cc",
531 "messagequeue.h",
532 "nethelpers.cc",
533 "nethelpers.h",
534 "network.cc",
535 "network.h",
536 "networkmonitor.cc",
537 "networkmonitor.h",
538 "nullsocketserver.cc",
539 "nullsocketserver.h",
540 "openssl.h",
541 "openssladapter.cc",
542 "openssladapter.h",
543 "openssldigest.cc",
544 "openssldigest.h",
545 "opensslidentity.cc",
546 "opensslidentity.h",
547 "opensslstreamadapter.cc",
548 "opensslstreamadapter.h",
549 "physicalsocketserver.cc",
550 "physicalsocketserver.h",
551 "proxyinfo.cc",
552 "proxyinfo.h",
553 "ratelimiter.cc",
554 "ratelimiter.h",
555 "rtccertificate.cc",
556 "rtccertificate.h",
557 "rtccertificategenerator.cc",
558 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700559 "signalthread.cc",
560 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200561 "sigslot.cc",
562 "sigslot.h",
563 "socket.h",
564 "socketadapters.cc",
565 "socketadapters.h",
566 "socketaddress.cc",
567 "socketaddress.h",
568 "socketaddresspair.cc",
569 "socketaddresspair.h",
570 "socketfactory.h",
571 "socketserver.h",
572 "socketstream.cc",
573 "socketstream.h",
574 "ssladapter.cc",
575 "ssladapter.h",
576 "sslfingerprint.cc",
577 "sslfingerprint.h",
578 "sslidentity.cc",
579 "sslidentity.h",
580 "sslstreamadapter.cc",
581 "sslstreamadapter.h",
582 "stream.cc",
583 "stream.h",
584 "thread.cc",
585 "thread.h",
586 ]
587
mbonadei310e32b2017-09-07 07:36:28 -0700588 visibility = [
589 ":rtc_base",
590 ":rtc_base_objc",
591 ]
592
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200593 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
594 # compiler settings.
595 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
596 configs += [ "//build/config/compiler:no_chromium_code" ]
597 if (!is_win) {
598 cflags += [ "-Wno-uninitialized" ]
599 }
600
601 if (build_with_chromium) {
602 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200603 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200604 }
605 include_dirs = [ "../../boringssl/src/include" ]
606 public_configs += [ ":rtc_base_chromium_config" ]
607 } else {
608 configs += [ ":rtc_base_warnings_config" ]
609 sources += [
610 "callback.h",
611 "logsinks.cc",
612 "logsinks.h",
613 "mathutils.h",
614 "optionsfile.cc",
615 "optionsfile.h",
616 "rollingaccumulator.h",
617 "sslroots.h",
618 "transformadapter.cc",
619 "transformadapter.h",
620 "window.h",
621 ]
622
623 if (is_win) {
624 sources += [
625 "win32socketinit.cc",
626 "win32socketinit.h",
627 "win32socketserver.cc",
628 "win32socketserver.h",
629 ]
630 }
631 } # !build_with_chromium
632
633 if (rtc_build_ssl) {
634 deps += [ "//third_party/boringssl" ]
635 } else {
636 configs += [ ":external_ssl_library" ]
637 }
638
639 if (is_android) {
640 sources += [
641 "ifaddrs-android.cc",
642 "ifaddrs-android.h",
643 ]
644
645 libs += [
646 "log",
647 "GLESv2",
648 ]
649 }
650
651 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700652 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200653 }
654
655 if (use_x11) {
656 libs += [
657 "dl",
658 "rt",
659 "Xext",
660 "X11",
661 "Xcomposite",
662 "Xrender",
663 ]
664 }
665
666 if (is_linux) {
667 libs += [
668 "dl",
669 "rt",
670 ]
671 }
672
673 if (is_mac) {
674 sources += [
675 "macutils.cc",
676 "macutils.h",
677 ]
678 libs += [
679 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
680 "ApplicationServices.framework",
681 ]
682 }
683
684 if (is_win) {
685 sources += [
686 "win32.cc",
687 "win32.h",
688 "win32filesystem.cc",
689 "win32filesystem.h",
690 "win32securityerrors.cc",
691 "win32window.cc",
692 "win32window.h",
693 ]
694
695 libs += [
696 "crypt32.lib",
697 "iphlpapi.lib",
698 "secur32.lib",
699 ]
700
701 cflags += [
702 # Suppress warnings about WIN32_LEAN_AND_MEAN.
703 "/wd4005",
704 "/wd4703",
705 ]
706
707 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
708 }
709
710 if (is_posix) {
711 sources += [
712 "ifaddrs_converter.cc",
713 "ifaddrs_converter.h",
714 "unixfilesystem.cc",
715 "unixfilesystem.h",
716 ]
717 }
718
719 if (is_nacl) {
720 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
721 defines += [ "timezone=_timezone" ]
722 sources -= [ "ifaddrs_converter.cc" ]
723 }
724 if (is_win && is_clang) {
725 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
726 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
727 }
728}
729
730rtc_source_set("gtest_prod") {
731 sources = [
732 "gtest_prod_util.h",
733 ]
734}
735
736config("rtc_base_tests_utils_exported_config") {
737 defines = [ "GTEST_RELATIVE_PATH" ]
738}
739
740config("rtc_base_tests_utils_warnings_config") {
741 if (is_win && is_clang) {
742 cflags = [
743 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
744 "-Wno-reorder",
745 "-Wno-sign-compare",
746 ]
747 }
748}
749
750rtc_source_set("rtc_base_tests_utils") {
751 testonly = true
752 sources = [
753 # Also use this as a convenient dumping ground for misc files that are
754 # included by multiple targets below.
755 "cpu_time.cc",
756 "cpu_time.h",
757 "fakeclock.cc",
758 "fakeclock.h",
759 "fakenetwork.h",
760 "fakesslidentity.h",
761 "firewallsocketserver.cc",
762 "firewallsocketserver.h",
763 "gunit.h",
764 "httpserver.cc",
765 "httpserver.h",
766 "md5.cc",
767 "md5.h",
768 "md5digest.cc",
769 "md5digest.h",
770 "memory_usage.cc",
771 "memory_usage.h",
772 "natserver.cc",
773 "natserver.h",
774 "natsocketfactory.cc",
775 "natsocketfactory.h",
776 "nattypes.cc",
777 "nattypes.h",
778 "proxyserver.cc",
779 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200780 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200781 "sha1.cc",
782 "sha1.h",
783 "sha1digest.cc",
784 "sha1digest.h",
785 "sigslottester.h",
786 "sigslottester.h.pump",
787 "testbase64.h",
788 "testclient.cc",
789 "testclient.h",
790 "testechoserver.h",
791 "testutils.h",
792 "timedelta.h",
793 "virtualsocketserver.cc",
794 "virtualsocketserver.h",
795 ]
796 configs += [ ":rtc_base_tests_utils_warnings_config" ]
797 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
798 deps = [
799 ":rtc_base",
800 "../test:field_trial",
801 "../test:test_support",
802 ]
803 public_deps = [
804 "//testing/gmock",
805 "//testing/gtest",
806 ]
807
808 if (!build_with_chromium && is_clang) {
809 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
810 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
811 }
812}
813
814if (rtc_include_tests) {
815 rtc_source_set("rtc_base_tests_main") {
816 testonly = true
817 sources = [
818 "unittest_main.cc",
819 ]
820 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
821 deps = [
822 ":rtc_base",
823 ":rtc_base_approved",
824 ":rtc_base_tests_utils",
825 "../test:field_trial",
826 "../test:test_support",
827 ]
828
829 public_deps = [
830 "//testing/gmock",
831 "//testing/gtest",
832 ]
833
834 if (!build_with_chromium && is_clang) {
835 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
836 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
837 }
838 }
839
840 rtc_source_set("rtc_base_nonparallel_tests") {
841 testonly = true
842
843 # Skip restricting visibility on mobile platforms since the tests on those
844 # gets additional generated targets which would require many lines here to
845 # cover (which would be confusing to read and hard to maintain).
846 if (!is_android && !is_ios) {
847 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800848 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200849 }
850 sources = [
851 "cpu_time_unittest.cc",
852 "filerotatingstream_unittest.cc",
853 "nullsocketserver_unittest.cc",
854 "physicalsocketserver_unittest.cc",
855 "socket_unittest.cc",
856 "socket_unittest.h",
857 "socketaddress_unittest.cc",
858 ]
859 deps = [
860 ":rtc_base",
861 ":rtc_base_tests_main",
862 ":rtc_base_tests_utils",
863 "../system_wrappers:system_wrappers",
864 "../test:test_support",
865 "//testing/gtest",
866 ]
867 if (is_win) {
868 sources += [ "win32socketserver_unittest.cc" ]
869 }
870
871 if (!build_with_chromium && is_clang) {
872 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
873 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
874 }
875 }
876
877 rtc_source_set("rtc_base_approved_unittests") {
878 testonly = true
879
880 # Skip restricting visibility on mobile platforms since the tests on those
881 # gets additional generated targets which would require many lines here to
882 # cover (which would be confusing to read and hard to maintain).
883 if (!is_android && !is_ios) {
884 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800885 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200886 }
887 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200888 "atomicops_unittest.cc",
889 "base64_unittest.cc",
890 "basictypes_unittest.cc",
891 "bind_unittest.cc",
892 "bitbuffer_unittest.cc",
893 "buffer_unittest.cc",
894 "bufferqueue_unittest.cc",
895 "bytebuffer_unittest.cc",
896 "byteorder_unittest.cc",
897 "copyonwritebuffer_unittest.cc",
898 "criticalsection_unittest.cc",
899 "event_tracer_unittest.cc",
900 "event_unittest.cc",
901 "file_unittest.cc",
902 "function_view_unittest.cc",
903 "logging_unittest.cc",
904 "md5digest_unittest.cc",
905 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700906 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200907 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200908 "pathutils_unittest.cc",
909 "platform_thread_unittest.cc",
910 "random_unittest.cc",
911 "rate_limiter_unittest.cc",
912 "rate_statistics_unittest.cc",
913 "ratetracker_unittest.cc",
914 "refcountedobject_unittest.cc",
915 "safe_compare_unittest.cc",
916 "safe_minmax_unittest.cc",
917 "string_to_number_unittest.cc",
918 "stringencode_unittest.cc",
919 "stringize_macros_unittest.cc",
920 "stringutils_unittest.cc",
921 "swap_queue_unittest.cc",
922 "thread_annotations_unittest.cc",
923 "thread_checker_unittest.cc",
924 "timestampaligner_unittest.cc",
925 "timeutils_unittest.cc",
926 "virtualsocket_unittest.cc",
927 ]
928 deps = [
929 ":rtc_base",
930 ":rtc_base_approved",
931 ":rtc_base_tests_main",
932 ":rtc_base_tests_utils",
933 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700934 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200935 "../system_wrappers:system_wrappers",
936 "../test:test_support",
937 ]
938 if (!build_with_chromium && is_clang) {
939 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
940 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
941 }
942 }
943
944 rtc_source_set("rtc_task_queue_unittests") {
945 testonly = true
946
947 # Skip restricting visibility on mobile platforms since the tests on those
948 # gets additional generated targets which would require many lines here to
949 # cover (which would be confusing to read and hard to maintain).
950 if (!is_android && !is_ios) {
951 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800952 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200953 }
954 sources = [
955 "task_queue_unittest.cc",
956 ]
957 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700958 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200959 ":rtc_base_tests_main",
960 ":rtc_base_tests_utils",
961 ":rtc_task_queue",
962 "../test:test_support",
963 ]
964 if (!build_with_chromium && is_clang) {
965 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
966 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
967 }
968 }
969
970 rtc_source_set("sequenced_task_checker_unittests") {
971 testonly = true
972
973 # Skip restricting visibility on mobile platforms since the tests on those
974 # gets additional generated targets which would require many lines here to
975 # cover (which would be confusing to read and hard to maintain).
976 if (!is_android && !is_ios) {
977 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800978 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200979 }
980 sources = [
981 "sequenced_task_checker_unittest.cc",
982 ]
983 deps = [
984 ":rtc_base_approved",
985 ":rtc_base_tests_main",
986 ":rtc_task_queue",
987 ":sequenced_task_checker",
988 "../test:test_support",
989 ]
990 }
991
992 rtc_source_set("weak_ptr_unittests") {
993 testonly = true
994
995 # Skip restricting visibility on mobile platforms since the tests on those
996 # gets additional generated targets which would require many lines here to
997 # cover (which would be confusing to read and hard to maintain).
998 if (!is_android && !is_ios) {
999 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001000 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001001 }
1002 sources = [
1003 "weak_ptr_unittest.cc",
1004 ]
1005 deps = [
1006 ":rtc_base_tests_main",
1007 ":rtc_base_tests_utils",
1008 ":rtc_task_queue",
1009 ":weak_ptr",
1010 "../test:test_support",
1011 ]
1012 }
1013
1014 rtc_source_set("rtc_numerics_unittests") {
1015 testonly = true
1016
1017 # Skip restricting visibility on mobile platforms since the tests on those
1018 # gets additional generated targets which would require many lines here to
1019 # cover (which would be confusing to read and hard to maintain).
1020 if (!is_android && !is_ios) {
1021 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001022 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001023 }
1024 sources = [
1025 "numerics/exp_filter_unittest.cc",
1026 "numerics/percentile_filter_unittest.cc",
1027 ]
1028 deps = [
1029 ":rtc_base_approved",
1030 ":rtc_base_tests_main",
1031 ":rtc_numerics",
1032 "../test:test_support",
1033 ]
1034 }
1035
1036 config("rtc_base_unittests_config") {
1037 if (is_clang) {
1038 cflags = [ "-Wno-unused-const-variable" ]
1039 }
1040 }
1041 rtc_source_set("rtc_base_unittests") {
1042 testonly = true
1043
1044 # Skip restricting visibility on mobile platforms since the tests on those
1045 # gets additional generated targets which would require many lines here to
1046 # cover (which would be confusing to read and hard to maintain).
1047 if (!is_android && !is_ios) {
1048 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001049 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001050 }
1051 sources = [
1052 "callback_unittest.cc",
1053 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001054 "helpers_unittest.cc",
1055 "httpbase_unittest.cc",
1056 "httpcommon_unittest.cc",
1057 "httpserver_unittest.cc",
1058 "ipaddress_unittest.cc",
1059 "memory_usage_unittest.cc",
1060 "messagedigest_unittest.cc",
1061 "messagequeue_unittest.cc",
1062 "nat_unittest.cc",
1063 "network_unittest.cc",
1064 "optionsfile_unittest.cc",
1065 "proxy_unittest.cc",
1066 "ptr_util_unittest.cc",
1067 "ratelimiter_unittest.cc",
1068 "rollingaccumulator_unittest.cc",
1069 "rtccertificate_unittest.cc",
1070 "rtccertificategenerator_unittest.cc",
1071 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001072 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001073 "sigslot_unittest.cc",
1074 "sigslottester_unittest.cc",
1075 "stream_unittest.cc",
1076 "testclient_unittest.cc",
1077 "thread_unittest.cc",
1078 ]
1079 if (is_win) {
1080 sources += [
1081 "win32_unittest.cc",
1082 "win32window_unittest.cc",
1083 ]
1084 }
1085 if (is_mac) {
1086 sources += [ "macutils_unittest.cc" ]
1087 }
1088 if (is_posix) {
1089 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001090 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001091 "ssladapter_unittest.cc",
1092 "sslidentity_unittest.cc",
1093 "sslstreamadapter_unittest.cc",
1094 ]
1095 }
1096 deps = [
1097 ":rtc_base_tests_main",
1098 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001099 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001100 "../test:test_support",
1101 ]
1102 public_deps = [
1103 ":rtc_base",
1104 ]
1105 configs += [ ":rtc_base_unittests_config" ]
1106 if (!build_with_chromium && is_clang) {
1107 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1108 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1109 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001110 if (build_with_chromium) {
1111 include_dirs = [ "../../boringssl/src/include" ]
1112 }
1113 if (rtc_build_ssl) {
1114 deps += [ "//third_party/boringssl" ]
1115 } else {
1116 configs += [ ":external_ssl_library" ]
1117 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001118 }
1119}
1120
Henrik Kjellander73e21802017-06-20 08:38:58 +02001121if (is_android) {
1122 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001123 java_files = [
1124 "java/src/org/webrtc/ContextUtils.java",
1125 "java/src/org/webrtc/Logging.java",
1126 "java/src/org/webrtc/Size.java",
1127 "java/src/org/webrtc/ThreadUtils.java",
1128 ]
charujain474acce2017-08-25 06:21:52 -07001129
1130 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1131 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001132 }
1133}