blob: 1441acf54bb0f549b064fa7d0c1cb6e61517e593 [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",
Tommi897e1362017-12-01 18:56:43 +010097 ":weak_ptr_unittests",
mbonadeibc378472017-09-11 03:43:34 -070098 ]
99
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200100 # TODO(kjellander): Remove (bugs.webrtc.org/7480)
101 # Enabling GN check triggers a cyclic dependency caused by rate_limiter.cc:
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800102 # :rtc_base_approved -> ../system_wrappers -> :rtc_base_approved
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200103 check_includes = false
104 defines = []
105 libs = []
106 deps = []
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200107
108 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200109 "arraysize.h",
110 "atomicops.h",
111 "base64.cc",
112 "base64.h",
113 "basictypes.h",
114 "bind.h",
115 "bitbuffer.cc",
116 "bitbuffer.h",
Alex Narest78609d52017-10-20 10:37:47 +0200117 "bitrateallocationstrategy.cc",
118 "bitrateallocationstrategy.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200119 "buffer.h",
120 "bufferqueue.cc",
121 "bufferqueue.h",
122 "bytebuffer.cc",
123 "bytebuffer.h",
124 "byteorder.h",
125 "checks.cc",
126 "checks.h",
127 "constructormagic.h",
128 "copyonwritebuffer.cc",
129 "copyonwritebuffer.h",
130 "criticalsection.cc",
131 "criticalsection.h",
132 "deprecation.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200133 "event_tracer.cc",
134 "event_tracer.h",
135 "file.cc",
136 "file.h",
137 "flags.cc",
138 "flags.h",
139 "format_macros.h",
140 "function_view.h",
141 "ignore_wundef.h",
142 "location.cc",
143 "location.h",
Karl Wiberg65c39222017-11-22 12:25:14 +0100144 "numerics/histogram_percentile_counter.cc",
145 "numerics/histogram_percentile_counter.h",
146 "numerics/mod_ops.h",
147 "numerics/moving_max_counter.h",
Karl Wiberge40468b2017-11-22 10:42:26 +0100148 "numerics/safe_compare.h",
149 "numerics/safe_conversions.h",
150 "numerics/safe_conversions_impl.h",
151 "numerics/safe_minmax.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200152 "onetimeevent.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200153 "pathutils.cc",
154 "pathutils.h",
155 "platform_file.cc",
156 "platform_file.h",
157 "platform_thread.cc",
158 "platform_thread.h",
159 "platform_thread_types.h",
160 "ptr_util.h",
161 "race_checker.cc",
162 "race_checker.h",
163 "random.cc",
164 "random.h",
165 "rate_limiter.cc",
166 "rate_limiter.h",
167 "rate_statistics.cc",
168 "rate_statistics.h",
169 "ratetracker.cc",
170 "ratetracker.h",
171 "refcount.h",
172 "refcountedobject.h",
Niels Möller9155e492017-10-23 11:22:30 +0200173 "refcounter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200174 "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 += [
Tommi06483ca2017-11-26 18:22:52 +0100215 "../../webrtc_overrides/rtc_base/event.cc",
216 "../../webrtc_overrides/rtc_base/event.h",
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200217 "../../webrtc_overrides/rtc_base/logging.cc",
218 "../../webrtc_overrides/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200219 ]
220 } else {
221 sources += [
Tommi06483ca2017-11-26 18:22:52 +0100222 "event.cc",
223 "event.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200224 "logging.cc",
225 "logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200226 ]
227 }
228 if (is_component_build && is_win) {
229 # Copy the VS runtime DLLs into the isolate so that they don't have to be
230 # preinstalled on the target machine. The debug runtimes have a "d" at
231 # the end.
232 # This is a copy of https://codereview.chromium.org/1783973002.
233 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
234 # so we don't have to copy their changes and risk breakages.
235 # See http://crbug.com/653569
236 if (is_debug) {
237 vcrt_suffix = "d"
238 } else {
239 vcrt_suffix = ""
240 }
241
242 # These runtime files are copied to the output directory by the
243 # vs_toolchain script that runs as part of toolchain configuration.
244 data = [
245 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
246 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
247 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
248
249 # Universal Windows 10 CRT files
250 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
251 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
256 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
257 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
261 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
262 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
266 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
267 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
272 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
279 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
280 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
281 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
282 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
283 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
284 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
285 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
286 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
287 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
288 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
289 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
290 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
291 ]
292 if (is_asan) {
293 if (current_cpu == "x64") {
294 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
295 } else {
296 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
297 }
298 }
299 }
300 if (is_nacl) {
301 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
302 }
303}
304
mbonadeibc378472017-09-11 03:43:34 -0700305if (is_mac && !build_with_chromium) {
306 config("rtc_base_approved_objc_all_dependent_config") {
307 visibility = [ ":rtc_base_approved_objc" ]
308 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
309 }
310
311 rtc_source_set("rtc_base_approved_objc") {
312 visibility = [ ":rtc_base_approved" ]
313 all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
314 sources = [
315 "logging_mac.mm",
316 ]
317 deps = [
318 ":rtc_base_approved_generic",
319 ]
320 }
321}
322
perkj650fdae2017-08-25 05:00:11 -0700323rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700324 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200325 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700326 ]
327 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700328 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200329 ]
330
perkj650fdae2017-08-25 05:00:11 -0700331 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700332 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700333 }
334}
335
336# WebRTC targets must not directly depend on rtc_task_queue_api or
337# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
338# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
339# to the default implemenation in rtc_task_queue_impl or if an externally
340# provided implementation should be used. An external implementation should
341# depend on rtc_task_queue_api.
342rtc_source_set("rtc_task_queue_api") {
nisse75dd6d42017-09-19 08:28:00 -0700343 sources = [
344 "task_queue.h",
345 ]
perkj650fdae2017-08-25 05:00:11 -0700346 deps = [
347 ":rtc_base_approved",
348 ]
349}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200350
perkj650fdae2017-08-25 05:00:11 -0700351rtc_source_set("rtc_task_queue_impl") {
352 deps = [
353 ":rtc_base_approved",
354 ":rtc_task_queue_api",
355 ]
Niels Möller15c9cf72017-10-19 12:38:09 +0200356 if (rtc_build_libevent) {
357 deps += [ "//base/third_party/libevent" ]
358 }
359 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700360 sources = [
Niels Möller15c9cf72017-10-19 12:38:09 +0200361 "task_queue_libevent.cc",
362 "task_queue_posix.cc",
363 "task_queue_posix.h",
perkj650fdae2017-08-25 05:00:11 -0700364 ]
365 } else {
Niels Möller15c9cf72017-10-19 12:38:09 +0200366 if (is_mac || is_ios) {
Niels Möller17a04742017-09-27 10:53:21 +0200367 sources = [
Niels Möller15c9cf72017-10-19 12:38:09 +0200368 "task_queue_gcd.cc",
Henrik Boströma9a27712017-10-03 08:01:07 +0000369 "task_queue_posix.cc",
370 "task_queue_posix.h",
Niels Möller17a04742017-09-27 10:53:21 +0200371 ]
Niels Möller15c9cf72017-10-19 12:38:09 +0200372 }
373 if (is_win) {
374 sources = [
375 "task_queue_win.cc",
376 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200377 }
378 }
379}
380
381rtc_static_library("sequenced_task_checker") {
382 sources = [
383 "sequenced_task_checker.h",
384 "sequenced_task_checker_impl.cc",
385 "sequenced_task_checker_impl.h",
386 ]
387 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700388 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200389 ":rtc_task_queue",
390 ]
391}
392
393rtc_static_library("weak_ptr") {
394 sources = [
395 "weak_ptr.cc",
396 "weak_ptr.h",
397 ]
398 deps = [
399 ":rtc_base_approved",
400 ":sequenced_task_checker",
401 ]
402}
403
404rtc_static_library("rtc_numerics") {
405 sources = [
406 "numerics/exp_filter.cc",
407 "numerics/exp_filter.h",
Ilya Nikolaevskiyb9685752017-11-01 14:01:00 +0100408 "numerics/moving_median_filter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200409 "numerics/percentile_filter.h",
Bjorn Tereliusa194e582017-10-25 13:07:09 +0200410 "numerics/sequence_number_util.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200411 ]
412 deps = [
413 ":rtc_base_approved",
Bjorn Tereliusa194e582017-10-25 13:07:09 +0200414 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200415 ]
416}
417
418config("rtc_base_warnings_config") {
419 if (is_win && is_clang) {
420 cflags = [
421 # Disable warnings failing when compiling with Clang on Windows.
422 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
423 "-Wno-sign-compare",
424 "-Wno-missing-braces",
425 ]
426 }
427}
428
429rtc_source_set("rtc_json") {
430 defines = []
431 sources = [
432 "json.cc",
433 "json.h",
434 ]
435 if (rtc_build_json) {
436 public_deps = [
437 "//third_party/jsoncpp",
438 ]
439 } else {
440 include_dirs = [ "$rtc_jsoncpp_root" ]
441
442 # When defined changes the include path for json.h to where it is
443 # expected to be when building json outside of the standalone build.
444 defines += [ "WEBRTC_EXTERNAL_JSON" ]
445 }
446}
447
mbonadei9c5e5112017-09-05 05:17:02 -0700448rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700449 public_deps = [
450 ":rtc_base_generic",
451 ]
452 if (is_win) {
453 sources = [
454 "noop.cc",
455 ]
456 }
457 if (is_ios || is_mac) {
458 sources = [
459 "noop.mm",
460 ]
461 public_deps += [ ":rtc_base_objc" ]
462 }
463}
464
465if (is_ios || is_mac) {
466 rtc_source_set("rtc_base_objc") {
467 sources = [
468 "thread_darwin.mm",
469 ]
470 deps = [
471 ":rtc_base_generic",
472 ]
473 visibility = [ ":rtc_base" ]
474 }
475}
476
477rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200478 cflags = []
479 cflags_cc = []
480 libs = []
481 defines = []
482 deps = [
483 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700484 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200485 ]
486 public_deps = [
487 ":rtc_base_approved",
488 ]
489 public_configs = []
490
491 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
492
493 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200494 "asyncinvoker-inl.h",
495 "asyncinvoker.cc",
496 "asyncinvoker.h",
497 "asyncpacketsocket.cc",
498 "asyncpacketsocket.h",
499 "asyncresolverinterface.cc",
500 "asyncresolverinterface.h",
501 "asyncsocket.cc",
502 "asyncsocket.h",
503 "asynctcpsocket.cc",
504 "asynctcpsocket.h",
505 "asyncudpsocket.cc",
506 "asyncudpsocket.h",
507 "crc32.cc",
508 "crc32.h",
509 "cryptstring.cc",
510 "cryptstring.h",
511 "filerotatingstream.cc",
512 "filerotatingstream.h",
513 "fileutils.cc",
514 "fileutils.h",
515 "gunit_prod.h",
516 "helpers.cc",
517 "helpers.h",
518 "httpbase.cc",
519 "httpbase.h",
520 "httpcommon-inl.h",
521 "httpcommon.cc",
522 "httpcommon.h",
523 "ipaddress.cc",
524 "ipaddress.h",
525 "messagedigest.cc",
526 "messagedigest.h",
527 "messagehandler.cc",
528 "messagehandler.h",
529 "messagequeue.cc",
530 "messagequeue.h",
Zhi Huang942bc2e2017-11-13 13:26:07 -0800531 "nethelper.cc",
532 "nethelper.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200533 "nethelpers.cc",
534 "nethelpers.h",
535 "network.cc",
536 "network.h",
Patrik Höglunde2d6a062017-10-05 14:53:33 +0200537 "network_constants.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200538 "networkmonitor.cc",
539 "networkmonitor.h",
540 "nullsocketserver.cc",
541 "nullsocketserver.h",
542 "openssl.h",
543 "openssladapter.cc",
544 "openssladapter.h",
545 "openssldigest.cc",
546 "openssldigest.h",
547 "opensslidentity.cc",
548 "opensslidentity.h",
549 "opensslstreamadapter.cc",
550 "opensslstreamadapter.h",
551 "physicalsocketserver.cc",
552 "physicalsocketserver.h",
553 "proxyinfo.cc",
554 "proxyinfo.h",
555 "ratelimiter.cc",
556 "ratelimiter.h",
557 "rtccertificate.cc",
558 "rtccertificate.h",
559 "rtccertificategenerator.cc",
560 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700561 "signalthread.cc",
562 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200563 "sigslot.cc",
564 "sigslot.h",
Taylor Brandstettere68b6c92017-10-05 09:13:55 -0700565 "sigslotrepeater.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200566 "socket.h",
567 "socketadapters.cc",
568 "socketadapters.h",
569 "socketaddress.cc",
570 "socketaddress.h",
571 "socketaddresspair.cc",
572 "socketaddresspair.h",
573 "socketfactory.h",
574 "socketserver.h",
575 "socketstream.cc",
576 "socketstream.h",
577 "ssladapter.cc",
578 "ssladapter.h",
579 "sslfingerprint.cc",
580 "sslfingerprint.h",
581 "sslidentity.cc",
582 "sslidentity.h",
583 "sslstreamadapter.cc",
584 "sslstreamadapter.h",
585 "stream.cc",
586 "stream.h",
587 "thread.cc",
588 "thread.h",
589 ]
590
mbonadei310e32b2017-09-07 07:36:28 -0700591 visibility = [
592 ":rtc_base",
593 ":rtc_base_objc",
594 ]
595
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200596 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
597 # compiler settings.
598 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
599 configs += [ "//build/config/compiler:no_chromium_code" ]
600 if (!is_win) {
601 cflags += [ "-Wno-uninitialized" ]
602 }
603
604 if (build_with_chromium) {
605 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200606 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200607 }
608 include_dirs = [ "../../boringssl/src/include" ]
609 public_configs += [ ":rtc_base_chromium_config" ]
610 } else {
611 configs += [ ":rtc_base_warnings_config" ]
612 sources += [
613 "callback.h",
614 "logsinks.cc",
615 "logsinks.h",
Karl Wiberg65c39222017-11-22 12:25:14 +0100616 "numerics/mathutils.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200617 "optionsfile.cc",
618 "optionsfile.h",
619 "rollingaccumulator.h",
620 "sslroots.h",
621 "transformadapter.cc",
622 "transformadapter.h",
623 "window.h",
624 ]
625
626 if (is_win) {
627 sources += [
628 "win32socketinit.cc",
629 "win32socketinit.h",
630 "win32socketserver.cc",
631 "win32socketserver.h",
632 ]
633 }
634 } # !build_with_chromium
635
636 if (rtc_build_ssl) {
637 deps += [ "//third_party/boringssl" ]
638 } else {
639 configs += [ ":external_ssl_library" ]
640 }
641
642 if (is_android) {
643 sources += [
644 "ifaddrs-android.cc",
645 "ifaddrs-android.h",
646 ]
647
648 libs += [
649 "log",
650 "GLESv2",
651 ]
652 }
653
654 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700655 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200656 }
657
658 if (use_x11) {
659 libs += [
660 "dl",
661 "rt",
662 "Xext",
663 "X11",
664 "Xcomposite",
665 "Xrender",
666 ]
667 }
668
669 if (is_linux) {
670 libs += [
671 "dl",
672 "rt",
673 ]
674 }
675
676 if (is_mac) {
677 sources += [
678 "macutils.cc",
679 "macutils.h",
680 ]
681 libs += [
682 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
683 "ApplicationServices.framework",
684 ]
685 }
686
687 if (is_win) {
688 sources += [
689 "win32.cc",
690 "win32.h",
691 "win32filesystem.cc",
692 "win32filesystem.h",
693 "win32securityerrors.cc",
694 "win32window.cc",
695 "win32window.h",
696 ]
697
698 libs += [
699 "crypt32.lib",
700 "iphlpapi.lib",
701 "secur32.lib",
702 ]
703
704 cflags += [
705 # Suppress warnings about WIN32_LEAN_AND_MEAN.
706 "/wd4005",
707 "/wd4703",
708 ]
709
710 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
711 }
712
713 if (is_posix) {
714 sources += [
715 "ifaddrs_converter.cc",
716 "ifaddrs_converter.h",
717 "unixfilesystem.cc",
718 "unixfilesystem.h",
719 ]
720 }
721
722 if (is_nacl) {
723 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
724 defines += [ "timezone=_timezone" ]
725 sources -= [ "ifaddrs_converter.cc" ]
726 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200727}
728
729rtc_source_set("gtest_prod") {
730 sources = [
731 "gtest_prod_util.h",
732 ]
733}
734
735config("rtc_base_tests_utils_exported_config") {
736 defines = [ "GTEST_RELATIVE_PATH" ]
737}
738
739config("rtc_base_tests_utils_warnings_config") {
740 if (is_win && is_clang) {
741 cflags = [
742 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
743 "-Wno-reorder",
744 "-Wno-sign-compare",
745 ]
746 }
747}
748
749rtc_source_set("rtc_base_tests_utils") {
750 testonly = true
751 sources = [
752 # Also use this as a convenient dumping ground for misc files that are
753 # included by multiple targets below.
754 "cpu_time.cc",
755 "cpu_time.h",
756 "fakeclock.cc",
757 "fakeclock.h",
758 "fakenetwork.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700759 "fakesslidentity.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200760 "fakesslidentity.h",
761 "firewallsocketserver.cc",
762 "firewallsocketserver.h",
763 "gunit.h",
764 "httpserver.cc",
765 "httpserver.h",
766 "md5.cc",
767 "md5.h",
768 "md5digest.cc",
769 "md5digest.h",
770 "memory_usage.cc",
771 "memory_usage.h",
772 "natserver.cc",
773 "natserver.h",
774 "natsocketfactory.cc",
775 "natsocketfactory.h",
776 "nattypes.cc",
777 "nattypes.h",
778 "proxyserver.cc",
779 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200780 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200781 "sha1.cc",
782 "sha1.h",
783 "sha1digest.cc",
784 "sha1digest.h",
785 "sigslottester.h",
786 "sigslottester.h.pump",
787 "testbase64.h",
788 "testclient.cc",
789 "testclient.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700790 "testechoserver.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200791 "testechoserver.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700792 "testutils.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200793 "testutils.h",
794 "timedelta.h",
795 "virtualsocketserver.cc",
796 "virtualsocketserver.h",
797 ]
798 configs += [ ":rtc_base_tests_utils_warnings_config" ]
799 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
800 deps = [
801 ":rtc_base",
802 "../test:field_trial",
803 "../test:test_support",
804 ]
805 public_deps = [
806 "//testing/gmock",
807 "//testing/gtest",
808 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200809}
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 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200830 }
831
832 rtc_source_set("rtc_base_nonparallel_tests") {
833 testonly = true
834
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200835 sources = [
836 "cpu_time_unittest.cc",
837 "filerotatingstream_unittest.cc",
838 "nullsocketserver_unittest.cc",
839 "physicalsocketserver_unittest.cc",
840 "socket_unittest.cc",
841 "socket_unittest.h",
842 "socketaddress_unittest.cc",
843 ]
844 deps = [
845 ":rtc_base",
846 ":rtc_base_tests_main",
847 ":rtc_base_tests_utils",
848 "../system_wrappers:system_wrappers",
849 "../test:test_support",
850 "//testing/gtest",
851 ]
852 if (is_win) {
853 sources += [ "win32socketserver_unittest.cc" ]
854 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200855 }
856
857 rtc_source_set("rtc_base_approved_unittests") {
858 testonly = true
859
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200860 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200861 "atomicops_unittest.cc",
862 "base64_unittest.cc",
863 "basictypes_unittest.cc",
864 "bind_unittest.cc",
865 "bitbuffer_unittest.cc",
Alex Narestd0e196b2017-11-22 17:22:35 +0100866 "bitrateallocationstrategy_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200867 "buffer_unittest.cc",
868 "bufferqueue_unittest.cc",
869 "bytebuffer_unittest.cc",
870 "byteorder_unittest.cc",
871 "copyonwritebuffer_unittest.cc",
872 "criticalsection_unittest.cc",
873 "event_tracer_unittest.cc",
874 "event_unittest.cc",
875 "file_unittest.cc",
876 "function_view_unittest.cc",
877 "logging_unittest.cc",
878 "md5digest_unittest.cc",
Karl Wiberg65c39222017-11-22 12:25:14 +0100879 "numerics/histogram_percentile_counter_unittest.cc",
880 "numerics/mod_ops_unittest.cc",
881 "numerics/moving_max_counter_unittest.cc",
Karl Wiberge40468b2017-11-22 10:42:26 +0100882 "numerics/safe_compare_unittest.cc",
883 "numerics/safe_minmax_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200884 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200885 "pathutils_unittest.cc",
886 "platform_thread_unittest.cc",
887 "random_unittest.cc",
888 "rate_limiter_unittest.cc",
889 "rate_statistics_unittest.cc",
890 "ratetracker_unittest.cc",
891 "refcountedobject_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200892 "string_to_number_unittest.cc",
893 "stringencode_unittest.cc",
894 "stringize_macros_unittest.cc",
895 "stringutils_unittest.cc",
896 "swap_queue_unittest.cc",
897 "thread_annotations_unittest.cc",
898 "thread_checker_unittest.cc",
899 "timestampaligner_unittest.cc",
900 "timeutils_unittest.cc",
901 "virtualsocket_unittest.cc",
902 ]
903 deps = [
904 ":rtc_base",
905 ":rtc_base_approved",
906 ":rtc_base_tests_main",
907 ":rtc_base_tests_utils",
908 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700909 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200910 "../system_wrappers:system_wrappers",
911 "../test:test_support",
912 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200913 }
914
915 rtc_source_set("rtc_task_queue_unittests") {
916 testonly = true
917
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200918 sources = [
919 "task_queue_unittest.cc",
920 ]
921 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700922 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200923 ":rtc_base_tests_main",
924 ":rtc_base_tests_utils",
925 ":rtc_task_queue",
926 "../test:test_support",
927 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200928 }
929
930 rtc_source_set("sequenced_task_checker_unittests") {
931 testonly = true
932
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200933 sources = [
934 "sequenced_task_checker_unittest.cc",
935 ]
936 deps = [
937 ":rtc_base_approved",
938 ":rtc_base_tests_main",
939 ":rtc_task_queue",
940 ":sequenced_task_checker",
941 "../test:test_support",
942 ]
943 }
944
945 rtc_source_set("weak_ptr_unittests") {
946 testonly = true
947
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200948 sources = [
949 "weak_ptr_unittest.cc",
950 ]
951 deps = [
Tommi897e1362017-12-01 18:56:43 +0100952 ":rtc_base_approved_generic",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200953 ":rtc_base_tests_main",
954 ":rtc_base_tests_utils",
955 ":rtc_task_queue",
956 ":weak_ptr",
957 "../test:test_support",
958 ]
959 }
960
961 rtc_source_set("rtc_numerics_unittests") {
962 testonly = true
963
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200964 sources = [
965 "numerics/exp_filter_unittest.cc",
Ilya Nikolaevskiyb9685752017-11-01 14:01:00 +0100966 "numerics/moving_median_filter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200967 "numerics/percentile_filter_unittest.cc",
Bjorn Tereliusa194e582017-10-25 13:07:09 +0200968 "numerics/sequence_number_util_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200969 ]
970 deps = [
971 ":rtc_base_approved",
972 ":rtc_base_tests_main",
973 ":rtc_numerics",
974 "../test:test_support",
975 ]
976 }
977
978 config("rtc_base_unittests_config") {
979 if (is_clang) {
980 cflags = [ "-Wno-unused-const-variable" ]
981 }
982 }
983 rtc_source_set("rtc_base_unittests") {
984 testonly = true
985
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200986 sources = [
987 "callback_unittest.cc",
988 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200989 "helpers_unittest.cc",
990 "httpbase_unittest.cc",
991 "httpcommon_unittest.cc",
992 "httpserver_unittest.cc",
993 "ipaddress_unittest.cc",
994 "memory_usage_unittest.cc",
995 "messagedigest_unittest.cc",
996 "messagequeue_unittest.cc",
997 "nat_unittest.cc",
998 "network_unittest.cc",
999 "optionsfile_unittest.cc",
1000 "proxy_unittest.cc",
1001 "ptr_util_unittest.cc",
1002 "ratelimiter_unittest.cc",
1003 "rollingaccumulator_unittest.cc",
1004 "rtccertificate_unittest.cc",
1005 "rtccertificategenerator_unittest.cc",
1006 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001007 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001008 "sigslot_unittest.cc",
1009 "sigslottester_unittest.cc",
1010 "stream_unittest.cc",
1011 "testclient_unittest.cc",
1012 "thread_unittest.cc",
1013 ]
1014 if (is_win) {
1015 sources += [
1016 "win32_unittest.cc",
1017 "win32window_unittest.cc",
1018 ]
1019 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001020 if (is_posix) {
1021 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001022 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001023 "ssladapter_unittest.cc",
1024 "sslidentity_unittest.cc",
1025 "sslstreamadapter_unittest.cc",
1026 ]
1027 }
1028 deps = [
1029 ":rtc_base_tests_main",
1030 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001031 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001032 "../test:test_support",
1033 ]
1034 public_deps = [
1035 ":rtc_base",
1036 ]
1037 configs += [ ":rtc_base_unittests_config" ]
Diogo Real1dca9d52017-08-29 12:18:32 -07001038 if (build_with_chromium) {
1039 include_dirs = [ "../../boringssl/src/include" ]
1040 }
1041 if (rtc_build_ssl) {
1042 deps += [ "//third_party/boringssl" ]
1043 } else {
1044 configs += [ ":external_ssl_library" ]
1045 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001046 }
1047}
1048
Henrik Kjellander73e21802017-06-20 08:38:58 +02001049if (is_android) {
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001050 rtc_android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001051 java_files = [
1052 "java/src/org/webrtc/ContextUtils.java",
1053 "java/src/org/webrtc/Logging.java",
1054 "java/src/org/webrtc/Size.java",
1055 "java/src/org/webrtc/ThreadUtils.java",
1056 ]
Henrik Kjellander73e21802017-06-20 08:38:58 +02001057 }
1058}