blob: 912029272866080cd1e2ff9d4b704a9066da5d19 [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 += [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700212 "../../webrtc_overrides/webrtc/rtc_base/logging.cc",
213 "../../webrtc_overrides/webrtc/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 = [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700338 "../../webrtc_overrides/webrtc/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 = [
357 "../../webrtc_overrides/webrtc/rtc_base/task_queue.cc",
358 ]
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) {
ehmaldonadof6a861a2017-07-19 10:40:47 -0700603 sources += [ "../../webrtc_overrides/webrtc/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",
780 "sha1.cc",
781 "sha1.h",
782 "sha1digest.cc",
783 "sha1digest.h",
784 "sigslottester.h",
785 "sigslottester.h.pump",
786 "testbase64.h",
787 "testclient.cc",
788 "testclient.h",
789 "testechoserver.h",
790 "testutils.h",
791 "timedelta.h",
792 "virtualsocketserver.cc",
793 "virtualsocketserver.h",
794 ]
795 configs += [ ":rtc_base_tests_utils_warnings_config" ]
796 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
797 deps = [
798 ":rtc_base",
799 "../test:field_trial",
800 "../test:test_support",
801 ]
802 public_deps = [
803 "//testing/gmock",
804 "//testing/gtest",
805 ]
806
807 if (!build_with_chromium && is_clang) {
808 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
809 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
810 }
811}
812
813if (rtc_include_tests) {
814 rtc_source_set("rtc_base_tests_main") {
815 testonly = true
816 sources = [
817 "unittest_main.cc",
818 ]
819 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
820 deps = [
821 ":rtc_base",
822 ":rtc_base_approved",
823 ":rtc_base_tests_utils",
824 "../test:field_trial",
825 "../test:test_support",
826 ]
827
828 public_deps = [
829 "//testing/gmock",
830 "//testing/gtest",
831 ]
832
833 if (!build_with_chromium && is_clang) {
834 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
835 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
836 }
837 }
838
839 rtc_source_set("rtc_base_nonparallel_tests") {
840 testonly = true
841
842 # Skip restricting visibility on mobile platforms since the tests on those
843 # gets additional generated targets which would require many lines here to
844 # cover (which would be confusing to read and hard to maintain).
845 if (!is_android && !is_ios) {
846 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800847 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200848 }
849 sources = [
850 "cpu_time_unittest.cc",
851 "filerotatingstream_unittest.cc",
852 "nullsocketserver_unittest.cc",
853 "physicalsocketserver_unittest.cc",
854 "socket_unittest.cc",
855 "socket_unittest.h",
856 "socketaddress_unittest.cc",
857 ]
858 deps = [
859 ":rtc_base",
860 ":rtc_base_tests_main",
861 ":rtc_base_tests_utils",
862 "../system_wrappers:system_wrappers",
863 "../test:test_support",
864 "//testing/gtest",
865 ]
866 if (is_win) {
867 sources += [ "win32socketserver_unittest.cc" ]
868 }
869
870 if (!build_with_chromium && is_clang) {
871 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
872 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
873 }
874 }
875
876 rtc_source_set("rtc_base_approved_unittests") {
877 testonly = true
878
879 # Skip restricting visibility on mobile platforms since the tests on those
880 # gets additional generated targets which would require many lines here to
881 # cover (which would be confusing to read and hard to maintain).
882 if (!is_android && !is_ios) {
883 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800884 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200885 }
886 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200887 "atomicops_unittest.cc",
888 "base64_unittest.cc",
889 "basictypes_unittest.cc",
890 "bind_unittest.cc",
891 "bitbuffer_unittest.cc",
892 "buffer_unittest.cc",
893 "bufferqueue_unittest.cc",
894 "bytebuffer_unittest.cc",
895 "byteorder_unittest.cc",
896 "copyonwritebuffer_unittest.cc",
897 "criticalsection_unittest.cc",
898 "event_tracer_unittest.cc",
899 "event_unittest.cc",
900 "file_unittest.cc",
901 "function_view_unittest.cc",
902 "logging_unittest.cc",
903 "md5digest_unittest.cc",
904 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700905 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200906 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200907 "pathutils_unittest.cc",
908 "platform_thread_unittest.cc",
909 "random_unittest.cc",
910 "rate_limiter_unittest.cc",
911 "rate_statistics_unittest.cc",
912 "ratetracker_unittest.cc",
913 "refcountedobject_unittest.cc",
914 "safe_compare_unittest.cc",
915 "safe_minmax_unittest.cc",
916 "string_to_number_unittest.cc",
917 "stringencode_unittest.cc",
918 "stringize_macros_unittest.cc",
919 "stringutils_unittest.cc",
920 "swap_queue_unittest.cc",
921 "thread_annotations_unittest.cc",
922 "thread_checker_unittest.cc",
923 "timestampaligner_unittest.cc",
924 "timeutils_unittest.cc",
925 "virtualsocket_unittest.cc",
926 ]
927 deps = [
928 ":rtc_base",
929 ":rtc_base_approved",
930 ":rtc_base_tests_main",
931 ":rtc_base_tests_utils",
932 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700933 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200934 "../system_wrappers:system_wrappers",
935 "../test:test_support",
936 ]
937 if (!build_with_chromium && is_clang) {
938 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
939 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
940 }
941 }
942
943 rtc_source_set("rtc_task_queue_unittests") {
944 testonly = true
945
946 # Skip restricting visibility on mobile platforms since the tests on those
947 # gets additional generated targets which would require many lines here to
948 # cover (which would be confusing to read and hard to maintain).
949 if (!is_android && !is_ios) {
950 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800951 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200952 }
953 sources = [
954 "task_queue_unittest.cc",
955 ]
956 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700957 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200958 ":rtc_base_tests_main",
959 ":rtc_base_tests_utils",
960 ":rtc_task_queue",
961 "../test:test_support",
962 ]
963 if (!build_with_chromium && is_clang) {
964 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
965 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
966 }
967 }
968
969 rtc_source_set("sequenced_task_checker_unittests") {
970 testonly = true
971
972 # Skip restricting visibility on mobile platforms since the tests on those
973 # gets additional generated targets which would require many lines here to
974 # cover (which would be confusing to read and hard to maintain).
975 if (!is_android && !is_ios) {
976 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800977 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200978 }
979 sources = [
980 "sequenced_task_checker_unittest.cc",
981 ]
982 deps = [
983 ":rtc_base_approved",
984 ":rtc_base_tests_main",
985 ":rtc_task_queue",
986 ":sequenced_task_checker",
987 "../test:test_support",
988 ]
989 }
990
991 rtc_source_set("weak_ptr_unittests") {
992 testonly = true
993
994 # Skip restricting visibility on mobile platforms since the tests on those
995 # gets additional generated targets which would require many lines here to
996 # cover (which would be confusing to read and hard to maintain).
997 if (!is_android && !is_ios) {
998 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800999 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001000 }
1001 sources = [
1002 "weak_ptr_unittest.cc",
1003 ]
1004 deps = [
1005 ":rtc_base_tests_main",
1006 ":rtc_base_tests_utils",
1007 ":rtc_task_queue",
1008 ":weak_ptr",
1009 "../test:test_support",
1010 ]
1011 }
1012
1013 rtc_source_set("rtc_numerics_unittests") {
1014 testonly = true
1015
1016 # Skip restricting visibility on mobile platforms since the tests on those
1017 # gets additional generated targets which would require many lines here to
1018 # cover (which would be confusing to read and hard to maintain).
1019 if (!is_android && !is_ios) {
1020 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001021 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001022 }
1023 sources = [
1024 "numerics/exp_filter_unittest.cc",
1025 "numerics/percentile_filter_unittest.cc",
1026 ]
1027 deps = [
1028 ":rtc_base_approved",
1029 ":rtc_base_tests_main",
1030 ":rtc_numerics",
1031 "../test:test_support",
1032 ]
1033 }
1034
1035 config("rtc_base_unittests_config") {
1036 if (is_clang) {
1037 cflags = [ "-Wno-unused-const-variable" ]
1038 }
1039 }
1040 rtc_source_set("rtc_base_unittests") {
1041 testonly = true
1042
1043 # Skip restricting visibility on mobile platforms since the tests on those
1044 # gets additional generated targets which would require many lines here to
1045 # cover (which would be confusing to read and hard to maintain).
1046 if (!is_android && !is_ios) {
1047 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001048 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001049 }
1050 sources = [
1051 "callback_unittest.cc",
1052 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001053 "helpers_unittest.cc",
1054 "httpbase_unittest.cc",
1055 "httpcommon_unittest.cc",
1056 "httpserver_unittest.cc",
1057 "ipaddress_unittest.cc",
1058 "memory_usage_unittest.cc",
1059 "messagedigest_unittest.cc",
1060 "messagequeue_unittest.cc",
1061 "nat_unittest.cc",
1062 "network_unittest.cc",
1063 "optionsfile_unittest.cc",
1064 "proxy_unittest.cc",
1065 "ptr_util_unittest.cc",
1066 "ratelimiter_unittest.cc",
1067 "rollingaccumulator_unittest.cc",
1068 "rtccertificate_unittest.cc",
1069 "rtccertificategenerator_unittest.cc",
1070 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001071 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001072 "sigslot_unittest.cc",
1073 "sigslottester_unittest.cc",
1074 "stream_unittest.cc",
1075 "testclient_unittest.cc",
1076 "thread_unittest.cc",
1077 ]
1078 if (is_win) {
1079 sources += [
1080 "win32_unittest.cc",
1081 "win32window_unittest.cc",
1082 ]
1083 }
1084 if (is_mac) {
1085 sources += [ "macutils_unittest.cc" ]
1086 }
1087 if (is_posix) {
1088 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001089 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001090 "ssladapter_unittest.cc",
1091 "sslidentity_unittest.cc",
1092 "sslstreamadapter_unittest.cc",
1093 ]
1094 }
1095 deps = [
1096 ":rtc_base_tests_main",
1097 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001098 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001099 "../test:test_support",
1100 ]
1101 public_deps = [
1102 ":rtc_base",
1103 ]
1104 configs += [ ":rtc_base_unittests_config" ]
1105 if (!build_with_chromium && is_clang) {
1106 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1107 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1108 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001109 if (build_with_chromium) {
1110 include_dirs = [ "../../boringssl/src/include" ]
1111 }
1112 if (rtc_build_ssl) {
1113 deps += [ "//third_party/boringssl" ]
1114 } else {
1115 configs += [ ":external_ssl_library" ]
1116 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001117 }
1118}
1119
Henrik Kjellander73e21802017-06-20 08:38:58 +02001120if (is_android) {
1121 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001122 java_files = [
1123 "java/src/org/webrtc/ContextUtils.java",
1124 "java/src/org/webrtc/Logging.java",
1125 "java/src/org/webrtc/Size.java",
1126 "java/src/org/webrtc/ThreadUtils.java",
1127 ]
charujain474acce2017-08-25 06:21:52 -07001128
1129 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1130 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001131 }
1132}