blob: d4c5c0b416f72e226ee7e29f9869e425ac892c42 [file] [log] [blame]
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("//build/config/crypto.gni")
import("//build/config/ui.gni")
import("../build/webrtc.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
config("rtc_base_approved_all_dependent_config") {
if (is_mac && !build_with_chromium) {
libs = [ "Foundation.framework" ] # needed for logging_mac.mm
}
}
config("rtc_base_config") {
include_dirs = [
"//third_party/jsoncpp/overrides/include",
"//third_party/jsoncpp/source/include",
]
defines = [
"FEATURE_ENABLE_SSL",
"LOGGING=1",
]
}
config("rtc_base_chromium_config") {
defines = [ "NO_MAIN_THREAD_WRAPPING" ]
}
config("openssl_config") {
defines = [
"SSL_USE_OPENSSL",
"HAVE_OPENSSL_SSL_H",
]
}
config("rtc_base_all_dependent_config") {
if (is_ios) {
libs = [
"CFNetwork.framework",
#"Foundation.framework", # Already in //build/config:default_libs.
"Security.framework",
"SystemConfiguration.framework",
"UIKit.framework",
]
}
if (is_mac) {
libs = [
"Cocoa.framework",
"Foundation.framework",
"IOKit.framework",
"Security.framework",
"SystemConfiguration.framework",
]
}
}
if (is_linux && !build_with_chromium) {
# Provides the same functionality as the //crypto:platform target, which
# WebRTC cannot use as we don't sync src/crypto from Chromium.
group("linux_system_ssl") {
deps = [
"//third_party/boringssl",
]
}
}
if (!rtc_build_ssl) {
config("external_ssl_library") {
assert(rtc_ssl_root != "",
"You must specify rtc_ssl_root when rtc_build_ssl==0.")
include_dirs = [ rtc_ssl_root ]
}
}
# The subset of rtc_base approved for use outside of libjingle.
rtc_static_library("rtc_base_approved") {
defines = []
libs = []
deps = []
all_dependent_configs = [ ":rtc_base_approved_all_dependent_config" ]
sources = [
"array_view.h",
"arraysize.h",
"atomicops.h",
"bind.h",
"bitbuffer.cc",
"bitbuffer.h",
"buffer.h",
"bufferqueue.cc",
"bufferqueue.h",
"bytebuffer.cc",
"bytebuffer.h",
"byteorder.h",
"checks.cc",
"checks.h",
"constructormagic.h",
"copyonwritebuffer.cc",
"copyonwritebuffer.h",
"criticalsection.cc",
"criticalsection.h",
"deprecation.h",
"event.cc",
"event.h",
"event_tracer.cc",
"event_tracer.h",
"exp_filter.cc",
"exp_filter.h",
"file.cc",
"file.h",
"format_macros.h",
"location.cc",
"location.h",
"md5.cc",
"md5.h",
"md5digest.cc",
"md5digest.h",
"mod_ops.h",
"onetimeevent.h",
"optional.cc",
"optional.h",
"platform_file.cc",
"platform_file.h",
"platform_thread.cc",
"platform_thread.h",
"platform_thread_types.h",
"race_checker.cc",
"race_checker.h",
"random.cc",
"random.h",
"rate_limiter.cc",
"rate_limiter.h",
"rate_statistics.cc",
"rate_statistics.h",
"ratetracker.cc",
"ratetracker.h",
"refcount.h",
"safe_conversions.h",
"safe_conversions_impl.h",
"sanitizer.h",
"scoped_ref_ptr.h",
"stringencode.cc",
"stringencode.h",
"stringutils.cc",
"stringutils.h",
"swap_queue.h",
"systeminfo.cc",
"systeminfo.h",
"template_util.h",
"thread_annotations.h",
"thread_checker.h",
"thread_checker_impl.cc",
"thread_checker_impl.h",
"timestampaligner.cc",
"timestampaligner.h",
"timeutils.cc",
"timeutils.h",
"trace_event.h",
"type_traits.h",
]
if (is_android) {
libs += [ "log" ]
}
if (is_posix) {
sources += [ "file_posix.cc" ]
}
if (is_win) {
sources += [ "file_win.cc" ]
}
if (build_with_chromium) {
# Dependency on chromium's logging (in //base).
deps += [ "//base:base" ]
sources += [
"../../webrtc_overrides/webrtc/base/logging.cc",
"../../webrtc_overrides/webrtc/base/logging.h",
]
include_dirs = [ "../../webrtc_overrides" ]
} else {
sources += [
"logging.cc",
"logging.h",
"logging_mac.mm",
]
}
}
config("enable_libevent_config") {
defines = [ "WEBRTC_BUILD_LIBEVENT" ]
}
rtc_static_library("rtc_task_queue") {
public_deps = [
":rtc_base_approved",
]
sources = [
"sequenced_task_checker.h",
"sequenced_task_checker_impl.cc",
"sequenced_task_checker_impl.h",
]
if (build_with_chromium) {
sources += [
"../../webrtc_overrides/webrtc/base/task_queue.cc",
"../../webrtc_overrides/webrtc/base/task_queue.h",
]
include_dirs = [ "../../webrtc_overrides" ]
} else {
sources += [
"task_queue.h",
"task_queue_posix.h",
]
if (rtc_build_libevent) {
deps = [
"//base/third_party/libevent",
]
}
if (rtc_enable_libevent) {
sources += [
"task_queue_libevent.cc",
"task_queue_posix.cc",
]
all_dependent_configs = [ ":enable_libevent_config" ]
} else {
if (is_mac || is_ios) {
sources += [
"task_queue_gcd.cc",
"task_queue_posix.cc",
]
}
if (is_win) {
sources += [ "task_queue_win.cc" ]
}
}
}
}
config("rtc_base_warnings_config") {
if (is_win && is_clang) {
cflags = [
# Disable warnings failing when compiling with Clang on Windows.
# https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
"-Wno-sign-compare",
"-Wno-missing-braces",
]
}
}
rtc_static_library("rtc_base") {
cflags = []
cflags_cc = []
libs = []
deps = [
"..:webrtc_common",
]
public_deps = [
":rtc_base_approved",
]
configs += [
":openssl_config",
":rtc_base_config",
]
public_configs = [
":openssl_config",
":rtc_base_config",
]
all_dependent_configs = [ ":rtc_base_all_dependent_config" ]
defines = [ "LOGGING=1" ]
sources = [
"applefilesystem.mm",
"asyncfile.cc",
"asyncfile.h",
"asyncinvoker-inl.h",
"asyncinvoker.cc",
"asyncinvoker.h",
"asyncpacketsocket.cc",
"asyncpacketsocket.h",
"asyncresolverinterface.cc",
"asyncresolverinterface.h",
"asyncsocket.cc",
"asyncsocket.h",
"asynctcpsocket.cc",
"asynctcpsocket.h",
"asyncudpsocket.cc",
"asyncudpsocket.h",
"autodetectproxy.cc",
"autodetectproxy.h",
"base64.cc",
"base64.h",
"common.cc",
"common.h",
"crc32.cc",
"crc32.h",
"cryptstring.cc",
"cryptstring.h",
"diskcache.cc",
"diskcache.h",
"filerotatingstream.cc",
"filerotatingstream.h",
"fileutils.cc",
"fileutils.h",
"firewallsocketserver.cc",
"firewallsocketserver.h",
"flags.cc",
"flags.h",
"gunit_prod.h",
"helpers.cc",
"helpers.h",
"httpbase.cc",
"httpbase.h",
"httpclient.cc",
"httpclient.h",
"httpcommon-inl.h",
"httpcommon.cc",
"httpcommon.h",
"httprequest.cc",
"httprequest.h",
"ipaddress.cc",
"ipaddress.h",
"linked_ptr.h",
"messagedigest.cc",
"messagedigest.h",
"messagehandler.cc",
"messagehandler.h",
"messagequeue.cc",
"messagequeue.h",
"nethelpers.cc",
"nethelpers.h",
"network.cc",
"network.h",
"networkmonitor.cc",
"networkmonitor.h",
"nullsocketserver.cc",
"nullsocketserver.h",
"openssl.h",
"openssladapter.cc",
"openssladapter.h",
"openssldigest.cc",
"openssldigest.h",
"opensslidentity.cc",
"opensslidentity.h",
"opensslstreamadapter.cc",
"opensslstreamadapter.h",
"pathutils.cc",
"pathutils.h",
"physicalsocketserver.cc",
"physicalsocketserver.h",
"proxydetect.cc",
"proxydetect.h",
"proxyinfo.cc",
"proxyinfo.h",
"ratelimiter.cc",
"ratelimiter.h",
"rtccertificate.cc",
"rtccertificate.h",
"rtccertificategenerator.cc",
"rtccertificategenerator.h",
"sha1.cc",
"sha1.h",
"sha1digest.cc",
"sha1digest.h",
"sharedexclusivelock.cc",
"sharedexclusivelock.h",
"signalthread.cc",
"signalthread.h",
"sigslot.cc",
"sigslot.h",
"sigslotrepeater.h",
"socket.h",
"socketadapters.cc",
"socketadapters.h",
"socketaddress.cc",
"socketaddress.h",
"socketaddresspair.cc",
"socketaddresspair.h",
"socketfactory.h",
"socketpool.cc",
"socketpool.h",
"socketserver.h",
"socketstream.cc",
"socketstream.h",
"ssladapter.cc",
"ssladapter.h",
"sslfingerprint.cc",
"sslfingerprint.h",
"sslidentity.cc",
"sslidentity.h",
"sslsocketfactory.cc",
"sslsocketfactory.h",
"sslstreamadapter.cc",
"sslstreamadapter.h",
"stream.cc",
"stream.h",
"task.cc",
"task.h",
"taskparent.cc",
"taskparent.h",
"taskrunner.cc",
"taskrunner.h",
"thread.cc",
"thread.h",
"urlencode.cc",
"urlencode.h",
"worker.cc",
"worker.h",
]
# TODO(henrike): issue 3307, make rtc_base build with the Chromium default
# compiler settings.
suppressed_configs += [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
if (!is_win) {
cflags += [ "-Wno-uninitialized" ]
}
if (build_with_chromium) {
if (is_win) {
sources += [ "../../webrtc_overrides/webrtc/base/win32socketinit.cc" ]
}
include_dirs = [
"../../webrtc_overrides",
"../../boringssl/src/include",
]
public_configs += [ ":rtc_base_chromium_config" ]
} else {
configs += [ ":rtc_base_warnings_config" ]
sources += [
"bandwidthsmoother.cc",
"bandwidthsmoother.h",
"callback.h",
"fileutils_mock.h",
"httpserver.cc",
"httpserver.h",
"json.cc",
"json.h",
"logsinks.cc",
"logsinks.h",
"mathutils.h",
"multipart.cc",
"multipart.h",
"natserver.cc",
"natserver.h",
"natsocketfactory.cc",
"natsocketfactory.h",
"nattypes.cc",
"nattypes.h",
"optionsfile.cc",
"optionsfile.h",
"profiler.cc",
"profiler.h",
"proxyserver.cc",
"proxyserver.h",
"referencecountedsingletonfactory.h",
"rollingaccumulator.h",
"scopedptrcollection.h",
"sec_buffer.h",
"sslconfig.h",
"sslroots.h",
"testbase64.h",
"testclient.cc",
"testclient.h",
"transformadapter.cc",
"transformadapter.h",
"versionparsing.cc",
"versionparsing.h",
"virtualsocketserver.cc",
"virtualsocketserver.h",
"window.h",
"windowpicker.h",
"windowpickerfactory.h",
]
if (is_linux) {
sources += [
"dbus.cc",
"dbus.h",
"libdbusglibsymboltable.cc",
"libdbusglibsymboltable.h",
"linuxfdwalk.c",
"linuxfdwalk.h",
]
}
if (is_posix) {
sources += [
"latebindingsymboltable.cc",
"latebindingsymboltable.h",
"posix.cc",
"posix.h",
]
}
if (is_mac) {
sources += [
"macasyncsocket.cc",
"macasyncsocket.h",
"maccocoasocketserver.h",
"maccocoasocketserver.mm",
"macsocketserver.cc",
"macsocketserver.h",
"macwindowpicker.cc",
"macwindowpicker.h",
]
}
if (is_win) {
sources += [
"diskcache_win32.cc",
"diskcache_win32.h",
"win32regkey.cc",
"win32regkey.h",
"win32socketinit.cc",
"win32socketinit.h",
"win32socketserver.cc",
"win32socketserver.h",
]
}
if (rtc_build_json) {
deps += [ "//third_party/jsoncpp" ]
} else {
include_dirs = [ "$rtc_jsoncpp_root" ]
# When defined changes the include path for json.h to where it is
# expected to be when building json outside of the standalone build.
defines += [ "WEBRTC_EXTERNAL_JSON" ]
}
} # !build_with_chromium
if (rtc_build_ssl) {
deps += [ "//third_party/boringssl" ]
} else {
configs += [ ":external_ssl_library" ]
}
if (is_android) {
sources += [
"ifaddrs-android.cc",
"ifaddrs-android.h",
]
libs += [
"log",
"GLESv2",
]
}
if (is_ios || is_mac) {
sources += [
"maccocoathreadhelper.h",
"maccocoathreadhelper.mm",
"macconversion.cc",
"macconversion.h",
"macifaddrs_converter.cc",
"scoped_autorelease_pool.h",
"scoped_autorelease_pool.mm",
]
}
if (use_x11) {
sources += [
"x11windowpicker.cc",
"x11windowpicker.h",
]
libs += [
"dl",
"rt",
"Xext",
"X11",
"Xcomposite",
"Xrender",
]
}
if (is_linux) {
libs += [
"dl",
"rt",
]
}
if (is_mac) {
sources += [
"macutils.cc",
"macutils.h",
]
libs += [
# For ProcessInformationCopyDictionary in unixfilesystem.cc.
"ApplicationServices.framework",
# For GetGestalt in macutils.cc.
"CoreServices.framework",
]
}
if (is_win) {
sources += [
"win32.cc",
"win32.h",
"win32filesystem.cc",
"win32filesystem.h",
"win32securityerrors.cc",
"win32window.cc",
"win32window.h",
"win32windowpicker.cc",
"win32windowpicker.h",
"winfirewall.cc",
"winfirewall.h",
"winping.cc",
"winping.h",
]
libs += [
"crypt32.lib",
"iphlpapi.lib",
"secur32.lib",
]
cflags += [
# Suppress warnings about WIN32_LEAN_AND_MEAN.
"/wd4005",
"/wd4703",
]
defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ]
}
if (is_posix) {
sources += [
"ifaddrs_converter.cc",
"ifaddrs_converter.h",
"unixfilesystem.cc",
"unixfilesystem.h",
]
if (is_debug) {
# The Chromium build/common.gypi defines this for all posix
# _except_ for ios & mac. We want it there as well, e.g.
# because ASSERT and friends trigger off of it.
defines += [ "_DEBUG" ]
}
}
if (is_linux || is_android) {
sources += [
"linux.cc",
"linux.h",
]
}
if (is_nacl) {
deps += [ "//native_client_sdk/src/libraries/nacl_io" ]
defines += [ "timezone=_timezone" ]
sources -= [ "ifaddrs_converter.cc" ]
}
if (is_win && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("gtest_prod") {
sources = [
"gtest_prod_util.h",
]
}
if (rtc_include_tests) {
config("rtc_base_tests_utils_exported_config") {
defines = [ "GTEST_RELATIVE_PATH" ]
}
config("rtc_base_tests_utils_warnings_config") {
if (is_win && is_clang) {
cflags = [
# See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270
"-Wno-reorder",
"-Wno-sign-compare",
]
}
}
rtc_source_set("rtc_base_tests_utils") {
testonly = true
sources = [
# Also use this as a convenient dumping ground for misc files that are
# included by multiple targets below.
"fakeclock.cc",
"fakeclock.h",
"fakenetwork.h",
"fakesslidentity.h",
"faketaskrunner.h",
"gunit.h",
"testbase64.h",
"testechoserver.h",
"testutils.h",
"timedelta.h",
"unittest_main.cc",
]
configs += [ ":rtc_base_tests_utils_warnings_config" ]
public_configs = [ ":rtc_base_tests_utils_exported_config" ]
deps = [
":rtc_base",
"../test:field_trial",
"../test:test_support",
]
public_deps = [
"//testing/gtest",
]
if (is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}
if (is_android) {
android_library("base_java") {
java_files = [
"java/src/org/webrtc/Logging.java",
"java/src/org/webrtc/Size.java",
"java/src/org/webrtc/ThreadUtils.java",
]
deps = [
"//base:base_java",
]
}
}