blob: 3bdd6a5a32593c72d3a18d4ece8fd23bae3f4d83 [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") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200335 if (build_with_chromium) {
336 sources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200337 "../../webrtc_overrides/rtc_base/task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200338 ]
339 } else {
340 sources = [
341 "task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200342 ]
perkj650fdae2017-08-25 05:00:11 -0700343 }
344 deps = [
345 ":rtc_base_approved",
346 ]
347}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200348
perkj650fdae2017-08-25 05:00:11 -0700349rtc_source_set("rtc_task_queue_impl") {
350 deps = [
351 ":rtc_base_approved",
352 ":rtc_task_queue_api",
353 ]
354 if (build_with_chromium) {
355 sources = [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200356 "../../webrtc_overrides/rtc_base/task_queue.cc",
perkj650fdae2017-08-25 05:00:11 -0700357 ]
358 } else {
359 if (rtc_build_libevent) {
360 deps += [ "//base/third_party/libevent" ]
361 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200362 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700363 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200364 "task_queue_libevent.cc",
365 "task_queue_posix.cc",
perkj650fdae2017-08-25 05:00:11 -0700366 "task_queue_posix.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200367 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200368 } else {
369 if (is_mac || is_ios) {
perkj650fdae2017-08-25 05:00:11 -0700370 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200371 "task_queue_gcd.cc",
372 "task_queue_posix.cc",
373 ]
374 }
375 if (is_win) {
perkj650fdae2017-08-25 05:00:11 -0700376 sources = [
377 "task_queue_win.cc",
378 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200379 }
380 }
381 }
382}
383
384rtc_static_library("sequenced_task_checker") {
385 sources = [
386 "sequenced_task_checker.h",
387 "sequenced_task_checker_impl.cc",
388 "sequenced_task_checker_impl.h",
389 ]
390 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700391 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200392 ":rtc_task_queue",
393 ]
394}
395
396rtc_static_library("weak_ptr") {
397 sources = [
398 "weak_ptr.cc",
399 "weak_ptr.h",
400 ]
401 deps = [
402 ":rtc_base_approved",
403 ":sequenced_task_checker",
404 ]
405}
406
407rtc_static_library("rtc_numerics") {
408 sources = [
409 "numerics/exp_filter.cc",
410 "numerics/exp_filter.h",
411 "numerics/percentile_filter.h",
412 ]
413 deps = [
414 ":rtc_base_approved",
415 ]
416}
417
418config("rtc_base_warnings_config") {
419 if (is_win && is_clang) {
420 cflags = [
421 # Disable warnings failing when compiling with Clang on Windows.
422 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
423 "-Wno-sign-compare",
424 "-Wno-missing-braces",
425 ]
426 }
427}
428
429rtc_source_set("rtc_json") {
430 defines = []
431 sources = [
432 "json.cc",
433 "json.h",
434 ]
435 if (rtc_build_json) {
436 public_deps = [
437 "//third_party/jsoncpp",
438 ]
439 } else {
440 include_dirs = [ "$rtc_jsoncpp_root" ]
441
442 # When defined changes the include path for json.h to where it is
443 # expected to be when building json outside of the standalone build.
444 defines += [ "WEBRTC_EXTERNAL_JSON" ]
445 }
446}
447
mbonadei9c5e5112017-09-05 05:17:02 -0700448rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700449 public_deps = [
450 ":rtc_base_generic",
451 ]
452 if (is_win) {
453 sources = [
454 "noop.cc",
455 ]
456 }
457 if (is_ios || is_mac) {
458 sources = [
459 "noop.mm",
460 ]
461 public_deps += [ ":rtc_base_objc" ]
462 }
463}
464
465if (is_ios || is_mac) {
466 rtc_source_set("rtc_base_objc") {
467 sources = [
468 "thread_darwin.mm",
469 ]
470 deps = [
471 ":rtc_base_generic",
472 ]
473 visibility = [ ":rtc_base" ]
474 }
475}
476
477rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200478 cflags = []
479 cflags_cc = []
480 libs = []
481 defines = []
482 deps = [
483 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700484 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200485 ]
486 public_deps = [
487 ":rtc_base_approved",
488 ]
489 public_configs = []
490
491 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
492
493 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200494 "asyncinvoker-inl.h",
495 "asyncinvoker.cc",
496 "asyncinvoker.h",
497 "asyncpacketsocket.cc",
498 "asyncpacketsocket.h",
499 "asyncresolverinterface.cc",
500 "asyncresolverinterface.h",
501 "asyncsocket.cc",
502 "asyncsocket.h",
503 "asynctcpsocket.cc",
504 "asynctcpsocket.h",
505 "asyncudpsocket.cc",
506 "asyncudpsocket.h",
507 "crc32.cc",
508 "crc32.h",
509 "cryptstring.cc",
510 "cryptstring.h",
511 "filerotatingstream.cc",
512 "filerotatingstream.h",
513 "fileutils.cc",
514 "fileutils.h",
515 "gunit_prod.h",
516 "helpers.cc",
517 "helpers.h",
518 "httpbase.cc",
519 "httpbase.h",
520 "httpcommon-inl.h",
521 "httpcommon.cc",
522 "httpcommon.h",
523 "ipaddress.cc",
524 "ipaddress.h",
525 "messagedigest.cc",
526 "messagedigest.h",
527 "messagehandler.cc",
528 "messagehandler.h",
529 "messagequeue.cc",
530 "messagequeue.h",
531 "nethelpers.cc",
532 "nethelpers.h",
533 "network.cc",
534 "network.h",
535 "networkmonitor.cc",
536 "networkmonitor.h",
537 "nullsocketserver.cc",
538 "nullsocketserver.h",
539 "openssl.h",
540 "openssladapter.cc",
541 "openssladapter.h",
542 "openssldigest.cc",
543 "openssldigest.h",
544 "opensslidentity.cc",
545 "opensslidentity.h",
546 "opensslstreamadapter.cc",
547 "opensslstreamadapter.h",
548 "physicalsocketserver.cc",
549 "physicalsocketserver.h",
550 "proxyinfo.cc",
551 "proxyinfo.h",
552 "ratelimiter.cc",
553 "ratelimiter.h",
554 "rtccertificate.cc",
555 "rtccertificate.h",
556 "rtccertificategenerator.cc",
557 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700558 "signalthread.cc",
559 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200560 "sigslot.cc",
561 "sigslot.h",
562 "socket.h",
563 "socketadapters.cc",
564 "socketadapters.h",
565 "socketaddress.cc",
566 "socketaddress.h",
567 "socketaddresspair.cc",
568 "socketaddresspair.h",
569 "socketfactory.h",
570 "socketserver.h",
571 "socketstream.cc",
572 "socketstream.h",
573 "ssladapter.cc",
574 "ssladapter.h",
575 "sslfingerprint.cc",
576 "sslfingerprint.h",
577 "sslidentity.cc",
578 "sslidentity.h",
579 "sslstreamadapter.cc",
580 "sslstreamadapter.h",
581 "stream.cc",
582 "stream.h",
583 "thread.cc",
584 "thread.h",
585 ]
586
mbonadei310e32b2017-09-07 07:36:28 -0700587 visibility = [
588 ":rtc_base",
589 ":rtc_base_objc",
590 ]
591
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200592 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
593 # compiler settings.
594 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
595 configs += [ "//build/config/compiler:no_chromium_code" ]
596 if (!is_win) {
597 cflags += [ "-Wno-uninitialized" ]
598 }
599
600 if (build_with_chromium) {
601 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200602 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200603 }
604 include_dirs = [ "../../boringssl/src/include" ]
605 public_configs += [ ":rtc_base_chromium_config" ]
606 } else {
607 configs += [ ":rtc_base_warnings_config" ]
608 sources += [
609 "callback.h",
610 "logsinks.cc",
611 "logsinks.h",
612 "mathutils.h",
613 "optionsfile.cc",
614 "optionsfile.h",
615 "rollingaccumulator.h",
616 "sslroots.h",
617 "transformadapter.cc",
618 "transformadapter.h",
619 "window.h",
620 ]
621
622 if (is_win) {
623 sources += [
624 "win32socketinit.cc",
625 "win32socketinit.h",
626 "win32socketserver.cc",
627 "win32socketserver.h",
628 ]
629 }
630 } # !build_with_chromium
631
632 if (rtc_build_ssl) {
633 deps += [ "//third_party/boringssl" ]
634 } else {
635 configs += [ ":external_ssl_library" ]
636 }
637
638 if (is_android) {
639 sources += [
640 "ifaddrs-android.cc",
641 "ifaddrs-android.h",
642 ]
643
644 libs += [
645 "log",
646 "GLESv2",
647 ]
648 }
649
650 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700651 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200652 }
653
654 if (use_x11) {
655 libs += [
656 "dl",
657 "rt",
658 "Xext",
659 "X11",
660 "Xcomposite",
661 "Xrender",
662 ]
663 }
664
665 if (is_linux) {
666 libs += [
667 "dl",
668 "rt",
669 ]
670 }
671
672 if (is_mac) {
673 sources += [
674 "macutils.cc",
675 "macutils.h",
676 ]
677 libs += [
678 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
679 "ApplicationServices.framework",
680 ]
681 }
682
683 if (is_win) {
684 sources += [
685 "win32.cc",
686 "win32.h",
687 "win32filesystem.cc",
688 "win32filesystem.h",
689 "win32securityerrors.cc",
690 "win32window.cc",
691 "win32window.h",
692 ]
693
694 libs += [
695 "crypt32.lib",
696 "iphlpapi.lib",
697 "secur32.lib",
698 ]
699
700 cflags += [
701 # Suppress warnings about WIN32_LEAN_AND_MEAN.
702 "/wd4005",
703 "/wd4703",
704 ]
705
706 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
707 }
708
709 if (is_posix) {
710 sources += [
711 "ifaddrs_converter.cc",
712 "ifaddrs_converter.h",
713 "unixfilesystem.cc",
714 "unixfilesystem.h",
715 ]
716 }
717
718 if (is_nacl) {
719 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
720 defines += [ "timezone=_timezone" ]
721 sources -= [ "ifaddrs_converter.cc" ]
722 }
723 if (is_win && is_clang) {
724 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
725 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
726 }
727}
728
729rtc_source_set("gtest_prod") {
730 sources = [
731 "gtest_prod_util.h",
732 ]
733}
734
735config("rtc_base_tests_utils_exported_config") {
736 defines = [ "GTEST_RELATIVE_PATH" ]
737}
738
739config("rtc_base_tests_utils_warnings_config") {
740 if (is_win && is_clang) {
741 cflags = [
742 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
743 "-Wno-reorder",
744 "-Wno-sign-compare",
745 ]
746 }
747}
748
749rtc_source_set("rtc_base_tests_utils") {
750 testonly = true
751 sources = [
752 # Also use this as a convenient dumping ground for misc files that are
753 # included by multiple targets below.
754 "cpu_time.cc",
755 "cpu_time.h",
756 "fakeclock.cc",
757 "fakeclock.h",
758 "fakenetwork.h",
759 "fakesslidentity.h",
760 "firewallsocketserver.cc",
761 "firewallsocketserver.h",
762 "gunit.h",
763 "httpserver.cc",
764 "httpserver.h",
765 "md5.cc",
766 "md5.h",
767 "md5digest.cc",
768 "md5digest.h",
769 "memory_usage.cc",
770 "memory_usage.h",
771 "natserver.cc",
772 "natserver.h",
773 "natsocketfactory.cc",
774 "natsocketfactory.h",
775 "nattypes.cc",
776 "nattypes.h",
777 "proxyserver.cc",
778 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200779 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200780 "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}