From d6d5bffab60c9fc3413ded251aa8513346d252c4 Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Tue, 17 Jun 2014 08:54:03 +0000 Subject: Initial GN work for WebRTC This CL makes it possible to build the 'webrtc_base' target using GN. The majority of our GYP stuff in webrtc/build/common.gypi has been translated into the configs of webrtc/BUILD.gn. The webrtc/base/base.gyp file is translated into webrtc/base/BUILD.gn. This CL depends on https://codereview.chromium.org/322373002/ for the jsoncpp BUILD.gn file and the ssl config. To build inside Chromium, https://codereview.chromium.org/321313006/ needs to be landed first. BUG=webrtc:3441 TEST= Successful compilation of WebRTC as standalone: gn gen out/Default --args="build_with_chromium=false" && ninja -C out/Default gn gen out/Default --args="build_with_chromium=false is_clang=true" && ninja -C out/Default I also ran: gn gen out/Default --args="build_with_chromium=false have_dbus_glib=true" but it fails to compile: something is probably wrong with with pkg-config for that. For Chromium, I symlinked src/third_party/webrtc to the webrtc subfolder of the WebRTC checkout and applied the following patches: https://codereview.chromium.org/322373002 (for jsoncpp and ssl config) https://codereview.chromium.org/321313006 (enable building WebRTC) Then I built successfully using: gn gen out/Default && ninja -C out/Default webrtc_base R=brettw@chromium.org TBR=niklas.enbom@webrtc.org Review URL: https://webrtc-codereview.appspot.com/17669004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@6461 4adac7df-926f-26a2-2b94-8c16560cd09d --- BUILD.gn | 174 +++++++++++++ base/BUILD.gn | 723 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ build/webrtc.gni | 57 +++++ 3 files changed, 954 insertions(+) create mode 100644 BUILD.gn create mode 100644 base/BUILD.gn create mode 100644 build/webrtc.gni diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 index 00000000..a86c8a76 --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,174 @@ +# 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/arm.gni") +import("//build/config/crypto.gni") +import("//build/config/linux/pkg_config.gni") +import("build/webrtc.gni") + +# Contains the defines and includes in common.gypi that are duplicated both as +# target_defaults and direct_dependent_settings. +config("common_inherited_config") { + defines = [] + if (build_with_mozilla) { + defines += [ "WEBRTC_MOZILLA_BUILD" ] + } + if (build_with_chromium) { + defines = [ + "WEBRTC_CHROMIUM_BUILD", + "LOGGING_INSIDE_WEBRTC", + ] + include_dirs = [ + # overrides must be included first as that is the mechanism for + # selecting the override headers in Chromium. + "overrides", + # Allow includes to be prefixed with webrtc/ in case it is not an + # immediate subdirectory of the top-level. + "..", + ] + } + if (is_posix) { + defines += [ "WEBRTC_POSIX" ] + } + if (is_ios) { + defines += [ + "WEBRTC_MAC", + "WEBRTC_IOS", + ] + } + if (is_linux) { + defines += [ "WEBRTC_LINUX" ] + } + if (is_mac) { + defines += [ "WEBRTC_MAC" ] + } + if (is_win) { + defines += [ "WEBRTC_WIN" ] + } + if (is_android) { + defines += [ + "WEBRTC_LINUX", + "WEBRTC_ANDROID", + ] + if (enable_android_opensl) { + defines += [ "WEBRTC_ANDROID_OPENSLES" ] + } + } +} + +pkg_config("dbus-glib") { + packages = [ "dbus-glib-1" ] +} + +config("common_config") { + if (restrict_webrtc_logging) { + defines = [ "WEBRTC_RESTRICT_LOGGING" ] + } + + if (have_dbus_glib) { + defines += [ "HAVE_DBUS_GLIB" ] + # TODO(kjellander): Investigate this, it seems like include + # is still not found even if the execution of + # build/config/linux/pkg-config.py dbus-glib-1 returns correct include + # dirs on Linux. + all_dependent_configs = [ "dbus-glib" ] + } + + if (enable_video) { + defines += [ "WEBRTC_MODULE_UTILITY_VIDEO" ] + } + + if (!build_with_chromium) { + if (is_posix) { + # -Wextra is currently disabled in Chromium"s common.gypi. Enable + # for targets that can handle it. For Android/arm64 right now + # there will be an "enumeral and non-enumeral type in conditional + # expression" warning in android_tools/ndk_experimental"s version + # of stlport. + # See: https://code.google.com/p/chromium/issues/detail?id=379699 + if (cpu_arch != "arm64" || !is_android) { + cflags = [ + "-Wextra", + # We need to repeat some flags from Chromium"s common.gypi + # here that get overridden by -Wextra. + "-Wno-unused-parameter", + "-Wno-missing-field-initializers", + "-Wno-strict-overflow", + ] + cflags_cc = [ + "-Wnon-virtual-dtor", + # This is enabled for clang; enable for gcc as well. + "-Woverloaded-virtual", + ] + } + } + + if (is_clang) { + cflags += [ "-Wthread-safety" ] + } + } + + if (cpu_arch == "arm") { + defines += [ "WEBRTC_ARCH_ARM" ] + if (arm_version == 7) { + defines += [ "WEBRTC_ARCH_ARM_V7" ] + if (arm_use_neon) { + defines += [ "WEBRTC_ARCH_ARM_NEON" ] + } else { + defines += [ "WEBRTC_DETECT_ARM_NEON" ] + } + } + } + + if (cpu_arch == "mipsel") { + defines += [ "MIPS32_LE" ] + if (mips_fpu) { + defines += [ "MIPS_FPU_LE" ] + cflags += [ "-mhard-float" ] + } else { + cflags += [ "-msoft-float" ] + } + if (mips_arch_variant == "mips32r2") { + defines += [ "MIPS32_R2_LE" ] + cflags += [ "-mips32r2" ] + cflags_cc += [ "-mips32r2" ] + } + if (mips_dsp_rev == 1) { + defines += [ "MIPS_DSP_R1_LE" ] + cflags += [ "-mdsp" ] + cflags_cc += [ "-mdsp" ] + } else if (mips_dsp_rev == 2) { + defines += [ + "MIPS_DSP_R1_LE", + "MIPS_DSP_R2_LE", + ] + cflags += [ "-mdspr2" ] + cflags_cc += [ "-mdspr2" ] + } + } + + # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the + # default warnings set in build/config/compiler/BUILD.gn. + + if (is_android && is_clang) { + # The Android NDK doesn"t provide optimized versions of these + # functions. Ensure they are disabled for all compilers. + cflags += [ + "-fno-builtin-cos", + "-fno-builtin-sin", + "-fno-builtin-cosf", + "-fno-builtin-sinf", + ] + } +} + +static_library("webrtc") { + deps = [ + "base:webrtc_base", + ] +} diff --git a/base/BUILD.gn b/base/BUILD.gn new file mode 100644 index 00000000..41180901 --- /dev/null +++ b/base/BUILD.gn @@ -0,0 +1,723 @@ +# 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/webrtc.gni") + +config("webrtc_base_config") { + include_dirs = [ + "//third_party/jsoncpp/overrides/include", + "//third_party/jsoncpp/source/include", + ] + + defines = [ + "FEATURE_ENABLE_SSL", + "GTEST_RELATIVE_PATH", + ] + + # TODO(henrike): issue 3307, make webrtc_base build without disabling + # these flags. + cflags_cc = [ "-Wno-non-virtual-dtor" ] +} + +config("webrtc_base_chromium_config") { + defines = [ + "NO_MAIN_THREAD_WRAPPING", + "SSL_USE_NSS", + ] +} + +config("openssl_config") { + defines = [ + "SSL_USE_OPENSSL", + "HAVE_OPENSSL_SSL_H", + ] +} + +config("no_openssl_config") { + defines = [ + "SSL_USE_NSS", + "HAVE_NSS_SSL_H", + "SSL_USE_NSS_RNG", + ] +} + +config("android_config") { + defines = [ "HAVE_OPENSSL_SSL_H" ] +} + +config("no_android_config") { + defines = [ + "HAVE_NSS_SSL_H", + "SSL_USE_NSS_RNG", + ] +} + +config("ios_config") { + ldflags = [ + #"Foundation.framework", # Already included in //build/config:default_libs. + "Security.framework", + "SystemConfiguration.framework", + #"UIKit.framework", # Already included in //build/config:default_libs. + ] +} + +config("mac_config") { + ldflags = [ + "Cocoa.framework", + #"Foundation.framework", # Already included in //build/config:default_libs. + #"IOKit.framework", # Already included in //build/config:default_libs. + #"Security.framework", # Already included in //build/config:default_libs. + "SystemConfiguration.framework", + ] +} + +config("mac_x86_config") { + libs = [ + #"Carbon.framework", # Already included in //build/config:default_libs. + ] +} + +config("linux_system_ssl_config") { + visibility = ":*" # Only targets in this file can depend on this. + + # TODO(kjellander): Find out how to convert GYP include_dirs+ (i.e. insert + # first in the include path?). + include_dirs = [ "//net/third_party/nss/ssl" ] + + configs = [ "//third_party/nss:system_nss_no_ssl_config" ] +} + +# Provides the same functionality as the build/linux/system.gyp:ssl GYP target. +# This cannot be in build/linux/BUILD.gn since targets in build/ are not allowed +# to depend on targets outside of it. This could be replaced by the Chromium +# //crypto:platform target, but as WebRTC currently don't sync src/crypto from +# Chromium, it is not possible today. +config("linux_system_ssl") { + if (use_openssl) { + deps = [ "//third_party/openssl" ] + } else { + deps = [ "//net/third_party/nss/ssl:libssl" ] + + direct_dependent_configs = [ + ":linux_system_ssl_config", + ] + + if (is_clang) { + cflags = [ + # There is a broken header guard in /usr/include/nss/secmod.h: + # https://bugzilla.mozilla.org/show_bug.cgi?id=884072 + "-Wno-header-guard", + ] + } + } +} + +static_library("webrtc_base") { + cflags = [] + cflags_cc = [] + + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + configs += [ + "..:common_inherited_config", + "..:common_config", + ":webrtc_base_config", + ] + + direct_dependent_configs = [ + "..:common_inherited_config", + ":webrtc_base_config", + ] + + defines = [ + "LOGGING=1", + "USE_WEBRTC_DEV_BRANCH", + ] + + sources = [ + "asyncfile.cc", + "asyncfile.h", + "asynchttprequest.cc", + "asynchttprequest.h", + "asyncinvoker.cc", + "asyncinvoker.h", + "asyncinvoker-inl.h", + "asyncpacketsocket.h", + "asyncresolverinterface.h", + "asyncsocket.cc", + "asyncsocket.h", + "asynctcpsocket.cc", + "asynctcpsocket.h", + "asyncudpsocket.cc", + "asyncudpsocket.h", + "atomicops.h", + "autodetectproxy.cc", + "autodetectproxy.h", + "bandwidthsmoother.cc", + "bandwidthsmoother.h", + "base64.cc", + "base64.h", + "basicdefs.h", + "basictypes.h", + "bind.h", + "bind.h.pump", + "buffer.h", + "bytebuffer.cc", + "bytebuffer.h", + "byteorder.h", + "callback.h", + "callback.h.pump", + "checks.cc", + "checks.h", + "common.cc", + "common.h", + "constructormagic.h", + "cpumonitor.cc", + "cpumonitor.h", + "crc32.cc", + "crc32.h", + "criticalsection.h", + "cryptstring.h", + "dbus.cc", + "dbus.h", + "diskcache.cc", + "diskcache.h", + "event.cc", + "event.h", + "filelock.cc", + "filelock.h", + "fileutils.cc", + "fileutils.h", + "fileutils_mock.h", + "firewallsocketserver.cc", + "firewallsocketserver.h", + "flags.cc", + "flags.h", + "genericslot.h", + "genericslot.h.pump", + "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", + "httpserver.cc", + "httpserver.h", + "ifaddrs-android.cc", + "ifaddrs-android.h", + "iosfilesystem.mm", + "ipaddress.cc", + "ipaddress.h", + "json.cc", + "json.h", + "latebindingsymboltable.cc", + "latebindingsymboltable.cc.def", + "latebindingsymboltable.h", + "latebindingsymboltable.h.def", + "libdbusglibsymboltable.cc", + "libdbusglibsymboltable.h", + "linux.cc", + "linux.h", + "linuxfdwalk.c", + "linuxfdwalk.h", + "linuxwindowpicker.cc", + "linuxwindowpicker.h", + "linked_ptr.h", + "logging.cc", + "logging.h", + "macasyncsocket.cc", + "macasyncsocket.h", + "maccocoasocketserver.h", + "maccocoasocketserver.mm", + "maccocoathreadhelper.h", + "maccocoathreadhelper.mm", + "macconversion.cc", + "macconversion.h", + "macsocketserver.cc", + "macsocketserver.h", + "macutils.cc", + "macutils.h", + "macwindowpicker.cc", + "macwindowpicker.h", + "mathutils.h", + "md5.cc", + "md5.h", + "md5digest.h", + "messagedigest.cc", + "messagedigest.h", + "messagehandler.cc", + "messagehandler.h", + "messagequeue.cc", + "messagequeue.h", + "multipart.cc", + "multipart.h", + "natserver.cc", + "natserver.h", + "natsocketfactory.cc", + "natsocketfactory.h", + "nattypes.cc", + "nattypes.h", + "nethelpers.cc", + "nethelpers.h", + "network.cc", + "network.h", + "nssidentity.cc", + "nssidentity.h", + "nssstreamadapter.cc", + "nssstreamadapter.h", + "nullsocketserver.h", + "openssl.h", + "openssladapter.cc", + "openssladapter.h", + "openssldigest.cc", + "openssldigest.h", + "opensslidentity.cc", + "opensslidentity.h", + "opensslstreamadapter.cc", + "opensslstreamadapter.h", + "optionsfile.cc", + "optionsfile.h", + "pathutils.cc", + "pathutils.h", + "physicalsocketserver.cc", + "physicalsocketserver.h", + "posix.cc", + "posix.h", + "profiler.cc", + "profiler.h", + "proxydetect.cc", + "proxydetect.h", + "proxyinfo.cc", + "proxyinfo.h", + "proxyserver.cc", + "proxyserver.h", + "ratelimiter.cc", + "ratelimiter.h", + "ratetracker.cc", + "ratetracker.h", + "refcount.h", + "referencecountedsingletonfactory.h", + "rollingaccumulator.h", + "schanneladapter.cc", + "schanneladapter.h", + "scoped_autorelease_pool.h", + "scoped_autorelease_pool.mm", + "scoped_ptr.h", + "scoped_ref_ptr.h", + "scopedptrcollection.h", + "sec_buffer.h", + "sha1.cc", + "sha1.h", + "sha1digest.h", + "sharedexclusivelock.cc", + "sharedexclusivelock.h", + "signalthread.cc", + "signalthread.h", + "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", + "sslconfig.h", + "sslfingerprint.cc", + "sslfingerprint.h", + "sslidentity.cc", + "sslidentity.h", + "sslroots.h", + "sslsocketfactory.cc", + "sslsocketfactory.h", + "sslstreamadapter.cc", + "sslstreamadapter.h", + "sslstreamadapterhelper.cc", + "sslstreamadapterhelper.h", + "stream.cc", + "stream.h", + "stringdigest.h", + "stringencode.cc", + "stringencode.h", + "stringutils.cc", + "stringutils.h", + "systeminfo.cc", + "systeminfo.h", + "task.cc", + "task.h", + "taskparent.cc", + "taskparent.h", + "taskrunner.cc", + "taskrunner.h", + "testclient.cc", + "testclient.h", + "thread.cc", + "thread.h", + "timeutils.cc", + "timeutils.h", + "timing.cc", + "timing.h", + "transformadapter.cc", + "transformadapter.h", + "unixfilesystem.cc", + "unixfilesystem.h", + "urlencode.cc", + "urlencode.h", + "versionparsing.cc", + "versionparsing.h", + "virtualsocketserver.cc", + "virtualsocketserver.h", + "win32.cc", + "win32.h", + "win32filesystem.cc", + "win32filesystem.h", + "win32regkey.cc", + "win32regkey.h", + "win32securityerrors.cc", + "win32socketinit.cc", + "win32socketinit.h", + "win32socketserver.cc", + "win32socketserver.h", + "win32window.cc", + "win32window.h", + "win32windowpicker.cc", + "win32windowpicker.h", + "window.h", + "windowpicker.h", + "windowpickerfactory.h", + "winfirewall.cc", + "winfirewall.h", + "winping.cc", + "winping.h", + "worker.cc", + "worker.h", + ] + + if (build_with_chromium) { + sources += [ + "../overrides/webrtc/base/basictypes.h", + "../overrides/webrtc/base/constructormagic.h", + "../overrides/webrtc/base/logging.cc", + "../overrides/webrtc/base/logging.h", + ] + if (is_win) { + sources += [ "../overrides/webrtc/base/win32socketinit.cc" ] + } + sources -= [ + "asyncinvoker.cc", + "asyncinvoker.h", + "asyncinvoker-inl.h", + "asyncresolverinterface.h", + "atomicops.h", + "bandwidthsmoother.cc", + "bandwidthsmoother.h", + "basictypes.h", + "bind.h", + "bind.h.pump", + "buffer.h", + "callback.h", + "callback.h.pump", + "constructormagic.h", + "dbus.cc", + "dbus.h", + "filelock.cc", + "filelock.h", + "fileutils_mock.h", + "genericslot.h", + "genericslot.h.pump", + "httpserver.cc", + "httpserver.h", + "json.cc", + "json.h", + "latebindingsymboltable.cc", + "latebindingsymboltable.cc.def", + "latebindingsymboltable.h", + "latebindingsymboltable.h.def", + "libdbusglibsymboltable.cc", + "libdbusglibsymboltable.h", + "linuxfdwalk.c", + "linuxfdwalk.h", + "linuxwindowpicker.cc", + "linuxwindowpicker.h", + "logging.cc", + "logging.h", + #"macasyncsocket.cc", + #"macasyncsocket.h", + #"maccocoasocketserver.h", + #"maccocoasocketserver.mm", + #"macsocketserver.cc", + #"macsocketserver.h", + #"macwindowpicker.cc", + #"macwindowpicker.h", + "mathutils.h", + "multipart.cc", + "multipart.h", + "natserver.cc", + "natserver.h", + "natsocketfactory.cc", + "natsocketfactory.h", + "nattypes.cc", + "nattypes.h", + "openssl.h", + "optionsfile.cc", + "optionsfile.h", + "posix.cc", + "posix.h", + "profiler.cc", + "profiler.h", + "proxyserver.cc", + "proxyserver.h", + "refcount.h", + "referencecountedsingletonfactory.h", + "rollingaccumulator.h", + #"safe_conversions.h", + #"safe_conversions_impl.h", + "scopedptrcollection.h", + "scoped_ref_ptr.h", + "sec_buffer.h", + "sharedexclusivelock.cc", + "sharedexclusivelock.h", + "sslconfig.h", + "sslroots.h", + "stringdigest.h", + #"testbase64.h", + "testclient.cc", + "testclient.h", + #"testutils.h", + "transformadapter.cc", + "transformadapter.h", + "versionparsing.cc", + "versionparsing.h", + "virtualsocketserver.cc", + "virtualsocketserver.h", + #"win32regkey.cc", + #"win32regkey.h", + #"win32socketinit.cc", + #"win32socketinit.h", + #"win32socketserver.cc", + #"win32socketserver.h", + #"win32toolhelp.h", + "window.h", + "windowpickerfactory.h", + "windowpicker.h", + ] + + include_dirs = [ + "../overrides", + "../../openssl/openssl/include", + ] + + direct_dependent_configs += [ ":webrtc_base_chromium_config" ] + } else { + if (is_win) { + sources += [ + "diskcache_win32.cc", + "diskcache_win32.h", + ] + } + + deps = [ "//third_party/jsoncpp" ] + } + + # TODO(henrike): issue 3307, make webrtc_base build without disabling + # these flags. + cflags += [ + "-Wno-extra", + "-Wno-all", + ] + cflags_cc += [ "-Wno-non-virtual-dtor" ] + + if (use_openssl) { + direct_dependent_configs += [ ":openssl_config" ] + + deps = [ "//third_party/openssl" ] + } else { + direct_dependent_configs += [ ":no_openssl_config" ] + } + + if (is_android) { + direct_dependent_configs += [ ":android_config" ] + + libs = [ + "log", + "GLESv2" + ] + } else { + direct_dependent_configs += [ ":no_android_config" ] + + sources -= [ + "ifaddrs-android.cc", + "ifaddrs-android.h", + ] + } + + if (is_ios) { + all_dependent_configs += [ ":ios_config" ] + + deps = [ "//net/third_party/nss/ssl:libssl" ] + } + + if (is_linux) { + libs = [ + "crypto", + "dl", + "rt", + "Xext", + "X11", + "Xcomposite", + "Xrender", + ] + configs += [ "//third_party/nss:system_nss_no_ssl_config" ] + } else { + sources -= [ + "dbus.cc", + "dbus.h", + "libdbusglibsymboltable.cc", + "libdbusglibsymboltable.h", + "linuxfdwalk.c", + "linuxfdwalk.h", + "linuxwindowpicker.cc", + "linuxwindowpicker.h", + ] + } + + if (is_mac) { + all_dependent_configs = [ ":mac_config" ] + + libs = [ + "crypto", # $(SDKROOT)/usr/lib/libcrypto.dylib + "ssl", # $(SDKROOT)/usr/lib/libssl.dylib + ] + if (cpu_arch == "x86") { + all_dependent_configs += [ ":mac_x86_config" ] + } + } else { + sources -= [ + "macasyncsocket.cc", + "macasyncsocket.h", + "maccocoasocketserver.h", + #"maccocoasocketserver.mm", # Seems to be excluded by default with GN. + "macconversion.cc", + "macconversion.h", + "macsocketserver.cc", + "macsocketserver.h", + "macutils.cc", + "macutils.h", + "macwindowpicker.cc", + "macwindowpicker.h", + ] + } + + if (is_win) { + libs = [ + "crypt32.lib", + "iphlpapi.lib", + "secur32.lib", + ] + + cflags += [ + # Suppress warnings about WIN32_LEAN_AND_MEAN. + "/wd4005", + "/wd4703", + ] + + defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ] + } else { + sources -= [ + "schanneladapter.cc", + "schanneladapter.h", + "winping.cc", + "winping.h", + "winfirewall.cc", + "winfirewall.h", + # The files below were covered by a regex exclude in GYP. + "win32.cc", + "win32.h", + "win32filesystem.cc", + "win32filesystem.h", + "win32regkey.cc", + "win32regkey.h", + "win32securityerrors.cc", + "win32socketinit.cc", + "win32socketinit.h", + "win32socketserver.cc", + "win32socketserver.h", + "win32window.cc", + "win32window.h", + "win32windowpicker.cc", + "win32windowpicker.h", + ] + } + + if (is_posix) { + if (is_debug) { + defines += [ "_DEBUG" ] + } + } else { + sources -= [ + "latebindingsymboltable.cc", + "latebindingsymboltable.h", + "posix.cc", + "posix.h", + "unixfilesystem.cc", + "unixfilesystem.h", + ] + } + + if (is_ios || (is_mac && cpu_arch != "x86")) { + defines += [ "CARBON_DEPRECATED=YES" ] + } + + if (is_ios || !is_posix) { + sources -= [ + "openssl.h", + "openssladapter.cc", + "openssladapter.h", + "openssldigest.cc", + "openssldigest.h", + "opensslidentity.cc", + "opensslidentity.h", + "opensslstreamadapter.cc", + "opensslstreamadapter.h", + ] + } + + if (!is_linux && !is_android) { + sources -= [ + "linux.cc", + "linux.h", + ] + } + + if (is_mac || is_ios || is_win) { + deps += [ + "//net/third_party/nss/ssl:libssl", + "//third_party/nss:nspr", + "//third_party/nss:nss", + ] + } + + if (is_posix && !is_mac && !is_ios && !is_android) { + configs += [ ":linux_system_ssl" ] + } +} diff --git a/build/webrtc.gni b/build/webrtc.gni new file mode 100644 index 00000000..e269a262 --- /dev/null +++ b/build/webrtc.gni @@ -0,0 +1,57 @@ +# 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. + +declare_args() { + # Assume Chromium build for now, since that's the priority case for getting GN + # up and running with WebRTC. + build_with_chromium = true + build_with_libjingle = true + + if (build_with_libjingle) { + include_tests = false + restrict_webrtc_logging = true + } else { + include_tests = true + restrict_webrtc_logging = false + } + + # Adds video support to dependencies shared by voice and video engine. + # This should normally be enabled; the intended use is to disable only + # when building voice engine exclusively. + enable_video = true + + # Selects fixed-point code where possible. + prefer_fixed_point = false + + build_libjpeg = true + # Enables the use of protocol buffers for debug recordings. + enable_protobuf = true + + # Disable by default. + have_dbus_glib = false + + # Enable to use the Mozilla internal settings. + build_with_mozilla = false + + # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU + # This may be subject to change in accordance to Chromium's MIPS flags + mips_arch_variant = "mips32r1" + mips_dsp_rev = 0 + mips_fpu = true + + enable_android_opensl = true + + if (is_ios) { + build_libjpeg = false + enable_protobuf = false + } + + if (cpu_arch == "arm") { + prefer_fixed_point = true + } +} -- cgit v1.2.3