blob: 3cb7766629652d0d48d02652f8088e520d780c00 [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_approved_all_dependent_config") {
35 if (is_mac && !build_with_chromium) {
36 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
37 }
38}
39
40config("rtc_base_chromium_config") {
41 defines = [ "NO_MAIN_THREAD_WRAPPING" ]
42}
43
44config("rtc_base_all_dependent_config") {
45 if (is_ios) {
46 libs = [
47 "CFNetwork.framework",
48 "Security.framework",
49 "SystemConfiguration.framework",
50 "UIKit.framework",
51 ]
52 }
53 if (is_mac) {
54 libs = [
55 "Cocoa.framework",
56 "Foundation.framework",
57 "IOKit.framework",
58 "Security.framework",
59 "SystemConfiguration.framework",
60 ]
61 }
62}
63
64if (!rtc_build_ssl) {
65 config("external_ssl_library") {
66 assert(rtc_ssl_root != "",
67 "You must specify rtc_ssl_root when rtc_build_ssl==0.")
68 include_dirs = [ rtc_ssl_root ]
69 }
70}
71
72source_set("protobuf_utils") {
73 sources = [
74 "protobuf_utils.h",
75 ]
76 if (rtc_enable_protobuf) {
77 public_deps = [
78 "//third_party/protobuf:protobuf_lite",
79 ]
80 }
81}
82
83source_set("compile_assert_c") {
84 sources = [
85 "compile_assert_c.h",
86 ]
87}
88
89# The subset of rtc_base approved for use outside of libjingle.
90rtc_static_library("rtc_base_approved") {
91 # TODO(kjellander): Remove (bugs.webrtc.org/7480)
92 # Enabling GN check triggers a cyclic dependency caused by rate_limiter.cc:
Jianjun Zhu037f3e42017-08-15 21:48:37 +080093 # :rtc_base_approved -> ../system_wrappers -> :rtc_base_approved
Henrik Kjellanderc0362762017-06-29 08:03:04 +020094 check_includes = false
95 defines = []
96 libs = []
97 deps = []
98 all_dependent_configs = [ ":rtc_base_approved_all_dependent_config" ]
99
100 sources = [
101 "array_view.h",
102 "arraysize.h",
103 "atomicops.h",
104 "base64.cc",
105 "base64.h",
106 "basictypes.h",
107 "bind.h",
108 "bitbuffer.cc",
109 "bitbuffer.h",
110 "buffer.h",
111 "bufferqueue.cc",
112 "bufferqueue.h",
113 "bytebuffer.cc",
114 "bytebuffer.h",
115 "byteorder.h",
116 "checks.cc",
117 "checks.h",
118 "constructormagic.h",
119 "copyonwritebuffer.cc",
120 "copyonwritebuffer.h",
121 "criticalsection.cc",
122 "criticalsection.h",
123 "deprecation.h",
124 "event.cc",
125 "event.h",
126 "event_tracer.cc",
127 "event_tracer.h",
128 "file.cc",
129 "file.h",
130 "flags.cc",
131 "flags.h",
132 "format_macros.h",
133 "function_view.h",
134 "ignore_wundef.h",
135 "location.cc",
136 "location.h",
137 "mod_ops.h",
ilnika79cc282017-08-23 05:24:10 -0700138 "moving_max_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200139 "onetimeevent.h",
140 "optional.cc",
141 "optional.h",
142 "pathutils.cc",
143 "pathutils.h",
144 "platform_file.cc",
145 "platform_file.h",
146 "platform_thread.cc",
147 "platform_thread.h",
148 "platform_thread_types.h",
149 "ptr_util.h",
150 "race_checker.cc",
151 "race_checker.h",
152 "random.cc",
153 "random.h",
154 "rate_limiter.cc",
155 "rate_limiter.h",
156 "rate_statistics.cc",
157 "rate_statistics.h",
158 "ratetracker.cc",
159 "ratetracker.h",
160 "refcount.h",
161 "refcountedobject.h",
162 "safe_compare.h",
163 "safe_conversions.h",
164 "safe_conversions_impl.h",
165 "safe_minmax.h",
166 "sanitizer.h",
167 "scoped_ref_ptr.h",
168 "string_to_number.cc",
169 "string_to_number.h",
170 "stringencode.cc",
171 "stringencode.h",
172 "stringize_macros.h",
173 "stringutils.cc",
174 "stringutils.h",
175 "swap_queue.h",
176 "template_util.h",
177 "thread_annotations.h",
178 "thread_checker.h",
179 "thread_checker_impl.cc",
180 "thread_checker_impl.h",
181 "timestampaligner.cc",
182 "timestampaligner.h",
183 "timeutils.cc",
184 "timeutils.h",
185 "trace_event.h",
186 "type_traits.h",
187 ]
188
189 deps += [ "..:webrtc_common" ]
190
191 if (is_android) {
192 libs += [ "log" ]
193 }
194
195 if (is_posix) {
196 sources += [ "file_posix.cc" ]
197 }
198
199 if (is_win) {
200 sources += [ "file_win.cc" ]
201 }
202
203 if (build_with_chromium) {
204 # Dependency on chromium's logging (in //base).
205 deps += [ "//base:base" ]
206 sources += [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700207 "../../webrtc_overrides/webrtc/rtc_base/logging.cc",
208 "../../webrtc_overrides/webrtc/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200209 ]
210 } else {
211 sources += [
212 "logging.cc",
213 "logging.h",
214 "logging_mac.mm",
215 ]
216 }
217 if (is_component_build && is_win) {
218 # Copy the VS runtime DLLs into the isolate so that they don't have to be
219 # preinstalled on the target machine. The debug runtimes have a "d" at
220 # the end.
221 # This is a copy of https://codereview.chromium.org/1783973002.
222 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
223 # so we don't have to copy their changes and risk breakages.
224 # See http://crbug.com/653569
225 if (is_debug) {
226 vcrt_suffix = "d"
227 } else {
228 vcrt_suffix = ""
229 }
230
231 # These runtime files are copied to the output directory by the
232 # vs_toolchain script that runs as part of toolchain configuration.
233 data = [
234 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
235 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
236 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
237
238 # Universal Windows 10 CRT files
239 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
240 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
241 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
242 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
243 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
244 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
245 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
246 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
248 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
249 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
250 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
251 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
252 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
253 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
256 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
258 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
261 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
263 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
266 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
268 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
279 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
280 ]
281 if (is_asan) {
282 if (current_cpu == "x64") {
283 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
284 } else {
285 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
286 }
287 }
288 }
289 if (is_nacl) {
290 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
291 }
292}
293
294config("enable_libevent_config") {
295 defines = [ "WEBRTC_BUILD_LIBEVENT" ]
296}
297
perkj650fdae2017-08-25 05:00:11 -0700298rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700299 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200300 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700301 ]
302 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700303 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200304 ]
305
perkj650fdae2017-08-25 05:00:11 -0700306 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700307 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700308 }
309}
310
311# WebRTC targets must not directly depend on rtc_task_queue_api or
312# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
313# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
314# to the default implemenation in rtc_task_queue_impl or if an externally
315# provided implementation should be used. An external implementation should
316# depend on rtc_task_queue_api.
317rtc_source_set("rtc_task_queue_api") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200318 if (build_with_chromium) {
319 sources = [
ehmaldonadof6a861a2017-07-19 10:40:47 -0700320 "../../webrtc_overrides/webrtc/rtc_base/task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200321 ]
322 } else {
323 sources = [
324 "task_queue.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200325 ]
perkj650fdae2017-08-25 05:00:11 -0700326 }
327 deps = [
328 ":rtc_base_approved",
329 ]
330}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200331
perkj650fdae2017-08-25 05:00:11 -0700332rtc_source_set("rtc_task_queue_impl") {
333 deps = [
334 ":rtc_base_approved",
335 ":rtc_task_queue_api",
336 ]
337 if (build_with_chromium) {
338 sources = [
339 "../../webrtc_overrides/webrtc/rtc_base/task_queue.cc",
340 ]
341 } else {
342 if (rtc_build_libevent) {
343 deps += [ "//base/third_party/libevent" ]
344 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200345 if (rtc_enable_libevent) {
perkj650fdae2017-08-25 05:00:11 -0700346 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200347 "task_queue_libevent.cc",
348 "task_queue_posix.cc",
perkj650fdae2017-08-25 05:00:11 -0700349 "task_queue_posix.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200350 ]
351 all_dependent_configs = [ ":enable_libevent_config" ]
352 } else {
353 if (is_mac || is_ios) {
perkj650fdae2017-08-25 05:00:11 -0700354 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200355 "task_queue_gcd.cc",
356 "task_queue_posix.cc",
357 ]
358 }
359 if (is_win) {
perkj650fdae2017-08-25 05:00:11 -0700360 sources = [
361 "task_queue_win.cc",
362 ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200363 }
364 }
365 }
366}
367
368rtc_static_library("sequenced_task_checker") {
369 sources = [
370 "sequenced_task_checker.h",
371 "sequenced_task_checker_impl.cc",
372 "sequenced_task_checker_impl.h",
373 ]
374 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700375 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200376 ":rtc_task_queue",
377 ]
378}
379
380rtc_static_library("weak_ptr") {
381 sources = [
382 "weak_ptr.cc",
383 "weak_ptr.h",
384 ]
385 deps = [
386 ":rtc_base_approved",
387 ":sequenced_task_checker",
388 ]
389}
390
391rtc_static_library("rtc_numerics") {
392 sources = [
393 "numerics/exp_filter.cc",
394 "numerics/exp_filter.h",
395 "numerics/percentile_filter.h",
396 ]
397 deps = [
398 ":rtc_base_approved",
399 ]
400}
401
402config("rtc_base_warnings_config") {
403 if (is_win && is_clang) {
404 cflags = [
405 # Disable warnings failing when compiling with Clang on Windows.
406 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
407 "-Wno-sign-compare",
408 "-Wno-missing-braces",
409 ]
410 }
411}
412
413rtc_source_set("rtc_json") {
414 defines = []
415 sources = [
416 "json.cc",
417 "json.h",
418 ]
419 if (rtc_build_json) {
420 public_deps = [
421 "//third_party/jsoncpp",
422 ]
423 } else {
424 include_dirs = [ "$rtc_jsoncpp_root" ]
425
426 # When defined changes the include path for json.h to where it is
427 # expected to be when building json outside of the standalone build.
428 defines += [ "WEBRTC_EXTERNAL_JSON" ]
429 }
430}
431
mbonadeia0c893f2017-09-05 02:59:26 -0700432rtc_source_set("rtc_base") {
433 public_deps = [
434 ":rtc_base_generic",
435 ]
436 if (is_ios || is_mac) {
437 public_deps += [ ":rtc_base_objc" ]
438 }
439}
440
441if (is_ios || is_mac) {
442 rtc_source_set("rtc_base_objc") {
443 sources = [
444 "thread_darwin.mm",
445 ]
446 deps = [
447 ":rtc_base_generic",
448 ]
449 visibility = [ ":rtc_base" ]
450 }
451}
452
453rtc_source_set("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200454 cflags = []
455 cflags_cc = []
456 libs = []
457 defines = []
458 deps = [
459 "..:webrtc_common",
460 ]
461 public_deps = [
462 ":rtc_base_approved",
463 ]
464 public_configs = []
465
466 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
467
468 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200469 "asyncinvoker-inl.h",
470 "asyncinvoker.cc",
471 "asyncinvoker.h",
472 "asyncpacketsocket.cc",
473 "asyncpacketsocket.h",
474 "asyncresolverinterface.cc",
475 "asyncresolverinterface.h",
476 "asyncsocket.cc",
477 "asyncsocket.h",
478 "asynctcpsocket.cc",
479 "asynctcpsocket.h",
480 "asyncudpsocket.cc",
481 "asyncudpsocket.h",
482 "crc32.cc",
483 "crc32.h",
484 "cryptstring.cc",
485 "cryptstring.h",
486 "filerotatingstream.cc",
487 "filerotatingstream.h",
488 "fileutils.cc",
489 "fileutils.h",
490 "gunit_prod.h",
491 "helpers.cc",
492 "helpers.h",
493 "httpbase.cc",
494 "httpbase.h",
495 "httpcommon-inl.h",
496 "httpcommon.cc",
497 "httpcommon.h",
498 "ipaddress.cc",
499 "ipaddress.h",
500 "messagedigest.cc",
501 "messagedigest.h",
502 "messagehandler.cc",
503 "messagehandler.h",
504 "messagequeue.cc",
505 "messagequeue.h",
506 "nethelpers.cc",
507 "nethelpers.h",
508 "network.cc",
509 "network.h",
510 "networkmonitor.cc",
511 "networkmonitor.h",
512 "nullsocketserver.cc",
513 "nullsocketserver.h",
514 "openssl.h",
515 "openssladapter.cc",
516 "openssladapter.h",
517 "openssldigest.cc",
518 "openssldigest.h",
519 "opensslidentity.cc",
520 "opensslidentity.h",
521 "opensslstreamadapter.cc",
522 "opensslstreamadapter.h",
523 "physicalsocketserver.cc",
524 "physicalsocketserver.h",
525 "proxyinfo.cc",
526 "proxyinfo.h",
527 "ratelimiter.cc",
528 "ratelimiter.h",
529 "rtccertificate.cc",
530 "rtccertificate.h",
531 "rtccertificategenerator.cc",
532 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700533 "signalthread.cc",
534 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200535 "sigslot.cc",
536 "sigslot.h",
537 "socket.h",
538 "socketadapters.cc",
539 "socketadapters.h",
540 "socketaddress.cc",
541 "socketaddress.h",
542 "socketaddresspair.cc",
543 "socketaddresspair.h",
544 "socketfactory.h",
545 "socketserver.h",
546 "socketstream.cc",
547 "socketstream.h",
548 "ssladapter.cc",
549 "ssladapter.h",
550 "sslfingerprint.cc",
551 "sslfingerprint.h",
552 "sslidentity.cc",
553 "sslidentity.h",
554 "sslstreamadapter.cc",
555 "sslstreamadapter.h",
556 "stream.cc",
557 "stream.h",
558 "thread.cc",
559 "thread.h",
560 ]
561
mbonadeia0c893f2017-09-05 02:59:26 -0700562 visibility = [
563 ":rtc_base",
564 ":rtc_base_objc",
565 ]
566
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200567 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
568 # compiler settings.
569 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
570 configs += [ "//build/config/compiler:no_chromium_code" ]
571 if (!is_win) {
572 cflags += [ "-Wno-uninitialized" ]
573 }
574
575 if (build_with_chromium) {
576 if (is_win) {
ehmaldonadof6a861a2017-07-19 10:40:47 -0700577 sources += [ "../../webrtc_overrides/webrtc/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200578 }
579 include_dirs = [ "../../boringssl/src/include" ]
580 public_configs += [ ":rtc_base_chromium_config" ]
581 } else {
582 configs += [ ":rtc_base_warnings_config" ]
583 sources += [
584 "callback.h",
585 "logsinks.cc",
586 "logsinks.h",
587 "mathutils.h",
588 "optionsfile.cc",
589 "optionsfile.h",
590 "rollingaccumulator.h",
591 "sslroots.h",
592 "transformadapter.cc",
593 "transformadapter.h",
594 "window.h",
595 ]
596
597 if (is_win) {
598 sources += [
599 "win32socketinit.cc",
600 "win32socketinit.h",
601 "win32socketserver.cc",
602 "win32socketserver.h",
603 ]
604 }
605 } # !build_with_chromium
606
607 if (rtc_build_ssl) {
608 deps += [ "//third_party/boringssl" ]
609 } else {
610 configs += [ ":external_ssl_library" ]
611 }
612
613 if (is_android) {
614 sources += [
615 "ifaddrs-android.cc",
616 "ifaddrs-android.h",
617 ]
618
619 libs += [
620 "log",
621 "GLESv2",
622 ]
623 }
624
625 if (is_ios || is_mac) {
mbonadeia0c893f2017-09-05 02:59:26 -0700626 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200627 }
628
629 if (use_x11) {
630 libs += [
631 "dl",
632 "rt",
633 "Xext",
634 "X11",
635 "Xcomposite",
636 "Xrender",
637 ]
638 }
639
640 if (is_linux) {
641 libs += [
642 "dl",
643 "rt",
644 ]
645 }
646
647 if (is_mac) {
648 sources += [
649 "macutils.cc",
650 "macutils.h",
651 ]
652 libs += [
653 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
654 "ApplicationServices.framework",
655 ]
656 }
657
658 if (is_win) {
659 sources += [
660 "win32.cc",
661 "win32.h",
662 "win32filesystem.cc",
663 "win32filesystem.h",
664 "win32securityerrors.cc",
665 "win32window.cc",
666 "win32window.h",
667 ]
668
669 libs += [
670 "crypt32.lib",
671 "iphlpapi.lib",
672 "secur32.lib",
673 ]
674
675 cflags += [
676 # Suppress warnings about WIN32_LEAN_AND_MEAN.
677 "/wd4005",
678 "/wd4703",
679 ]
680
681 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
682 }
683
684 if (is_posix) {
685 sources += [
686 "ifaddrs_converter.cc",
687 "ifaddrs_converter.h",
688 "unixfilesystem.cc",
689 "unixfilesystem.h",
690 ]
691 }
692
693 if (is_nacl) {
694 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
695 defines += [ "timezone=_timezone" ]
696 sources -= [ "ifaddrs_converter.cc" ]
697 }
698 if (is_win && is_clang) {
699 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
700 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
701 }
702}
703
704rtc_source_set("gtest_prod") {
705 sources = [
706 "gtest_prod_util.h",
707 ]
708}
709
710config("rtc_base_tests_utils_exported_config") {
711 defines = [ "GTEST_RELATIVE_PATH" ]
712}
713
714config("rtc_base_tests_utils_warnings_config") {
715 if (is_win && is_clang) {
716 cflags = [
717 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
718 "-Wno-reorder",
719 "-Wno-sign-compare",
720 ]
721 }
722}
723
724rtc_source_set("rtc_base_tests_utils") {
725 testonly = true
726 sources = [
727 # Also use this as a convenient dumping ground for misc files that are
728 # included by multiple targets below.
729 "cpu_time.cc",
730 "cpu_time.h",
731 "fakeclock.cc",
732 "fakeclock.h",
733 "fakenetwork.h",
734 "fakesslidentity.h",
735 "firewallsocketserver.cc",
736 "firewallsocketserver.h",
737 "gunit.h",
738 "httpserver.cc",
739 "httpserver.h",
740 "md5.cc",
741 "md5.h",
742 "md5digest.cc",
743 "md5digest.h",
744 "memory_usage.cc",
745 "memory_usage.h",
746 "natserver.cc",
747 "natserver.h",
748 "natsocketfactory.cc",
749 "natsocketfactory.h",
750 "nattypes.cc",
751 "nattypes.h",
752 "proxyserver.cc",
753 "proxyserver.h",
754 "sha1.cc",
755 "sha1.h",
756 "sha1digest.cc",
757 "sha1digest.h",
758 "sigslottester.h",
759 "sigslottester.h.pump",
760 "testbase64.h",
761 "testclient.cc",
762 "testclient.h",
763 "testechoserver.h",
764 "testutils.h",
765 "timedelta.h",
766 "virtualsocketserver.cc",
767 "virtualsocketserver.h",
768 ]
769 configs += [ ":rtc_base_tests_utils_warnings_config" ]
770 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
771 deps = [
772 ":rtc_base",
773 "../test:field_trial",
774 "../test:test_support",
775 ]
776 public_deps = [
777 "//testing/gmock",
778 "//testing/gtest",
779 ]
780
781 if (!build_with_chromium && is_clang) {
782 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
783 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
784 }
785}
786
787if (rtc_include_tests) {
788 rtc_source_set("rtc_base_tests_main") {
789 testonly = true
790 sources = [
791 "unittest_main.cc",
792 ]
793 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
794 deps = [
795 ":rtc_base",
796 ":rtc_base_approved",
797 ":rtc_base_tests_utils",
798 "../test:field_trial",
799 "../test:test_support",
800 ]
801
802 public_deps = [
803 "//testing/gmock",
804 "//testing/gtest",
805 ]
806
807 if (!build_with_chromium && is_clang) {
808 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
809 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
810 }
811 }
812
813 rtc_source_set("rtc_base_nonparallel_tests") {
814 testonly = true
815
816 # Skip restricting visibility on mobile platforms since the tests on those
817 # gets additional generated targets which would require many lines here to
818 # cover (which would be confusing to read and hard to maintain).
819 if (!is_android && !is_ios) {
820 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800821 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200822 }
823 sources = [
824 "cpu_time_unittest.cc",
825 "filerotatingstream_unittest.cc",
826 "nullsocketserver_unittest.cc",
827 "physicalsocketserver_unittest.cc",
828 "socket_unittest.cc",
829 "socket_unittest.h",
830 "socketaddress_unittest.cc",
831 ]
832 deps = [
833 ":rtc_base",
834 ":rtc_base_tests_main",
835 ":rtc_base_tests_utils",
836 "../system_wrappers:system_wrappers",
837 "../test:test_support",
838 "//testing/gtest",
839 ]
840 if (is_win) {
841 sources += [ "win32socketserver_unittest.cc" ]
842 }
843
844 if (!build_with_chromium && is_clang) {
845 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
846 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
847 }
848 }
849
850 rtc_source_set("rtc_base_approved_unittests") {
851 testonly = true
852
853 # Skip restricting visibility on mobile platforms since the tests on those
854 # gets additional generated targets which would require many lines here to
855 # cover (which would be confusing to read and hard to maintain).
856 if (!is_android && !is_ios) {
857 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800858 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200859 }
860 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200861 "atomicops_unittest.cc",
862 "base64_unittest.cc",
863 "basictypes_unittest.cc",
864 "bind_unittest.cc",
865 "bitbuffer_unittest.cc",
866 "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",
878 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700879 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200880 "onetimeevent_unittest.cc",
881 "optional_unittest.cc",
882 "pathutils_unittest.cc",
883 "platform_thread_unittest.cc",
884 "random_unittest.cc",
885 "rate_limiter_unittest.cc",
886 "rate_statistics_unittest.cc",
887 "ratetracker_unittest.cc",
888 "refcountedobject_unittest.cc",
889 "safe_compare_unittest.cc",
890 "safe_minmax_unittest.cc",
891 "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 ]
912 if (!build_with_chromium && is_clang) {
913 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
914 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
915 }
916 }
917
918 rtc_source_set("rtc_task_queue_unittests") {
919 testonly = true
920
921 # Skip restricting visibility on mobile platforms since the tests on those
922 # gets additional generated targets which would require many lines here to
923 # cover (which would be confusing to read and hard to maintain).
924 if (!is_android && !is_ios) {
925 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800926 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200927 }
928 sources = [
929 "task_queue_unittest.cc",
930 ]
931 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700932 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200933 ":rtc_base_tests_main",
934 ":rtc_base_tests_utils",
935 ":rtc_task_queue",
936 "../test:test_support",
937 ]
938 if (!build_with_chromium && is_clang) {
939 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
940 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
941 }
942 }
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",
1001 ]
1002 deps = [
1003 ":rtc_base_approved",
1004 ":rtc_base_tests_main",
1005 ":rtc_numerics",
1006 "../test:test_support",
1007 ]
1008 }
1009
1010 config("rtc_base_unittests_config") {
1011 if (is_clang) {
1012 cflags = [ "-Wno-unused-const-variable" ]
1013 }
1014 }
1015 rtc_source_set("rtc_base_unittests") {
1016 testonly = true
1017
1018 # Skip restricting visibility on mobile platforms since the tests on those
1019 # gets additional generated targets which would require many lines here to
1020 # cover (which would be confusing to read and hard to maintain).
1021 if (!is_android && !is_ios) {
1022 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001023 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001024 }
1025 sources = [
1026 "callback_unittest.cc",
1027 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001028 "helpers_unittest.cc",
1029 "httpbase_unittest.cc",
1030 "httpcommon_unittest.cc",
1031 "httpserver_unittest.cc",
1032 "ipaddress_unittest.cc",
1033 "memory_usage_unittest.cc",
1034 "messagedigest_unittest.cc",
1035 "messagequeue_unittest.cc",
1036 "nat_unittest.cc",
1037 "network_unittest.cc",
1038 "optionsfile_unittest.cc",
1039 "proxy_unittest.cc",
1040 "ptr_util_unittest.cc",
1041 "ratelimiter_unittest.cc",
1042 "rollingaccumulator_unittest.cc",
1043 "rtccertificate_unittest.cc",
1044 "rtccertificategenerator_unittest.cc",
1045 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001046 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001047 "sigslot_unittest.cc",
1048 "sigslottester_unittest.cc",
1049 "stream_unittest.cc",
1050 "testclient_unittest.cc",
1051 "thread_unittest.cc",
1052 ]
1053 if (is_win) {
1054 sources += [
1055 "win32_unittest.cc",
1056 "win32window_unittest.cc",
1057 ]
1058 }
1059 if (is_mac) {
1060 sources += [ "macutils_unittest.cc" ]
1061 }
1062 if (is_posix) {
1063 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001064 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001065 "ssladapter_unittest.cc",
1066 "sslidentity_unittest.cc",
1067 "sslstreamadapter_unittest.cc",
1068 ]
1069 }
1070 deps = [
1071 ":rtc_base_tests_main",
1072 ":rtc_base_tests_utils",
1073 "../test:test_support",
1074 ]
1075 public_deps = [
1076 ":rtc_base",
1077 ]
1078 configs += [ ":rtc_base_unittests_config" ]
1079 if (!build_with_chromium && is_clang) {
1080 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1081 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1082 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001083 if (build_with_chromium) {
1084 include_dirs = [ "../../boringssl/src/include" ]
1085 }
1086 if (rtc_build_ssl) {
1087 deps += [ "//third_party/boringssl" ]
1088 } else {
1089 configs += [ ":external_ssl_library" ]
1090 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001091 }
1092}
1093
Henrik Kjellander73e21802017-06-20 08:38:58 +02001094if (is_android) {
1095 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001096 java_files = [
1097 "java/src/org/webrtc/ContextUtils.java",
1098 "java/src/org/webrtc/Logging.java",
1099 "java/src/org/webrtc/Size.java",
1100 "java/src/org/webrtc/ThreadUtils.java",
1101 ]
charujain474acce2017-08-25 06:21:52 -07001102
1103 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1104 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001105 }
1106}