blob: eddef51aa154a6ca83e1f9290a6ccb870259e357 [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",
116 "buffer.h",
117 "bufferqueue.cc",
118 "bufferqueue.h",
119 "bytebuffer.cc",
120 "bytebuffer.h",
121 "byteorder.h",
122 "checks.cc",
123 "checks.h",
124 "constructormagic.h",
125 "copyonwritebuffer.cc",
126 "copyonwritebuffer.h",
127 "criticalsection.cc",
128 "criticalsection.h",
129 "deprecation.h",
130 "event.cc",
131 "event.h",
132 "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",
Ilya Nikolaevskiyed23be92017-10-12 12:38:01 +0200140 "histogram_percentile_counter.cc",
141 "histogram_percentile_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200142 "ignore_wundef.h",
143 "location.cc",
144 "location.h",
145 "mod_ops.h",
ilnika79cc282017-08-23 05:24:10 -0700146 "moving_max_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200147 "onetimeevent.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200148 "pathutils.cc",
149 "pathutils.h",
150 "platform_file.cc",
151 "platform_file.h",
152 "platform_thread.cc",
153 "platform_thread.h",
154 "platform_thread_types.h",
155 "ptr_util.h",
156 "race_checker.cc",
157 "race_checker.h",
158 "random.cc",
159 "random.h",
160 "rate_limiter.cc",
161 "rate_limiter.h",
162 "rate_statistics.cc",
163 "rate_statistics.h",
164 "ratetracker.cc",
165 "ratetracker.h",
166 "refcount.h",
167 "refcountedobject.h",
168 "safe_compare.h",
169 "safe_conversions.h",
170 "safe_conversions_impl.h",
171 "safe_minmax.h",
172 "sanitizer.h",
173 "scoped_ref_ptr.h",
174 "string_to_number.cc",
175 "string_to_number.h",
176 "stringencode.cc",
177 "stringencode.h",
178 "stringize_macros.h",
179 "stringutils.cc",
180 "stringutils.h",
181 "swap_queue.h",
182 "template_util.h",
183 "thread_annotations.h",
184 "thread_checker.h",
185 "thread_checker_impl.cc",
186 "thread_checker_impl.h",
187 "timestampaligner.cc",
188 "timestampaligner.h",
189 "timeutils.cc",
190 "timeutils.h",
191 "trace_event.h",
192 "type_traits.h",
193 ]
194
195 deps += [ "..:webrtc_common" ]
196
197 if (is_android) {
198 libs += [ "log" ]
199 }
200
201 if (is_posix) {
202 sources += [ "file_posix.cc" ]
203 }
204
205 if (is_win) {
206 sources += [ "file_win.cc" ]
207 }
208
209 if (build_with_chromium) {
210 # Dependency on chromium's logging (in //base).
211 deps += [ "//base:base" ]
212 sources += [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200213 "../../webrtc_overrides/rtc_base/logging.cc",
214 "../../webrtc_overrides/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200215 ]
216 } else {
217 sources += [
218 "logging.cc",
219 "logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200220 ]
221 }
222 if (is_component_build && is_win) {
223 # Copy the VS runtime DLLs into the isolate so that they don't have to be
224 # preinstalled on the target machine. The debug runtimes have a "d" at
225 # the end.
226 # This is a copy of https://codereview.chromium.org/1783973002.
227 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
228 # so we don't have to copy their changes and risk breakages.
229 # See http://crbug.com/653569
230 if (is_debug) {
231 vcrt_suffix = "d"
232 } else {
233 vcrt_suffix = ""
234 }
235
236 # These runtime files are copied to the output directory by the
237 # vs_toolchain script that runs as part of toolchain configuration.
238 data = [
239 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
240 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
241 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
242
243 # Universal Windows 10 CRT files
244 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
245 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
246 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
248 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
249 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
250 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
251 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
256 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
261 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
266 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
279 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
280 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
281 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
282 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
283 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
284 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
285 ]
286 if (is_asan) {
287 if (current_cpu == "x64") {
288 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
289 } else {
290 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
291 }
292 }
293 }
294 if (is_nacl) {
295 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
296 }
297}
298
mbonadeibc378472017-09-11 03:43:34 -0700299if (is_mac && !build_with_chromium) {
300 config("rtc_base_approved_objc_all_dependent_config") {
301 visibility = [ ":rtc_base_approved_objc" ]
302 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
303 }
304
305 rtc_source_set("rtc_base_approved_objc") {
306 visibility = [ ":rtc_base_approved" ]
307 all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
308 sources = [
309 "logging_mac.mm",
310 ]
311 deps = [
312 ":rtc_base_approved_generic",
313 ]
314 }
315}
316
perkj650fdae2017-08-25 05:00:11 -0700317rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700318 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200319 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700320 ]
321 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700322 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200323 ]
324
perkj650fdae2017-08-25 05:00:11 -0700325 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700326 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700327 }
328}
329
330# WebRTC targets must not directly depend on rtc_task_queue_api or
331# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
332# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
333# to the default implemenation in rtc_task_queue_impl or if an externally
334# provided implementation should be used. An external implementation should
335# depend on rtc_task_queue_api.
336rtc_source_set("rtc_task_queue_api") {
nisse75dd6d42017-09-19 08:28:00 -0700337 sources = [
338 "task_queue.h",
339 ]
perkj650fdae2017-08-25 05:00:11 -0700340 deps = [
341 ":rtc_base_approved",
342 ]
343}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200344
perkj650fdae2017-08-25 05:00:11 -0700345rtc_source_set("rtc_task_queue_impl") {
346 deps = [
347 ":rtc_base_approved",
348 ":rtc_task_queue_api",
349 ]
Niels Möller15c9cf72017-10-19 12:38:09 +0200350 if (rtc_build_libevent) {
351 deps += [ "//base/third_party/libevent" ]
352 }
353 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700354 sources = [
Niels Möller15c9cf72017-10-19 12:38:09 +0200355 "task_queue_libevent.cc",
356 "task_queue_posix.cc",
357 "task_queue_posix.h",
perkj650fdae2017-08-25 05:00:11 -0700358 ]
359 } else {
Niels Möller15c9cf72017-10-19 12:38:09 +0200360 if (is_mac || is_ios) {
Niels Möller17a04742017-09-27 10:53:21 +0200361 sources = [
Niels Möller15c9cf72017-10-19 12:38:09 +0200362 "task_queue_gcd.cc",
Henrik Boströma9a27712017-10-03 08:01:07 +0000363 "task_queue_posix.cc",
364 "task_queue_posix.h",
Niels Möller17a04742017-09-27 10:53:21 +0200365 ]
Niels Möller15c9cf72017-10-19 12:38:09 +0200366 }
367 if (is_win) {
368 sources = [
369 "task_queue_win.cc",
370 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200371 }
372 }
373}
374
375rtc_static_library("sequenced_task_checker") {
376 sources = [
377 "sequenced_task_checker.h",
378 "sequenced_task_checker_impl.cc",
379 "sequenced_task_checker_impl.h",
380 ]
381 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700382 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200383 ":rtc_task_queue",
384 ]
385}
386
387rtc_static_library("weak_ptr") {
388 sources = [
389 "weak_ptr.cc",
390 "weak_ptr.h",
391 ]
392 deps = [
393 ":rtc_base_approved",
394 ":sequenced_task_checker",
395 ]
396}
397
398rtc_static_library("rtc_numerics") {
399 sources = [
400 "numerics/exp_filter.cc",
401 "numerics/exp_filter.h",
402 "numerics/percentile_filter.h",
403 ]
404 deps = [
405 ":rtc_base_approved",
406 ]
407}
408
409config("rtc_base_warnings_config") {
410 if (is_win && is_clang) {
411 cflags = [
412 # Disable warnings failing when compiling with Clang on Windows.
413 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
414 "-Wno-sign-compare",
415 "-Wno-missing-braces",
416 ]
417 }
418}
419
420rtc_source_set("rtc_json") {
421 defines = []
422 sources = [
423 "json.cc",
424 "json.h",
425 ]
426 if (rtc_build_json) {
427 public_deps = [
428 "//third_party/jsoncpp",
429 ]
430 } else {
431 include_dirs = [ "$rtc_jsoncpp_root" ]
432
433 # When defined changes the include path for json.h to where it is
434 # expected to be when building json outside of the standalone build.
435 defines += [ "WEBRTC_EXTERNAL_JSON" ]
436 }
437}
438
mbonadei9c5e5112017-09-05 05:17:02 -0700439rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700440 public_deps = [
441 ":rtc_base_generic",
442 ]
443 if (is_win) {
444 sources = [
445 "noop.cc",
446 ]
447 }
448 if (is_ios || is_mac) {
449 sources = [
450 "noop.mm",
451 ]
452 public_deps += [ ":rtc_base_objc" ]
453 }
454}
455
456if (is_ios || is_mac) {
457 rtc_source_set("rtc_base_objc") {
458 sources = [
459 "thread_darwin.mm",
460 ]
461 deps = [
462 ":rtc_base_generic",
463 ]
464 visibility = [ ":rtc_base" ]
465 }
466}
467
468rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200469 cflags = []
470 cflags_cc = []
471 libs = []
472 defines = []
473 deps = [
474 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700475 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200476 ]
477 public_deps = [
478 ":rtc_base_approved",
479 ]
480 public_configs = []
481
482 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
483
484 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200485 "asyncinvoker-inl.h",
486 "asyncinvoker.cc",
487 "asyncinvoker.h",
488 "asyncpacketsocket.cc",
489 "asyncpacketsocket.h",
490 "asyncresolverinterface.cc",
491 "asyncresolverinterface.h",
492 "asyncsocket.cc",
493 "asyncsocket.h",
494 "asynctcpsocket.cc",
495 "asynctcpsocket.h",
496 "asyncudpsocket.cc",
497 "asyncudpsocket.h",
498 "crc32.cc",
499 "crc32.h",
500 "cryptstring.cc",
501 "cryptstring.h",
502 "filerotatingstream.cc",
503 "filerotatingstream.h",
504 "fileutils.cc",
505 "fileutils.h",
506 "gunit_prod.h",
507 "helpers.cc",
508 "helpers.h",
509 "httpbase.cc",
510 "httpbase.h",
511 "httpcommon-inl.h",
512 "httpcommon.cc",
513 "httpcommon.h",
514 "ipaddress.cc",
515 "ipaddress.h",
516 "messagedigest.cc",
517 "messagedigest.h",
518 "messagehandler.cc",
519 "messagehandler.h",
520 "messagequeue.cc",
521 "messagequeue.h",
522 "nethelpers.cc",
523 "nethelpers.h",
524 "network.cc",
525 "network.h",
Patrik Höglunde2d6a062017-10-05 14:53:33 +0200526 "network_constants.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200527 "networkmonitor.cc",
528 "networkmonitor.h",
529 "nullsocketserver.cc",
530 "nullsocketserver.h",
531 "openssl.h",
532 "openssladapter.cc",
533 "openssladapter.h",
534 "openssldigest.cc",
535 "openssldigest.h",
536 "opensslidentity.cc",
537 "opensslidentity.h",
538 "opensslstreamadapter.cc",
539 "opensslstreamadapter.h",
540 "physicalsocketserver.cc",
541 "physicalsocketserver.h",
542 "proxyinfo.cc",
543 "proxyinfo.h",
544 "ratelimiter.cc",
545 "ratelimiter.h",
546 "rtccertificate.cc",
547 "rtccertificate.h",
548 "rtccertificategenerator.cc",
549 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700550 "signalthread.cc",
551 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200552 "sigslot.cc",
553 "sigslot.h",
Taylor Brandstettere68b6c92017-10-05 09:13:55 -0700554 "sigslotrepeater.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200555 "socket.h",
556 "socketadapters.cc",
557 "socketadapters.h",
558 "socketaddress.cc",
559 "socketaddress.h",
560 "socketaddresspair.cc",
561 "socketaddresspair.h",
562 "socketfactory.h",
563 "socketserver.h",
564 "socketstream.cc",
565 "socketstream.h",
566 "ssladapter.cc",
567 "ssladapter.h",
568 "sslfingerprint.cc",
569 "sslfingerprint.h",
570 "sslidentity.cc",
571 "sslidentity.h",
572 "sslstreamadapter.cc",
573 "sslstreamadapter.h",
574 "stream.cc",
575 "stream.h",
576 "thread.cc",
577 "thread.h",
578 ]
579
mbonadei310e32b2017-09-07 07:36:28 -0700580 visibility = [
581 ":rtc_base",
582 ":rtc_base_objc",
583 ]
584
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200585 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
586 # compiler settings.
587 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
588 configs += [ "//build/config/compiler:no_chromium_code" ]
589 if (!is_win) {
590 cflags += [ "-Wno-uninitialized" ]
591 }
592
593 if (build_with_chromium) {
594 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200595 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200596 }
597 include_dirs = [ "../../boringssl/src/include" ]
598 public_configs += [ ":rtc_base_chromium_config" ]
599 } else {
600 configs += [ ":rtc_base_warnings_config" ]
601 sources += [
602 "callback.h",
603 "logsinks.cc",
604 "logsinks.h",
605 "mathutils.h",
606 "optionsfile.cc",
607 "optionsfile.h",
608 "rollingaccumulator.h",
609 "sslroots.h",
610 "transformadapter.cc",
611 "transformadapter.h",
612 "window.h",
613 ]
614
615 if (is_win) {
616 sources += [
617 "win32socketinit.cc",
618 "win32socketinit.h",
619 "win32socketserver.cc",
620 "win32socketserver.h",
621 ]
622 }
623 } # !build_with_chromium
624
625 if (rtc_build_ssl) {
626 deps += [ "//third_party/boringssl" ]
627 } else {
628 configs += [ ":external_ssl_library" ]
629 }
630
631 if (is_android) {
632 sources += [
633 "ifaddrs-android.cc",
634 "ifaddrs-android.h",
635 ]
636
637 libs += [
638 "log",
639 "GLESv2",
640 ]
641 }
642
643 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700644 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200645 }
646
647 if (use_x11) {
648 libs += [
649 "dl",
650 "rt",
651 "Xext",
652 "X11",
653 "Xcomposite",
654 "Xrender",
655 ]
656 }
657
658 if (is_linux) {
659 libs += [
660 "dl",
661 "rt",
662 ]
663 }
664
665 if (is_mac) {
666 sources += [
667 "macutils.cc",
668 "macutils.h",
669 ]
670 libs += [
671 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
672 "ApplicationServices.framework",
673 ]
674 }
675
676 if (is_win) {
677 sources += [
678 "win32.cc",
679 "win32.h",
680 "win32filesystem.cc",
681 "win32filesystem.h",
682 "win32securityerrors.cc",
683 "win32window.cc",
684 "win32window.h",
685 ]
686
687 libs += [
688 "crypt32.lib",
689 "iphlpapi.lib",
690 "secur32.lib",
691 ]
692
693 cflags += [
694 # Suppress warnings about WIN32_LEAN_AND_MEAN.
695 "/wd4005",
696 "/wd4703",
697 ]
698
699 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
700 }
701
702 if (is_posix) {
703 sources += [
704 "ifaddrs_converter.cc",
705 "ifaddrs_converter.h",
706 "unixfilesystem.cc",
707 "unixfilesystem.h",
708 ]
709 }
710
711 if (is_nacl) {
712 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
713 defines += [ "timezone=_timezone" ]
714 sources -= [ "ifaddrs_converter.cc" ]
715 }
716 if (is_win && is_clang) {
717 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
718 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
719 }
720}
721
722rtc_source_set("gtest_prod") {
723 sources = [
724 "gtest_prod_util.h",
725 ]
726}
727
728config("rtc_base_tests_utils_exported_config") {
729 defines = [ "GTEST_RELATIVE_PATH" ]
730}
731
732config("rtc_base_tests_utils_warnings_config") {
733 if (is_win && is_clang) {
734 cflags = [
735 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
736 "-Wno-reorder",
737 "-Wno-sign-compare",
738 ]
739 }
740}
741
742rtc_source_set("rtc_base_tests_utils") {
743 testonly = true
744 sources = [
745 # Also use this as a convenient dumping ground for misc files that are
746 # included by multiple targets below.
747 "cpu_time.cc",
748 "cpu_time.h",
749 "fakeclock.cc",
750 "fakeclock.h",
751 "fakenetwork.h",
752 "fakesslidentity.h",
753 "firewallsocketserver.cc",
754 "firewallsocketserver.h",
755 "gunit.h",
756 "httpserver.cc",
757 "httpserver.h",
758 "md5.cc",
759 "md5.h",
760 "md5digest.cc",
761 "md5digest.h",
762 "memory_usage.cc",
763 "memory_usage.h",
764 "natserver.cc",
765 "natserver.h",
766 "natsocketfactory.cc",
767 "natsocketfactory.h",
768 "nattypes.cc",
769 "nattypes.h",
770 "proxyserver.cc",
771 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200772 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200773 "sha1.cc",
774 "sha1.h",
775 "sha1digest.cc",
776 "sha1digest.h",
777 "sigslottester.h",
778 "sigslottester.h.pump",
779 "testbase64.h",
780 "testclient.cc",
781 "testclient.h",
782 "testechoserver.h",
783 "testutils.h",
784 "timedelta.h",
785 "virtualsocketserver.cc",
786 "virtualsocketserver.h",
787 ]
788 configs += [ ":rtc_base_tests_utils_warnings_config" ]
789 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
790 deps = [
791 ":rtc_base",
792 "../test:field_trial",
793 "../test:test_support",
794 ]
795 public_deps = [
796 "//testing/gmock",
797 "//testing/gtest",
798 ]
799
800 if (!build_with_chromium && is_clang) {
801 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
802 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
803 }
804}
805
806if (rtc_include_tests) {
807 rtc_source_set("rtc_base_tests_main") {
808 testonly = true
809 sources = [
810 "unittest_main.cc",
811 ]
812 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
813 deps = [
814 ":rtc_base",
815 ":rtc_base_approved",
816 ":rtc_base_tests_utils",
817 "../test:field_trial",
818 "../test:test_support",
819 ]
820
821 public_deps = [
822 "//testing/gmock",
823 "//testing/gtest",
824 ]
825
826 if (!build_with_chromium && is_clang) {
827 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
828 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
829 }
830 }
831
832 rtc_source_set("rtc_base_nonparallel_tests") {
833 testonly = true
834
835 # Skip restricting visibility on mobile platforms since the tests on those
836 # gets additional generated targets which would require many lines here to
837 # cover (which would be confusing to read and hard to maintain).
838 if (!is_android && !is_ios) {
839 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800840 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200841 }
842 sources = [
843 "cpu_time_unittest.cc",
844 "filerotatingstream_unittest.cc",
845 "nullsocketserver_unittest.cc",
846 "physicalsocketserver_unittest.cc",
847 "socket_unittest.cc",
848 "socket_unittest.h",
849 "socketaddress_unittest.cc",
850 ]
851 deps = [
852 ":rtc_base",
853 ":rtc_base_tests_main",
854 ":rtc_base_tests_utils",
855 "../system_wrappers:system_wrappers",
856 "../test:test_support",
857 "//testing/gtest",
858 ]
859 if (is_win) {
860 sources += [ "win32socketserver_unittest.cc" ]
861 }
862
863 if (!build_with_chromium && is_clang) {
864 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
865 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
866 }
867 }
868
869 rtc_source_set("rtc_base_approved_unittests") {
870 testonly = true
871
872 # Skip restricting visibility on mobile platforms since the tests on those
873 # gets additional generated targets which would require many lines here to
874 # cover (which would be confusing to read and hard to maintain).
875 if (!is_android && !is_ios) {
876 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800877 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200878 }
879 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200880 "atomicops_unittest.cc",
881 "base64_unittest.cc",
882 "basictypes_unittest.cc",
883 "bind_unittest.cc",
884 "bitbuffer_unittest.cc",
885 "buffer_unittest.cc",
886 "bufferqueue_unittest.cc",
887 "bytebuffer_unittest.cc",
888 "byteorder_unittest.cc",
889 "copyonwritebuffer_unittest.cc",
890 "criticalsection_unittest.cc",
891 "event_tracer_unittest.cc",
892 "event_unittest.cc",
893 "file_unittest.cc",
894 "function_view_unittest.cc",
Ilya Nikolaevskiyed23be92017-10-12 12:38:01 +0200895 "histogram_percentile_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200896 "logging_unittest.cc",
897 "md5digest_unittest.cc",
898 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700899 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200900 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200901 "pathutils_unittest.cc",
902 "platform_thread_unittest.cc",
903 "random_unittest.cc",
904 "rate_limiter_unittest.cc",
905 "rate_statistics_unittest.cc",
906 "ratetracker_unittest.cc",
907 "refcountedobject_unittest.cc",
908 "safe_compare_unittest.cc",
909 "safe_minmax_unittest.cc",
910 "string_to_number_unittest.cc",
911 "stringencode_unittest.cc",
912 "stringize_macros_unittest.cc",
913 "stringutils_unittest.cc",
914 "swap_queue_unittest.cc",
915 "thread_annotations_unittest.cc",
916 "thread_checker_unittest.cc",
917 "timestampaligner_unittest.cc",
918 "timeutils_unittest.cc",
919 "virtualsocket_unittest.cc",
920 ]
921 deps = [
922 ":rtc_base",
923 ":rtc_base_approved",
924 ":rtc_base_tests_main",
925 ":rtc_base_tests_utils",
926 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700927 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200928 "../system_wrappers:system_wrappers",
929 "../test:test_support",
930 ]
931 if (!build_with_chromium && is_clang) {
932 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
933 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
934 }
935 }
936
937 rtc_source_set("rtc_task_queue_unittests") {
938 testonly = true
939
940 # Skip restricting visibility on mobile platforms since the tests on those
941 # gets additional generated targets which would require many lines here to
942 # cover (which would be confusing to read and hard to maintain).
943 if (!is_android && !is_ios) {
944 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800945 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200946 }
947 sources = [
948 "task_queue_unittest.cc",
949 ]
950 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700951 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200952 ":rtc_base_tests_main",
953 ":rtc_base_tests_utils",
954 ":rtc_task_queue",
955 "../test:test_support",
956 ]
957 if (!build_with_chromium && is_clang) {
958 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
959 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
960 }
961 }
962
963 rtc_source_set("sequenced_task_checker_unittests") {
964 testonly = true
965
966 # Skip restricting visibility on mobile platforms since the tests on those
967 # gets additional generated targets which would require many lines here to
968 # cover (which would be confusing to read and hard to maintain).
969 if (!is_android && !is_ios) {
970 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800971 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200972 }
973 sources = [
974 "sequenced_task_checker_unittest.cc",
975 ]
976 deps = [
977 ":rtc_base_approved",
978 ":rtc_base_tests_main",
979 ":rtc_task_queue",
980 ":sequenced_task_checker",
981 "../test:test_support",
982 ]
983 }
984
985 rtc_source_set("weak_ptr_unittests") {
986 testonly = true
987
988 # Skip restricting visibility on mobile platforms since the tests on those
989 # gets additional generated targets which would require many lines here to
990 # cover (which would be confusing to read and hard to maintain).
991 if (!is_android && !is_ios) {
992 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800993 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200994 }
995 sources = [
996 "weak_ptr_unittest.cc",
997 ]
998 deps = [
999 ":rtc_base_tests_main",
1000 ":rtc_base_tests_utils",
1001 ":rtc_task_queue",
1002 ":weak_ptr",
1003 "../test:test_support",
1004 ]
1005 }
1006
1007 rtc_source_set("rtc_numerics_unittests") {
1008 testonly = true
1009
1010 # Skip restricting visibility on mobile platforms since the tests on those
1011 # gets additional generated targets which would require many lines here to
1012 # cover (which would be confusing to read and hard to maintain).
1013 if (!is_android && !is_ios) {
1014 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001015 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001016 }
1017 sources = [
1018 "numerics/exp_filter_unittest.cc",
1019 "numerics/percentile_filter_unittest.cc",
1020 ]
1021 deps = [
1022 ":rtc_base_approved",
1023 ":rtc_base_tests_main",
1024 ":rtc_numerics",
1025 "../test:test_support",
1026 ]
1027 }
1028
1029 config("rtc_base_unittests_config") {
1030 if (is_clang) {
1031 cflags = [ "-Wno-unused-const-variable" ]
1032 }
1033 }
1034 rtc_source_set("rtc_base_unittests") {
1035 testonly = true
1036
1037 # Skip restricting visibility on mobile platforms since the tests on those
1038 # gets additional generated targets which would require many lines here to
1039 # cover (which would be confusing to read and hard to maintain).
1040 if (!is_android && !is_ios) {
1041 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001042 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001043 }
1044 sources = [
1045 "callback_unittest.cc",
1046 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001047 "helpers_unittest.cc",
1048 "httpbase_unittest.cc",
1049 "httpcommon_unittest.cc",
1050 "httpserver_unittest.cc",
1051 "ipaddress_unittest.cc",
1052 "memory_usage_unittest.cc",
1053 "messagedigest_unittest.cc",
1054 "messagequeue_unittest.cc",
1055 "nat_unittest.cc",
1056 "network_unittest.cc",
1057 "optionsfile_unittest.cc",
1058 "proxy_unittest.cc",
1059 "ptr_util_unittest.cc",
1060 "ratelimiter_unittest.cc",
1061 "rollingaccumulator_unittest.cc",
1062 "rtccertificate_unittest.cc",
1063 "rtccertificategenerator_unittest.cc",
1064 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001065 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001066 "sigslot_unittest.cc",
1067 "sigslottester_unittest.cc",
1068 "stream_unittest.cc",
1069 "testclient_unittest.cc",
1070 "thread_unittest.cc",
1071 ]
1072 if (is_win) {
1073 sources += [
1074 "win32_unittest.cc",
1075 "win32window_unittest.cc",
1076 ]
1077 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001078 if (is_posix) {
1079 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001080 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001081 "ssladapter_unittest.cc",
1082 "sslidentity_unittest.cc",
1083 "sslstreamadapter_unittest.cc",
1084 ]
1085 }
1086 deps = [
1087 ":rtc_base_tests_main",
1088 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001089 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001090 "../test:test_support",
1091 ]
1092 public_deps = [
1093 ":rtc_base",
1094 ]
1095 configs += [ ":rtc_base_unittests_config" ]
1096 if (!build_with_chromium && is_clang) {
1097 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1098 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1099 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001100 if (build_with_chromium) {
1101 include_dirs = [ "../../boringssl/src/include" ]
1102 }
1103 if (rtc_build_ssl) {
1104 deps += [ "//third_party/boringssl" ]
1105 } else {
1106 configs += [ ":external_ssl_library" ]
1107 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001108 }
1109}
1110
Henrik Kjellander73e21802017-06-20 08:38:58 +02001111if (is_android) {
1112 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001113 java_files = [
1114 "java/src/org/webrtc/ContextUtils.java",
1115 "java/src/org/webrtc/Logging.java",
1116 "java/src/org/webrtc/Size.java",
1117 "java/src/org/webrtc/ThreadUtils.java",
1118 ]
charujain474acce2017-08-25 06:21:52 -07001119
1120 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1121 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001122 }
1123}