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