blob: 775fd14b1cf4868b07c4fe97e3ccc4a60f5b14d8 [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",
Bjorn Tereliusa194e582017-10-25 13:07:09 +0200406 "numerics/sequence_number_util.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200407 ]
408 deps = [
409 ":rtc_base_approved",
Bjorn Tereliusa194e582017-10-25 13:07:09 +0200410 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200411 ]
412}
413
414config("rtc_base_warnings_config") {
415 if (is_win && is_clang) {
416 cflags = [
417 # Disable warnings failing when compiling with Clang on Windows.
418 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
419 "-Wno-sign-compare",
420 "-Wno-missing-braces",
421 ]
422 }
423}
424
425rtc_source_set("rtc_json") {
426 defines = []
427 sources = [
428 "json.cc",
429 "json.h",
430 ]
431 if (rtc_build_json) {
432 public_deps = [
433 "//third_party/jsoncpp",
434 ]
435 } else {
436 include_dirs = [ "$rtc_jsoncpp_root" ]
437
438 # When defined changes the include path for json.h to where it is
439 # expected to be when building json outside of the standalone build.
440 defines += [ "WEBRTC_EXTERNAL_JSON" ]
441 }
442}
443
mbonadei9c5e5112017-09-05 05:17:02 -0700444rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700445 public_deps = [
446 ":rtc_base_generic",
447 ]
448 if (is_win) {
449 sources = [
450 "noop.cc",
451 ]
452 }
453 if (is_ios || is_mac) {
454 sources = [
455 "noop.mm",
456 ]
457 public_deps += [ ":rtc_base_objc" ]
458 }
459}
460
461if (is_ios || is_mac) {
462 rtc_source_set("rtc_base_objc") {
463 sources = [
464 "thread_darwin.mm",
465 ]
466 deps = [
467 ":rtc_base_generic",
468 ]
469 visibility = [ ":rtc_base" ]
470 }
471}
472
473rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200474 cflags = []
475 cflags_cc = []
476 libs = []
477 defines = []
478 deps = [
479 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700480 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200481 ]
482 public_deps = [
483 ":rtc_base_approved",
484 ]
485 public_configs = []
486
487 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
488
489 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200490 "asyncinvoker-inl.h",
491 "asyncinvoker.cc",
492 "asyncinvoker.h",
493 "asyncpacketsocket.cc",
494 "asyncpacketsocket.h",
495 "asyncresolverinterface.cc",
496 "asyncresolverinterface.h",
497 "asyncsocket.cc",
498 "asyncsocket.h",
499 "asynctcpsocket.cc",
500 "asynctcpsocket.h",
501 "asyncudpsocket.cc",
502 "asyncudpsocket.h",
503 "crc32.cc",
504 "crc32.h",
505 "cryptstring.cc",
506 "cryptstring.h",
507 "filerotatingstream.cc",
508 "filerotatingstream.h",
509 "fileutils.cc",
510 "fileutils.h",
511 "gunit_prod.h",
512 "helpers.cc",
513 "helpers.h",
514 "httpbase.cc",
515 "httpbase.h",
516 "httpcommon-inl.h",
517 "httpcommon.cc",
518 "httpcommon.h",
519 "ipaddress.cc",
520 "ipaddress.h",
521 "messagedigest.cc",
522 "messagedigest.h",
523 "messagehandler.cc",
524 "messagehandler.h",
525 "messagequeue.cc",
526 "messagequeue.h",
527 "nethelpers.cc",
528 "nethelpers.h",
529 "network.cc",
530 "network.h",
Patrik Höglunde2d6a062017-10-05 14:53:33 +0200531 "network_constants.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200532 "networkmonitor.cc",
533 "networkmonitor.h",
534 "nullsocketserver.cc",
535 "nullsocketserver.h",
536 "openssl.h",
537 "openssladapter.cc",
538 "openssladapter.h",
539 "openssldigest.cc",
540 "openssldigest.h",
541 "opensslidentity.cc",
542 "opensslidentity.h",
543 "opensslstreamadapter.cc",
544 "opensslstreamadapter.h",
545 "physicalsocketserver.cc",
546 "physicalsocketserver.h",
547 "proxyinfo.cc",
548 "proxyinfo.h",
549 "ratelimiter.cc",
550 "ratelimiter.h",
551 "rtccertificate.cc",
552 "rtccertificate.h",
553 "rtccertificategenerator.cc",
554 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700555 "signalthread.cc",
556 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200557 "sigslot.cc",
558 "sigslot.h",
Taylor Brandstettere68b6c92017-10-05 09:13:55 -0700559 "sigslotrepeater.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200560 "socket.h",
561 "socketadapters.cc",
562 "socketadapters.h",
563 "socketaddress.cc",
564 "socketaddress.h",
565 "socketaddresspair.cc",
566 "socketaddresspair.h",
567 "socketfactory.h",
568 "socketserver.h",
569 "socketstream.cc",
570 "socketstream.h",
571 "ssladapter.cc",
572 "ssladapter.h",
573 "sslfingerprint.cc",
574 "sslfingerprint.h",
575 "sslidentity.cc",
576 "sslidentity.h",
577 "sslstreamadapter.cc",
578 "sslstreamadapter.h",
579 "stream.cc",
580 "stream.h",
581 "thread.cc",
582 "thread.h",
583 ]
584
mbonadei310e32b2017-09-07 07:36:28 -0700585 visibility = [
586 ":rtc_base",
587 ":rtc_base_objc",
588 ]
589
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200590 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
591 # compiler settings.
592 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
593 configs += [ "//build/config/compiler:no_chromium_code" ]
594 if (!is_win) {
595 cflags += [ "-Wno-uninitialized" ]
596 }
597
598 if (build_with_chromium) {
599 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200600 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200601 }
602 include_dirs = [ "../../boringssl/src/include" ]
603 public_configs += [ ":rtc_base_chromium_config" ]
604 } else {
605 configs += [ ":rtc_base_warnings_config" ]
606 sources += [
607 "callback.h",
608 "logsinks.cc",
609 "logsinks.h",
610 "mathutils.h",
611 "optionsfile.cc",
612 "optionsfile.h",
613 "rollingaccumulator.h",
614 "sslroots.h",
615 "transformadapter.cc",
616 "transformadapter.h",
617 "window.h",
618 ]
619
620 if (is_win) {
621 sources += [
622 "win32socketinit.cc",
623 "win32socketinit.h",
624 "win32socketserver.cc",
625 "win32socketserver.h",
626 ]
627 }
628 } # !build_with_chromium
629
630 if (rtc_build_ssl) {
631 deps += [ "//third_party/boringssl" ]
632 } else {
633 configs += [ ":external_ssl_library" ]
634 }
635
636 if (is_android) {
637 sources += [
638 "ifaddrs-android.cc",
639 "ifaddrs-android.h",
640 ]
641
642 libs += [
643 "log",
644 "GLESv2",
645 ]
646 }
647
648 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700649 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200650 }
651
652 if (use_x11) {
653 libs += [
654 "dl",
655 "rt",
656 "Xext",
657 "X11",
658 "Xcomposite",
659 "Xrender",
660 ]
661 }
662
663 if (is_linux) {
664 libs += [
665 "dl",
666 "rt",
667 ]
668 }
669
670 if (is_mac) {
671 sources += [
672 "macutils.cc",
673 "macutils.h",
674 ]
675 libs += [
676 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
677 "ApplicationServices.framework",
678 ]
679 }
680
681 if (is_win) {
682 sources += [
683 "win32.cc",
684 "win32.h",
685 "win32filesystem.cc",
686 "win32filesystem.h",
687 "win32securityerrors.cc",
688 "win32window.cc",
689 "win32window.h",
690 ]
691
692 libs += [
693 "crypt32.lib",
694 "iphlpapi.lib",
695 "secur32.lib",
696 ]
697
698 cflags += [
699 # Suppress warnings about WIN32_LEAN_AND_MEAN.
700 "/wd4005",
701 "/wd4703",
702 ]
703
704 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
705 }
706
707 if (is_posix) {
708 sources += [
709 "ifaddrs_converter.cc",
710 "ifaddrs_converter.h",
711 "unixfilesystem.cc",
712 "unixfilesystem.h",
713 ]
714 }
715
716 if (is_nacl) {
717 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
718 defines += [ "timezone=_timezone" ]
719 sources -= [ "ifaddrs_converter.cc" ]
720 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200721}
722
723rtc_source_set("gtest_prod") {
724 sources = [
725 "gtest_prod_util.h",
726 ]
727}
728
729config("rtc_base_tests_utils_exported_config") {
730 defines = [ "GTEST_RELATIVE_PATH" ]
731}
732
733config("rtc_base_tests_utils_warnings_config") {
734 if (is_win && is_clang) {
735 cflags = [
736 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
737 "-Wno-reorder",
738 "-Wno-sign-compare",
739 ]
740 }
741}
742
743rtc_source_set("rtc_base_tests_utils") {
744 testonly = true
745 sources = [
746 # Also use this as a convenient dumping ground for misc files that are
747 # included by multiple targets below.
748 "cpu_time.cc",
749 "cpu_time.h",
750 "fakeclock.cc",
751 "fakeclock.h",
752 "fakenetwork.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700753 "fakesslidentity.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200754 "fakesslidentity.h",
755 "firewallsocketserver.cc",
756 "firewallsocketserver.h",
757 "gunit.h",
758 "httpserver.cc",
759 "httpserver.h",
760 "md5.cc",
761 "md5.h",
762 "md5digest.cc",
763 "md5digest.h",
764 "memory_usage.cc",
765 "memory_usage.h",
766 "natserver.cc",
767 "natserver.h",
768 "natsocketfactory.cc",
769 "natsocketfactory.h",
770 "nattypes.cc",
771 "nattypes.h",
772 "proxyserver.cc",
773 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200774 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200775 "sha1.cc",
776 "sha1.h",
777 "sha1digest.cc",
778 "sha1digest.h",
779 "sigslottester.h",
780 "sigslottester.h.pump",
781 "testbase64.h",
782 "testclient.cc",
783 "testclient.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700784 "testechoserver.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200785 "testechoserver.h",
Steve Anton9de3aac2017-10-24 10:08:26 -0700786 "testutils.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200787 "testutils.h",
788 "timedelta.h",
789 "virtualsocketserver.cc",
790 "virtualsocketserver.h",
791 ]
792 configs += [ ":rtc_base_tests_utils_warnings_config" ]
793 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
794 deps = [
795 ":rtc_base",
796 "../test:field_trial",
797 "../test:test_support",
798 ]
799 public_deps = [
800 "//testing/gmock",
801 "//testing/gtest",
802 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200803}
804
805if (rtc_include_tests) {
806 rtc_source_set("rtc_base_tests_main") {
807 testonly = true
808 sources = [
809 "unittest_main.cc",
810 ]
811 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
812 deps = [
813 ":rtc_base",
814 ":rtc_base_approved",
815 ":rtc_base_tests_utils",
816 "../test:field_trial",
817 "../test:test_support",
818 ]
819
820 public_deps = [
821 "//testing/gmock",
822 "//testing/gtest",
823 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200824 }
825
826 rtc_source_set("rtc_base_nonparallel_tests") {
827 testonly = true
828
829 # Skip restricting visibility on mobile platforms since the tests on those
830 # gets additional generated targets which would require many lines here to
831 # cover (which would be confusing to read and hard to maintain).
832 if (!is_android && !is_ios) {
833 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800834 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200835 }
836 sources = [
837 "cpu_time_unittest.cc",
838 "filerotatingstream_unittest.cc",
839 "nullsocketserver_unittest.cc",
840 "physicalsocketserver_unittest.cc",
841 "socket_unittest.cc",
842 "socket_unittest.h",
843 "socketaddress_unittest.cc",
844 ]
845 deps = [
846 ":rtc_base",
847 ":rtc_base_tests_main",
848 ":rtc_base_tests_utils",
849 "../system_wrappers:system_wrappers",
850 "../test:test_support",
851 "//testing/gtest",
852 ]
853 if (is_win) {
854 sources += [ "win32socketserver_unittest.cc" ]
855 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200856 }
857
858 rtc_source_set("rtc_base_approved_unittests") {
859 testonly = true
860
861 # Skip restricting visibility on mobile platforms since the tests on those
862 # gets additional generated targets which would require many lines here to
863 # cover (which would be confusing to read and hard to maintain).
864 if (!is_android && !is_ios) {
865 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800866 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200867 }
868 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200869 "atomicops_unittest.cc",
870 "base64_unittest.cc",
871 "basictypes_unittest.cc",
872 "bind_unittest.cc",
873 "bitbuffer_unittest.cc",
874 "buffer_unittest.cc",
875 "bufferqueue_unittest.cc",
876 "bytebuffer_unittest.cc",
877 "byteorder_unittest.cc",
878 "copyonwritebuffer_unittest.cc",
879 "criticalsection_unittest.cc",
880 "event_tracer_unittest.cc",
881 "event_unittest.cc",
882 "file_unittest.cc",
883 "function_view_unittest.cc",
Ilya Nikolaevskiyed23be92017-10-12 12:38:01 +0200884 "histogram_percentile_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200885 "logging_unittest.cc",
886 "md5digest_unittest.cc",
887 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700888 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200889 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200890 "pathutils_unittest.cc",
891 "platform_thread_unittest.cc",
892 "random_unittest.cc",
893 "rate_limiter_unittest.cc",
894 "rate_statistics_unittest.cc",
895 "ratetracker_unittest.cc",
896 "refcountedobject_unittest.cc",
897 "safe_compare_unittest.cc",
898 "safe_minmax_unittest.cc",
899 "string_to_number_unittest.cc",
900 "stringencode_unittest.cc",
901 "stringize_macros_unittest.cc",
902 "stringutils_unittest.cc",
903 "swap_queue_unittest.cc",
904 "thread_annotations_unittest.cc",
905 "thread_checker_unittest.cc",
906 "timestampaligner_unittest.cc",
907 "timeutils_unittest.cc",
908 "virtualsocket_unittest.cc",
909 ]
910 deps = [
911 ":rtc_base",
912 ":rtc_base_approved",
913 ":rtc_base_tests_main",
914 ":rtc_base_tests_utils",
915 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700916 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200917 "../system_wrappers:system_wrappers",
918 "../test:test_support",
919 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200920 }
921
922 rtc_source_set("rtc_task_queue_unittests") {
923 testonly = true
924
925 # Skip restricting visibility on mobile platforms since the tests on those
926 # gets additional generated targets which would require many lines here to
927 # cover (which would be confusing to read and hard to maintain).
928 if (!is_android && !is_ios) {
929 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800930 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200931 }
932 sources = [
933 "task_queue_unittest.cc",
934 ]
935 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700936 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200937 ":rtc_base_tests_main",
938 ":rtc_base_tests_utils",
939 ":rtc_task_queue",
940 "../test:test_support",
941 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200942 }
943
944 rtc_source_set("sequenced_task_checker_unittests") {
945 testonly = true
946
947 # Skip restricting visibility on mobile platforms since the tests on those
948 # gets additional generated targets which would require many lines here to
949 # cover (which would be confusing to read and hard to maintain).
950 if (!is_android && !is_ios) {
951 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800952 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200953 }
954 sources = [
955 "sequenced_task_checker_unittest.cc",
956 ]
957 deps = [
958 ":rtc_base_approved",
959 ":rtc_base_tests_main",
960 ":rtc_task_queue",
961 ":sequenced_task_checker",
962 "../test:test_support",
963 ]
964 }
965
966 rtc_source_set("weak_ptr_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 "weak_ptr_unittest.cc",
978 ]
979 deps = [
980 ":rtc_base_tests_main",
981 ":rtc_base_tests_utils",
982 ":rtc_task_queue",
983 ":weak_ptr",
984 "../test:test_support",
985 ]
986 }
987
988 rtc_source_set("rtc_numerics_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 "numerics/exp_filter_unittest.cc",
1000 "numerics/percentile_filter_unittest.cc",
Bjorn Tereliusa194e582017-10-25 13:07:09 +02001001 "numerics/sequence_number_util_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001002 ]
1003 deps = [
1004 ":rtc_base_approved",
1005 ":rtc_base_tests_main",
1006 ":rtc_numerics",
1007 "../test:test_support",
1008 ]
1009 }
1010
1011 config("rtc_base_unittests_config") {
1012 if (is_clang) {
1013 cflags = [ "-Wno-unused-const-variable" ]
1014 }
1015 }
1016 rtc_source_set("rtc_base_unittests") {
1017 testonly = true
1018
1019 # Skip restricting visibility on mobile platforms since the tests on those
1020 # gets additional generated targets which would require many lines here to
1021 # cover (which would be confusing to read and hard to maintain).
1022 if (!is_android && !is_ios) {
1023 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001024 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001025 }
1026 sources = [
1027 "callback_unittest.cc",
1028 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001029 "helpers_unittest.cc",
1030 "httpbase_unittest.cc",
1031 "httpcommon_unittest.cc",
1032 "httpserver_unittest.cc",
1033 "ipaddress_unittest.cc",
1034 "memory_usage_unittest.cc",
1035 "messagedigest_unittest.cc",
1036 "messagequeue_unittest.cc",
1037 "nat_unittest.cc",
1038 "network_unittest.cc",
1039 "optionsfile_unittest.cc",
1040 "proxy_unittest.cc",
1041 "ptr_util_unittest.cc",
1042 "ratelimiter_unittest.cc",
1043 "rollingaccumulator_unittest.cc",
1044 "rtccertificate_unittest.cc",
1045 "rtccertificategenerator_unittest.cc",
1046 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001047 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001048 "sigslot_unittest.cc",
1049 "sigslottester_unittest.cc",
1050 "stream_unittest.cc",
1051 "testclient_unittest.cc",
1052 "thread_unittest.cc",
1053 ]
1054 if (is_win) {
1055 sources += [
1056 "win32_unittest.cc",
1057 "win32window_unittest.cc",
1058 ]
1059 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001060 if (is_posix) {
1061 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001062 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001063 "ssladapter_unittest.cc",
1064 "sslidentity_unittest.cc",
1065 "sslstreamadapter_unittest.cc",
1066 ]
1067 }
1068 deps = [
1069 ":rtc_base_tests_main",
1070 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001071 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001072 "../test:test_support",
1073 ]
1074 public_deps = [
1075 ":rtc_base",
1076 ]
1077 configs += [ ":rtc_base_unittests_config" ]
Diogo Real1dca9d52017-08-29 12:18:32 -07001078 if (build_with_chromium) {
1079 include_dirs = [ "../../boringssl/src/include" ]
1080 }
1081 if (rtc_build_ssl) {
1082 deps += [ "//third_party/boringssl" ]
1083 } else {
1084 configs += [ ":external_ssl_library" ]
1085 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001086 }
1087}
1088
Henrik Kjellander73e21802017-06-20 08:38:58 +02001089if (is_android) {
1090 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001091 java_files = [
1092 "java/src/org/webrtc/ContextUtils.java",
1093 "java/src/org/webrtc/Logging.java",
1094 "java/src/org/webrtc/Size.java",
1095 "java/src/org/webrtc/ThreadUtils.java",
1096 ]
charujain474acce2017-08-25 06:21:52 -07001097
1098 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1099 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001100 }
1101}