1 # Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
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.
9 # TODO(kjellander): Rebase this to webrtc/build/common.gypi changes after r6330.
11 import("//build/config/arm.gni")
12 import("//build/config/crypto.gni")
13 import("//build/config/linux/pkg_config.gni")
14 import("build/webrtc.gni")
16 # Contains the defines and includes in common.gypi that are duplicated both as
17 # target_defaults and direct_dependent_settings.
18 config("common_inherited_config") {
20 if (build_with_mozilla) {
21 defines += [ "WEBRTC_MOZILLA_BUILD" ]
23 if (build_with_chromium) {
25 "WEBRTC_CHROMIUM_BUILD",
28 # overrides must be included first as that is the mechanism for
29 # selecting the override headers in Chromium.
31 # Allow includes to be prefixed with webrtc/ in case it is not an
32 # immediate subdirectory of the top-level.
37 defines += [ "WEBRTC_POSIX" ]
46 defines += [ "WEBRTC_LINUX" ]
49 defines += [ "WEBRTC_MAC" ]
52 defines += [ "WEBRTC_WIN" ]
59 if (rtc_enable_android_opensl) {
60 defines += [ "WEBRTC_ANDROID_OPENSLES" ]
65 if (rtc_have_dbus_glib) {
66 pkg_config("dbus-glib") {
67 packages = [ "dbus-glib-1" ]
71 config("common_config") {
74 if (rtc_restrict_logging) {
75 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
78 if (rtc_have_dbus_glib) {
79 defines += [ "HAVE_DBUS_GLIB" ]
80 # TODO(kjellander): Investigate this, it seems like include <dbus/dbus.h>
81 # is still not found even if the execution of
82 # build/config/linux/pkg-config.py dbus-glib-1 returns correct include
84 all_dependent_configs = [ "dbus-glib" ]
87 if (rtc_enable_video) {
88 defines += [ "WEBRTC_MODULE_UTILITY_VIDEO" ]
91 if (build_with_chromium) {
92 defines += [ "LOGGING_INSIDE_WEBRTC" ]
95 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
96 # for targets that can handle it. For Android/arm64 right now
97 # there will be an "enumeral and non-enumeral type in conditional
98 # expression" warning in android_tools/ndk_experimental"s version
100 # See: https://code.google.com/p/chromium/issues/detail?id=379699
101 if (cpu_arch != "arm64" || !is_android) {
104 # We need to repeat some flags from Chromium"s common.gypi
105 # here that get overridden by -Wextra.
106 "-Wno-unused-parameter",
107 "-Wno-missing-field-initializers",
108 "-Wno-strict-overflow",
111 "-Wnon-virtual-dtor",
112 # This is enabled for clang; enable for gcc as well.
113 "-Woverloaded-virtual",
119 cflags += [ "-Wthread-safety" ]
123 if (cpu_arch == "arm64") {
124 defines += [ "WEBRTC_ARCH_ARM" ]
127 if (cpu_arch == "arm") {
128 defines += [ "WEBRTC_ARCH_ARM" ]
129 if (arm_version == 7) {
130 defines += [ "WEBRTC_ARCH_ARM_V7" ]
132 defines += [ "WEBRTC_ARCH_ARM_NEON" ]
134 defines += [ "WEBRTC_DETECT_ARM_NEON" ]
139 if (cpu_arch == "mipsel") {
140 defines += [ "MIPS32_LE" ]
142 defines += [ "MIPS_FPU_LE" ]
143 cflags += [ "-mhard-float" ]
145 cflags += [ "-msoft-float" ]
147 if (mips_arch_variant == "mips32r2") {
148 defines += [ "MIPS32_R2_LE" ]
149 cflags += [ "-mips32r2" ]
150 cflags_cc += [ "-mips32r2" ]
152 if (mips_dsp_rev == 1) {
153 defines += [ "MIPS_DSP_R1_LE" ]
154 cflags += [ "-mdsp" ]
155 cflags_cc += [ "-mdsp" ]
156 } else if (mips_dsp_rev == 2) {
161 cflags += [ "-mdspr2" ]
162 cflags_cc += [ "-mdspr2" ]
166 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
167 # default warnings set in build/config/compiler/BUILD.gn.
169 if (is_android && is_clang) {
170 # The Android NDK doesn"t provide optimized versions of these
171 # functions. Ensure they are disabled for all compilers.
181 static_library("webrtc") {
190 configs += [ ":common_config" ]
191 public_configs = [ ":common_inherited_config"]
198 "modules/audio_coding",
199 "modules/audio_conference_mixer",
200 "modules/audio_device",
201 "modules/audio_processing",
202 "modules/bitrate_controller",
203 "modules/desktop_capture",
204 "modules/media_file",
207 "modules/video_capture",
208 "modules/video_coding",
209 "modules/video_processing",
210 "modules/video_render",
219 if (!build_with_chromium) {
220 executable("webrtc_tests") {
224 "modules/video_render:video_render_internal_impl",
225 "modules/video_capture:video_capture_internal_impl",
231 source_set("webrtc_common") {
238 # Suppress warnings from Chrome's Clang plugins.
239 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
240 configs -= [ "//build/config/clang:find_bad_constructs" ]
243 configs += [ ":common_config" ]
244 public_configs = [ ":common_inherited_config" ]