blob: 8c3000e0d0ccbeec4a37cf8eb4418a8b5f493e9d [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 ]
Henrik Boströma9a27712017-10-03 08:01:07 +0000348 if (build_with_chromium) {
perkj650fdae2017-08-25 05:00:11 -0700349 sources = [
Henrik Boströma9a27712017-10-03 08:01:07 +0000350 "../../webrtc_overrides/rtc_base/task_queue.cc",
perkj650fdae2017-08-25 05:00:11 -0700351 ]
352 } else {
Henrik Boströma9a27712017-10-03 08:01:07 +0000353 if (rtc_build_libevent) {
354 deps += [ "//base/third_party/libevent" ]
Niels Möller17a04742017-09-27 10:53:21 +0200355 }
Henrik Boströma9a27712017-10-03 08:01:07 +0000356 if (rtc_enable_libevent) {
Niels Möller17a04742017-09-27 10:53:21 +0200357 sources = [
Henrik Boströma9a27712017-10-03 08:01:07 +0000358 "task_queue_libevent.cc",
359 "task_queue_posix.cc",
360 "task_queue_posix.h",
Niels Möller17a04742017-09-27 10:53:21 +0200361 ]
Henrik Boströma9a27712017-10-03 08:01:07 +0000362 } else {
363 if (is_mac || is_ios) {
364 sources = [
365 "task_queue_gcd.cc",
366 "task_queue_posix.cc",
367 ]
368 }
369 if (is_win) {
370 sources = [
371 "task_queue_win.cc",
372 ]
373 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200374 }
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",
Patrik Höglunde2d6a062017-10-05 14:53:33 +0200529 "network_constants.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200530 "networkmonitor.cc",
531 "networkmonitor.h",
532 "nullsocketserver.cc",
533 "nullsocketserver.h",
534 "openssl.h",
535 "openssladapter.cc",
536 "openssladapter.h",
537 "openssldigest.cc",
538 "openssldigest.h",
539 "opensslidentity.cc",
540 "opensslidentity.h",
541 "opensslstreamadapter.cc",
542 "opensslstreamadapter.h",
543 "physicalsocketserver.cc",
544 "physicalsocketserver.h",
545 "proxyinfo.cc",
546 "proxyinfo.h",
547 "ratelimiter.cc",
548 "ratelimiter.h",
549 "rtccertificate.cc",
550 "rtccertificate.h",
551 "rtccertificategenerator.cc",
552 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700553 "signalthread.cc",
554 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200555 "sigslot.cc",
556 "sigslot.h",
557 "socket.h",
558 "socketadapters.cc",
559 "socketadapters.h",
560 "socketaddress.cc",
561 "socketaddress.h",
562 "socketaddresspair.cc",
563 "socketaddresspair.h",
564 "socketfactory.h",
565 "socketserver.h",
566 "socketstream.cc",
567 "socketstream.h",
568 "ssladapter.cc",
569 "ssladapter.h",
570 "sslfingerprint.cc",
571 "sslfingerprint.h",
572 "sslidentity.cc",
573 "sslidentity.h",
574 "sslstreamadapter.cc",
575 "sslstreamadapter.h",
576 "stream.cc",
577 "stream.h",
578 "thread.cc",
579 "thread.h",
580 ]
581
mbonadei310e32b2017-09-07 07:36:28 -0700582 visibility = [
583 ":rtc_base",
584 ":rtc_base_objc",
585 ]
586
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200587 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
588 # compiler settings.
589 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
590 configs += [ "//build/config/compiler:no_chromium_code" ]
591 if (!is_win) {
592 cflags += [ "-Wno-uninitialized" ]
593 }
594
595 if (build_with_chromium) {
596 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200597 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200598 }
599 include_dirs = [ "../../boringssl/src/include" ]
600 public_configs += [ ":rtc_base_chromium_config" ]
601 } else {
602 configs += [ ":rtc_base_warnings_config" ]
603 sources += [
604 "callback.h",
605 "logsinks.cc",
606 "logsinks.h",
607 "mathutils.h",
608 "optionsfile.cc",
609 "optionsfile.h",
610 "rollingaccumulator.h",
611 "sslroots.h",
612 "transformadapter.cc",
613 "transformadapter.h",
614 "window.h",
615 ]
616
617 if (is_win) {
618 sources += [
619 "win32socketinit.cc",
620 "win32socketinit.h",
621 "win32socketserver.cc",
622 "win32socketserver.h",
623 ]
624 }
625 } # !build_with_chromium
626
627 if (rtc_build_ssl) {
628 deps += [ "//third_party/boringssl" ]
629 } else {
630 configs += [ ":external_ssl_library" ]
631 }
632
633 if (is_android) {
634 sources += [
635 "ifaddrs-android.cc",
636 "ifaddrs-android.h",
637 ]
638
639 libs += [
640 "log",
641 "GLESv2",
642 ]
643 }
644
645 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700646 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200647 }
648
649 if (use_x11) {
650 libs += [
651 "dl",
652 "rt",
653 "Xext",
654 "X11",
655 "Xcomposite",
656 "Xrender",
657 ]
658 }
659
660 if (is_linux) {
661 libs += [
662 "dl",
663 "rt",
664 ]
665 }
666
667 if (is_mac) {
668 sources += [
669 "macutils.cc",
670 "macutils.h",
671 ]
672 libs += [
673 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
674 "ApplicationServices.framework",
675 ]
676 }
677
678 if (is_win) {
679 sources += [
680 "win32.cc",
681 "win32.h",
682 "win32filesystem.cc",
683 "win32filesystem.h",
684 "win32securityerrors.cc",
685 "win32window.cc",
686 "win32window.h",
687 ]
688
689 libs += [
690 "crypt32.lib",
691 "iphlpapi.lib",
692 "secur32.lib",
693 ]
694
695 cflags += [
696 # Suppress warnings about WIN32_LEAN_AND_MEAN.
697 "/wd4005",
698 "/wd4703",
699 ]
700
701 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
702 }
703
704 if (is_posix) {
705 sources += [
706 "ifaddrs_converter.cc",
707 "ifaddrs_converter.h",
708 "unixfilesystem.cc",
709 "unixfilesystem.h",
710 ]
711 }
712
713 if (is_nacl) {
714 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
715 defines += [ "timezone=_timezone" ]
716 sources -= [ "ifaddrs_converter.cc" ]
717 }
718 if (is_win && is_clang) {
719 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
720 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
721 }
722}
723
724rtc_source_set("gtest_prod") {
725 sources = [
726 "gtest_prod_util.h",
727 ]
728}
729
730config("rtc_base_tests_utils_exported_config") {
731 defines = [ "GTEST_RELATIVE_PATH" ]
732}
733
734config("rtc_base_tests_utils_warnings_config") {
735 if (is_win && is_clang) {
736 cflags = [
737 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
738 "-Wno-reorder",
739 "-Wno-sign-compare",
740 ]
741 }
742}
743
744rtc_source_set("rtc_base_tests_utils") {
745 testonly = true
746 sources = [
747 # Also use this as a convenient dumping ground for misc files that are
748 # included by multiple targets below.
749 "cpu_time.cc",
750 "cpu_time.h",
751 "fakeclock.cc",
752 "fakeclock.h",
753 "fakenetwork.h",
754 "fakesslidentity.h",
755 "firewallsocketserver.cc",
756 "firewallsocketserver.h",
757 "gunit.h",
758 "httpserver.cc",
759 "httpserver.h",
760 "md5.cc",
761 "md5.h",
762 "md5digest.cc",
763 "md5digest.h",
764 "memory_usage.cc",
765 "memory_usage.h",
766 "natserver.cc",
767 "natserver.h",
768 "natsocketfactory.cc",
769 "natsocketfactory.h",
770 "nattypes.cc",
771 "nattypes.h",
772 "proxyserver.cc",
773 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200774 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200775 "sha1.cc",
776 "sha1.h",
777 "sha1digest.cc",
778 "sha1digest.h",
779 "sigslottester.h",
780 "sigslottester.h.pump",
781 "testbase64.h",
782 "testclient.cc",
783 "testclient.h",
784 "testechoserver.h",
785 "testutils.h",
786 "timedelta.h",
787 "virtualsocketserver.cc",
788 "virtualsocketserver.h",
789 ]
790 configs += [ ":rtc_base_tests_utils_warnings_config" ]
791 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
792 deps = [
793 ":rtc_base",
794 "../test:field_trial",
795 "../test:test_support",
796 ]
797 public_deps = [
798 "//testing/gmock",
799 "//testing/gtest",
800 ]
801
802 if (!build_with_chromium && is_clang) {
803 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
804 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
805 }
806}
807
808if (rtc_include_tests) {
809 rtc_source_set("rtc_base_tests_main") {
810 testonly = true
811 sources = [
812 "unittest_main.cc",
813 ]
814 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
815 deps = [
816 ":rtc_base",
817 ":rtc_base_approved",
818 ":rtc_base_tests_utils",
819 "../test:field_trial",
820 "../test:test_support",
821 ]
822
823 public_deps = [
824 "//testing/gmock",
825 "//testing/gtest",
826 ]
827
828 if (!build_with_chromium && is_clang) {
829 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
830 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
831 }
832 }
833
834 rtc_source_set("rtc_base_nonparallel_tests") {
835 testonly = true
836
837 # Skip restricting visibility on mobile platforms since the tests on those
838 # gets additional generated targets which would require many lines here to
839 # cover (which would be confusing to read and hard to maintain).
840 if (!is_android && !is_ios) {
841 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800842 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200843 }
844 sources = [
845 "cpu_time_unittest.cc",
846 "filerotatingstream_unittest.cc",
847 "nullsocketserver_unittest.cc",
848 "physicalsocketserver_unittest.cc",
849 "socket_unittest.cc",
850 "socket_unittest.h",
851 "socketaddress_unittest.cc",
852 ]
853 deps = [
854 ":rtc_base",
855 ":rtc_base_tests_main",
856 ":rtc_base_tests_utils",
857 "../system_wrappers:system_wrappers",
858 "../test:test_support",
859 "//testing/gtest",
860 ]
861 if (is_win) {
862 sources += [ "win32socketserver_unittest.cc" ]
863 }
864
865 if (!build_with_chromium && is_clang) {
866 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
867 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
868 }
869 }
870
871 rtc_source_set("rtc_base_approved_unittests") {
872 testonly = true
873
874 # Skip restricting visibility on mobile platforms since the tests on those
875 # gets additional generated targets which would require many lines here to
876 # cover (which would be confusing to read and hard to maintain).
877 if (!is_android && !is_ios) {
878 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800879 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200880 }
881 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200882 "atomicops_unittest.cc",
883 "base64_unittest.cc",
884 "basictypes_unittest.cc",
885 "bind_unittest.cc",
886 "bitbuffer_unittest.cc",
887 "buffer_unittest.cc",
888 "bufferqueue_unittest.cc",
889 "bytebuffer_unittest.cc",
890 "byteorder_unittest.cc",
891 "copyonwritebuffer_unittest.cc",
892 "criticalsection_unittest.cc",
893 "event_tracer_unittest.cc",
894 "event_unittest.cc",
895 "file_unittest.cc",
896 "function_view_unittest.cc",
897 "logging_unittest.cc",
898 "md5digest_unittest.cc",
899 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700900 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200901 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200902 "pathutils_unittest.cc",
903 "platform_thread_unittest.cc",
904 "random_unittest.cc",
905 "rate_limiter_unittest.cc",
906 "rate_statistics_unittest.cc",
907 "ratetracker_unittest.cc",
908 "refcountedobject_unittest.cc",
909 "safe_compare_unittest.cc",
910 "safe_minmax_unittest.cc",
911 "string_to_number_unittest.cc",
912 "stringencode_unittest.cc",
913 "stringize_macros_unittest.cc",
914 "stringutils_unittest.cc",
915 "swap_queue_unittest.cc",
916 "thread_annotations_unittest.cc",
917 "thread_checker_unittest.cc",
918 "timestampaligner_unittest.cc",
919 "timeutils_unittest.cc",
920 "virtualsocket_unittest.cc",
921 ]
922 deps = [
923 ":rtc_base",
924 ":rtc_base_approved",
925 ":rtc_base_tests_main",
926 ":rtc_base_tests_utils",
927 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700928 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200929 "../system_wrappers:system_wrappers",
930 "../test:test_support",
931 ]
932 if (!build_with_chromium && is_clang) {
933 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
934 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
935 }
936 }
937
938 rtc_source_set("rtc_task_queue_unittests") {
939 testonly = true
940
941 # Skip restricting visibility on mobile platforms since the tests on those
942 # gets additional generated targets which would require many lines here to
943 # cover (which would be confusing to read and hard to maintain).
944 if (!is_android && !is_ios) {
945 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800946 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200947 }
948 sources = [
949 "task_queue_unittest.cc",
950 ]
951 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700952 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200953 ":rtc_base_tests_main",
954 ":rtc_base_tests_utils",
955 ":rtc_task_queue",
956 "../test:test_support",
957 ]
958 if (!build_with_chromium && is_clang) {
959 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
960 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
961 }
962 }
963
964 rtc_source_set("sequenced_task_checker_unittests") {
965 testonly = true
966
967 # Skip restricting visibility on mobile platforms since the tests on those
968 # gets additional generated targets which would require many lines here to
969 # cover (which would be confusing to read and hard to maintain).
970 if (!is_android && !is_ios) {
971 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800972 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200973 }
974 sources = [
975 "sequenced_task_checker_unittest.cc",
976 ]
977 deps = [
978 ":rtc_base_approved",
979 ":rtc_base_tests_main",
980 ":rtc_task_queue",
981 ":sequenced_task_checker",
982 "../test:test_support",
983 ]
984 }
985
986 rtc_source_set("weak_ptr_unittests") {
987 testonly = true
988
989 # Skip restricting visibility on mobile platforms since the tests on those
990 # gets additional generated targets which would require many lines here to
991 # cover (which would be confusing to read and hard to maintain).
992 if (!is_android && !is_ios) {
993 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800994 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200995 }
996 sources = [
997 "weak_ptr_unittest.cc",
998 ]
999 deps = [
1000 ":rtc_base_tests_main",
1001 ":rtc_base_tests_utils",
1002 ":rtc_task_queue",
1003 ":weak_ptr",
1004 "../test:test_support",
1005 ]
1006 }
1007
1008 rtc_source_set("rtc_numerics_unittests") {
1009 testonly = true
1010
1011 # Skip restricting visibility on mobile platforms since the tests on those
1012 # gets additional generated targets which would require many lines here to
1013 # cover (which would be confusing to read and hard to maintain).
1014 if (!is_android && !is_ios) {
1015 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001016 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001017 }
1018 sources = [
1019 "numerics/exp_filter_unittest.cc",
1020 "numerics/percentile_filter_unittest.cc",
1021 ]
1022 deps = [
1023 ":rtc_base_approved",
1024 ":rtc_base_tests_main",
1025 ":rtc_numerics",
1026 "../test:test_support",
1027 ]
1028 }
1029
1030 config("rtc_base_unittests_config") {
1031 if (is_clang) {
1032 cflags = [ "-Wno-unused-const-variable" ]
1033 }
1034 }
1035 rtc_source_set("rtc_base_unittests") {
1036 testonly = true
1037
1038 # Skip restricting visibility on mobile platforms since the tests on those
1039 # gets additional generated targets which would require many lines here to
1040 # cover (which would be confusing to read and hard to maintain).
1041 if (!is_android && !is_ios) {
1042 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001043 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001044 }
1045 sources = [
1046 "callback_unittest.cc",
1047 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001048 "helpers_unittest.cc",
1049 "httpbase_unittest.cc",
1050 "httpcommon_unittest.cc",
1051 "httpserver_unittest.cc",
1052 "ipaddress_unittest.cc",
1053 "memory_usage_unittest.cc",
1054 "messagedigest_unittest.cc",
1055 "messagequeue_unittest.cc",
1056 "nat_unittest.cc",
1057 "network_unittest.cc",
1058 "optionsfile_unittest.cc",
1059 "proxy_unittest.cc",
1060 "ptr_util_unittest.cc",
1061 "ratelimiter_unittest.cc",
1062 "rollingaccumulator_unittest.cc",
1063 "rtccertificate_unittest.cc",
1064 "rtccertificategenerator_unittest.cc",
1065 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001066 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001067 "sigslot_unittest.cc",
1068 "sigslottester_unittest.cc",
1069 "stream_unittest.cc",
1070 "testclient_unittest.cc",
1071 "thread_unittest.cc",
1072 ]
1073 if (is_win) {
1074 sources += [
1075 "win32_unittest.cc",
1076 "win32window_unittest.cc",
1077 ]
1078 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001079 if (is_posix) {
1080 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001081 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001082 "ssladapter_unittest.cc",
1083 "sslidentity_unittest.cc",
1084 "sslstreamadapter_unittest.cc",
1085 ]
1086 }
1087 deps = [
1088 ":rtc_base_tests_main",
1089 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001090 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001091 "../test:test_support",
1092 ]
1093 public_deps = [
1094 ":rtc_base",
1095 ]
1096 configs += [ ":rtc_base_unittests_config" ]
1097 if (!build_with_chromium && is_clang) {
1098 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1099 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1100 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001101 if (build_with_chromium) {
1102 include_dirs = [ "../../boringssl/src/include" ]
1103 }
1104 if (rtc_build_ssl) {
1105 deps += [ "//third_party/boringssl" ]
1106 } else {
1107 configs += [ ":external_ssl_library" ]
1108 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001109 }
1110}
1111
Henrik Kjellander73e21802017-06-20 08:38:58 +02001112if (is_android) {
1113 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001114 java_files = [
1115 "java/src/org/webrtc/ContextUtils.java",
1116 "java/src/org/webrtc/Logging.java",
1117 "java/src/org/webrtc/Size.java",
1118 "java/src/org/webrtc/ThreadUtils.java",
1119 ]
charujain474acce2017-08-25 06:21:52 -07001120
1121 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1122 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001123 }
1124}