blob: f8fb0bd4fe11eff7f86661c06962d9cbb82ab2a7 [file] [log] [blame]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +00001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
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
9import("//build/config/crypto.gni")
10import("../build/webrtc.gni")
11
12config("webrtc_base_config") {
13 include_dirs = [
14 "//third_party/jsoncpp/overrides/include",
15 "//third_party/jsoncpp/source/include",
16 ]
17
18 defines = [
19 "FEATURE_ENABLE_SSL",
20 "GTEST_RELATIVE_PATH",
21 ]
22
23 # TODO(henrike): issue 3307, make webrtc_base build without disabling
24 # these flags.
25 cflags_cc = [ "-Wno-non-virtual-dtor" ]
26}
27
28config("webrtc_base_chromium_config") {
29 defines = [
30 "NO_MAIN_THREAD_WRAPPING",
31 "SSL_USE_NSS",
32 ]
33}
34
35config("openssl_config") {
36 defines = [
37 "SSL_USE_OPENSSL",
38 "HAVE_OPENSSL_SSL_H",
39 ]
40}
41
42config("no_openssl_config") {
43 defines = [
44 "SSL_USE_NSS",
45 "HAVE_NSS_SSL_H",
46 "SSL_USE_NSS_RNG",
47 ]
48}
49
50config("android_config") {
51 defines = [ "HAVE_OPENSSL_SSL_H" ]
52}
53
54config("no_android_config") {
55 defines = [
56 "HAVE_NSS_SSL_H",
57 "SSL_USE_NSS_RNG",
58 ]
59}
60
61config("ios_config") {
62 ldflags = [
63 #"Foundation.framework", # Already included in //build/config:default_libs.
64 "Security.framework",
65 "SystemConfiguration.framework",
66 #"UIKit.framework", # Already included in //build/config:default_libs.
67 ]
68}
69
70config("mac_config") {
71 ldflags = [
72 "Cocoa.framework",
73 #"Foundation.framework", # Already included in //build/config:default_libs.
74 #"IOKit.framework", # Already included in //build/config:default_libs.
75 #"Security.framework", # Already included in //build/config:default_libs.
76 "SystemConfiguration.framework",
77 ]
78}
79
80config("mac_x86_config") {
81 libs = [
82 #"Carbon.framework", # Already included in //build/config:default_libs.
83 ]
84}
85
86config("linux_system_ssl_config") {
87 visibility = ":*" # Only targets in this file can depend on this.
88
89 # TODO(kjellander): Find out how to convert GYP include_dirs+ (i.e. insert
90 # first in the include path?).
91 include_dirs = [ "//net/third_party/nss/ssl" ]
92
93 configs = [ "//third_party/nss:system_nss_no_ssl_config" ]
94}
95
96# Provides the same functionality as the build/linux/system.gyp:ssl GYP target.
97# This cannot be in build/linux/BUILD.gn since targets in build/ are not allowed
98# to depend on targets outside of it. This could be replaced by the Chromium
99# //crypto:platform target, but as WebRTC currently don't sync src/crypto from
100# Chromium, it is not possible today.
101config("linux_system_ssl") {
102 if (use_openssl) {
103 deps = [ "//third_party/openssl" ]
104 } else {
105 deps = [ "//net/third_party/nss/ssl:libssl" ]
106
107 direct_dependent_configs = [
108 ":linux_system_ssl_config",
109 ]
110
111 if (is_clang) {
112 cflags = [
113 # There is a broken header guard in /usr/include/nss/secmod.h:
114 # https://bugzilla.mozilla.org/show_bug.cgi?id=884072
115 "-Wno-header-guard",
116 ]
117 }
118 }
119}
120
121static_library("webrtc_base") {
122 cflags = []
123 cflags_cc = []
124
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000125 configs += [
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000126 "..:common_config",
127 ":webrtc_base_config",
128 ]
129
130 direct_dependent_configs = [
131 "..:common_inherited_config",
132 ":webrtc_base_config",
133 ]
134
135 defines = [
136 "LOGGING=1",
137 "USE_WEBRTC_DEV_BRANCH",
138 ]
139
140 sources = [
141 "asyncfile.cc",
142 "asyncfile.h",
143 "asynchttprequest.cc",
144 "asynchttprequest.h",
145 "asyncinvoker.cc",
146 "asyncinvoker.h",
147 "asyncinvoker-inl.h",
148 "asyncpacketsocket.h",
149 "asyncresolverinterface.h",
150 "asyncsocket.cc",
151 "asyncsocket.h",
152 "asynctcpsocket.cc",
153 "asynctcpsocket.h",
154 "asyncudpsocket.cc",
155 "asyncudpsocket.h",
156 "atomicops.h",
157 "autodetectproxy.cc",
158 "autodetectproxy.h",
159 "bandwidthsmoother.cc",
160 "bandwidthsmoother.h",
161 "base64.cc",
162 "base64.h",
163 "basicdefs.h",
164 "basictypes.h",
165 "bind.h",
166 "bind.h.pump",
167 "buffer.h",
168 "bytebuffer.cc",
169 "bytebuffer.h",
170 "byteorder.h",
171 "callback.h",
172 "callback.h.pump",
173 "checks.cc",
174 "checks.h",
175 "common.cc",
176 "common.h",
177 "constructormagic.h",
178 "cpumonitor.cc",
179 "cpumonitor.h",
180 "crc32.cc",
181 "crc32.h",
182 "criticalsection.h",
183 "cryptstring.h",
184 "dbus.cc",
185 "dbus.h",
186 "diskcache.cc",
187 "diskcache.h",
188 "event.cc",
189 "event.h",
190 "filelock.cc",
191 "filelock.h",
192 "fileutils.cc",
193 "fileutils.h",
194 "fileutils_mock.h",
195 "firewallsocketserver.cc",
196 "firewallsocketserver.h",
197 "flags.cc",
198 "flags.h",
199 "genericslot.h",
200 "genericslot.h.pump",
201 "gunit_prod.h",
202 "helpers.cc",
203 "helpers.h",
204 "httpbase.cc",
205 "httpbase.h",
206 "httpclient.cc",
207 "httpclient.h",
208 "httpcommon-inl.h",
209 "httpcommon.cc",
210 "httpcommon.h",
211 "httprequest.cc",
212 "httprequest.h",
213 "httpserver.cc",
214 "httpserver.h",
215 "ifaddrs-android.cc",
216 "ifaddrs-android.h",
217 "iosfilesystem.mm",
218 "ipaddress.cc",
219 "ipaddress.h",
220 "json.cc",
221 "json.h",
222 "latebindingsymboltable.cc",
223 "latebindingsymboltable.cc.def",
224 "latebindingsymboltable.h",
225 "latebindingsymboltable.h.def",
226 "libdbusglibsymboltable.cc",
227 "libdbusglibsymboltable.h",
228 "linux.cc",
229 "linux.h",
230 "linuxfdwalk.c",
231 "linuxfdwalk.h",
232 "linuxwindowpicker.cc",
233 "linuxwindowpicker.h",
234 "linked_ptr.h",
235 "logging.cc",
236 "logging.h",
237 "macasyncsocket.cc",
238 "macasyncsocket.h",
239 "maccocoasocketserver.h",
240 "maccocoasocketserver.mm",
241 "maccocoathreadhelper.h",
242 "maccocoathreadhelper.mm",
243 "macconversion.cc",
244 "macconversion.h",
245 "macsocketserver.cc",
246 "macsocketserver.h",
247 "macutils.cc",
248 "macutils.h",
249 "macwindowpicker.cc",
250 "macwindowpicker.h",
251 "mathutils.h",
252 "md5.cc",
253 "md5.h",
254 "md5digest.h",
255 "messagedigest.cc",
256 "messagedigest.h",
257 "messagehandler.cc",
258 "messagehandler.h",
259 "messagequeue.cc",
260 "messagequeue.h",
261 "multipart.cc",
262 "multipart.h",
263 "natserver.cc",
264 "natserver.h",
265 "natsocketfactory.cc",
266 "natsocketfactory.h",
267 "nattypes.cc",
268 "nattypes.h",
269 "nethelpers.cc",
270 "nethelpers.h",
271 "network.cc",
272 "network.h",
273 "nssidentity.cc",
274 "nssidentity.h",
275 "nssstreamadapter.cc",
276 "nssstreamadapter.h",
277 "nullsocketserver.h",
278 "openssl.h",
279 "openssladapter.cc",
280 "openssladapter.h",
281 "openssldigest.cc",
282 "openssldigest.h",
283 "opensslidentity.cc",
284 "opensslidentity.h",
285 "opensslstreamadapter.cc",
286 "opensslstreamadapter.h",
287 "optionsfile.cc",
288 "optionsfile.h",
289 "pathutils.cc",
290 "pathutils.h",
291 "physicalsocketserver.cc",
292 "physicalsocketserver.h",
293 "posix.cc",
294 "posix.h",
295 "profiler.cc",
296 "profiler.h",
297 "proxydetect.cc",
298 "proxydetect.h",
299 "proxyinfo.cc",
300 "proxyinfo.h",
301 "proxyserver.cc",
302 "proxyserver.h",
303 "ratelimiter.cc",
304 "ratelimiter.h",
305 "ratetracker.cc",
306 "ratetracker.h",
307 "refcount.h",
308 "referencecountedsingletonfactory.h",
309 "rollingaccumulator.h",
310 "schanneladapter.cc",
311 "schanneladapter.h",
312 "scoped_autorelease_pool.h",
313 "scoped_autorelease_pool.mm",
314 "scoped_ptr.h",
315 "scoped_ref_ptr.h",
316 "scopedptrcollection.h",
317 "sec_buffer.h",
318 "sha1.cc",
319 "sha1.h",
320 "sha1digest.h",
321 "sharedexclusivelock.cc",
322 "sharedexclusivelock.h",
323 "signalthread.cc",
324 "signalthread.h",
325 "sigslot.h",
326 "sigslotrepeater.h",
327 "socket.h",
328 "socketadapters.cc",
329 "socketadapters.h",
330 "socketaddress.cc",
331 "socketaddress.h",
332 "socketaddresspair.cc",
333 "socketaddresspair.h",
334 "socketfactory.h",
335 "socketpool.cc",
336 "socketpool.h",
337 "socketserver.h",
338 "socketstream.cc",
339 "socketstream.h",
340 "ssladapter.cc",
341 "ssladapter.h",
342 "sslconfig.h",
343 "sslfingerprint.cc",
344 "sslfingerprint.h",
345 "sslidentity.cc",
346 "sslidentity.h",
347 "sslroots.h",
348 "sslsocketfactory.cc",
349 "sslsocketfactory.h",
350 "sslstreamadapter.cc",
351 "sslstreamadapter.h",
352 "sslstreamadapterhelper.cc",
353 "sslstreamadapterhelper.h",
354 "stream.cc",
355 "stream.h",
356 "stringdigest.h",
357 "stringencode.cc",
358 "stringencode.h",
359 "stringutils.cc",
360 "stringutils.h",
361 "systeminfo.cc",
362 "systeminfo.h",
363 "task.cc",
364 "task.h",
365 "taskparent.cc",
366 "taskparent.h",
367 "taskrunner.cc",
368 "taskrunner.h",
369 "testclient.cc",
370 "testclient.h",
371 "thread.cc",
372 "thread.h",
373 "timeutils.cc",
374 "timeutils.h",
375 "timing.cc",
376 "timing.h",
377 "transformadapter.cc",
378 "transformadapter.h",
379 "unixfilesystem.cc",
380 "unixfilesystem.h",
381 "urlencode.cc",
382 "urlencode.h",
383 "versionparsing.cc",
384 "versionparsing.h",
385 "virtualsocketserver.cc",
386 "virtualsocketserver.h",
387 "win32.cc",
388 "win32.h",
389 "win32filesystem.cc",
390 "win32filesystem.h",
391 "win32regkey.cc",
392 "win32regkey.h",
393 "win32securityerrors.cc",
394 "win32socketinit.cc",
395 "win32socketinit.h",
396 "win32socketserver.cc",
397 "win32socketserver.h",
398 "win32window.cc",
399 "win32window.h",
400 "win32windowpicker.cc",
401 "win32windowpicker.h",
402 "window.h",
403 "windowpicker.h",
404 "windowpickerfactory.h",
405 "winfirewall.cc",
406 "winfirewall.h",
407 "winping.cc",
408 "winping.h",
409 "worker.cc",
410 "worker.h",
411 ]
412
413 if (build_with_chromium) {
414 sources += [
415 "../overrides/webrtc/base/basictypes.h",
416 "../overrides/webrtc/base/constructormagic.h",
417 "../overrides/webrtc/base/logging.cc",
418 "../overrides/webrtc/base/logging.h",
419 ]
420 if (is_win) {
421 sources += [ "../overrides/webrtc/base/win32socketinit.cc" ]
422 }
423 sources -= [
424 "asyncinvoker.cc",
425 "asyncinvoker.h",
426 "asyncinvoker-inl.h",
427 "asyncresolverinterface.h",
428 "atomicops.h",
429 "bandwidthsmoother.cc",
430 "bandwidthsmoother.h",
431 "basictypes.h",
432 "bind.h",
433 "bind.h.pump",
434 "buffer.h",
435 "callback.h",
436 "callback.h.pump",
437 "constructormagic.h",
438 "dbus.cc",
439 "dbus.h",
440 "filelock.cc",
441 "filelock.h",
442 "fileutils_mock.h",
443 "genericslot.h",
444 "genericslot.h.pump",
445 "httpserver.cc",
446 "httpserver.h",
447 "json.cc",
448 "json.h",
449 "latebindingsymboltable.cc",
450 "latebindingsymboltable.cc.def",
451 "latebindingsymboltable.h",
452 "latebindingsymboltable.h.def",
453 "libdbusglibsymboltable.cc",
454 "libdbusglibsymboltable.h",
455 "linuxfdwalk.c",
456 "linuxfdwalk.h",
457 "linuxwindowpicker.cc",
458 "linuxwindowpicker.h",
459 "logging.cc",
460 "logging.h",
461 #"macasyncsocket.cc",
462 #"macasyncsocket.h",
463 #"maccocoasocketserver.h",
464 #"maccocoasocketserver.mm",
465 #"macsocketserver.cc",
466 #"macsocketserver.h",
467 #"macwindowpicker.cc",
468 #"macwindowpicker.h",
469 "mathutils.h",
470 "multipart.cc",
471 "multipart.h",
472 "natserver.cc",
473 "natserver.h",
474 "natsocketfactory.cc",
475 "natsocketfactory.h",
476 "nattypes.cc",
477 "nattypes.h",
478 "openssl.h",
479 "optionsfile.cc",
480 "optionsfile.h",
481 "posix.cc",
482 "posix.h",
483 "profiler.cc",
484 "profiler.h",
485 "proxyserver.cc",
486 "proxyserver.h",
487 "refcount.h",
488 "referencecountedsingletonfactory.h",
489 "rollingaccumulator.h",
490 #"safe_conversions.h",
491 #"safe_conversions_impl.h",
492 "scopedptrcollection.h",
493 "scoped_ref_ptr.h",
494 "sec_buffer.h",
495 "sharedexclusivelock.cc",
496 "sharedexclusivelock.h",
497 "sslconfig.h",
498 "sslroots.h",
499 "stringdigest.h",
500 #"testbase64.h",
501 "testclient.cc",
502 "testclient.h",
503 #"testutils.h",
504 "transformadapter.cc",
505 "transformadapter.h",
506 "versionparsing.cc",
507 "versionparsing.h",
508 "virtualsocketserver.cc",
509 "virtualsocketserver.h",
510 #"win32regkey.cc",
511 #"win32regkey.h",
512 #"win32socketinit.cc",
513 #"win32socketinit.h",
514 #"win32socketserver.cc",
515 #"win32socketserver.h",
516 #"win32toolhelp.h",
517 "window.h",
518 "windowpickerfactory.h",
519 "windowpicker.h",
520 ]
521
522 include_dirs = [
523 "../overrides",
524 "../../openssl/openssl/include",
525 ]
526
527 direct_dependent_configs += [ ":webrtc_base_chromium_config" ]
528 } else {
529 if (is_win) {
530 sources += [
531 "diskcache_win32.cc",
532 "diskcache_win32.h",
533 ]
534 }
535
536 deps = [ "//third_party/jsoncpp" ]
537 }
538
539 # TODO(henrike): issue 3307, make webrtc_base build without disabling
540 # these flags.
541 cflags += [
542 "-Wno-extra",
543 "-Wno-all",
544 ]
545 cflags_cc += [ "-Wno-non-virtual-dtor" ]
546
547 if (use_openssl) {
548 direct_dependent_configs += [ ":openssl_config" ]
549
550 deps = [ "//third_party/openssl" ]
551 } else {
552 direct_dependent_configs += [ ":no_openssl_config" ]
553 }
554
555 if (is_android) {
556 direct_dependent_configs += [ ":android_config" ]
557
558 libs = [
559 "log",
560 "GLESv2"
561 ]
562 } else {
563 direct_dependent_configs += [ ":no_android_config" ]
564
565 sources -= [
566 "ifaddrs-android.cc",
567 "ifaddrs-android.h",
568 ]
569 }
570
571 if (is_ios) {
572 all_dependent_configs += [ ":ios_config" ]
573
574 deps = [ "//net/third_party/nss/ssl:libssl" ]
575 }
576
577 if (is_linux) {
578 libs = [
579 "crypto",
580 "dl",
581 "rt",
582 "Xext",
583 "X11",
584 "Xcomposite",
585 "Xrender",
586 ]
587 configs += [ "//third_party/nss:system_nss_no_ssl_config" ]
588 } else {
589 sources -= [
590 "dbus.cc",
591 "dbus.h",
592 "libdbusglibsymboltable.cc",
593 "libdbusglibsymboltable.h",
594 "linuxfdwalk.c",
595 "linuxfdwalk.h",
596 "linuxwindowpicker.cc",
597 "linuxwindowpicker.h",
598 ]
599 }
600
601 if (is_mac) {
602 all_dependent_configs = [ ":mac_config" ]
603
604 libs = [
605 "crypto", # $(SDKROOT)/usr/lib/libcrypto.dylib
606 "ssl", # $(SDKROOT)/usr/lib/libssl.dylib
607 ]
608 if (cpu_arch == "x86") {
609 all_dependent_configs += [ ":mac_x86_config" ]
610 }
611 } else {
612 sources -= [
613 "macasyncsocket.cc",
614 "macasyncsocket.h",
615 "maccocoasocketserver.h",
616 #"maccocoasocketserver.mm", # Seems to be excluded by default with GN.
617 "macconversion.cc",
618 "macconversion.h",
619 "macsocketserver.cc",
620 "macsocketserver.h",
621 "macutils.cc",
622 "macutils.h",
623 "macwindowpicker.cc",
624 "macwindowpicker.h",
625 ]
626 }
627
628 if (is_win) {
629 libs = [
630 "crypt32.lib",
631 "iphlpapi.lib",
632 "secur32.lib",
633 ]
634
635 cflags += [
636 # Suppress warnings about WIN32_LEAN_AND_MEAN.
637 "/wd4005",
638 "/wd4703",
639 ]
640
641 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
642 } else {
643 sources -= [
644 "schanneladapter.cc",
645 "schanneladapter.h",
646 "winping.cc",
647 "winping.h",
648 "winfirewall.cc",
649 "winfirewall.h",
650 # The files below were covered by a regex exclude in GYP.
651 "win32.cc",
652 "win32.h",
653 "win32filesystem.cc",
654 "win32filesystem.h",
655 "win32regkey.cc",
656 "win32regkey.h",
657 "win32securityerrors.cc",
658 "win32socketinit.cc",
659 "win32socketinit.h",
660 "win32socketserver.cc",
661 "win32socketserver.h",
662 "win32window.cc",
663 "win32window.h",
664 "win32windowpicker.cc",
665 "win32windowpicker.h",
666 ]
667 }
668
669 if (is_posix) {
670 if (is_debug) {
671 defines += [ "_DEBUG" ]
672 }
673 } else {
674 sources -= [
675 "latebindingsymboltable.cc",
676 "latebindingsymboltable.h",
677 "posix.cc",
678 "posix.h",
679 "unixfilesystem.cc",
680 "unixfilesystem.h",
681 ]
682 }
683
684 if (is_ios || (is_mac && cpu_arch != "x86")) {
685 defines += [ "CARBON_DEPRECATED=YES" ]
686 }
687
688 if (is_ios || !is_posix) {
689 sources -= [
690 "openssl.h",
691 "openssladapter.cc",
692 "openssladapter.h",
693 "openssldigest.cc",
694 "openssldigest.h",
695 "opensslidentity.cc",
696 "opensslidentity.h",
697 "opensslstreamadapter.cc",
698 "opensslstreamadapter.h",
699 ]
700 }
701
702 if (!is_linux && !is_android) {
703 sources -= [
704 "linux.cc",
705 "linux.h",
706 ]
707 }
708
709 if (is_mac || is_ios || is_win) {
710 deps += [
711 "//net/third_party/nss/ssl:libssl",
712 "//third_party/nss:nspr",
713 "//third_party/nss:nss",
714 ]
715 }
716
717 if (is_posix && !is_mac && !is_ios && !is_android) {
718 configs += [ ":linux_system_ssl" ]
719 }
720}