blob: 17d766f769c64cddec860a36829e8fc9e98afed7 [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",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200132 "event_tracer.cc",
133 "event_tracer.h",
134 "file.cc",
135 "file.h",
136 "flags.cc",
137 "flags.h",
138 "format_macros.h",
139 "function_view.h",
140 "ignore_wundef.h",
141 "location.cc",
142 "location.h",
Karl Wiberg65c39222017-11-22 12:25:14 +0100143 "numerics/histogram_percentile_counter.cc",
144 "numerics/histogram_percentile_counter.h",
145 "numerics/mod_ops.h",
146 "numerics/moving_max_counter.h",
Karl Wiberge40468b2017-11-22 10:42:26 +0100147 "numerics/safe_compare.h",
148 "numerics/safe_conversions.h",
149 "numerics/safe_conversions_impl.h",
150 "numerics/safe_minmax.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200151 "onetimeevent.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200152 "pathutils.cc",
153 "pathutils.h",
154 "platform_file.cc",
155 "platform_file.h",
156 "platform_thread.cc",
157 "platform_thread.h",
158 "platform_thread_types.h",
159 "ptr_util.h",
160 "race_checker.cc",
161 "race_checker.h",
162 "random.cc",
163 "random.h",
164 "rate_limiter.cc",
165 "rate_limiter.h",
166 "rate_statistics.cc",
167 "rate_statistics.h",
168 "ratetracker.cc",
169 "ratetracker.h",
170 "refcount.h",
171 "refcountedobject.h",
Niels Möller9155e492017-10-23 11:22:30 +0200172 "refcounter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200173 "sanitizer.h",
174 "scoped_ref_ptr.h",
175 "string_to_number.cc",
176 "string_to_number.h",
177 "stringencode.cc",
178 "stringencode.h",
179 "stringize_macros.h",
180 "stringutils.cc",
181 "stringutils.h",
182 "swap_queue.h",
183 "template_util.h",
184 "thread_annotations.h",
185 "thread_checker.h",
186 "thread_checker_impl.cc",
187 "thread_checker_impl.h",
188 "timestampaligner.cc",
189 "timestampaligner.h",
190 "timeutils.cc",
191 "timeutils.h",
192 "trace_event.h",
193 "type_traits.h",
194 ]
195
196 deps += [ "..:webrtc_common" ]
197
198 if (is_android) {
199 libs += [ "log" ]
200 }
201
202 if (is_posix) {
203 sources += [ "file_posix.cc" ]
204 }
205
206 if (is_win) {
207 sources += [ "file_win.cc" ]
208 }
209
210 if (build_with_chromium) {
211 # Dependency on chromium's logging (in //base).
212 deps += [ "//base:base" ]
213 sources += [
Tommi06483ca2017-11-26 18:22:52 +0100214 "../../webrtc_overrides/rtc_base/event.cc",
215 "../../webrtc_overrides/rtc_base/event.h",
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 += [
Tommi06483ca2017-11-26 18:22:52 +0100221 "event.cc",
222 "event.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200223 "logging.cc",
224 "logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200225 ]
226 }
227 if (is_component_build && is_win) {
228 # Copy the VS runtime DLLs into the isolate so that they don't have to be
229 # preinstalled on the target machine. The debug runtimes have a "d" at
230 # the end.
231 # This is a copy of https://codereview.chromium.org/1783973002.
232 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
233 # so we don't have to copy their changes and risk breakages.
234 # See http://crbug.com/653569
235 if (is_debug) {
236 vcrt_suffix = "d"
237 } else {
238 vcrt_suffix = ""
239 }
240
241 # These runtime files are copied to the output directory by the
242 # vs_toolchain script that runs as part of toolchain configuration.
243 data = [
244 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
245 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
246 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
247
248 # Universal Windows 10 CRT files
249 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
250 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
251 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
255 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
256 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
261 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
266 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
271 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
279 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
280 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
281 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
282 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
283 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
284 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
285 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
286 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
287 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
288 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
289 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
290 ]
291 if (is_asan) {
292 if (current_cpu == "x64") {
293 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
294 } else {
295 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
296 }
297 }
298 }
299 if (is_nacl) {
300 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
301 }
302}
303
mbonadeibc378472017-09-11 03:43:34 -0700304if (is_mac && !build_with_chromium) {
305 config("rtc_base_approved_objc_all_dependent_config") {
306 visibility = [ ":rtc_base_approved_objc" ]
307 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
308 }
309
310 rtc_source_set("rtc_base_approved_objc") {
311 visibility = [ ":rtc_base_approved" ]
312 all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
313 sources = [
314 "logging_mac.mm",
315 ]
316 deps = [
317 ":rtc_base_approved_generic",
318 ]
319 }
320}
321
perkj650fdae2017-08-25 05:00:11 -0700322rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700323 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200324 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700325 ]
326 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700327 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200328 ]
329
perkj650fdae2017-08-25 05:00:11 -0700330 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700331 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700332 }
333}
334
335# WebRTC targets must not directly depend on rtc_task_queue_api or
336# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
337# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
338# to the default implemenation in rtc_task_queue_impl or if an externally
339# provided implementation should be used. An external implementation should
340# depend on rtc_task_queue_api.
341rtc_source_set("rtc_task_queue_api") {
nisse75dd6d42017-09-19 08:28:00 -0700342 sources = [
343 "task_queue.h",
344 ]
perkj650fdae2017-08-25 05:00:11 -0700345 deps = [
346 ":rtc_base_approved",
347 ]
348}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200349
perkj650fdae2017-08-25 05:00:11 -0700350rtc_source_set("rtc_task_queue_impl") {
351 deps = [
352 ":rtc_base_approved",
353 ":rtc_task_queue_api",
354 ]
Niels Möller15c9cf72017-10-19 12:38:09 +0200355 if (rtc_build_libevent) {
356 deps += [ "//base/third_party/libevent" ]
357 }
358 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700359 sources = [
Niels Möller15c9cf72017-10-19 12:38:09 +0200360 "task_queue_libevent.cc",
361 "task_queue_posix.cc",
362 "task_queue_posix.h",
perkj650fdae2017-08-25 05:00:11 -0700363 ]
364 } else {
Niels Möller15c9cf72017-10-19 12:38:09 +0200365 if (is_mac || is_ios) {
Niels Möller17a04742017-09-27 10:53:21 +0200366 sources = [
Niels Möller15c9cf72017-10-19 12:38:09 +0200367 "task_queue_gcd.cc",
Henrik Boströma9a27712017-10-03 08:01:07 +0000368 "task_queue_posix.cc",
369 "task_queue_posix.h",
Niels Möller17a04742017-09-27 10:53:21 +0200370 ]
Niels Möller15c9cf72017-10-19 12:38:09 +0200371 }
372 if (is_win) {
373 sources = [
374 "task_queue_win.cc",
375 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200376 }
377 }
378}
379
380rtc_static_library("sequenced_task_checker") {
381 sources = [
382 "sequenced_task_checker.h",
383 "sequenced_task_checker_impl.cc",
384 "sequenced_task_checker_impl.h",
385 ]
386 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700387 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200388 ":rtc_task_queue",
389 ]
390}
391
392rtc_static_library("weak_ptr") {
393 sources = [
394 "weak_ptr.cc",
395 "weak_ptr.h",
396 ]
397 deps = [
398 ":rtc_base_approved",
399 ":sequenced_task_checker",
400 ]
401}
402
403rtc_static_library("rtc_numerics") {
404 sources = [
405 "numerics/exp_filter.cc",
406 "numerics/exp_filter.h",
Ilya Nikolaevskiyb9685752017-11-01 14:01:00 +0100407 "numerics/moving_median_filter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200408 "numerics/percentile_filter.h",
Bjorn Tereliusa194e582017-10-25 13:07:09 +0200409 "numerics/sequence_number_util.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200410 ]
411 deps = [
412 ":rtc_base_approved",
Bjorn Tereliusa194e582017-10-25 13:07:09 +0200413 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200414 ]
415}
416
417config("rtc_base_warnings_config") {
418 if (is_win && is_clang) {
419 cflags = [
420 # Disable warnings failing when compiling with Clang on Windows.
421 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
422 "-Wno-sign-compare",
423 "-Wno-missing-braces",
424 ]
425 }
426}
427
428rtc_source_set("rtc_json") {
429 defines = []
430 sources = [
431 "json.cc",
432 "json.h",
433 ]
434 if (rtc_build_json) {
435 public_deps = [
436 "//third_party/jsoncpp",
437 ]
438 } else {
439 include_dirs = [ "$rtc_jsoncpp_root" ]
440
441 # When defined changes the include path for json.h to where it is
442 # expected to be when building json outside of the standalone build.
443 defines += [ "WEBRTC_EXTERNAL_JSON" ]
444 }
445}
446
mbonadei9c5e5112017-09-05 05:17:02 -0700447rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700448 public_deps = [
449 ":rtc_base_generic",
450 ]
451 if (is_win) {
452 sources = [
453 "noop.cc",
454 ]
455 }
456 if (is_ios || is_mac) {
457 sources = [
458 "noop.mm",
459 ]
460 public_deps += [ ":rtc_base_objc" ]
461 }
462}
463
464if (is_ios || is_mac) {
465 rtc_source_set("rtc_base_objc") {
466 sources = [
467 "thread_darwin.mm",
468 ]
469 deps = [
470 ":rtc_base_generic",
471 ]
472 visibility = [ ":rtc_base" ]
473 }
474}
475
476rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200477 cflags = []
478 cflags_cc = []
479 libs = []
480 defines = []
481 deps = [
482 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700483 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200484 ]
485 public_deps = [
486 ":rtc_base_approved",
487 ]
488 public_configs = []
489
490 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
491
492 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200493 "asyncinvoker-inl.h",
494 "asyncinvoker.cc",
495 "asyncinvoker.h",
496 "asyncpacketsocket.cc",
497 "asyncpacketsocket.h",
498 "asyncresolverinterface.cc",
499 "asyncresolverinterface.h",
500 "asyncsocket.cc",
501 "asyncsocket.h",
502 "asynctcpsocket.cc",
503 "asynctcpsocket.h",
504 "asyncudpsocket.cc",
505 "asyncudpsocket.h",
506 "crc32.cc",
507 "crc32.h",
508 "cryptstring.cc",
509 "cryptstring.h",
510 "filerotatingstream.cc",
511 "filerotatingstream.h",
512 "fileutils.cc",
513 "fileutils.h",
514 "gunit_prod.h",
515 "helpers.cc",
516 "helpers.h",
517 "httpbase.cc",
518 "httpbase.h",
519 "httpcommon-inl.h",
520 "httpcommon.cc",
521 "httpcommon.h",
522 "ipaddress.cc",
523 "ipaddress.h",
524 "messagedigest.cc",
525 "messagedigest.h",
526 "messagehandler.cc",
527 "messagehandler.h",
528 "messagequeue.cc",
529 "messagequeue.h",
Zhi Huang942bc2e2017-11-13 13:26:07 -0800530 "nethelper.cc",
531 "nethelper.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200532 "nethelpers.cc",
533 "nethelpers.h",
534 "network.cc",
535 "network.h",
Patrik Höglunde2d6a062017-10-05 14:53:33 +0200536 "network_constants.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200537 "networkmonitor.cc",
538 "networkmonitor.h",
539 "nullsocketserver.cc",
540 "nullsocketserver.h",
541 "openssl.h",
542 "openssladapter.cc",
543 "openssladapter.h",
544 "openssldigest.cc",
545 "openssldigest.h",
546 "opensslidentity.cc",
547 "opensslidentity.h",
548 "opensslstreamadapter.cc",
549 "opensslstreamadapter.h",
550 "physicalsocketserver.cc",
551 "physicalsocketserver.h",
552 "proxyinfo.cc",
553 "proxyinfo.h",
554 "ratelimiter.cc",
555 "ratelimiter.h",
556 "rtccertificate.cc",
557 "rtccertificate.h",
558 "rtccertificategenerator.cc",
559 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700560 "signalthread.cc",
561 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200562 "sigslot.cc",
563 "sigslot.h",
Taylor Brandstettere68b6c92017-10-05 09:13:55 -0700564 "sigslotrepeater.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200565 "socket.h",
566 "socketadapters.cc",
567 "socketadapters.h",
568 "socketaddress.cc",
569 "socketaddress.h",
570 "socketaddresspair.cc",
571 "socketaddresspair.h",
572 "socketfactory.h",
573 "socketserver.h",
574 "socketstream.cc",
575 "socketstream.h",
576 "ssladapter.cc",
577 "ssladapter.h",
578 "sslfingerprint.cc",
579 "sslfingerprint.h",
580 "sslidentity.cc",
581 "sslidentity.h",
582 "sslstreamadapter.cc",
583 "sslstreamadapter.h",
584 "stream.cc",
585 "stream.h",
586 "thread.cc",
587 "thread.h",
588 ]
589
mbonadei310e32b2017-09-07 07:36:28 -0700590 visibility = [
591 ":rtc_base",
592 ":rtc_base_objc",
593 ]
594
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200595 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
596 # compiler settings.
597 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
598 configs += [ "//build/config/compiler:no_chromium_code" ]
599 if (!is_win) {
600 cflags += [ "-Wno-uninitialized" ]
601 }
602
603 if (build_with_chromium) {
604 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200605 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200606 }
607 include_dirs = [ "../../boringssl/src/include" ]
608 public_configs += [ ":rtc_base_chromium_config" ]
609 } else {
610 configs += [ ":rtc_base_warnings_config" ]
611 sources += [
612 "callback.h",
613 "logsinks.cc",
614 "logsinks.h",
Karl Wiberg65c39222017-11-22 12:25:14 +0100615 "numerics/mathutils.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200616 "optionsfile.cc",
617 "optionsfile.h",
618 "rollingaccumulator.h",
619 "sslroots.h",
620 "transformadapter.cc",
621 "transformadapter.h",
622 "window.h",
623 ]
624
625 if (is_win) {
626 sources += [
627 "win32socketinit.cc",
628 "win32socketinit.h",
629 "win32socketserver.cc",
630 "win32socketserver.h",
631 ]
632 }
633 } # !build_with_chromium
634
635 if (rtc_build_ssl) {
636 deps += [ "//third_party/boringssl" ]
637 } else {
638 configs += [ ":external_ssl_library" ]
639 }
640
641 if (is_android) {
642 sources += [
643 "ifaddrs-android.cc",
644 "ifaddrs-android.h",
645 ]
646
647 libs += [
648 "log",
649 "GLESv2",
650 ]
651 }
652
653 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700654 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200655 }
656
657 if (use_x11) {
658 libs += [
659 "dl",
660 "rt",
661 "Xext",
662 "X11",
663 "Xcomposite",
664 "Xrender",
665 ]
666 }
667
668 if (is_linux) {
669 libs += [
670 "dl",
671 "rt",
672 ]
673 }
674
675 if (is_mac) {
676 sources += [
677 "macutils.cc",
678 "macutils.h",
679 ]
680 libs += [
681 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
682 "ApplicationServices.framework",
683 ]
684 }
685
686 if (is_win) {
687 sources += [
688 "win32.cc",
689 "win32.h",
690 "win32filesystem.cc",
691 "win32filesystem.h",
692 "win32securityerrors.cc",
693 "win32window.cc",
694 "win32window.h",
695 ]
696
697 libs += [
698 "crypt32.lib",
699 "iphlpapi.lib",
700 "secur32.lib",
701 ]
702
703 cflags += [
704 # Suppress warnings about WIN32_LEAN_AND_MEAN.
705 "/wd4005",
706 "/wd4703",
707 ]
708
709 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
710 }
711
712 if (is_posix) {
713 sources += [
714 "ifaddrs_converter.cc",
715 "ifaddrs_converter.h",
716 "unixfilesystem.cc",
717 "unixfilesystem.h",
718 ]
719 }
720
721 if (is_nacl) {
722 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
723 defines += [ "timezone=_timezone" ]
724 sources -= [ "ifaddrs_converter.cc" ]
725 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200726}
727
728rtc_source_set("gtest_prod") {
729 sources = [
730 "gtest_prod_util.h",
731 ]
732}
733
734config("rtc_base_tests_utils_exported_config") {
735 defines = [ "GTEST_RELATIVE_PATH" ]
736}
737
738config("rtc_base_tests_utils_warnings_config") {
739 if (is_win && is_clang) {
740 cflags = [
741 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
742 "-Wno-reorder",
743 "-Wno-sign-compare",
744 ]
745 }
746}
747
748rtc_source_set("rtc_base_tests_utils") {
749 testonly = true
750 sources = [
751 # Also use this as a convenient dumping ground for misc files that are
752 # included by multiple targets below.
753 "cpu_time.cc",
754 "cpu_time.h",
755 "fakeclock.cc",
756 "fakeclock.h",
757 "fakenetwork.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700758 "fakesslidentity.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200759 "fakesslidentity.h",
760 "firewallsocketserver.cc",
761 "firewallsocketserver.h",
762 "gunit.h",
763 "httpserver.cc",
764 "httpserver.h",
765 "md5.cc",
766 "md5.h",
767 "md5digest.cc",
768 "md5digest.h",
769 "memory_usage.cc",
770 "memory_usage.h",
771 "natserver.cc",
772 "natserver.h",
773 "natsocketfactory.cc",
774 "natsocketfactory.h",
775 "nattypes.cc",
776 "nattypes.h",
777 "proxyserver.cc",
778 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200779 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200780 "sha1.cc",
781 "sha1.h",
782 "sha1digest.cc",
783 "sha1digest.h",
784 "sigslottester.h",
785 "sigslottester.h.pump",
786 "testbase64.h",
787 "testclient.cc",
788 "testclient.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700789 "testechoserver.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200790 "testechoserver.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700791 "testutils.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200792 "testutils.h",
793 "timedelta.h",
794 "virtualsocketserver.cc",
795 "virtualsocketserver.h",
796 ]
797 configs += [ ":rtc_base_tests_utils_warnings_config" ]
798 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
799 deps = [
800 ":rtc_base",
801 "../test:field_trial",
802 "../test:test_support",
803 ]
804 public_deps = [
805 "//testing/gmock",
806 "//testing/gtest",
807 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200808}
809
810if (rtc_include_tests) {
811 rtc_source_set("rtc_base_tests_main") {
812 testonly = true
813 sources = [
814 "unittest_main.cc",
815 ]
816 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
817 deps = [
818 ":rtc_base",
819 ":rtc_base_approved",
820 ":rtc_base_tests_utils",
821 "../test:field_trial",
822 "../test:test_support",
823 ]
824
825 public_deps = [
826 "//testing/gmock",
827 "//testing/gtest",
828 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200829 }
830
831 rtc_source_set("rtc_base_nonparallel_tests") {
832 testonly = true
833
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200834 sources = [
835 "cpu_time_unittest.cc",
836 "filerotatingstream_unittest.cc",
837 "nullsocketserver_unittest.cc",
838 "physicalsocketserver_unittest.cc",
839 "socket_unittest.cc",
840 "socket_unittest.h",
841 "socketaddress_unittest.cc",
842 ]
843 deps = [
844 ":rtc_base",
845 ":rtc_base_tests_main",
846 ":rtc_base_tests_utils",
847 "../system_wrappers:system_wrappers",
848 "../test:test_support",
849 "//testing/gtest",
850 ]
851 if (is_win) {
852 sources += [ "win32socketserver_unittest.cc" ]
853 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200854 }
855
856 rtc_source_set("rtc_base_approved_unittests") {
857 testonly = true
858
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200859 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200860 "atomicops_unittest.cc",
861 "base64_unittest.cc",
862 "basictypes_unittest.cc",
863 "bind_unittest.cc",
864 "bitbuffer_unittest.cc",
Alex Narestd0e196b2017-11-22 17:22:35 +0100865 "bitrateallocationstrategy_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200866 "buffer_unittest.cc",
867 "bufferqueue_unittest.cc",
868 "bytebuffer_unittest.cc",
869 "byteorder_unittest.cc",
870 "copyonwritebuffer_unittest.cc",
871 "criticalsection_unittest.cc",
872 "event_tracer_unittest.cc",
873 "event_unittest.cc",
874 "file_unittest.cc",
875 "function_view_unittest.cc",
876 "logging_unittest.cc",
877 "md5digest_unittest.cc",
Karl Wiberg65c39222017-11-22 12:25:14 +0100878 "numerics/histogram_percentile_counter_unittest.cc",
879 "numerics/mod_ops_unittest.cc",
880 "numerics/moving_max_counter_unittest.cc",
Karl Wiberge40468b2017-11-22 10:42:26 +0100881 "numerics/safe_compare_unittest.cc",
882 "numerics/safe_minmax_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200883 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200884 "pathutils_unittest.cc",
885 "platform_thread_unittest.cc",
886 "random_unittest.cc",
887 "rate_limiter_unittest.cc",
888 "rate_statistics_unittest.cc",
889 "ratetracker_unittest.cc",
890 "refcountedobject_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200891 "string_to_number_unittest.cc",
892 "stringencode_unittest.cc",
893 "stringize_macros_unittest.cc",
894 "stringutils_unittest.cc",
895 "swap_queue_unittest.cc",
896 "thread_annotations_unittest.cc",
897 "thread_checker_unittest.cc",
898 "timestampaligner_unittest.cc",
899 "timeutils_unittest.cc",
900 "virtualsocket_unittest.cc",
901 ]
902 deps = [
903 ":rtc_base",
904 ":rtc_base_approved",
905 ":rtc_base_tests_main",
906 ":rtc_base_tests_utils",
907 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700908 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200909 "../system_wrappers:system_wrappers",
910 "../test:test_support",
911 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200912 }
913
914 rtc_source_set("rtc_task_queue_unittests") {
915 testonly = true
916
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200917 sources = [
918 "task_queue_unittest.cc",
919 ]
920 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700921 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200922 ":rtc_base_tests_main",
923 ":rtc_base_tests_utils",
924 ":rtc_task_queue",
925 "../test:test_support",
926 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200927 }
928
929 rtc_source_set("sequenced_task_checker_unittests") {
930 testonly = true
931
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200932 sources = [
933 "sequenced_task_checker_unittest.cc",
934 ]
935 deps = [
936 ":rtc_base_approved",
937 ":rtc_base_tests_main",
938 ":rtc_task_queue",
939 ":sequenced_task_checker",
940 "../test:test_support",
941 ]
942 }
943
944 rtc_source_set("weak_ptr_unittests") {
945 testonly = true
946
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200947 sources = [
948 "weak_ptr_unittest.cc",
949 ]
950 deps = [
951 ":rtc_base_tests_main",
952 ":rtc_base_tests_utils",
953 ":rtc_task_queue",
954 ":weak_ptr",
955 "../test:test_support",
956 ]
957 }
958
959 rtc_source_set("rtc_numerics_unittests") {
960 testonly = true
961
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200962 sources = [
963 "numerics/exp_filter_unittest.cc",
Ilya Nikolaevskiyb9685752017-11-01 14:01:00 +0100964 "numerics/moving_median_filter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200965 "numerics/percentile_filter_unittest.cc",
Bjorn Tereliusa194e582017-10-25 13:07:09 +0200966 "numerics/sequence_number_util_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200967 ]
968 deps = [
969 ":rtc_base_approved",
970 ":rtc_base_tests_main",
971 ":rtc_numerics",
972 "../test:test_support",
973 ]
974 }
975
976 config("rtc_base_unittests_config") {
977 if (is_clang) {
978 cflags = [ "-Wno-unused-const-variable" ]
979 }
980 }
981 rtc_source_set("rtc_base_unittests") {
982 testonly = true
983
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200984 sources = [
985 "callback_unittest.cc",
986 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200987 "helpers_unittest.cc",
988 "httpbase_unittest.cc",
989 "httpcommon_unittest.cc",
990 "httpserver_unittest.cc",
991 "ipaddress_unittest.cc",
992 "memory_usage_unittest.cc",
993 "messagedigest_unittest.cc",
994 "messagequeue_unittest.cc",
995 "nat_unittest.cc",
996 "network_unittest.cc",
997 "optionsfile_unittest.cc",
998 "proxy_unittest.cc",
999 "ptr_util_unittest.cc",
1000 "ratelimiter_unittest.cc",
1001 "rollingaccumulator_unittest.cc",
1002 "rtccertificate_unittest.cc",
1003 "rtccertificategenerator_unittest.cc",
1004 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001005 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001006 "sigslot_unittest.cc",
1007 "sigslottester_unittest.cc",
1008 "stream_unittest.cc",
1009 "testclient_unittest.cc",
1010 "thread_unittest.cc",
1011 ]
1012 if (is_win) {
1013 sources += [
1014 "win32_unittest.cc",
1015 "win32window_unittest.cc",
1016 ]
1017 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001018 if (is_posix) {
1019 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001020 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001021 "ssladapter_unittest.cc",
1022 "sslidentity_unittest.cc",
1023 "sslstreamadapter_unittest.cc",
1024 ]
1025 }
1026 deps = [
1027 ":rtc_base_tests_main",
1028 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001029 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001030 "../test:test_support",
1031 ]
1032 public_deps = [
1033 ":rtc_base",
1034 ]
1035 configs += [ ":rtc_base_unittests_config" ]
Diogo Real1dca9d52017-08-29 12:18:32 -07001036 if (build_with_chromium) {
1037 include_dirs = [ "../../boringssl/src/include" ]
1038 }
1039 if (rtc_build_ssl) {
1040 deps += [ "//third_party/boringssl" ]
1041 } else {
1042 configs += [ ":external_ssl_library" ]
1043 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001044 }
1045}
1046
Henrik Kjellander73e21802017-06-20 08:38:58 +02001047if (is_android) {
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001048 rtc_android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001049 java_files = [
1050 "java/src/org/webrtc/ContextUtils.java",
1051 "java/src/org/webrtc/Logging.java",
1052 "java/src/org/webrtc/Size.java",
1053 "java/src/org/webrtc/ThreadUtils.java",
1054 ]
Henrik Kjellander73e21802017-06-20 08:38:58 +02001055 }
1056}