blob: 65b16e5d80c3ba2c873711302613be2e991fc4b1 [file] [log] [blame]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
Henrik Kjellander73e21802017-06-20 08:38:58 +02002#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
Henrik Kjellanderc0362762017-06-29 08:03:04 +02009import("//build/config/crypto.gni")
10import("//build/config/ui.gni")
Henrik Kjellander73e21802017-06-20 08:38:58 +020011import("../webrtc.gni")
12
13if (is_android) {
14 import("//build/config/android/config.gni")
15 import("//build/config/android/rules.gni")
16}
Henrik Kjellanderc0362762017-06-29 08:03:04 +020017if (is_win) {
18 import("//build/config/clang/clang.gni")
19}
Henrik Kjellander73e21802017-06-20 08:38:58 +020020
Henrik Kjellanderc0362762017-06-29 08:03:04 +020021group("base") {
22 public_deps = [
23 ":rtc_base",
24 ":rtc_base_approved",
25 ":rtc_task_queue",
26 ":sequenced_task_checker",
27 ":weak_ptr",
28 ]
Henrik Kjellander73e21802017-06-20 08:38:58 +020029 if (is_android) {
30 public_deps += [ ":base_java" ]
31 }
32}
33
Henrik Kjellanderc0362762017-06-29 08:03:04 +020034config("rtc_base_chromium_config") {
35 defines = [ "NO_MAIN_THREAD_WRAPPING" ]
36}
37
38config("rtc_base_all_dependent_config") {
39 if (is_ios) {
40 libs = [
41 "CFNetwork.framework",
42 "Security.framework",
43 "SystemConfiguration.framework",
44 "UIKit.framework",
45 ]
46 }
47 if (is_mac) {
48 libs = [
49 "Cocoa.framework",
50 "Foundation.framework",
51 "IOKit.framework",
52 "Security.framework",
53 "SystemConfiguration.framework",
54 ]
55 }
56}
57
58if (!rtc_build_ssl) {
59 config("external_ssl_library") {
60 assert(rtc_ssl_root != "",
61 "You must specify rtc_ssl_root when rtc_build_ssl==0.")
62 include_dirs = [ rtc_ssl_root ]
63 }
64}
65
66source_set("protobuf_utils") {
67 sources = [
68 "protobuf_utils.h",
69 ]
70 if (rtc_enable_protobuf) {
71 public_deps = [
72 "//third_party/protobuf:protobuf_lite",
73 ]
74 }
75}
76
77source_set("compile_assert_c") {
78 sources = [
79 "compile_assert_c.h",
80 ]
81}
82
mbonadeibc378472017-09-11 03:43:34 -070083rtc_source_set("rtc_base_approved") {
84 public_deps = [
85 ":rtc_base_approved_generic",
86 ]
87 if (is_mac && !build_with_chromium) {
88 public_deps += [ ":rtc_base_approved_objc" ]
89 }
90}
91
Henrik Kjellanderc0362762017-06-29 08:03:04 +020092# The subset of rtc_base approved for use outside of libjingle.
mbonadeibc378472017-09-11 03:43:34 -070093rtc_source_set("rtc_base_approved_generic") {
94 visibility = [
95 ":rtc_base_approved",
96 ":rtc_base_approved_objc",
97 ]
98
Henrik Kjellanderc0362762017-06-29 08:03:04 +020099 # TODO(kjellander): Remove (bugs.webrtc.org/7480)
100 # Enabling GN check triggers a cyclic dependency caused by rate_limiter.cc:
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800101 # :rtc_base_approved -> ../system_wrappers -> :rtc_base_approved
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200102 check_includes = false
103 defines = []
104 libs = []
105 deps = []
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200106
107 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200108 "arraysize.h",
109 "atomicops.h",
110 "base64.cc",
111 "base64.h",
112 "basictypes.h",
113 "bind.h",
114 "bitbuffer.cc",
115 "bitbuffer.h",
Alex Naresta5fbc232017-10-18 18:31:07 +0200116 "bitrateallocationstrategy.cc",
117 "bitrateallocationstrategy.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200118 "buffer.h",
119 "bufferqueue.cc",
120 "bufferqueue.h",
121 "bytebuffer.cc",
122 "bytebuffer.h",
123 "byteorder.h",
124 "checks.cc",
125 "checks.h",
126 "constructormagic.h",
127 "copyonwritebuffer.cc",
128 "copyonwritebuffer.h",
129 "criticalsection.cc",
130 "criticalsection.h",
131 "deprecation.h",
132 "event.cc",
133 "event.h",
134 "event_tracer.cc",
135 "event_tracer.h",
136 "file.cc",
137 "file.h",
138 "flags.cc",
139 "flags.h",
140 "format_macros.h",
141 "function_view.h",
Ilya Nikolaevskiyed23be92017-10-12 12:38:01 +0200142 "histogram_percentile_counter.cc",
143 "histogram_percentile_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200144 "ignore_wundef.h",
145 "location.cc",
146 "location.h",
147 "mod_ops.h",
ilnika79cc282017-08-23 05:24:10 -0700148 "moving_max_counter.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200149 "onetimeevent.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200150 "pathutils.cc",
151 "pathutils.h",
152 "platform_file.cc",
153 "platform_file.h",
154 "platform_thread.cc",
155 "platform_thread.h",
156 "platform_thread_types.h",
157 "ptr_util.h",
158 "race_checker.cc",
159 "race_checker.h",
160 "random.cc",
161 "random.h",
162 "rate_limiter.cc",
163 "rate_limiter.h",
164 "rate_statistics.cc",
165 "rate_statistics.h",
166 "ratetracker.cc",
167 "ratetracker.h",
168 "refcount.h",
169 "refcountedobject.h",
170 "safe_compare.h",
171 "safe_conversions.h",
172 "safe_conversions_impl.h",
173 "safe_minmax.h",
174 "sanitizer.h",
175 "scoped_ref_ptr.h",
176 "string_to_number.cc",
177 "string_to_number.h",
178 "stringencode.cc",
179 "stringencode.h",
180 "stringize_macros.h",
181 "stringutils.cc",
182 "stringutils.h",
183 "swap_queue.h",
184 "template_util.h",
185 "thread_annotations.h",
186 "thread_checker.h",
187 "thread_checker_impl.cc",
188 "thread_checker_impl.h",
189 "timestampaligner.cc",
190 "timestampaligner.h",
191 "timeutils.cc",
192 "timeutils.h",
193 "trace_event.h",
194 "type_traits.h",
195 ]
196
197 deps += [ "..:webrtc_common" ]
198
199 if (is_android) {
200 libs += [ "log" ]
201 }
202
203 if (is_posix) {
204 sources += [ "file_posix.cc" ]
205 }
206
207 if (is_win) {
208 sources += [ "file_win.cc" ]
209 }
210
211 if (build_with_chromium) {
212 # Dependency on chromium's logging (in //base).
213 deps += [ "//base:base" ]
214 sources += [
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200215 "../../webrtc_overrides/rtc_base/logging.cc",
216 "../../webrtc_overrides/rtc_base/logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200217 ]
218 } else {
219 sources += [
220 "logging.cc",
221 "logging.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200222 ]
223 }
224 if (is_component_build && is_win) {
225 # Copy the VS runtime DLLs into the isolate so that they don't have to be
226 # preinstalled on the target machine. The debug runtimes have a "d" at
227 # the end.
228 # This is a copy of https://codereview.chromium.org/1783973002.
229 # TODO(ehmaldonado): We'd like Chromium to make this changes easier to use,
230 # so we don't have to copy their changes and risk breakages.
231 # See http://crbug.com/653569
232 if (is_debug) {
233 vcrt_suffix = "d"
234 } else {
235 vcrt_suffix = ""
236 }
237
238 # These runtime files are copied to the output directory by the
239 # vs_toolchain script that runs as part of toolchain configuration.
240 data = [
241 "$root_out_dir/msvcp140${vcrt_suffix}.dll",
242 "$root_out_dir/vccorlib140${vcrt_suffix}.dll",
243 "$root_out_dir/vcruntime140${vcrt_suffix}.dll",
244
245 # Universal Windows 10 CRT files
246 "$root_out_dir/api-ms-win-core-console-l1-1-0.dll",
247 "$root_out_dir/api-ms-win-core-datetime-l1-1-0.dll",
248 "$root_out_dir/api-ms-win-core-debug-l1-1-0.dll",
249 "$root_out_dir/api-ms-win-core-errorhandling-l1-1-0.dll",
250 "$root_out_dir/api-ms-win-core-file-l1-1-0.dll",
251 "$root_out_dir/api-ms-win-core-file-l1-2-0.dll",
252 "$root_out_dir/api-ms-win-core-file-l2-1-0.dll",
253 "$root_out_dir/api-ms-win-core-handle-l1-1-0.dll",
254 "$root_out_dir/api-ms-win-core-heap-l1-1-0.dll",
255 "$root_out_dir/api-ms-win-core-interlocked-l1-1-0.dll",
256 "$root_out_dir/api-ms-win-core-libraryloader-l1-1-0.dll",
257 "$root_out_dir/api-ms-win-core-localization-l1-2-0.dll",
258 "$root_out_dir/api-ms-win-core-memory-l1-1-0.dll",
259 "$root_out_dir/api-ms-win-core-namedpipe-l1-1-0.dll",
260 "$root_out_dir/api-ms-win-core-processenvironment-l1-1-0.dll",
261 "$root_out_dir/api-ms-win-core-processthreads-l1-1-0.dll",
262 "$root_out_dir/api-ms-win-core-processthreads-l1-1-1.dll",
263 "$root_out_dir/api-ms-win-core-profile-l1-1-0.dll",
264 "$root_out_dir/api-ms-win-core-rtlsupport-l1-1-0.dll",
265 "$root_out_dir/api-ms-win-core-string-l1-1-0.dll",
266 "$root_out_dir/api-ms-win-core-synch-l1-1-0.dll",
267 "$root_out_dir/api-ms-win-core-synch-l1-2-0.dll",
268 "$root_out_dir/api-ms-win-core-sysinfo-l1-1-0.dll",
269 "$root_out_dir/api-ms-win-core-timezone-l1-1-0.dll",
270 "$root_out_dir/api-ms-win-core-util-l1-1-0.dll",
271 "$root_out_dir/api-ms-win-crt-conio-l1-1-0.dll",
272 "$root_out_dir/api-ms-win-crt-convert-l1-1-0.dll",
273 "$root_out_dir/api-ms-win-crt-environment-l1-1-0.dll",
274 "$root_out_dir/api-ms-win-crt-filesystem-l1-1-0.dll",
275 "$root_out_dir/api-ms-win-crt-heap-l1-1-0.dll",
276 "$root_out_dir/api-ms-win-crt-locale-l1-1-0.dll",
277 "$root_out_dir/api-ms-win-crt-math-l1-1-0.dll",
278 "$root_out_dir/api-ms-win-crt-multibyte-l1-1-0.dll",
279 "$root_out_dir/api-ms-win-crt-private-l1-1-0.dll",
280 "$root_out_dir/api-ms-win-crt-process-l1-1-0.dll",
281 "$root_out_dir/api-ms-win-crt-runtime-l1-1-0.dll",
282 "$root_out_dir/api-ms-win-crt-stdio-l1-1-0.dll",
283 "$root_out_dir/api-ms-win-crt-string-l1-1-0.dll",
284 "$root_out_dir/api-ms-win-crt-time-l1-1-0.dll",
285 "$root_out_dir/api-ms-win-crt-utility-l1-1-0.dll",
286 "$root_out_dir/ucrtbase${vcrt_suffix}.dll",
287 ]
288 if (is_asan) {
289 if (current_cpu == "x64") {
290 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-x86_64.dll" ]
291 } else {
292 data += [ "$clang_base_path/lib/clang/$clang_version/lib/windows/clang_rt.asan_dynamic-i386.dll" ]
293 }
294 }
295 }
296 if (is_nacl) {
297 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
298 }
299}
300
mbonadeibc378472017-09-11 03:43:34 -0700301if (is_mac && !build_with_chromium) {
302 config("rtc_base_approved_objc_all_dependent_config") {
303 visibility = [ ":rtc_base_approved_objc" ]
304 libs = [ "Foundation.framework" ] # needed for logging_mac.mm
305 }
306
307 rtc_source_set("rtc_base_approved_objc") {
308 visibility = [ ":rtc_base_approved" ]
309 all_dependent_configs = [ ":rtc_base_approved_objc_all_dependent_config" ]
310 sources = [
311 "logging_mac.mm",
312 ]
313 deps = [
314 ":rtc_base_approved_generic",
315 ]
316 }
317}
318
perkj650fdae2017-08-25 05:00:11 -0700319rtc_source_set("rtc_task_queue") {
mbonadei95c8f652017-08-27 23:40:10 -0700320 deps = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200321 ":rtc_base_approved",
mbonadei95c8f652017-08-27 23:40:10 -0700322 ]
323 public_deps = [
perkj650fdae2017-08-25 05:00:11 -0700324 ":rtc_task_queue_api",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200325 ]
326
perkj650fdae2017-08-25 05:00:11 -0700327 if (rtc_link_task_queue_impl) {
mbonadei95c8f652017-08-27 23:40:10 -0700328 deps += [ ":rtc_task_queue_impl" ]
perkj650fdae2017-08-25 05:00:11 -0700329 }
330}
331
332# WebRTC targets must not directly depend on rtc_task_queue_api or
333# rtc_task_queue_impl. Instead, depend on rtc_task_queue.
334# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link
335# to the default implemenation in rtc_task_queue_impl or if an externally
336# provided implementation should be used. An external implementation should
337# depend on rtc_task_queue_api.
338rtc_source_set("rtc_task_queue_api") {
nisse75dd6d42017-09-19 08:28:00 -0700339 sources = [
340 "task_queue.h",
341 ]
perkj650fdae2017-08-25 05:00:11 -0700342 deps = [
343 ":rtc_base_approved",
344 ]
345}
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200346
perkj650fdae2017-08-25 05:00:11 -0700347rtc_source_set("rtc_task_queue_impl") {
348 deps = [
349 ":rtc_base_approved",
350 ":rtc_task_queue_api",
351 ]
Henrik Boströma9a27712017-10-03 08:01:07 +0000352 if (build_with_chromium) {
perkj650fdae2017-08-25 05:00:11 -0700353 sources = [
Henrik Boströma9a27712017-10-03 08:01:07 +0000354 "../../webrtc_overrides/rtc_base/task_queue.cc",
perkj650fdae2017-08-25 05:00:11 -0700355 ]
356 } else {
Henrik Boströma9a27712017-10-03 08:01:07 +0000357 if (rtc_build_libevent) {
358 deps += [ "//base/third_party/libevent" ]
Niels Möller17a04742017-09-27 10:53:21 +0200359 }
Henrik Boströma9a27712017-10-03 08:01:07 +0000360 if (rtc_enable_libevent) {
Niels Möller17a04742017-09-27 10:53:21 +0200361 sources = [
Henrik Boströma9a27712017-10-03 08:01:07 +0000362 "task_queue_libevent.cc",
363 "task_queue_posix.cc",
364 "task_queue_posix.h",
Niels Möller17a04742017-09-27 10:53:21 +0200365 ]
Henrik Boströma9a27712017-10-03 08:01:07 +0000366 } else {
367 if (is_mac || is_ios) {
368 sources = [
369 "task_queue_gcd.cc",
370 "task_queue_posix.cc",
371 ]
372 }
373 if (is_win) {
374 sources = [
375 "task_queue_win.cc",
376 ]
377 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200378 }
379 }
380}
381
382rtc_static_library("sequenced_task_checker") {
383 sources = [
384 "sequenced_task_checker.h",
385 "sequenced_task_checker_impl.cc",
386 "sequenced_task_checker_impl.h",
387 ]
388 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700389 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200390 ":rtc_task_queue",
391 ]
392}
393
394rtc_static_library("weak_ptr") {
395 sources = [
396 "weak_ptr.cc",
397 "weak_ptr.h",
398 ]
399 deps = [
400 ":rtc_base_approved",
401 ":sequenced_task_checker",
402 ]
403}
404
405rtc_static_library("rtc_numerics") {
406 sources = [
407 "numerics/exp_filter.cc",
408 "numerics/exp_filter.h",
409 "numerics/percentile_filter.h",
410 ]
411 deps = [
412 ":rtc_base_approved",
413 ]
414}
415
416config("rtc_base_warnings_config") {
417 if (is_win && is_clang) {
418 cflags = [
419 # Disable warnings failing when compiling with Clang on Windows.
420 # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
421 "-Wno-sign-compare",
422 "-Wno-missing-braces",
423 ]
424 }
425}
426
427rtc_source_set("rtc_json") {
428 defines = []
429 sources = [
430 "json.cc",
431 "json.h",
432 ]
433 if (rtc_build_json) {
434 public_deps = [
435 "//third_party/jsoncpp",
436 ]
437 } else {
438 include_dirs = [ "$rtc_jsoncpp_root" ]
439
440 # When defined changes the include path for json.h to where it is
441 # expected to be when building json outside of the standalone build.
442 defines += [ "WEBRTC_EXTERNAL_JSON" ]
443 }
444}
445
mbonadei9c5e5112017-09-05 05:17:02 -0700446rtc_static_library("rtc_base") {
mbonadei310e32b2017-09-07 07:36:28 -0700447 public_deps = [
448 ":rtc_base_generic",
449 ]
450 if (is_win) {
451 sources = [
452 "noop.cc",
453 ]
454 }
455 if (is_ios || is_mac) {
456 sources = [
457 "noop.mm",
458 ]
459 public_deps += [ ":rtc_base_objc" ]
460 }
461}
462
463if (is_ios || is_mac) {
464 rtc_source_set("rtc_base_objc") {
465 sources = [
466 "thread_darwin.mm",
467 ]
468 deps = [
469 ":rtc_base_generic",
470 ]
471 visibility = [ ":rtc_base" ]
472 }
473}
474
475rtc_static_library("rtc_base_generic") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200476 cflags = []
477 cflags_cc = []
478 libs = []
479 defines = []
480 deps = [
481 "..:webrtc_common",
kwiberg84f6a3f2017-09-05 08:43:13 -0700482 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200483 ]
484 public_deps = [
485 ":rtc_base_approved",
486 ]
487 public_configs = []
488
489 all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
490
491 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200492 "asyncinvoker-inl.h",
493 "asyncinvoker.cc",
494 "asyncinvoker.h",
495 "asyncpacketsocket.cc",
496 "asyncpacketsocket.h",
497 "asyncresolverinterface.cc",
498 "asyncresolverinterface.h",
499 "asyncsocket.cc",
500 "asyncsocket.h",
501 "asynctcpsocket.cc",
502 "asynctcpsocket.h",
503 "asyncudpsocket.cc",
504 "asyncudpsocket.h",
505 "crc32.cc",
506 "crc32.h",
507 "cryptstring.cc",
508 "cryptstring.h",
509 "filerotatingstream.cc",
510 "filerotatingstream.h",
511 "fileutils.cc",
512 "fileutils.h",
513 "gunit_prod.h",
514 "helpers.cc",
515 "helpers.h",
516 "httpbase.cc",
517 "httpbase.h",
518 "httpcommon-inl.h",
519 "httpcommon.cc",
520 "httpcommon.h",
521 "ipaddress.cc",
522 "ipaddress.h",
523 "messagedigest.cc",
524 "messagedigest.h",
525 "messagehandler.cc",
526 "messagehandler.h",
527 "messagequeue.cc",
528 "messagequeue.h",
529 "nethelpers.cc",
530 "nethelpers.h",
531 "network.cc",
532 "network.h",
Patrik Höglunde2d6a062017-10-05 14:53:33 +0200533 "network_constants.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200534 "networkmonitor.cc",
535 "networkmonitor.h",
536 "nullsocketserver.cc",
537 "nullsocketserver.h",
538 "openssl.h",
539 "openssladapter.cc",
540 "openssladapter.h",
541 "openssldigest.cc",
542 "openssldigest.h",
543 "opensslidentity.cc",
544 "opensslidentity.h",
545 "opensslstreamadapter.cc",
546 "opensslstreamadapter.h",
547 "physicalsocketserver.cc",
548 "physicalsocketserver.h",
549 "proxyinfo.cc",
550 "proxyinfo.h",
551 "ratelimiter.cc",
552 "ratelimiter.h",
553 "rtccertificate.cc",
554 "rtccertificate.h",
555 "rtccertificategenerator.cc",
556 "rtccertificategenerator.h",
deadbeef8290ddf2017-07-11 16:56:05 -0700557 "signalthread.cc",
558 "signalthread.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200559 "sigslot.cc",
560 "sigslot.h",
Taylor Brandstettere68b6c92017-10-05 09:13:55 -0700561 "sigslotrepeater.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200562 "socket.h",
563 "socketadapters.cc",
564 "socketadapters.h",
565 "socketaddress.cc",
566 "socketaddress.h",
567 "socketaddresspair.cc",
568 "socketaddresspair.h",
569 "socketfactory.h",
570 "socketserver.h",
571 "socketstream.cc",
572 "socketstream.h",
573 "ssladapter.cc",
574 "ssladapter.h",
575 "sslfingerprint.cc",
576 "sslfingerprint.h",
577 "sslidentity.cc",
578 "sslidentity.h",
579 "sslstreamadapter.cc",
580 "sslstreamadapter.h",
581 "stream.cc",
582 "stream.h",
583 "thread.cc",
584 "thread.h",
585 ]
586
mbonadei310e32b2017-09-07 07:36:28 -0700587 visibility = [
588 ":rtc_base",
589 ":rtc_base_objc",
590 ]
591
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200592 # TODO(henrike): issue 3307, make rtc_base build with the Chromium default
593 # compiler settings.
594 suppressed_configs += [ "//build/config/compiler:chromium_code" ]
595 configs += [ "//build/config/compiler:no_chromium_code" ]
596 if (!is_win) {
597 cflags += [ "-Wno-uninitialized" ]
598 }
599
600 if (build_with_chromium) {
601 if (is_win) {
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200602 sources += [ "../../webrtc_overrides/rtc_base/win32socketinit.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200603 }
604 include_dirs = [ "../../boringssl/src/include" ]
605 public_configs += [ ":rtc_base_chromium_config" ]
606 } else {
607 configs += [ ":rtc_base_warnings_config" ]
608 sources += [
609 "callback.h",
610 "logsinks.cc",
611 "logsinks.h",
612 "mathutils.h",
613 "optionsfile.cc",
614 "optionsfile.h",
615 "rollingaccumulator.h",
616 "sslroots.h",
617 "transformadapter.cc",
618 "transformadapter.h",
619 "window.h",
620 ]
621
622 if (is_win) {
623 sources += [
624 "win32socketinit.cc",
625 "win32socketinit.h",
626 "win32socketserver.cc",
627 "win32socketserver.h",
628 ]
629 }
630 } # !build_with_chromium
631
632 if (rtc_build_ssl) {
633 deps += [ "//third_party/boringssl" ]
634 } else {
635 configs += [ ":external_ssl_library" ]
636 }
637
638 if (is_android) {
639 sources += [
640 "ifaddrs-android.cc",
641 "ifaddrs-android.h",
642 ]
643
644 libs += [
645 "log",
646 "GLESv2",
647 ]
648 }
649
650 if (is_ios || is_mac) {
mbonadei310e32b2017-09-07 07:36:28 -0700651 sources += [ "macifaddrs_converter.cc" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200652 }
653
654 if (use_x11) {
655 libs += [
656 "dl",
657 "rt",
658 "Xext",
659 "X11",
660 "Xcomposite",
661 "Xrender",
662 ]
663 }
664
665 if (is_linux) {
666 libs += [
667 "dl",
668 "rt",
669 ]
670 }
671
672 if (is_mac) {
673 sources += [
674 "macutils.cc",
675 "macutils.h",
676 ]
677 libs += [
678 # For ProcessInformationCopyDictionary in unixfilesystem.cc.
679 "ApplicationServices.framework",
680 ]
681 }
682
683 if (is_win) {
684 sources += [
685 "win32.cc",
686 "win32.h",
687 "win32filesystem.cc",
688 "win32filesystem.h",
689 "win32securityerrors.cc",
690 "win32window.cc",
691 "win32window.h",
692 ]
693
694 libs += [
695 "crypt32.lib",
696 "iphlpapi.lib",
697 "secur32.lib",
698 ]
699
700 cflags += [
701 # Suppress warnings about WIN32_LEAN_AND_MEAN.
702 "/wd4005",
703 "/wd4703",
704 ]
705
706 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
707 }
708
709 if (is_posix) {
710 sources += [
711 "ifaddrs_converter.cc",
712 "ifaddrs_converter.h",
713 "unixfilesystem.cc",
714 "unixfilesystem.h",
715 ]
716 }
717
718 if (is_nacl) {
719 deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
720 defines += [ "timezone=_timezone" ]
721 sources -= [ "ifaddrs_converter.cc" ]
722 }
723 if (is_win && is_clang) {
724 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
725 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
726 }
727}
728
729rtc_source_set("gtest_prod") {
730 sources = [
731 "gtest_prod_util.h",
732 ]
733}
734
735config("rtc_base_tests_utils_exported_config") {
736 defines = [ "GTEST_RELATIVE_PATH" ]
737}
738
739config("rtc_base_tests_utils_warnings_config") {
740 if (is_win && is_clang) {
741 cflags = [
742 # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
743 "-Wno-reorder",
744 "-Wno-sign-compare",
745 ]
746 }
747}
748
749rtc_source_set("rtc_base_tests_utils") {
750 testonly = true
751 sources = [
752 # Also use this as a convenient dumping ground for misc files that are
753 # included by multiple targets below.
754 "cpu_time.cc",
755 "cpu_time.h",
756 "fakeclock.cc",
757 "fakeclock.h",
758 "fakenetwork.h",
759 "fakesslidentity.h",
760 "firewallsocketserver.cc",
761 "firewallsocketserver.h",
762 "gunit.h",
763 "httpserver.cc",
764 "httpserver.h",
765 "md5.cc",
766 "md5.h",
767 "md5digest.cc",
768 "md5digest.h",
769 "memory_usage.cc",
770 "memory_usage.h",
771 "natserver.cc",
772 "natserver.h",
773 "natsocketfactory.cc",
774 "natsocketfactory.h",
775 "nattypes.cc",
776 "nattypes.h",
777 "proxyserver.cc",
778 "proxyserver.h",
Patrik Höglund563934e2017-09-15 09:04:28 +0200779 "refcount.h",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200780 "sha1.cc",
781 "sha1.h",
782 "sha1digest.cc",
783 "sha1digest.h",
784 "sigslottester.h",
785 "sigslottester.h.pump",
786 "testbase64.h",
787 "testclient.cc",
788 "testclient.h",
789 "testechoserver.h",
790 "testutils.h",
791 "timedelta.h",
792 "virtualsocketserver.cc",
793 "virtualsocketserver.h",
794 ]
795 configs += [ ":rtc_base_tests_utils_warnings_config" ]
796 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
797 deps = [
798 ":rtc_base",
799 "../test:field_trial",
800 "../test:test_support",
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
813if (rtc_include_tests) {
814 rtc_source_set("rtc_base_tests_main") {
815 testonly = true
816 sources = [
817 "unittest_main.cc",
818 ]
819 public_configs = [ ":rtc_base_tests_utils_exported_config" ]
820 deps = [
821 ":rtc_base",
822 ":rtc_base_approved",
823 ":rtc_base_tests_utils",
824 "../test:field_trial",
825 "../test:test_support",
826 ]
827
828 public_deps = [
829 "//testing/gmock",
830 "//testing/gtest",
831 ]
832
833 if (!build_with_chromium && is_clang) {
834 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
835 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
836 }
837 }
838
839 rtc_source_set("rtc_base_nonparallel_tests") {
840 testonly = true
841
842 # Skip restricting visibility on mobile platforms since the tests on those
843 # gets additional generated targets which would require many lines here to
844 # cover (which would be confusing to read and hard to maintain).
845 if (!is_android && !is_ios) {
846 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800847 #visibility = [ "..:webrtc_nonparallel_tests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200848 }
849 sources = [
850 "cpu_time_unittest.cc",
851 "filerotatingstream_unittest.cc",
852 "nullsocketserver_unittest.cc",
853 "physicalsocketserver_unittest.cc",
854 "socket_unittest.cc",
855 "socket_unittest.h",
856 "socketaddress_unittest.cc",
857 ]
858 deps = [
859 ":rtc_base",
860 ":rtc_base_tests_main",
861 ":rtc_base_tests_utils",
862 "../system_wrappers:system_wrappers",
863 "../test:test_support",
864 "//testing/gtest",
865 ]
866 if (is_win) {
867 sources += [ "win32socketserver_unittest.cc" ]
868 }
869
870 if (!build_with_chromium && is_clang) {
871 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
872 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
873 }
874 }
875
876 rtc_source_set("rtc_base_approved_unittests") {
877 testonly = true
878
879 # Skip restricting visibility on mobile platforms since the tests on those
880 # gets additional generated targets which would require many lines here to
881 # cover (which would be confusing to read and hard to maintain).
882 if (!is_android && !is_ios) {
883 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800884 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200885 }
886 sources = [
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200887 "atomicops_unittest.cc",
888 "base64_unittest.cc",
889 "basictypes_unittest.cc",
890 "bind_unittest.cc",
891 "bitbuffer_unittest.cc",
892 "buffer_unittest.cc",
893 "bufferqueue_unittest.cc",
894 "bytebuffer_unittest.cc",
895 "byteorder_unittest.cc",
896 "copyonwritebuffer_unittest.cc",
897 "criticalsection_unittest.cc",
898 "event_tracer_unittest.cc",
899 "event_unittest.cc",
900 "file_unittest.cc",
901 "function_view_unittest.cc",
Ilya Nikolaevskiyed23be92017-10-12 12:38:01 +0200902 "histogram_percentile_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200903 "logging_unittest.cc",
904 "md5digest_unittest.cc",
905 "mod_ops_unittest.cc",
ilnika79cc282017-08-23 05:24:10 -0700906 "moving_max_counter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200907 "onetimeevent_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200908 "pathutils_unittest.cc",
909 "platform_thread_unittest.cc",
910 "random_unittest.cc",
911 "rate_limiter_unittest.cc",
912 "rate_statistics_unittest.cc",
913 "ratetracker_unittest.cc",
914 "refcountedobject_unittest.cc",
915 "safe_compare_unittest.cc",
916 "safe_minmax_unittest.cc",
917 "string_to_number_unittest.cc",
918 "stringencode_unittest.cc",
919 "stringize_macros_unittest.cc",
920 "stringutils_unittest.cc",
921 "swap_queue_unittest.cc",
922 "thread_annotations_unittest.cc",
923 "thread_checker_unittest.cc",
924 "timestampaligner_unittest.cc",
925 "timeutils_unittest.cc",
926 "virtualsocket_unittest.cc",
927 ]
928 deps = [
929 ":rtc_base",
930 ":rtc_base_approved",
931 ":rtc_base_tests_main",
932 ":rtc_base_tests_utils",
933 ":rtc_task_queue",
kwiberg529662a2017-09-04 05:43:17 -0700934 "../api:array_view",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200935 "../system_wrappers:system_wrappers",
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("rtc_task_queue_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 "task_queue_unittest.cc",
956 ]
957 deps = [
mbonadei95c8f652017-08-27 23:40:10 -0700958 ":rtc_base_approved",
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200959 ":rtc_base_tests_main",
960 ":rtc_base_tests_utils",
961 ":rtc_task_queue",
962 "../test:test_support",
963 ]
964 if (!build_with_chromium && is_clang) {
965 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
966 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
967 }
968 }
969
970 rtc_source_set("sequenced_task_checker_unittests") {
971 testonly = true
972
973 # Skip restricting visibility on mobile platforms since the tests on those
974 # gets additional generated targets which would require many lines here to
975 # cover (which would be confusing to read and hard to maintain).
976 if (!is_android && !is_ios) {
977 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800978 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +0200979 }
980 sources = [
981 "sequenced_task_checker_unittest.cc",
982 ]
983 deps = [
984 ":rtc_base_approved",
985 ":rtc_base_tests_main",
986 ":rtc_task_queue",
987 ":sequenced_task_checker",
988 "../test:test_support",
989 ]
990 }
991
992 rtc_source_set("weak_ptr_unittests") {
993 testonly = true
994
995 # Skip restricting visibility on mobile platforms since the tests on those
996 # gets additional generated targets which would require many lines here to
997 # cover (which would be confusing to read and hard to maintain).
998 if (!is_android && !is_ios) {
999 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001000 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001001 }
1002 sources = [
1003 "weak_ptr_unittest.cc",
1004 ]
1005 deps = [
1006 ":rtc_base_tests_main",
1007 ":rtc_base_tests_utils",
1008 ":rtc_task_queue",
1009 ":weak_ptr",
1010 "../test:test_support",
1011 ]
1012 }
1013
1014 rtc_source_set("rtc_numerics_unittests") {
1015 testonly = true
1016
1017 # Skip restricting visibility on mobile platforms since the tests on those
1018 # gets additional generated targets which would require many lines here to
1019 # cover (which would be confusing to read and hard to maintain).
1020 if (!is_android && !is_ios) {
1021 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001022 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001023 }
1024 sources = [
1025 "numerics/exp_filter_unittest.cc",
1026 "numerics/percentile_filter_unittest.cc",
1027 ]
1028 deps = [
1029 ":rtc_base_approved",
1030 ":rtc_base_tests_main",
1031 ":rtc_numerics",
1032 "../test:test_support",
1033 ]
1034 }
1035
1036 config("rtc_base_unittests_config") {
1037 if (is_clang) {
1038 cflags = [ "-Wno-unused-const-variable" ]
1039 }
1040 }
1041 rtc_source_set("rtc_base_unittests") {
1042 testonly = true
1043
1044 # Skip restricting visibility on mobile platforms since the tests on those
1045 # gets additional generated targets which would require many lines here to
1046 # cover (which would be confusing to read and hard to maintain).
1047 if (!is_android && !is_ios) {
1048 # TODO(kjellander): Reenable after finishing https://bugs.webrtc.org/7634.
Jianjun Zhu037f3e42017-08-15 21:48:37 +08001049 #visibility = [ "..:rtc_unittests" ]
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001050 }
1051 sources = [
1052 "callback_unittest.cc",
1053 "crc32_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001054 "helpers_unittest.cc",
1055 "httpbase_unittest.cc",
1056 "httpcommon_unittest.cc",
1057 "httpserver_unittest.cc",
1058 "ipaddress_unittest.cc",
1059 "memory_usage_unittest.cc",
1060 "messagedigest_unittest.cc",
1061 "messagequeue_unittest.cc",
1062 "nat_unittest.cc",
1063 "network_unittest.cc",
1064 "optionsfile_unittest.cc",
1065 "proxy_unittest.cc",
1066 "ptr_util_unittest.cc",
1067 "ratelimiter_unittest.cc",
1068 "rollingaccumulator_unittest.cc",
1069 "rtccertificate_unittest.cc",
1070 "rtccertificategenerator_unittest.cc",
1071 "sha1digest_unittest.cc",
deadbeef8290ddf2017-07-11 16:56:05 -07001072 "signalthread_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001073 "sigslot_unittest.cc",
1074 "sigslottester_unittest.cc",
1075 "stream_unittest.cc",
1076 "testclient_unittest.cc",
1077 "thread_unittest.cc",
1078 ]
1079 if (is_win) {
1080 sources += [
1081 "win32_unittest.cc",
1082 "win32window_unittest.cc",
1083 ]
1084 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001085 if (is_posix) {
1086 sources += [
Diogo Real1dca9d52017-08-29 12:18:32 -07001087 "openssladapter_unittest.cc",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001088 "ssladapter_unittest.cc",
1089 "sslidentity_unittest.cc",
1090 "sslstreamadapter_unittest.cc",
1091 ]
1092 }
1093 deps = [
1094 ":rtc_base_tests_main",
1095 ":rtc_base_tests_utils",
kwiberg84f6a3f2017-09-05 08:43:13 -07001096 "../api:optional",
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001097 "../test:test_support",
1098 ]
1099 public_deps = [
1100 ":rtc_base",
1101 ]
1102 configs += [ ":rtc_base_unittests_config" ]
1103 if (!build_with_chromium && is_clang) {
1104 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
1105 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
1106 }
Diogo Real1dca9d52017-08-29 12:18:32 -07001107 if (build_with_chromium) {
1108 include_dirs = [ "../../boringssl/src/include" ]
1109 }
1110 if (rtc_build_ssl) {
1111 deps += [ "//third_party/boringssl" ]
1112 } else {
1113 configs += [ ":external_ssl_library" ]
1114 }
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001115 }
1116}
1117
Henrik Kjellander73e21802017-06-20 08:38:58 +02001118if (is_android) {
1119 android_library("base_java") {
Henrik Kjellanderc0362762017-06-29 08:03:04 +02001120 java_files = [
1121 "java/src/org/webrtc/ContextUtils.java",
1122 "java/src/org/webrtc/Logging.java",
1123 "java/src/org/webrtc/Size.java",
1124 "java/src/org/webrtc/ThreadUtils.java",
1125 ]
charujain474acce2017-08-25 06:21:52 -07001126
1127 # TODO(sakal): Fix build hooks crbug.com/webrtc/8148
1128 no_build_hooks = true
Henrik Kjellander73e21802017-06-20 08:38:58 +02001129 }
1130}