blob: 443d32ef80699dd3bfeb2ccdb227909954fcfcfd [file] [log] [blame]
Henrik Kjellanderc0362762017-06-29 06:03:041# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
Henrik Kjellander73e21802017-06-20 06:38:582#
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 06:03:049import("//build/config/crypto.gni")
10import("//build/config/ui.gni")
Henrik Kjellander73e21802017-06-20 06:38:5811import("../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 06:03:0417if (is_win) {
18 import("//build/config/clang/clang.gni")
19}
Henrik Kjellander73e21802017-06-20 06:38:5820
Henrik Kjellanderc0362762017-06-29 06:03:0421group("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 06:38:5829 if (is_android) {
30 public_deps += [ ":base_java" ]
31 }
32}
33
Henrik Kjellanderc0362762017-06-29 06:03:0434config("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 10:43:3483rtc_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 06:03:0492# The subset of rtc_base approved for use outside of libjingle.
mbonadeibc378472017-09-11 10:43:3493rtc_source_set("rtc_base_approved_generic") {
94 visibility = [
95 ":rtc_base_approved",
96 ":rtc_base_approved_objc",
97 ]
98
Henrik Kjellanderc0362762017-06-29 06:03:0499 # TODO(kjellander): Remove (bugs.webrtc.org/7480)
100 # Enabling GN check triggers a cyclic dependency caused by rate_limiter.cc:
Jianjun Zhu037f3e42017-08-15 13:48:37101 # :rtc_base_approved -> ../system_wrappers -> :rtc_base_approved
Henrik Kjellanderc0362762017-06-29 06:03:04102 check_includes = false
103 defines = []
104 libs = []
105 deps = []
Henrik Kjellanderc0362762017-06-29 06:03:04106
107 sources = [
Henrik Kjellanderc0362762017-06-29 06:03:04108 "arraysize.h",
109 "atomicops.h",
110 "base64.cc",
111 "base64.h",
112 "basictypes.h",
113 "bind.h",
114 "bitbuffer.cc",
115 "bitbuffer.h",
Alex Naresta5fbc232017-10-18 16:31:07116 "bitrateallocationstrategy.cc",
117 "bitrateallocationstrategy.h",
Henrik Kjellanderc0362762017-06-29 06:03:04118 "buffer.h",
119 "bufferqueue.cc",
120 "bufferqueue.h",
121 "bytebuffer.cc",
122 "bytebuffer.h",
123 "byteorder.h",
124 "checks.cc",
125 "checks.h",
126 "constructormagic.h",
127 "copyonwritebuffer.cc",
128 "copyonwritebuffer.h",
129 "criticalsection.cc",
130 "criticalsection.h",
131 "deprecation.h",
132 "event.cc",
133 "event.h",
134 "event_tracer.cc",
135 "event_tracer.h",
136 "file.cc",
137 "file.h",
138 "flags.cc",
139 "flags.h",
140 "format_macros.h",
141 "function_view.h",
Ilya Nikolaevskiyed23be92017-10-12 10:38:01142 "histogram_percentile_counter.cc",
143 "histogram_percentile_counter.h",
Henrik Kjellanderc0362762017-06-29 06:03:04144 "ignore_wundef.h",
145 "location.cc",
146 "location.h",
147 "mod_ops.h",
ilnika79cc282017-08-23 12:24:10148 "moving_max_counter.h",
Henrik Kjellanderc0362762017-06-29 06:03:04149 "onetimeevent.h",
Henrik Kjellanderc0362762017-06-29 06:03:04150 "pathutils.cc",
151 "pathutils.h",
152 "platform_file.cc",
153 "platform_file.h",
154 "platform_thread.cc",
155 "platform_thread.h",
156 "platform_thread_types.h",
157 "ptr_util.h",
158 "race_checker.cc",
159 "race_checker.h",
160 "random.cc",
161 "random.h",
162 "rate_limiter.cc",
163 "rate_limiter.h",
164 "rate_statistics.cc",
165 "rate_statistics.h",
166 "ratetracker.cc",
167 "ratetracker.h",
168 "refcount.h",
169 "refcountedobject.h",
170 "safe_compare.h",
171 "safe_conversions.h",
172 "safe_conversions_impl.h",
173 "safe_minmax.h",
174 "sanitizer.h",
175 "scoped_ref_ptr.h",
176 "string_to_number.cc",
177 "string_to_number.h",
178 "stringencode.cc",
179 "stringencode.h",
180 "stringize_macros.h",
181 "stringutils.cc",
182 "stringutils.h",
183 "swap_queue.h",
184 "template_util.h",
185 "thread_annotations.h",
186 "thread_checker.h",
187 "thread_checker_impl.cc",
188 "thread_checker_impl.h",
189 "timestampaligner.cc",
190 "timestampaligner.h",
191 "timeutils.cc",
192 "timeutils.h",
193 "trace_event.h",
194 "type_traits.h",
195 ]
196
197 deps += [ "..:webrtc_common" ]
198
199 if (is_android) {
200 libs += [ "log" ]
201 }
202
203 if (is_posix) {
204 sources += [ "file_posix.cc" ]
205 }
206
207 if (is_win) {
208 sources += [ "file_win.cc" ]
209 }
210
211 if (build_with_chromium) {
212 # Dependency on chromium's logging (in //base).
213 deps += [ "//base:base" ]
214 sources += [
Mirko Bonadei92ea95e2017-09-15 04:47:31215 "../../webrtc_overrides/rtc_base/logging.cc",
216 "../../webrtc_overrides/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 06:03:04217 ]
218 } else {
219 sources += [
220 "logging.cc",
221 "logging.h",
Henrik Kjellanderc0362762017-06-29 06:03:04222 ]
223 }
224 if (is_component_build && is_win) {
225 # Copy the VS runtime DLLs into the isolate so that they don't have to be
226 # preinstalled on the target machine. The debug runtimes have a "d" at
227 # the end.
228 # This is a copy of https://codereview.chromium.org/1783973002.
229 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
230 # so we don't have to copy their changes and risk breakages.
231 # See http://crbug.com/653569
232 if (is_debug) {
233 vcrt_suffix = "d"
234 } else {
235 vcrt_suffix = ""
236 }
237
238 # These runtime files are copied to the output directory by the
239 # vs_toolchain script that runs as part of toolchain configuration.
240 data = [
241 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
242 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
243 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
244
245 # Universal Windows 10 CRT files
246 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
248 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
249 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
250 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
251 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
252 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
253 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
256 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
258 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
261 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
263 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
266 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
268 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
279 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
280 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
281 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
282 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
283 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
284 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
285 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
286 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
287 ]
288 if (is_asan) {
289 if (current_cpu == "x64") {
290 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
291 } else {
292 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
293 }
294 }
295 }
296 if (is_nacl) {
297 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
298 }
299}
300
mbonadeibc378472017-09-11 10:43:34301if (is_mac && !build_with_chromium) {
302 config("rtc_base_approved_objc_all_dependent_config") {
303 visibility = [ ":rtc_base_approved_objc" ]
304 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
305 }
306
307 rtc_source_set("rtc_base_approved_objc") {
308 visibility = [ ":rtc_base_approved" ]
309 all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
310 sources = [
311 "logging_mac.mm",
312 ]
313 deps = [
314 ":rtc_base_approved_generic",
315 ]
316 }
317}
318
perkj650fdae2017-08-25 12:00:11319rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-28 06:40:10320 deps = [
Henrik Kjellanderc0362762017-06-29 06:03:04321 ":rtc_base_approved",
mbonadei95c8f652017-08-28 06:40:10322 ]
323 public_deps = [
perkj650fdae2017-08-25 12:00:11324 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 06:03:04325 ]
326
perkj650fdae2017-08-25 12:00:11327 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-28 06:40:10328 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 12:00:11329 }
330}
331
332# WebRTC targets must not directly depend on rtc_task_queue_api or
333# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
334# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
335# to the default implemenation in rtc_task_queue_impl or if an externally
336# provided implementation should be used. An external implementation should
337# depend on rtc_task_queue_api.
338rtc_source_set("rtc_task_queue_api") {
nisse75dd6d42017-09-19 15:28:00339 sources = [
340 "task_queue.h",
341 ]
perkj650fdae2017-08-25 12:00:11342 deps = [
343 ":rtc_base_approved",
344 ]
345}
Henrik Kjellanderc0362762017-06-29 06:03:04346
perkj650fdae2017-08-25 12:00:11347rtc_source_set("rtc_task_queue_impl") {
348 deps = [
349 ":rtc_base_approved",
350 ":rtc_task_queue_api",
351 ]
Niels Möller15c9cf72017-10-19 10:38:09352 if (rtc_build_libevent) {
353 deps += [ "//base/third_party/libevent" ]
354 }
355 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 12:00:11356 sources = [
Niels Möller15c9cf72017-10-19 10:38:09357 "task_queue_libevent.cc",
358 "task_queue_posix.cc",
359 "task_queue_posix.h",
perkj650fdae2017-08-25 12:00:11360 ]
361 } else {
Niels Möller15c9cf72017-10-19 10:38:09362 if (is_mac || is_ios) {
Niels Möller17a04742017-09-27 08:53:21363 sources = [
Niels Möller15c9cf72017-10-19 10:38:09364 "task_queue_gcd.cc",
Henrik Boströma9a27712017-10-03 08:01:07365 "task_queue_posix.cc",
366 "task_queue_posix.h",
Niels Möller17a04742017-09-27 08:53:21367 ]
Niels Möller15c9cf72017-10-19 10:38:09368 }
369 if (is_win) {
370 sources = [
371 "task_queue_win.cc",
372 ]
Henrik Kjellanderc0362762017-06-29 06:03:04373 }
374 }
375}
376
377rtc_static_library("sequenced_task_checker") {
378 sources = [
379 "sequenced_task_checker.h",
380 "sequenced_task_checker_impl.cc",
381 "sequenced_task_checker_impl.h",
382 ]
383 deps = [
mbonadei95c8f652017-08-28 06:40:10384 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 06:03:04385 ":rtc_task_queue",
386 ]
387}
388
389rtc_static_library("weak_ptr") {
390 sources = [
391 "weak_ptr.cc",
392 "weak_ptr.h",
393 ]
394 deps = [
395 ":rtc_base_approved",
396 ":sequenced_task_checker",
397 ]
398}
399
400rtc_static_library("rtc_numerics") {
401 sources = [
402 "numerics/exp_filter.cc",
403 "numerics/exp_filter.h",
404 "numerics/percentile_filter.h",
405 ]
406 deps = [
407 ":rtc_base_approved",
408 ]
409}
410
411config("rtc_base_warnings_config") {
412 if (is_win && is_clang) {
413 cflags = [
414 # Disable warnings failing when compiling with Clang on Windows.
415 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
416 "-Wno-sign-compare",
417 "-Wno-missing-braces",
418 ]
419 }
420}
421
422rtc_source_set("rtc_json") {
423 defines = []
424 sources = [
425 "json.cc",
426 "json.h",
427 ]
428 if (rtc_build_json) {
429 public_deps = [
430 "//third_party/jsoncpp",
431 ]
432 } else {
433 include_dirs = [ "$rtc_jsoncpp_root" ]
434
435 # When defined changes the include path for json.h to where it is
436 # expected to be when building json outside of the standalone build.
437 defines += [ "WEBRTC_EXTERNAL_JSON" ]
438 }
439}
440
mbonadei9c5e5112017-09-05 12:17:02441rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 14:36:28442 public_deps = [
443 ":rtc_base_generic",
444 ]
445 if (is_win) {
446 sources = [
447 "noop.cc",
448 ]
449 }
450 if (is_ios || is_mac) {
451 sources = [
452 "noop.mm",
453 ]
454 public_deps += [ ":rtc_base_objc" ]
455 }
456}
457
458if (is_ios || is_mac) {
459 rtc_source_set("rtc_base_objc") {
460 sources = [
461 "thread_darwin.mm",
462 ]
463 deps = [
464 ":rtc_base_generic",
465 ]
466 visibility = [ ":rtc_base" ]
467 }
468}
469
470rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 06:03:04471 cflags = []
472 cflags_cc = []
473 libs = []
474 defines = []
475 deps = [
476 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 15:43:13477 "../api:optional",
Henrik Kjellanderc0362762017-06-29 06:03:04478 ]
479 public_deps = [
480 ":rtc_base_approved",
481 ]
482 public_configs = []
483
484 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
485
486 sources = [
Henrik Kjellanderc0362762017-06-29 06:03:04487 "asyncinvoker-inl.h",
488 "asyncinvoker.cc",
489 "asyncinvoker.h",
490 "asyncpacketsocket.cc",
491 "asyncpacketsocket.h",
492 "asyncresolverinterface.cc",
493 "asyncresolverinterface.h",
494 "asyncsocket.cc",
495 "asyncsocket.h",
496 "asynctcpsocket.cc",
497 "asynctcpsocket.h",
498 "asyncudpsocket.cc",
499 "asyncudpsocket.h",
500 "crc32.cc",
501 "crc32.h",
502 "cryptstring.cc",
503 "cryptstring.h",
504 "filerotatingstream.cc",
505 "filerotatingstream.h",
506 "fileutils.cc",
507 "fileutils.h",
508 "gunit_prod.h",
509 "helpers.cc",
510 "helpers.h",
511 "httpbase.cc",
512 "httpbase.h",
513 "httpcommon-inl.h",
514 "httpcommon.cc",
515 "httpcommon.h",
516 "ipaddress.cc",
517 "ipaddress.h",
518 "messagedigest.cc",
519 "messagedigest.h",
520 "messagehandler.cc",
521 "messagehandler.h",
522 "messagequeue.cc",
523 "messagequeue.h",
524 "nethelpers.cc",
525 "nethelpers.h",
526 "network.cc",
527 "network.h",
Patrik Höglunde2d6a062017-10-05 12:53:33528 "network_constants.h",
Henrik Kjellanderc0362762017-06-29 06:03:04529 "networkmonitor.cc",
530 "networkmonitor.h",
531 "nullsocketserver.cc",
532 "nullsocketserver.h",
533 "openssl.h",
534 "openssladapter.cc",
535 "openssladapter.h",
536 "openssldigest.cc",
537 "openssldigest.h",
538 "opensslidentity.cc",
539 "opensslidentity.h",
540 "opensslstreamadapter.cc",
541 "opensslstreamadapter.h",
542 "physicalsocketserver.cc",
543 "physicalsocketserver.h",
544 "proxyinfo.cc",
545 "proxyinfo.h",
546 "ratelimiter.cc",
547 "ratelimiter.h",
548 "rtccertificate.cc",
549 "rtccertificate.h",
550 "rtccertificategenerator.cc",
551 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 23:56:05552 "signalthread.cc",
553 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 06:03:04554 "sigslot.cc",
555 "sigslot.h",
Taylor Brandstettere68b6c92017-10-05 16:13:55556 "sigslotrepeater.h",
Henrik Kjellanderc0362762017-06-29 06:03:04557 "socket.h",
558 "socketadapters.cc",
559 "socketadapters.h",
560 "socketaddress.cc",
561 "socketaddress.h",
562 "socketaddresspair.cc",
563 "socketaddresspair.h",
564 "socketfactory.h",
565 "socketserver.h",
566 "socketstream.cc",
567 "socketstream.h",
568 "ssladapter.cc",
569 "ssladapter.h",
570 "sslfingerprint.cc",
571 "sslfingerprint.h",
572 "sslidentity.cc",
573 "sslidentity.h",
574 "sslstreamadapter.cc",
575 "sslstreamadapter.h",
576 "stream.cc",
577 "stream.h",
578 "thread.cc",
579 "thread.h",
580 ]
581
mbonadei310e32b2017-09-07 14:36:28582 visibility = [
583 ":rtc_base",
584 ":rtc_base_objc",
585 ]
586
Henrik Kjellanderc0362762017-06-29 06:03:04587 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
588 # compiler settings.
589 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
590 configs += [ "//build/config/compiler:no_chromium_code" ]
591 if (!is_win) {
592 cflags += [ "-Wno-uninitialized" ]
593 }
594
595 if (build_with_chromium) {
596 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 04:47:31597 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 06:03:04598 }
599 include_dirs = [ "../../boringssl/src/include" ]
600 public_configs += [ ":rtc_base_chromium_config" ]
601 } else {
602 configs += [ ":rtc_base_warnings_config" ]
603 sources += [
604 "callback.h",
605 "logsinks.cc",
606 "logsinks.h",
607 "mathutils.h",
608 "optionsfile.cc",
609 "optionsfile.h",
610 "rollingaccumulator.h",
611 "sslroots.h",
612 "transformadapter.cc",
613 "transformadapter.h",
614 "window.h",
615 ]
616
617 if (is_win) {
618 sources += [
619 "win32socketinit.cc",
620 "win32socketinit.h",
621 "win32socketserver.cc",
622 "win32socketserver.h",
623 ]
624 }
625 } # !build_with_chromium
626
627 if (rtc_build_ssl) {
628 deps += [ "//third_party/boringssl" ]
629 } else {
630 configs += [ ":external_ssl_library" ]
631 }
632
633 if (is_android) {
634 sources += [
635 "ifaddrs-android.cc",
636 "ifaddrs-android.h",
637 ]
638
639 libs += [
640 "log",
641 "GLESv2",
642 ]
643 }
644
645 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 14:36:28646 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 06:03:04647 }
648
649 if (use_x11) {
650 libs += [
651 "dl",
652 "rt",
653 "Xext",
654 "X11",
655 "Xcomposite",
656 "Xrender",
657 ]
658 }
659
660 if (is_linux) {
661 libs += [
662 "dl",
663 "rt",
664 ]
665 }
666
667 if (is_mac) {
668 sources += [
669 "macutils.cc",
670 "macutils.h",
671 ]
672 libs += [
673 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
674 "ApplicationServices.framework",
675 ]
676 }
677
678 if (is_win) {
679 sources += [
680 "win32.cc",
681 "win32.h",
682 "win32filesystem.cc",
683 "win32filesystem.h",
684 "win32securityerrors.cc",
685 "win32window.cc",
686 "win32window.h",
687 ]
688
689 libs += [
690 "crypt32.lib",
691 "iphlpapi.lib",
692 "secur32.lib",
693 ]
694
695 cflags += [
696 # Suppress warnings about WIN32_LEAN_AND_MEAN.
697 "/wd4005",
698 "/wd4703",
699 ]
700
701 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
702 }
703
704 if (is_posix) {
705 sources += [
706 "ifaddrs_converter.cc",
707 "ifaddrs_converter.h",
708 "unixfilesystem.cc",
709 "unixfilesystem.h",
710 ]
711 }
712
713 if (is_nacl) {
714 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
715 defines += [ "timezone=_timezone" ]
716 sources -= [ "ifaddrs_converter.cc" ]
717 }
718 if (is_win && is_clang) {
719 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
720 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
721 }
722}
723
724rtc_source_set("gtest_prod") {
725 sources = [
726 "gtest_prod_util.h",
727 ]
728}
729
730config("rtc_base_tests_utils_exported_config") {
731 defines = [ "GTEST_RELATIVE_PATH" ]
732}
733
734config("rtc_base_tests_utils_warnings_config") {
735 if (is_win && is_clang) {
736 cflags = [
737 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
738 "-Wno-reorder",
739 "-Wno-sign-compare",
740 ]
741 }
742}
743
744rtc_source_set("rtc_base_tests_utils") {
745 testonly = true
746 sources = [
747 # Also use this as a convenient dumping ground for misc files that are
748 # included by multiple targets below.
749 "cpu_time.cc",
750 "cpu_time.h",
751 "fakeclock.cc",
752 "fakeclock.h",
753 "fakenetwork.h",
754 "fakesslidentity.h",
755 "firewallsocketserver.cc",
756 "firewallsocketserver.h",
757 "gunit.h",
758 "httpserver.cc",
759 "httpserver.h",
760 "md5.cc",
761 "md5.h",
762 "md5digest.cc",
763 "md5digest.h",
764 "memory_usage.cc",
765 "memory_usage.h",
766 "natserver.cc",
767 "natserver.h",
768 "natsocketfactory.cc",
769 "natsocketfactory.h",
770 "nattypes.cc",
771 "nattypes.h",
772 "proxyserver.cc",
773 "proxyserver.h",
Patrik Höglund563934e2017-09-15 07:04:28774 "refcount.h",
Henrik Kjellanderc0362762017-06-29 06:03:04775 "sha1.cc",
776 "sha1.h",
777 "sha1digest.cc",
778 "sha1digest.h",
779 "sigslottester.h",
780 "sigslottester.h.pump",
781 "testbase64.h",
782 "testclient.cc",
783 "testclient.h",
784 "testechoserver.h",
785 "testutils.h",
786 "timedelta.h",
787 "virtualsocketserver.cc",
788 "virtualsocketserver.h",
789 ]
790 configs += [ ":rtc_base_tests_utils_warnings_config" ]
791 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
792 deps = [
793 ":rtc_base",
794 "../test:field_trial",
795 "../test:test_support",
796 ]
797 public_deps = [
798 "//testing/gmock",
799 "//testing/gtest",
800 ]
801
802 if (!build_with_chromium && is_clang) {
803 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
804 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
805 }
806}
807
808if (rtc_include_tests) {
809 rtc_source_set("rtc_base_tests_main") {
810 testonly = true
811 sources = [
812 "unittest_main.cc",
813 ]
814 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
815 deps = [
816 ":rtc_base",
817 ":rtc_base_approved",
818 ":rtc_base_tests_utils",
819 "../test:field_trial",
820 "../test:test_support",
821 ]
822
823 public_deps = [
824 "//testing/gmock",
825 "//testing/gtest",
826 ]
827
828 if (!build_with_chromium && is_clang) {
829 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
830 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
831 }
832 }
833
834 rtc_source_set("rtc_base_nonparallel_tests") {
835 testonly = true
836
837 # Skip restricting visibility on mobile platforms since the tests on those
838 # gets additional generated targets which would require many lines here to
839 # cover (which would be confusing to read and hard to maintain).
840 if (!is_android && !is_ios) {
841 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 13:48:37842 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 06:03:04843 }
844 sources = [
845 "cpu_time_unittest.cc",
846 "filerotatingstream_unittest.cc",
847 "nullsocketserver_unittest.cc",
848 "physicalsocketserver_unittest.cc",
849 "socket_unittest.cc",
850 "socket_unittest.h",
851 "socketaddress_unittest.cc",
852 ]
853 deps = [
854 ":rtc_base",
855 ":rtc_base_tests_main",
856 ":rtc_base_tests_utils",
857 "../system_wrappers:system_wrappers",
858 "../test:test_support",
859 "//testing/gtest",
860 ]
861 if (is_win) {
862 sources += [ "win32socketserver_unittest.cc" ]
863 }
864
865 if (!build_with_chromium && is_clang) {
866 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
867 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
868 }
869 }
870
871 rtc_source_set("rtc_base_approved_unittests") {
872 testonly = true
873
874 # Skip restricting visibility on mobile platforms since the tests on those
875 # gets additional generated targets which would require many lines here to
876 # cover (which would be confusing to read and hard to maintain).
877 if (!is_android && !is_ios) {
878 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 13:48:37879 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 06:03:04880 }
881 sources = [
Henrik Kjellanderc0362762017-06-29 06:03:04882 "atomicops_unittest.cc",
883 "base64_unittest.cc",
884 "basictypes_unittest.cc",
885 "bind_unittest.cc",
886 "bitbuffer_unittest.cc",
887 "buffer_unittest.cc",
888 "bufferqueue_unittest.cc",
889 "bytebuffer_unittest.cc",
890 "byteorder_unittest.cc",
891 "copyonwritebuffer_unittest.cc",
892 "criticalsection_unittest.cc",
893 "event_tracer_unittest.cc",
894 "event_unittest.cc",
895 "file_unittest.cc",
896 "function_view_unittest.cc",
Ilya Nikolaevskiyed23be92017-10-12 10:38:01897 "histogram_percentile_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 06:03:04898 "logging_unittest.cc",
899 "md5digest_unittest.cc",
900 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 12:24:10901 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 06:03:04902 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 06:03:04903 "pathutils_unittest.cc",
904 "platform_thread_unittest.cc",
905 "random_unittest.cc",
906 "rate_limiter_unittest.cc",
907 "rate_statistics_unittest.cc",
908 "ratetracker_unittest.cc",
909 "refcountedobject_unittest.cc",
910 "safe_compare_unittest.cc",
911 "safe_minmax_unittest.cc",
912 "string_to_number_unittest.cc",
913 "stringencode_unittest.cc",
914 "stringize_macros_unittest.cc",
915 "stringutils_unittest.cc",
916 "swap_queue_unittest.cc",
917 "thread_annotations_unittest.cc",
918 "thread_checker_unittest.cc",
919 "timestampaligner_unittest.cc",
920 "timeutils_unittest.cc",
921 "virtualsocket_unittest.cc",
922 ]
923 deps = [
924 ":rtc_base",
925 ":rtc_base_approved",
926 ":rtc_base_tests_main",
927 ":rtc_base_tests_utils",
928 ":rtc_task_queue",
kwiberg529662a2017-09-04 12:43:17929 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 06:03:04930 "../system_wrappers:system_wrappers",
931 "../test:test_support",
932 ]
933 if (!build_with_chromium && is_clang) {
934 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
935 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
936 }
937 }
938
939 rtc_source_set("rtc_task_queue_unittests") {
940 testonly = true
941
942 # Skip restricting visibility on mobile platforms since the tests on those
943 # gets additional generated targets which would require many lines here to
944 # cover (which would be confusing to read and hard to maintain).
945 if (!is_android && !is_ios) {
946 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 13:48:37947 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 06:03:04948 }
949 sources = [
950 "task_queue_unittest.cc",
951 ]
952 deps = [
mbonadei95c8f652017-08-28 06:40:10953 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 06:03:04954 ":rtc_base_tests_main",
955 ":rtc_base_tests_utils",
956 ":rtc_task_queue",
957 "../test:test_support",
958 ]
959 if (!build_with_chromium && is_clang) {
960 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
961 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
962 }
963 }
964
965 rtc_source_set("sequenced_task_checker_unittests") {
966 testonly = true
967
968 # Skip restricting visibility on mobile platforms since the tests on those
969 # gets additional generated targets which would require many lines here to
970 # cover (which would be confusing to read and hard to maintain).
971 if (!is_android && !is_ios) {
972 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 13:48:37973 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 06:03:04974 }
975 sources = [
976 "sequenced_task_checker_unittest.cc",
977 ]
978 deps = [
979 ":rtc_base_approved",
980 ":rtc_base_tests_main",
981 ":rtc_task_queue",
982 ":sequenced_task_checker",
983 "../test:test_support",
984 ]
985 }
986
987 rtc_source_set("weak_ptr_unittests") {
988 testonly = true
989
990 # Skip restricting visibility on mobile platforms since the tests on those
991 # gets additional generated targets which would require many lines here to
992 # cover (which would be confusing to read and hard to maintain).
993 if (!is_android && !is_ios) {
994 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 13:48:37995 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 06:03:04996 }
997 sources = [
998 "weak_ptr_unittest.cc",
999 ]
1000 deps = [
1001 ":rtc_base_tests_main",
1002 ":rtc_base_tests_utils",
1003 ":rtc_task_queue",
1004 ":weak_ptr",
1005 "../test:test_support",
1006 ]
1007 }
1008
1009 rtc_source_set("rtc_numerics_unittests") {
1010 testonly = true
1011
1012 # Skip restricting visibility on mobile platforms since the tests on those
1013 # gets additional generated targets which would require many lines here to
1014 # cover (which would be confusing to read and hard to maintain).
1015 if (!is_android && !is_ios) {
1016 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 13:48:371017 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 06:03:041018 }
1019 sources = [
1020 "numerics/exp_filter_unittest.cc",
1021 "numerics/percentile_filter_unittest.cc",
1022 ]
1023 deps = [
1024 ":rtc_base_approved",
1025 ":rtc_base_tests_main",
1026 ":rtc_numerics",
1027 "../test:test_support",
1028 ]
1029 }
1030
1031 config("rtc_base_unittests_config") {
1032 if (is_clang) {
1033 cflags = [ "-Wno-unused-const-variable" ]
1034 }
1035 }
1036 rtc_source_set("rtc_base_unittests") {
1037 testonly = true
1038
1039 # Skip restricting visibility on mobile platforms since the tests on those
1040 # gets additional generated targets which would require many lines here to
1041 # cover (which would be confusing to read and hard to maintain).
1042 if (!is_android && !is_ios) {
1043 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 13:48:371044 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 06:03:041045 }
1046 sources = [
1047 "callback_unittest.cc",
1048 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 06:03:041049 "helpers_unittest.cc",
1050 "httpbase_unittest.cc",
1051 "httpcommon_unittest.cc",
1052 "httpserver_unittest.cc",
1053 "ipaddress_unittest.cc",
1054 "memory_usage_unittest.cc",
1055 "messagedigest_unittest.cc",
1056 "messagequeue_unittest.cc",
1057 "nat_unittest.cc",
1058 "network_unittest.cc",
1059 "optionsfile_unittest.cc",
1060 "proxy_unittest.cc",
1061 "ptr_util_unittest.cc",
1062 "ratelimiter_unittest.cc",
1063 "rollingaccumulator_unittest.cc",
1064 "rtccertificate_unittest.cc",
1065 "rtccertificategenerator_unittest.cc",
1066 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 23:56:051067 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 06:03:041068 "sigslot_unittest.cc",
1069 "sigslottester_unittest.cc",
1070 "stream_unittest.cc",
1071 "testclient_unittest.cc",
1072 "thread_unittest.cc",
1073 ]
1074 if (is_win) {
1075 sources += [
1076 "win32_unittest.cc",
1077 "win32window_unittest.cc",
1078 ]
1079 }
Henrik Kjellanderc0362762017-06-29 06:03:041080 if (is_posix) {
1081 sources += [
Diogo Real1dca9d52017-08-29 19:18:321082 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 06:03:041083 "ssladapter_unittest.cc",
1084 "sslidentity_unittest.cc",
1085 "sslstreamadapter_unittest.cc",
1086 ]
1087 }
1088 deps = [
1089 ":rtc_base_tests_main",
1090 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 15:43:131091 "../api:optional",
Henrik Kjellanderc0362762017-06-29 06:03:041092 "../test:test_support",
1093 ]
1094 public_deps = [
1095 ":rtc_base",
1096 ]
1097 configs += [ ":rtc_base_unittests_config" ]
1098 if (!build_with_chromium && is_clang) {
1099 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1100 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1101 }
Diogo Real1dca9d52017-08-29 19:18:321102 if (build_with_chromium) {
1103 include_dirs = [ "../../boringssl/src/include" ]
1104 }
1105 if (rtc_build_ssl) {
1106 deps += [ "//third_party/boringssl" ]
1107 } else {
1108 configs += [ ":external_ssl_library" ]
1109 }
Henrik Kjellanderc0362762017-06-29 06:03:041110 }
1111}
1112
Henrik Kjellander73e21802017-06-20 06:38:581113if (is_android) {
1114 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 06:03:041115 java_files = [
1116 "java/src/org/webrtc/ContextUtils.java",
1117 "java/src/org/webrtc/Logging.java",
1118 "java/src/org/webrtc/Size.java",
1119 "java/src/org/webrtc/ThreadUtils.java",
1120 ]
charujain474acce2017-08-25 13:21:521121
1122 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1123 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 06:38:581124 }
1125}