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