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