blob: 0646fb3d326e804072c0c1b4424ea9ca8301c8d8 [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",
Ilya Nikolaevskiyed23be92017-10-12 12:38:01 +0200140 "histogram_percentile_counter.cc",
141 "histogram_percentile_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200142 "ignore_wundef.h",
143 "location.cc",
144 "location.h",
145 "mod_ops.h",
ilnika79cc282017-08-23 05:24:10 -0700146 "moving_max_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200147 "onetimeevent.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200148 "pathutils.cc",
149 "pathutils.h",
150 "platform_file.cc",
151 "platform_file.h",
152 "platform_thread.cc",
153 "platform_thread.h",
154 "platform_thread_types.h",
155 "ptr_util.h",
156 "race_checker.cc",
157 "race_checker.h",
158 "random.cc",
159 "random.h",
160 "rate_limiter.cc",
161 "rate_limiter.h",
162 "rate_statistics.cc",
163 "rate_statistics.h",
164 "ratetracker.cc",
165 "ratetracker.h",
166 "refcount.h",
167 "refcountedobject.h",
168 "safe_compare.h",
169 "safe_conversions.h",
170 "safe_conversions_impl.h",
171 "safe_minmax.h",
172 "sanitizer.h",
173 "scoped_ref_ptr.h",
174 "string_to_number.cc",
175 "string_to_number.h",
176 "stringencode.cc",
177 "stringencode.h",
178 "stringize_macros.h",
179 "stringutils.cc",
180 "stringutils.h",
181 "swap_queue.h",
182 "template_util.h",
183 "thread_annotations.h",
184 "thread_checker.h",
185 "thread_checker_impl.cc",
186 "thread_checker_impl.h",
187 "timestampaligner.cc",
188 "timestampaligner.h",
189 "timeutils.cc",
190 "timeutils.h",
191 "trace_event.h",
192 "type_traits.h",
193 ]
194
195 deps += [ "..:webrtc_common" ]
196
197 if (is_android) {
198 libs += [ "log" ]
199 }
200
201 if (is_posix) {
202 sources += [ "file_posix.cc" ]
203 }
204
205 if (is_win) {
206 sources += [ "file_win.cc" ]
207 }
208
209 if (build_with_chromium) {
210 # Dependency on chromium's logging (in //base).
211 deps += [ "//base:base" ]
212 sources += [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200213 "../../webrtc_overrides/rtc_base/logging.cc",
214 "../../webrtc_overrides/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200215 ]
216 } else {
217 sources += [
218 "logging.cc",
219 "logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200220 ]
221 }
222 if (is_component_build && is_win) {
223 # Copy the VS runtime DLLs into the isolate so that they don't have to be
224 # preinstalled on the target machine. The debug runtimes have a "d" at
225 # the end.
226 # This is a copy of https://codereview.chromium.org/1783973002.
227 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
228 # so we don't have to copy their changes and risk breakages.
229 # See http://crbug.com/653569
230 if (is_debug) {
231 vcrt_suffix = "d"
232 } else {
233 vcrt_suffix = ""
234 }
235
236 # These runtime files are copied to the output directory by the
237 # vs_toolchain script that runs as part of toolchain configuration.
238 data = [
239 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
240 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
241 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
242
243 # Universal Windows 10 CRT files
244 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
245 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
246 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
248 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
249 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
250 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
251 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
256 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
261 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
266 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
279 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
280 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
281 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
282 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
283 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
284 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
285 ]
286 if (is_asan) {
287 if (current_cpu == "x64") {
288 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
289 } else {
290 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
291 }
292 }
293 }
294 if (is_nacl) {
295 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
296 }
297}
298
mbonadeibc378472017-09-11 03:43:34 -0700299if (is_mac && !build_with_chromium) {
300 config("rtc_base_approved_objc_all_dependent_config") {
301 visibility = [ ":rtc_base_approved_objc" ]
302 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
303 }
304
305 rtc_source_set("rtc_base_approved_objc") {
306 visibility = [ ":rtc_base_approved" ]
307 all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
308 sources = [
309 "logging_mac.mm",
310 ]
311 deps = [
312 ":rtc_base_approved_generic",
313 ]
314 }
315}
316
perkj650fdae2017-08-25 05:00:11 -0700317rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700318 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200319 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700320 ]
321 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700322 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200323 ]
324
perkj650fdae2017-08-25 05:00:11 -0700325 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700326 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700327 }
328}
329
330# WebRTC targets must not directly depend on rtc_task_queue_api or
331# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
332# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
333# to the default implemenation in rtc_task_queue_impl or if an externally
334# provided implementation should be used. An external implementation should
335# depend on rtc_task_queue_api.
336rtc_source_set("rtc_task_queue_api") {
nisse75dd6d42017-09-19 08:28:00 -0700337 sources = [
338 "task_queue.h",
339 ]
perkj650fdae2017-08-25 05:00:11 -0700340 deps = [
341 ":rtc_base_approved",
342 ]
343}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200344
perkj650fdae2017-08-25 05:00:11 -0700345rtc_source_set("rtc_task_queue_impl") {
346 deps = [
347 ":rtc_base_approved",
348 ":rtc_task_queue_api",
349 ]
Henrik Boströma9a27712017-10-03 08:01:07 +0000350 if (build_with_chromium) {
perkj650fdae2017-08-25 05:00:11 -0700351 sources = [
Henrik Boströma9a27712017-10-03 08:01:07 +0000352 "../../webrtc_overrides/rtc_base/task_queue.cc",
perkj650fdae2017-08-25 05:00:11 -0700353 ]
354 } else {
Henrik Boströma9a27712017-10-03 08:01:07 +0000355 if (rtc_build_libevent) {
356 deps += [ "//base/third_party/libevent" ]
Niels Möller17a04742017-09-27 10:53:21 +0200357 }
Henrik Boströma9a27712017-10-03 08:01:07 +0000358 if (rtc_enable_libevent) {
Niels Möller17a04742017-09-27 10:53:21 +0200359 sources = [
Henrik Boströma9a27712017-10-03 08:01:07 +0000360 "task_queue_libevent.cc",
361 "task_queue_posix.cc",
362 "task_queue_posix.h",
Niels Möller17a04742017-09-27 10:53:21 +0200363 ]
Henrik Boströma9a27712017-10-03 08:01:07 +0000364 } else {
365 if (is_mac || is_ios) {
366 sources = [
367 "task_queue_gcd.cc",
368 "task_queue_posix.cc",
369 ]
370 }
371 if (is_win) {
372 sources = [
373 "task_queue_win.cc",
374 ]
375 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200376 }
377 }
378}
379
380rtc_static_library("sequenced_task_checker") {
381 sources = [
382 "sequenced_task_checker.h",
383 "sequenced_task_checker_impl.cc",
384 "sequenced_task_checker_impl.h",
385 ]
386 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700387 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200388 ":rtc_task_queue",
389 ]
390}
391
392rtc_static_library("weak_ptr") {
393 sources = [
394 "weak_ptr.cc",
395 "weak_ptr.h",
396 ]
397 deps = [
398 ":rtc_base_approved",
399 ":sequenced_task_checker",
400 ]
401}
402
403rtc_static_library("rtc_numerics") {
404 sources = [
405 "numerics/exp_filter.cc",
406 "numerics/exp_filter.h",
407 "numerics/percentile_filter.h",
408 ]
409 deps = [
410 ":rtc_base_approved",
411 ]
412}
413
414config("rtc_base_warnings_config") {
415 if (is_win && is_clang) {
416 cflags = [
417 # Disable warnings failing when compiling with Clang on Windows.
418 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
419 "-Wno-sign-compare",
420 "-Wno-missing-braces",
421 ]
422 }
423}
424
425rtc_source_set("rtc_json") {
426 defines = []
427 sources = [
428 "json.cc",
429 "json.h",
430 ]
431 if (rtc_build_json) {
432 public_deps = [
433 "//third_party/jsoncpp",
434 ]
435 } else {
436 include_dirs = [ "$rtc_jsoncpp_root" ]
437
438 # When defined changes the include path for json.h to where it is
439 # expected to be when building json outside of the standalone build.
440 defines += [ "WEBRTC_EXTERNAL_JSON" ]
441 }
442}
443
mbonadei9c5e5112017-09-05 05:17:02 -0700444rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700445 public_deps = [
446 ":rtc_base_generic",
447 ]
448 if (is_win) {
449 sources = [
450 "noop.cc",
451 ]
452 }
453 if (is_ios || is_mac) {
454 sources = [
455 "noop.mm",
456 ]
457 public_deps += [ ":rtc_base_objc" ]
458 }
459}
460
461if (is_ios || is_mac) {
462 rtc_source_set("rtc_base_objc") {
463 sources = [
464 "thread_darwin.mm",
465 ]
466 deps = [
467 ":rtc_base_generic",
468 ]
469 visibility = [ ":rtc_base" ]
470 }
471}
472
473rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200474 cflags = []
475 cflags_cc = []
476 libs = []
477 defines = []
478 deps = [
479 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700480 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200481 ]
482 public_deps = [
483 ":rtc_base_approved",
484 ]
485 public_configs = []
486
487 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
488
489 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200490 "asyncinvoker-inl.h",
491 "asyncinvoker.cc",
492 "asyncinvoker.h",
493 "asyncpacketsocket.cc",
494 "asyncpacketsocket.h",
495 "asyncresolverinterface.cc",
496 "asyncresolverinterface.h",
497 "asyncsocket.cc",
498 "asyncsocket.h",
499 "asynctcpsocket.cc",
500 "asynctcpsocket.h",
501 "asyncudpsocket.cc",
502 "asyncudpsocket.h",
503 "crc32.cc",
504 "crc32.h",
505 "cryptstring.cc",
506 "cryptstring.h",
507 "filerotatingstream.cc",
508 "filerotatingstream.h",
509 "fileutils.cc",
510 "fileutils.h",
511 "gunit_prod.h",
512 "helpers.cc",
513 "helpers.h",
514 "httpbase.cc",
515 "httpbase.h",
516 "httpcommon-inl.h",
517 "httpcommon.cc",
518 "httpcommon.h",
519 "ipaddress.cc",
520 "ipaddress.h",
521 "messagedigest.cc",
522 "messagedigest.h",
523 "messagehandler.cc",
524 "messagehandler.h",
525 "messagequeue.cc",
526 "messagequeue.h",
527 "nethelpers.cc",
528 "nethelpers.h",
529 "network.cc",
530 "network.h",
Patrik Höglunde2d6a062017-10-05 14:53:33 +0200531 "network_constants.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200532 "networkmonitor.cc",
533 "networkmonitor.h",
534 "nullsocketserver.cc",
535 "nullsocketserver.h",
536 "openssl.h",
537 "openssladapter.cc",
538 "openssladapter.h",
539 "openssldigest.cc",
540 "openssldigest.h",
541 "opensslidentity.cc",
542 "opensslidentity.h",
543 "opensslstreamadapter.cc",
544 "opensslstreamadapter.h",
545 "physicalsocketserver.cc",
546 "physicalsocketserver.h",
547 "proxyinfo.cc",
548 "proxyinfo.h",
549 "ratelimiter.cc",
550 "ratelimiter.h",
551 "rtccertificate.cc",
552 "rtccertificate.h",
553 "rtccertificategenerator.cc",
554 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700555 "signalthread.cc",
556 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200557 "sigslot.cc",
558 "sigslot.h",
Taylor Brandstettere68b6c92017-10-05 09:13:55 -0700559 "sigslotrepeater.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200560 "socket.h",
561 "socketadapters.cc",
562 "socketadapters.h",
563 "socketaddress.cc",
564 "socketaddress.h",
565 "socketaddresspair.cc",
566 "socketaddresspair.h",
567 "socketfactory.h",
568 "socketserver.h",
569 "socketstream.cc",
570 "socketstream.h",
571 "ssladapter.cc",
572 "ssladapter.h",
573 "sslfingerprint.cc",
574 "sslfingerprint.h",
575 "sslidentity.cc",
576 "sslidentity.h",
577 "sslstreamadapter.cc",
578 "sslstreamadapter.h",
579 "stream.cc",
580 "stream.h",
581 "thread.cc",
582 "thread.h",
583 ]
584
mbonadei310e32b2017-09-07 07:36:28 -0700585 visibility = [
586 ":rtc_base",
587 ":rtc_base_objc",
588 ]
589
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200590 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
591 # compiler settings.
592 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
593 configs += [ "//build/config/compiler:no_chromium_code" ]
594 if (!is_win) {
595 cflags += [ "-Wno-uninitialized" ]
596 }
597
598 if (build_with_chromium) {
599 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200600 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200601 }
602 include_dirs = [ "../../boringssl/src/include" ]
603 public_configs += [ ":rtc_base_chromium_config" ]
604 } else {
605 configs += [ ":rtc_base_warnings_config" ]
606 sources += [
607 "callback.h",
608 "logsinks.cc",
609 "logsinks.h",
610 "mathutils.h",
611 "optionsfile.cc",
612 "optionsfile.h",
613 "rollingaccumulator.h",
614 "sslroots.h",
615 "transformadapter.cc",
616 "transformadapter.h",
617 "window.h",
618 ]
619
620 if (is_win) {
621 sources += [
622 "win32socketinit.cc",
623 "win32socketinit.h",
624 "win32socketserver.cc",
625 "win32socketserver.h",
626 ]
627 }
628 } # !build_with_chromium
629
630 if (rtc_build_ssl) {
631 deps += [ "//third_party/boringssl" ]
632 } else {
633 configs += [ ":external_ssl_library" ]
634 }
635
636 if (is_android) {
637 sources += [
638 "ifaddrs-android.cc",
639 "ifaddrs-android.h",
640 ]
641
642 libs += [
643 "log",
644 "GLESv2",
645 ]
646 }
647
648 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700649 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200650 }
651
652 if (use_x11) {
653 libs += [
654 "dl",
655 "rt",
656 "Xext",
657 "X11",
658 "Xcomposite",
659 "Xrender",
660 ]
661 }
662
663 if (is_linux) {
664 libs += [
665 "dl",
666 "rt",
667 ]
668 }
669
670 if (is_mac) {
671 sources += [
672 "macutils.cc",
673 "macutils.h",
674 ]
675 libs += [
676 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
677 "ApplicationServices.framework",
678 ]
679 }
680
681 if (is_win) {
682 sources += [
683 "win32.cc",
684 "win32.h",
685 "win32filesystem.cc",
686 "win32filesystem.h",
687 "win32securityerrors.cc",
688 "win32window.cc",
689 "win32window.h",
690 ]
691
692 libs += [
693 "crypt32.lib",
694 "iphlpapi.lib",
695 "secur32.lib",
696 ]
697
698 cflags += [
699 # Suppress warnings about WIN32_LEAN_AND_MEAN.
700 "/wd4005",
701 "/wd4703",
702 ]
703
704 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
705 }
706
707 if (is_posix) {
708 sources += [
709 "ifaddrs_converter.cc",
710 "ifaddrs_converter.h",
711 "unixfilesystem.cc",
712 "unixfilesystem.h",
713 ]
714 }
715
716 if (is_nacl) {
717 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
718 defines += [ "timezone=_timezone" ]
719 sources -= [ "ifaddrs_converter.cc" ]
720 }
721 if (is_win && is_clang) {
722 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
723 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
724 }
725}
726
727rtc_source_set("gtest_prod") {
728 sources = [
729 "gtest_prod_util.h",
730 ]
731}
732
733config("rtc_base_tests_utils_exported_config") {
734 defines = [ "GTEST_RELATIVE_PATH" ]
735}
736
737config("rtc_base_tests_utils_warnings_config") {
738 if (is_win && is_clang) {
739 cflags = [
740 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
741 "-Wno-reorder",
742 "-Wno-sign-compare",
743 ]
744 }
745}
746
747rtc_source_set("rtc_base_tests_utils") {
748 testonly = true
749 sources = [
750 # Also use this as a convenient dumping ground for misc files that are
751 # included by multiple targets below.
752 "cpu_time.cc",
753 "cpu_time.h",
754 "fakeclock.cc",
755 "fakeclock.h",
756 "fakenetwork.h",
757 "fakesslidentity.h",
758 "firewallsocketserver.cc",
759 "firewallsocketserver.h",
760 "gunit.h",
761 "httpserver.cc",
762 "httpserver.h",
763 "md5.cc",
764 "md5.h",
765 "md5digest.cc",
766 "md5digest.h",
767 "memory_usage.cc",
768 "memory_usage.h",
769 "natserver.cc",
770 "natserver.h",
771 "natsocketfactory.cc",
772 "natsocketfactory.h",
773 "nattypes.cc",
774 "nattypes.h",
775 "proxyserver.cc",
776 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200777 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200778 "sha1.cc",
779 "sha1.h",
780 "sha1digest.cc",
781 "sha1digest.h",
782 "sigslottester.h",
783 "sigslottester.h.pump",
784 "testbase64.h",
785 "testclient.cc",
786 "testclient.h",
787 "testechoserver.h",
788 "testutils.h",
789 "timedelta.h",
790 "virtualsocketserver.cc",
791 "virtualsocketserver.h",
792 ]
793 configs += [ ":rtc_base_tests_utils_warnings_config" ]
794 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
795 deps = [
796 ":rtc_base",
797 "../test:field_trial",
798 "../test:test_support",
799 ]
800 public_deps = [
801 "//testing/gmock",
802 "//testing/gtest",
803 ]
804
805 if (!build_with_chromium && is_clang) {
806 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
807 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
808 }
809}
810
811if (rtc_include_tests) {
812 rtc_source_set("rtc_base_tests_main") {
813 testonly = true
814 sources = [
815 "unittest_main.cc",
816 ]
817 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
818 deps = [
819 ":rtc_base",
820 ":rtc_base_approved",
821 ":rtc_base_tests_utils",
822 "../test:field_trial",
823 "../test:test_support",
824 ]
825
826 public_deps = [
827 "//testing/gmock",
828 "//testing/gtest",
829 ]
830
831 if (!build_with_chromium && is_clang) {
832 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
833 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
834 }
835 }
836
837 rtc_source_set("rtc_base_nonparallel_tests") {
838 testonly = true
839
840 # Skip restricting visibility on mobile platforms since the tests on those
841 # gets additional generated targets which would require many lines here to
842 # cover (which would be confusing to read and hard to maintain).
843 if (!is_android && !is_ios) {
844 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800845 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200846 }
847 sources = [
848 "cpu_time_unittest.cc",
849 "filerotatingstream_unittest.cc",
850 "nullsocketserver_unittest.cc",
851 "physicalsocketserver_unittest.cc",
852 "socket_unittest.cc",
853 "socket_unittest.h",
854 "socketaddress_unittest.cc",
855 ]
856 deps = [
857 ":rtc_base",
858 ":rtc_base_tests_main",
859 ":rtc_base_tests_utils",
860 "../system_wrappers:system_wrappers",
861 "../test:test_support",
862 "//testing/gtest",
863 ]
864 if (is_win) {
865 sources += [ "win32socketserver_unittest.cc" ]
866 }
867
868 if (!build_with_chromium && is_clang) {
869 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
870 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
871 }
872 }
873
874 rtc_source_set("rtc_base_approved_unittests") {
875 testonly = true
876
877 # Skip restricting visibility on mobile platforms since the tests on those
878 # gets additional generated targets which would require many lines here to
879 # cover (which would be confusing to read and hard to maintain).
880 if (!is_android && !is_ios) {
881 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800882 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200883 }
884 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200885 "atomicops_unittest.cc",
886 "base64_unittest.cc",
887 "basictypes_unittest.cc",
888 "bind_unittest.cc",
889 "bitbuffer_unittest.cc",
890 "buffer_unittest.cc",
891 "bufferqueue_unittest.cc",
892 "bytebuffer_unittest.cc",
893 "byteorder_unittest.cc",
894 "copyonwritebuffer_unittest.cc",
895 "criticalsection_unittest.cc",
896 "event_tracer_unittest.cc",
897 "event_unittest.cc",
898 "file_unittest.cc",
899 "function_view_unittest.cc",
Ilya Nikolaevskiyed23be92017-10-12 12:38:01 +0200900 "histogram_percentile_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200901 "logging_unittest.cc",
902 "md5digest_unittest.cc",
903 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700904 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200905 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200906 "pathutils_unittest.cc",
907 "platform_thread_unittest.cc",
908 "random_unittest.cc",
909 "rate_limiter_unittest.cc",
910 "rate_statistics_unittest.cc",
911 "ratetracker_unittest.cc",
912 "refcountedobject_unittest.cc",
913 "safe_compare_unittest.cc",
914 "safe_minmax_unittest.cc",
915 "string_to_number_unittest.cc",
916 "stringencode_unittest.cc",
917 "stringize_macros_unittest.cc",
918 "stringutils_unittest.cc",
919 "swap_queue_unittest.cc",
920 "thread_annotations_unittest.cc",
921 "thread_checker_unittest.cc",
922 "timestampaligner_unittest.cc",
923 "timeutils_unittest.cc",
924 "virtualsocket_unittest.cc",
925 ]
926 deps = [
927 ":rtc_base",
928 ":rtc_base_approved",
929 ":rtc_base_tests_main",
930 ":rtc_base_tests_utils",
931 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700932 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200933 "../system_wrappers:system_wrappers",
934 "../test:test_support",
935 ]
936 if (!build_with_chromium && is_clang) {
937 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
938 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
939 }
940 }
941
942 rtc_source_set("rtc_task_queue_unittests") {
943 testonly = true
944
945 # Skip restricting visibility on mobile platforms since the tests on those
946 # gets additional generated targets which would require many lines here to
947 # cover (which would be confusing to read and hard to maintain).
948 if (!is_android && !is_ios) {
949 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800950 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200951 }
952 sources = [
953 "task_queue_unittest.cc",
954 ]
955 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700956 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200957 ":rtc_base_tests_main",
958 ":rtc_base_tests_utils",
959 ":rtc_task_queue",
960 "../test:test_support",
961 ]
962 if (!build_with_chromium && is_clang) {
963 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
964 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
965 }
966 }
967
968 rtc_source_set("sequenced_task_checker_unittests") {
969 testonly = true
970
971 # Skip restricting visibility on mobile platforms since the tests on those
972 # gets additional generated targets which would require many lines here to
973 # cover (which would be confusing to read and hard to maintain).
974 if (!is_android && !is_ios) {
975 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800976 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200977 }
978 sources = [
979 "sequenced_task_checker_unittest.cc",
980 ]
981 deps = [
982 ":rtc_base_approved",
983 ":rtc_base_tests_main",
984 ":rtc_task_queue",
985 ":sequenced_task_checker",
986 "../test:test_support",
987 ]
988 }
989
990 rtc_source_set("weak_ptr_unittests") {
991 testonly = true
992
993 # Skip restricting visibility on mobile platforms since the tests on those
994 # gets additional generated targets which would require many lines here to
995 # cover (which would be confusing to read and hard to maintain).
996 if (!is_android && !is_ios) {
997 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800998 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200999 }
1000 sources = [
1001 "weak_ptr_unittest.cc",
1002 ]
1003 deps = [
1004 ":rtc_base_tests_main",
1005 ":rtc_base_tests_utils",
1006 ":rtc_task_queue",
1007 ":weak_ptr",
1008 "../test:test_support",
1009 ]
1010 }
1011
1012 rtc_source_set("rtc_numerics_unittests") {
1013 testonly = true
1014
1015 # Skip restricting visibility on mobile platforms since the tests on those
1016 # gets additional generated targets which would require many lines here to
1017 # cover (which would be confusing to read and hard to maintain).
1018 if (!is_android && !is_ios) {
1019 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001020 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001021 }
1022 sources = [
1023 "numerics/exp_filter_unittest.cc",
1024 "numerics/percentile_filter_unittest.cc",
1025 ]
1026 deps = [
1027 ":rtc_base_approved",
1028 ":rtc_base_tests_main",
1029 ":rtc_numerics",
1030 "../test:test_support",
1031 ]
1032 }
1033
1034 config("rtc_base_unittests_config") {
1035 if (is_clang) {
1036 cflags = [ "-Wno-unused-const-variable" ]
1037 }
1038 }
1039 rtc_source_set("rtc_base_unittests") {
1040 testonly = true
1041
1042 # Skip restricting visibility on mobile platforms since the tests on those
1043 # gets additional generated targets which would require many lines here to
1044 # cover (which would be confusing to read and hard to maintain).
1045 if (!is_android && !is_ios) {
1046 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001047 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001048 }
1049 sources = [
1050 "callback_unittest.cc",
1051 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001052 "helpers_unittest.cc",
1053 "httpbase_unittest.cc",
1054 "httpcommon_unittest.cc",
1055 "httpserver_unittest.cc",
1056 "ipaddress_unittest.cc",
1057 "memory_usage_unittest.cc",
1058 "messagedigest_unittest.cc",
1059 "messagequeue_unittest.cc",
1060 "nat_unittest.cc",
1061 "network_unittest.cc",
1062 "optionsfile_unittest.cc",
1063 "proxy_unittest.cc",
1064 "ptr_util_unittest.cc",
1065 "ratelimiter_unittest.cc",
1066 "rollingaccumulator_unittest.cc",
1067 "rtccertificate_unittest.cc",
1068 "rtccertificategenerator_unittest.cc",
1069 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001070 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001071 "sigslot_unittest.cc",
1072 "sigslottester_unittest.cc",
1073 "stream_unittest.cc",
1074 "testclient_unittest.cc",
1075 "thread_unittest.cc",
1076 ]
1077 if (is_win) {
1078 sources += [
1079 "win32_unittest.cc",
1080 "win32window_unittest.cc",
1081 ]
1082 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001083 if (is_posix) {
1084 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001085 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001086 "ssladapter_unittest.cc",
1087 "sslidentity_unittest.cc",
1088 "sslstreamadapter_unittest.cc",
1089 ]
1090 }
1091 deps = [
1092 ":rtc_base_tests_main",
1093 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001094 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001095 "../test:test_support",
1096 ]
1097 public_deps = [
1098 ":rtc_base",
1099 ]
1100 configs += [ ":rtc_base_unittests_config" ]
1101 if (!build_with_chromium && is_clang) {
1102 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1103 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1104 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001105 if (build_with_chromium) {
1106 include_dirs = [ "../../boringssl/src/include" ]
1107 }
1108 if (rtc_build_ssl) {
1109 deps += [ "//third_party/boringssl" ]
1110 } else {
1111 configs += [ ":external_ssl_library" ]
1112 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001113 }
1114}
1115
Henrik Kjellander73e21802017-06-20 08:38:58 +02001116if (is_android) {
1117 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001118 java_files = [
1119 "java/src/org/webrtc/ContextUtils.java",
1120 "java/src/org/webrtc/Logging.java",
1121 "java/src/org/webrtc/Size.java",
1122 "java/src/org/webrtc/ThreadUtils.java",
1123 ]
charujain474acce2017-08-25 06:21:52 -07001124
1125 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1126 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001127 }
1128}