1# 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/config/ui.gni") 11import("../build/webrtc.gni") 12 13config("webrtc_base_config") { 14 include_dirs = [ 15 "//third_party/jsoncpp/overrides/include", 16 "//third_party/jsoncpp/source/include", 17 ] 18 19 defines = [ 20 "FEATURE_ENABLE_SSL", 21 "LOGGING=1", 22 "USE_WEBRTC_DEV_BRANCH", 23 ] 24 25 # TODO(henrike): issue 3307, make webrtc_base build without disabling 26 # these flags. 27 cflags_cc = [ "-Wno-non-virtual-dtor" ] 28} 29 30config("webrtc_base_chromium_config") { 31 defines = [ 32 "NO_MAIN_THREAD_WRAPPING", 33 ] 34} 35 36config("openssl_config") { 37 defines = [ 38 "SSL_USE_OPENSSL", 39 "HAVE_OPENSSL_SSL_H", 40 ] 41} 42 43config("no_openssl_config") { 44 defines = [ 45 "SSL_USE_NSS", 46 "HAVE_NSS_SSL_H", 47 "SSL_USE_NSS_RNG", 48 ] 49} 50 51config("ios_config") { 52 ldflags = [ 53 #"Foundation.framework", # Already included in //build/config:default_libs. 54 "Security.framework", 55 "SystemConfiguration.framework", 56 #"UIKit.framework", # Already included in //build/config:default_libs. 57 ] 58} 59 60config("mac_config") { 61 ldflags = [ 62 "Cocoa.framework", 63 #"Foundation.framework", # Already included in //build/config:default_libs. 64 #"IOKit.framework", # Already included in //build/config:default_libs. 65 #"Security.framework", # Already included in //build/config:default_libs. 66 "SystemConfiguration.framework", 67 ] 68} 69 70config("mac_x86_config") { 71 libs = [ 72 #"Carbon.framework", # Already included in //build/config:default_libs. 73 ] 74} 75 76if (is_linux && !build_with_chromium) { 77 # Provides the same functionality as the //crypto:platform target, which 78 # WebRTC cannot use as we don't sync src/crypto from Chromium. 79 group("linux_system_ssl") { 80 if (use_openssl) { 81 deps = [ "//third_party/boringssl" ] 82 } else { 83 deps = [ "//net/third_party/nss/ssl:libssl" ] 84 85 direct_dependent_configs = [ 86 "//net/third_party/nss/ssl:ssl_config", 87 "//third_party/nss:system_nss_no_ssl_config", 88 ] 89 } 90 } 91} 92 93if (rtc_build_ssl == 0) { 94 config("external_ssl_library") { 95 assert(rtc_ssl_root != "", 96 "You must specify rtc_ssl_root when rtc_build_ssl==0.") 97 include_dirs = [ rtc_ssl_root ] 98 } 99} 100 101# The subset of rtc_base approved for use outside of libjingle. 102static_library("rtc_base_approved") { 103 configs += [ "..:common_config" ] 104 direct_dependent_configs = [ "..:common_inherited_config" ] 105 106 sources = [ 107 "checks.cc", 108 "checks.h", 109 "exp_filter.cc", 110 "exp_filter.h", 111 "md5.cc", 112 "md5.h", 113 "md5digest.h", 114 "platform_file.cc", 115 "platform_file.h", 116 "stringencode.cc", 117 "stringencode.h", 118 "stringutils.cc", 119 "stringutils.h", 120 "thread_annotations.h", 121 "timeutils.cc", 122 "timeutils.h", 123 ] 124} 125 126static_library("webrtc_base") { 127 cflags = [] 128 cflags_cc = [] 129 libs = [] 130 deps = [ 131 ":rtc_base_approved", 132 ] 133 134 configs += [ 135 "..:common_config", 136 ":webrtc_base_config", 137 ] 138 139 direct_dependent_configs = [ 140 "..:common_inherited_config", 141 ":webrtc_base_config", 142 ] 143 144 defines = [ 145 "LOGGING=1", 146 "USE_WEBRTC_DEV_BRANCH", 147 ] 148 149 sources = [ 150 "asyncfile.cc", 151 "asyncfile.h", 152 "asynchttprequest.cc", 153 "asynchttprequest.h", 154 "asyncpacketsocket.h", 155 "asyncsocket.cc", 156 "asyncsocket.h", 157 "asynctcpsocket.cc", 158 "asynctcpsocket.h", 159 "asyncudpsocket.cc", 160 "asyncudpsocket.h", 161 "autodetectproxy.cc", 162 "autodetectproxy.h", 163 "base64.cc", 164 "base64.h", 165 "basicdefs.h", 166 "bytebuffer.cc", 167 "bytebuffer.h", 168 "byteorder.h", 169 "common.cc", 170 "common.h", 171 "cpumonitor.cc", 172 "cpumonitor.h", 173 "crc32.cc", 174 "crc32.h", 175 "criticalsection.h", 176 "cryptstring.h", 177 "diskcache.cc", 178 "diskcache.h", 179 "event.cc", 180 "event.h", 181 "fileutils.cc", 182 "fileutils.h", 183 "firewallsocketserver.cc", 184 "firewallsocketserver.h", 185 "flags.cc", 186 "flags.h", 187 "gunit_prod.h", 188 "helpers.cc", 189 "helpers.h", 190 "httpbase.cc", 191 "httpbase.h", 192 "httpclient.cc", 193 "httpclient.h", 194 "httpcommon-inl.h", 195 "httpcommon.cc", 196 "httpcommon.h", 197 "httprequest.cc", 198 "httprequest.h", 199 "iosfilesystem.mm", 200 "ipaddress.cc", 201 "ipaddress.h", 202 "linked_ptr.h", 203 "mathutils.h", 204 "messagedigest.cc", 205 "messagedigest.h", 206 "messagehandler.cc", 207 "messagehandler.h", 208 "messagequeue.cc", 209 "messagequeue.h", 210 "nethelpers.cc", 211 "nethelpers.h", 212 "network.cc", 213 "network.h", 214 "nullsocketserver.h", 215 "pathutils.cc", 216 "pathutils.h", 217 "physicalsocketserver.cc", 218 "physicalsocketserver.h", 219 "proxydetect.cc", 220 "proxydetect.h", 221 "proxyinfo.cc", 222 "proxyinfo.h", 223 "ratelimiter.cc", 224 "ratelimiter.h", 225 "ratetracker.cc", 226 "ratetracker.h", 227 "safe_conversions.h", 228 "safe_conversions_impl.h", 229 "scoped_autorelease_pool.h", 230 "scoped_autorelease_pool.mm", 231 "scoped_ptr.h", 232 "sha1.cc", 233 "sha1.h", 234 "sha1digest.h", 235 "signalthread.cc", 236 "signalthread.h", 237 "sigslot.h", 238 "sigslotrepeater.h", 239 "socket.h", 240 "socketadapters.cc", 241 "socketadapters.h", 242 "socketaddress.cc", 243 "socketaddress.h", 244 "socketaddresspair.cc", 245 "socketaddresspair.h", 246 "socketfactory.h", 247 "socketpool.cc", 248 "socketpool.h", 249 "socketserver.h", 250 "socketstream.cc", 251 "socketstream.h", 252 "ssladapter.cc", 253 "ssladapter.h", 254 "sslfingerprint.cc", 255 "sslfingerprint.h", 256 "sslidentity.cc", 257 "sslidentity.h", 258 "sslsocketfactory.cc", 259 "sslsocketfactory.h", 260 "sslstreamadapter.cc", 261 "sslstreamadapter.h", 262 "sslstreamadapterhelper.cc", 263 "sslstreamadapterhelper.h", 264 "stream.cc", 265 "stream.h", 266 "systeminfo.cc", 267 "systeminfo.h", 268 "task.cc", 269 "task.h", 270 "taskparent.cc", 271 "taskparent.h", 272 "taskrunner.cc", 273 "taskrunner.h", 274 "thread.cc", 275 "thread.h", 276 "thread_checker.h", 277 "thread_checker_impl.cc", 278 "thread_checker_impl.h", 279 "timing.cc", 280 "timing.h", 281 "urlencode.cc", 282 "urlencode.h", 283 "worker.cc", 284 "worker.h", 285 ] 286 287 if (is_posix) { 288 sources += [ 289 "unixfilesystem.cc", 290 "unixfilesystem.h", 291 ] 292 } 293 294 if (build_with_chromium) { 295 sources += [ 296 "../overrides/webrtc/base/basictypes.h", 297 "../overrides/webrtc/base/constructormagic.h", 298 "../overrides/webrtc/base/logging.cc", 299 "../overrides/webrtc/base/logging.h", 300 ] 301 302 if (is_win) { 303 sources += [ "../overrides/webrtc/base/win32socketinit.cc" ] 304 } 305 306 include_dirs = [ 307 "../overrides", 308 "../../boringssl/src/include", 309 ] 310 311 direct_dependent_configs += [ ":webrtc_base_chromium_config" ] 312 } else { 313 sources += [ 314 "asyncinvoker.cc", 315 "asyncinvoker.h", 316 "asyncinvoker-inl.h", 317 "asyncresolverinterface.h", 318 "atomicops.h", 319 "bandwidthsmoother.cc", 320 "bandwidthsmoother.h", 321 "basictypes.h", 322 "bind.h", 323 "bind.h.pump", 324 "buffer.h", 325 "callback.h", 326 "callback.h.pump", 327 "constructormagic.h", 328 "filelock.cc", 329 "filelock.h", 330 "fileutils_mock.h", 331 "genericslot.h", 332 "genericslot.h.pump", 333 "httpserver.cc", 334 "httpserver.h", 335 "json.cc", 336 "json.h", 337 "logging.cc", 338 "logging.h", 339 "mathutils.h", 340 "multipart.cc", 341 "multipart.h", 342 "natserver.cc", 343 "natserver.h", 344 "natsocketfactory.cc", 345 "natsocketfactory.h", 346 "nattypes.cc", 347 "nattypes.h", 348 "optionsfile.cc", 349 "optionsfile.h", 350 "profiler.cc", 351 "profiler.h", 352 "proxyserver.cc", 353 "proxyserver.h", 354 "refcount.h", 355 "referencecountedsingletonfactory.h", 356 "rollingaccumulator.h", 357 "scopedptrcollection.h", 358 "scoped_ref_ptr.h", 359 "sec_buffer.h", 360 "sharedexclusivelock.cc", 361 "sharedexclusivelock.h", 362 "sslconfig.h", 363 "sslroots.h", 364 "stringdigest.h", 365 "testclient.cc", 366 "testclient.h", 367 "transformadapter.cc", 368 "transformadapter.h", 369 "versionparsing.cc", 370 "versionparsing.h", 371 "virtualsocketserver.cc", 372 "virtualsocketserver.h", 373 "window.h", 374 "windowpickerfactory.h", 375 "windowpicker.h", 376 ] 377 378 if (is_posix) { 379 sources += [ 380 "latebindingsymboltable.cc", 381 "latebindingsymboltable.cc.def", 382 "latebindingsymboltable.h", 383 "latebindingsymboltable.h.def", 384 "posix.cc", 385 "posix.h", 386 ] 387 } 388 389 if (is_linux) { 390 sources += [ 391 "dbus.cc", 392 "dbus.h", 393 "libdbusglibsymboltable.cc", 394 "libdbusglibsymboltable.h", 395 "linuxfdwalk.c", 396 "linuxfdwalk.h", 397 ] 398 } 399 400 if (is_mac) { 401 sources += [ 402 "macasyncsocket.cc", 403 "macasyncsocket.h", 404 "maccocoasocketserver.h", 405 "maccocoasocketserver.mm", 406 "macsocketserver.cc", 407 "macsocketserver.h", 408 "macwindowpicker.cc", 409 "macwindowpicker.h", 410 ] 411 } 412 413 if (is_win) { 414 sources += [ 415 "diskcache_win32.cc", 416 "diskcache_win32.h", 417 "win32regkey.cc", 418 "win32regkey.h", 419 "win32socketinit.cc", 420 "win32socketinit.h", 421 "win32socketserver.cc", 422 "win32socketserver.h", 423 ] 424 } 425 if (rtc_build_json) { 426 deps += [ "//third_party/jsoncpp" ] 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 } # !build_with_chromium 435 436 if (is_clang) { 437 # Suppress warnings from the Chrome Clang plugins. 438 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. 439 configs -= [ "//build/config/clang:find_bad_constructs" ] 440 } 441 442 # TODO(henrike): issue 3307, make webrtc_base build with the Chromium default 443 # compiler settings. 444 configs -= [ "//build/config/compiler:chromium_code" ] 445 configs += [ "//build/config/compiler:no_chromium_code" ] 446 cflags += [ "-Wno-uninitialized" ] 447 cflags_cc += [ "-Wno-non-virtual-dtor" ] 448 449 if (use_openssl) { 450 direct_dependent_configs += [ ":openssl_config" ] 451 if (rtc_build_ssl) { 452 deps += [ "//third_party/boringssl" ] 453 } else { 454 configs += [ "external_ssl_library" ] 455 } 456 sources += [ 457 "openssl.h", 458 "openssladapter.cc", 459 "openssladapter.h", 460 "openssldigest.cc", 461 "openssldigest.h", 462 "opensslidentity.cc", 463 "opensslidentity.h", 464 "opensslstreamadapter.cc", 465 "opensslstreamadapter.h", 466 ] 467 } else { 468 direct_dependent_configs += [ ":no_openssl_config" ] 469 sources += [ 470 "nssidentity.cc", 471 "nssidentity.h", 472 "nssstreamadapter.cc", 473 "nssstreamadapter.h", 474 ] 475 if (is_mac || is_ios || is_win) { 476 if (rtc_build_ssl) { 477 deps += [ 478 "//net/third_party/nss/ssl:libssl", 479 "//third_party/nss:nspr", 480 "//third_party/nss:nss", 481 ] 482 } else { 483 configs += [ "external_ssl_library" ] 484 } 485 } 486 } 487 488 if (is_android) { 489 sources += [ 490 "ifaddrs-android.cc", 491 "ifaddrs-android.h", 492 ] 493 494 libs += [ 495 "log", 496 "GLESv2" 497 ] 498 } 499 500 if (is_ios) { 501 all_dependent_configs += [ ":ios_config" ] 502 } 503 504 if (use_x11) { 505 sources += [ 506 "x11windowpicker.cc", 507 "x11windowpicker.h", 508 ] 509 libs += [ 510 "dl", 511 "rt", 512 "Xext", 513 "X11", 514 "Xcomposite", 515 "Xrender", 516 ] 517 } 518 519 if (is_linux) { 520 libs += [ 521 "crypto", 522 "dl", 523 "rt", 524 ] 525 if (rtc_build_ssl) { 526 configs += [ "//third_party/nss:system_nss_no_ssl_config" ] 527 } 528 } 529 530 if (is_mac) { 531 sources += [ 532 "maccocoathreadhelper.h", 533 "maccocoathreadhelper.mm", 534 "macconversion.cc", 535 "macconversion.h", 536 "macutils.cc", 537 "macutils.h", 538 ] 539 540 all_dependent_configs = [ ":mac_config" ] 541 542 if (cpu_arch == "x86") { 543 all_dependent_configs += [ ":mac_x86_config" ] 544 } 545 } 546 547 if (is_win) { 548 sources += [ 549 "schanneladapter.cc", 550 "schanneladapter.h", 551 "win32.cc", 552 "win32.h", 553 "win32filesystem.cc", 554 "win32filesystem.h", 555 "win32securityerrors.cc", 556 "win32window.cc", 557 "win32window.h", 558 "win32windowpicker.cc", 559 "win32windowpicker.h", 560 "winfirewall.cc", 561 "winfirewall.h", 562 "winping.cc", 563 "winping.h", 564 ] 565 566 libs += [ 567 "crypt32.lib", 568 "iphlpapi.lib", 569 "secur32.lib", 570 ] 571 572 cflags += [ 573 # Suppress warnings about WIN32_LEAN_AND_MEAN. 574 "/wd4005", 575 "/wd4703", 576 ] 577 578 defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ] 579 } 580 581 if (is_posix && is_debug) { 582 # The Chromium build/common.gypi defines this for all posix 583 # _except_ for ios & mac. We want it there as well, e.g. 584 # because ASSERT and friends trigger off of it. 585 defines += [ "_DEBUG" ] 586 } 587 588 if (is_ios || (is_mac && cpu_arch != "x86")) { 589 defines += [ "CARBON_DEPRECATED=YES" ] 590 } 591 592 if (is_linux || is_android) { 593 sources += [ 594 "linux.cc", 595 "linux.h", 596 ] 597 } 598 599 if (is_posix && !is_mac && !is_ios && !is_android) { 600 if (build_with_chromium) { 601 deps += [ "//crypto:platform" ] 602 } else { 603 if (rtc_build_ssl) { 604 deps += [ ":linux_system_ssl" ] 605 } else { 606 configs += [ "external_ssl_library" ] 607 } 608 } 609 } 610} 611