GN: Refactor base/BUILD.gn and fix dbus-glib error.

Refactor webrtc/base/BUILD.gn to not have any subtracted
source entries.

Also fix an error in webrtc/BUILD.gn that occurs when running
on Chormium trybots as a part of enabling WebRTC for GN in
https://codereview.chromium.org/321313006/
The error is that pkg-config for dbus-glib fails. Workaround
this by putting the pkg-config entry within the proper condition.

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 clang_use_chrome_plugins=false" && ninja -C out/Default

I built successfully from a Chromium checkout (with
https://codereview.chromium.org/321313006/ applied) using:
gn gen out/Default && ninja -C out/Default webrtc

R=brettw@chromium.org, henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/16759004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6560 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org 2014-06-28 18:05:22 +00:00
parent b3c188f27b
commit 7497fa74e4
2 changed files with 115 additions and 244 deletions

View File

@ -6,6 +6,8 @@
# in the file PATENTS. All contributing project authors may # in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree. # be found in the AUTHORS file in the root of the source tree.
# TODO(kjellander): Rebase this to webrtc/build/common.gypi changes after r6330.
import("//build/config/arm.gni") import("//build/config/arm.gni")
import("//build/config/crypto.gni") import("//build/config/crypto.gni")
import("//build/config/linux/pkg_config.gni") import("//build/config/linux/pkg_config.gni")
@ -61,9 +63,11 @@ config("common_inherited_config") {
} }
} }
if (have_dbus_glib) {
pkg_config("dbus-glib") { pkg_config("dbus-glib") {
packages = [ "dbus-glib-1" ] packages = [ "dbus-glib-1" ]
} }
}
config("common_config") { config("common_config") {
if (restrict_webrtc_logging) { if (restrict_webrtc_logging) {

View File

@ -6,6 +6,8 @@
# in the file PATENTS. All contributing project authors may # in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree. # be found in the AUTHORS file in the root of the source tree.
# TODO(kjellander): Rebase this to base.gyp changes after r6438.
import("//build/config/crypto.gni") import("//build/config/crypto.gni")
import("../build/webrtc.gni") import("../build/webrtc.gni")
@ -121,6 +123,7 @@ config("linux_system_ssl") {
static_library("webrtc_base") { static_library("webrtc_base") {
cflags = [] cflags = []
cflags_cc = [] cflags_cc = []
deps= []
configs += [ configs += [
"..:common_config", "..:common_config",
@ -142,62 +145,41 @@ static_library("webrtc_base") {
"asyncfile.h", "asyncfile.h",
"asynchttprequest.cc", "asynchttprequest.cc",
"asynchttprequest.h", "asynchttprequest.h",
"asyncinvoker.cc",
"asyncinvoker.h",
"asyncinvoker-inl.h",
"asyncpacketsocket.h", "asyncpacketsocket.h",
"asyncresolverinterface.h",
"asyncsocket.cc", "asyncsocket.cc",
"asyncsocket.h", "asyncsocket.h",
"asynctcpsocket.cc", "asynctcpsocket.cc",
"asynctcpsocket.h", "asynctcpsocket.h",
"asyncudpsocket.cc", "asyncudpsocket.cc",
"asyncudpsocket.h", "asyncudpsocket.h",
"atomicops.h",
"autodetectproxy.cc", "autodetectproxy.cc",
"autodetectproxy.h", "autodetectproxy.h",
"bandwidthsmoother.cc",
"bandwidthsmoother.h",
"base64.cc", "base64.cc",
"base64.h", "base64.h",
"basicdefs.h", "basicdefs.h",
"basictypes.h",
"bind.h",
"bind.h.pump",
"buffer.h",
"bytebuffer.cc", "bytebuffer.cc",
"bytebuffer.h", "bytebuffer.h",
"byteorder.h", "byteorder.h",
"callback.h",
"callback.h.pump",
"checks.cc", "checks.cc",
"checks.h", "checks.h",
"common.cc", "common.cc",
"common.h", "common.h",
"constructormagic.h",
"cpumonitor.cc", "cpumonitor.cc",
"cpumonitor.h", "cpumonitor.h",
"crc32.cc", "crc32.cc",
"crc32.h", "crc32.h",
"criticalsection.h", "criticalsection.h",
"cryptstring.h", "cryptstring.h",
"dbus.cc",
"dbus.h",
"diskcache.cc", "diskcache.cc",
"diskcache.h", "diskcache.h",
"event.cc", "event.cc",
"event.h", "event.h",
"filelock.cc",
"filelock.h",
"fileutils.cc", "fileutils.cc",
"fileutils.h", "fileutils.h",
"fileutils_mock.h",
"firewallsocketserver.cc", "firewallsocketserver.cc",
"firewallsocketserver.h", "firewallsocketserver.h",
"flags.cc", "flags.cc",
"flags.h", "flags.h",
"genericslot.h",
"genericslot.h.pump",
"gunit_prod.h", "gunit_prod.h",
"helpers.cc", "helpers.cc",
"helpers.h", "helpers.h",
@ -210,44 +192,10 @@ static_library("webrtc_base") {
"httpcommon.h", "httpcommon.h",
"httprequest.cc", "httprequest.cc",
"httprequest.h", "httprequest.h",
"httpserver.cc",
"httpserver.h",
"ifaddrs-android.cc",
"ifaddrs-android.h",
"iosfilesystem.mm", "iosfilesystem.mm",
"ipaddress.cc", "ipaddress.cc",
"ipaddress.h", "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", "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", "mathutils.h",
"md5.cc", "md5.cc",
"md5.h", "md5.h",
@ -258,14 +206,6 @@ static_library("webrtc_base") {
"messagehandler.h", "messagehandler.h",
"messagequeue.cc", "messagequeue.cc",
"messagequeue.h", "messagequeue.h",
"multipart.cc",
"multipart.h",
"natserver.cc",
"natserver.h",
"natsocketfactory.cc",
"natsocketfactory.h",
"nattypes.cc",
"nattypes.h",
"nethelpers.cc", "nethelpers.cc",
"nethelpers.h", "nethelpers.h",
"network.cc", "network.cc",
@ -275,51 +215,26 @@ static_library("webrtc_base") {
"nssstreamadapter.cc", "nssstreamadapter.cc",
"nssstreamadapter.h", "nssstreamadapter.h",
"nullsocketserver.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.cc",
"pathutils.h", "pathutils.h",
"physicalsocketserver.cc", "physicalsocketserver.cc",
"physicalsocketserver.h", "physicalsocketserver.h",
"posix.cc",
"posix.h",
"profiler.cc",
"profiler.h",
"proxydetect.cc", "proxydetect.cc",
"proxydetect.h", "proxydetect.h",
"proxyinfo.cc", "proxyinfo.cc",
"proxyinfo.h", "proxyinfo.h",
"proxyserver.cc",
"proxyserver.h",
"ratelimiter.cc", "ratelimiter.cc",
"ratelimiter.h", "ratelimiter.h",
"ratetracker.cc", "ratetracker.cc",
"ratetracker.h", "ratetracker.h",
"refcount.h", "safe_conversions.h",
"referencecountedsingletonfactory.h", "safe_conversions_impl.h",
"rollingaccumulator.h",
"schanneladapter.cc",
"schanneladapter.h",
"scoped_autorelease_pool.h", "scoped_autorelease_pool.h",
"scoped_autorelease_pool.mm", "scoped_autorelease_pool.mm",
"scoped_ptr.h", "scoped_ptr.h",
"scoped_ref_ptr.h",
"scopedptrcollection.h",
"sec_buffer.h",
"sha1.cc", "sha1.cc",
"sha1.h", "sha1.h",
"sha1digest.h", "sha1digest.h",
"sharedexclusivelock.cc",
"sharedexclusivelock.h",
"signalthread.cc", "signalthread.cc",
"signalthread.h", "signalthread.h",
"sigslot.h", "sigslot.h",
@ -339,12 +254,10 @@ static_library("webrtc_base") {
"socketstream.h", "socketstream.h",
"ssladapter.cc", "ssladapter.cc",
"ssladapter.h", "ssladapter.h",
"sslconfig.h",
"sslfingerprint.cc", "sslfingerprint.cc",
"sslfingerprint.h", "sslfingerprint.h",
"sslidentity.cc", "sslidentity.cc",
"sslidentity.h", "sslidentity.h",
"sslroots.h",
"sslsocketfactory.cc", "sslsocketfactory.cc",
"sslsocketfactory.h", "sslsocketfactory.h",
"sslstreamadapter.cc", "sslstreamadapter.cc",
@ -353,7 +266,6 @@ static_library("webrtc_base") {
"sslstreamadapterhelper.h", "sslstreamadapterhelper.h",
"stream.cc", "stream.cc",
"stream.h", "stream.h",
"stringdigest.h",
"stringencode.cc", "stringencode.cc",
"stringencode.h", "stringencode.h",
"stringutils.cc", "stringutils.cc",
@ -366,50 +278,25 @@ static_library("webrtc_base") {
"taskparent.h", "taskparent.h",
"taskrunner.cc", "taskrunner.cc",
"taskrunner.h", "taskrunner.h",
"testclient.cc",
"testclient.h",
"thread.cc", "thread.cc",
"thread.h", "thread.h",
"timeutils.cc", "timeutils.cc",
"timeutils.h", "timeutils.h",
"timing.cc", "timing.cc",
"timing.h", "timing.h",
"transformadapter.cc",
"transformadapter.h",
"unixfilesystem.cc",
"unixfilesystem.h",
"urlencode.cc", "urlencode.cc",
"urlencode.h", "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.cc",
"worker.h", "worker.h",
] ]
if (is_posix) {
sources += [
"unixfilesystem.cc",
"unixfilesystem.h",
]
}
if (build_with_chromium) { if (build_with_chromium) {
sources += [ sources += [
"../overrides/webrtc/base/basictypes.h", "../overrides/webrtc/base/basictypes.h",
@ -417,10 +304,19 @@ static_library("webrtc_base") {
"../overrides/webrtc/base/logging.cc", "../overrides/webrtc/base/logging.cc",
"../overrides/webrtc/base/logging.h", "../overrides/webrtc/base/logging.h",
] ]
if (is_win) { if (is_win) {
sources += [ "../overrides/webrtc/base/win32socketinit.cc" ] sources += [ "../overrides/webrtc/base/win32socketinit.cc" ]
} }
sources -= [
include_dirs = [
"../overrides",
"../../openssl/openssl/include",
]
direct_dependent_configs += [ ":webrtc_base_chromium_config" ]
} else {
sources += [
"asyncinvoker.cc", "asyncinvoker.cc",
"asyncinvoker.h", "asyncinvoker.h",
"asyncinvoker-inl.h", "asyncinvoker-inl.h",
@ -435,8 +331,6 @@ static_library("webrtc_base") {
"callback.h", "callback.h",
"callback.h.pump", "callback.h.pump",
"constructormagic.h", "constructormagic.h",
"dbus.cc",
"dbus.h",
"filelock.cc", "filelock.cc",
"filelock.h", "filelock.h",
"fileutils_mock.h", "fileutils_mock.h",
@ -446,26 +340,8 @@ static_library("webrtc_base") {
"httpserver.h", "httpserver.h",
"json.cc", "json.cc",
"json.h", "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.cc",
"logging.h", "logging.h",
#"macasyncsocket.cc",
#"macasyncsocket.h",
#"maccocoasocketserver.h",
#"maccocoasocketserver.mm",
#"macsocketserver.cc",
#"macsocketserver.h",
#"macwindowpicker.cc",
#"macwindowpicker.h",
"mathutils.h", "mathutils.h",
"multipart.cc", "multipart.cc",
"multipart.h", "multipart.h",
@ -478,8 +354,6 @@ static_library("webrtc_base") {
"openssl.h", "openssl.h",
"optionsfile.cc", "optionsfile.cc",
"optionsfile.h", "optionsfile.h",
"posix.cc",
"posix.h",
"profiler.cc", "profiler.cc",
"profiler.h", "profiler.h",
"proxyserver.cc", "proxyserver.cc",
@ -487,8 +361,6 @@ static_library("webrtc_base") {
"refcount.h", "refcount.h",
"referencecountedsingletonfactory.h", "referencecountedsingletonfactory.h",
"rollingaccumulator.h", "rollingaccumulator.h",
#"safe_conversions.h",
#"safe_conversions_impl.h",
"scopedptrcollection.h", "scopedptrcollection.h",
"scoped_ref_ptr.h", "scoped_ref_ptr.h",
"sec_buffer.h", "sec_buffer.h",
@ -497,44 +369,71 @@ static_library("webrtc_base") {
"sslconfig.h", "sslconfig.h",
"sslroots.h", "sslroots.h",
"stringdigest.h", "stringdigest.h",
#"testbase64.h",
"testclient.cc", "testclient.cc",
"testclient.h", "testclient.h",
#"testutils.h",
"transformadapter.cc", "transformadapter.cc",
"transformadapter.h", "transformadapter.h",
"versionparsing.cc", "versionparsing.cc",
"versionparsing.h", "versionparsing.h",
"virtualsocketserver.cc", "virtualsocketserver.cc",
"virtualsocketserver.h", "virtualsocketserver.h",
#"win32regkey.cc",
#"win32regkey.h",
#"win32socketinit.cc",
#"win32socketinit.h",
#"win32socketserver.cc",
#"win32socketserver.h",
#"win32toolhelp.h",
"window.h", "window.h",
"windowpickerfactory.h", "windowpickerfactory.h",
"windowpicker.h", "windowpicker.h",
] ]
include_dirs = [ if (is_posix) {
"../overrides", sources += [
"../../openssl/openssl/include", "latebindingsymboltable.cc",
"latebindingsymboltable.cc.def",
"latebindingsymboltable.h",
"latebindingsymboltable.h.def",
"posix.cc",
"posix.h",
] ]
}
if (is_linux) {
sources += [
"dbus.cc",
"dbus.h",
"libdbusglibsymboltable.cc",
"libdbusglibsymboltable.h",
"linuxfdwalk.c",
"linuxfdwalk.h",
"linuxwindowpicker.cc",
"linuxwindowpicker.h",
]
}
if (is_mac) {
sources += [
"macasyncsocket.cc",
"macasyncsocket.h",
"maccocoasocketserver.h",
"maccocoasocketserver.mm",
"macsocketserver.cc",
"macsocketserver.h",
"macwindowpicker.cc",
"macwindowpicker.h",
]
}
direct_dependent_configs += [ ":webrtc_base_chromium_config" ]
} else {
if (is_win) { if (is_win) {
sources += [ sources += [
"diskcache_win32.cc", "diskcache_win32.cc",
"diskcache_win32.h", "diskcache_win32.h",
"win32regkey.cc",
"win32regkey.h",
"win32socketinit.cc",
"win32socketinit.h",
"win32socketserver.cc",
"win32socketserver.h",
] ]
} }
deps = [ "//third_party/jsoncpp" ] deps += [ "//third_party/jsoncpp" ]
} } # !build_with_chromium
# TODO(henrike): issue 3307, make webrtc_base build without disabling # TODO(henrike): issue 3307, make webrtc_base build without disabling
# these flags. # these flags.
@ -547,12 +446,17 @@ static_library("webrtc_base") {
if (use_openssl) { if (use_openssl) {
direct_dependent_configs += [ ":openssl_config" ] direct_dependent_configs += [ ":openssl_config" ]
deps = [ "//third_party/openssl" ] deps += [ "//third_party/openssl" ]
} else { } else {
direct_dependent_configs += [ ":no_openssl_config" ] direct_dependent_configs += [ ":no_openssl_config" ]
} }
if (is_android) { if (is_android) {
sources += [
"ifaddrs-android.cc",
"ifaddrs-android.h",
]
direct_dependent_configs += [ ":android_config" ] direct_dependent_configs += [ ":android_config" ]
libs = [ libs = [
@ -561,17 +465,12 @@ static_library("webrtc_base") {
] ]
} else { } else {
direct_dependent_configs += [ ":no_android_config" ] direct_dependent_configs += [ ":no_android_config" ]
sources -= [
"ifaddrs-android.cc",
"ifaddrs-android.h",
]
} }
if (is_ios) { if (is_ios) {
all_dependent_configs += [ ":ios_config" ] all_dependent_configs += [ ":ios_config" ]
deps = [ "//net/third_party/nss/ssl:libssl" ] deps += [ "//net/third_party/nss/ssl:libssl" ]
} }
if (is_linux) { if (is_linux) {
@ -585,20 +484,18 @@ static_library("webrtc_base") {
"Xrender", "Xrender",
] ]
configs += [ "//third_party/nss:system_nss_no_ssl_config" ] 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) { if (is_mac) {
sources += [
"maccocoathreadhelper.h",
"maccocoathreadhelper.mm",
"macconversion.cc",
"macconversion.h",
"macutils.cc",
"macutils.h",
]
all_dependent_configs = [ ":mac_config" ] all_dependent_configs = [ ":mac_config" ]
libs = [ libs = [
@ -608,24 +505,27 @@ static_library("webrtc_base") {
if (cpu_arch == "x86") { if (cpu_arch == "x86") {
all_dependent_configs += [ ":mac_x86_config" ] 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) { if (is_win) {
sources += [
"schanneladapter.cc",
"schanneladapter.h",
"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 = [ libs = [
"crypt32.lib", "crypt32.lib",
"iphlpapi.lib", "iphlpapi.lib",
@ -639,54 +539,21 @@ static_library("webrtc_base") {
] ]
defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ] 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_posix && is_debug) {
if (is_debug) { # Chromium's 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" ] defines += [ "_DEBUG" ]
} }
} else {
sources -= [
"latebindingsymboltable.cc",
"latebindingsymboltable.h",
"posix.cc",
"posix.h",
"unixfilesystem.cc",
"unixfilesystem.h",
]
}
if (is_ios || (is_mac && cpu_arch != "x86")) { if (is_ios || (is_mac && cpu_arch != "x86")) {
defines += [ "CARBON_DEPRECATED=YES" ] defines += [ "CARBON_DEPRECATED=YES" ]
} }
if (is_ios || !is_posix) { if (!is_ios && is_posix) {
sources -= [ sources += [
"openssl.h", "openssl.h",
"openssladapter.cc", "openssladapter.cc",
"openssladapter.h", "openssladapter.h",
@ -699,8 +566,8 @@ static_library("webrtc_base") {
] ]
} }
if (!is_linux && !is_android) { if (is_linux || is_android) {
sources -= [ sources += [
"linux.cc", "linux.cc",
"linux.h", "linux.h",
] ]