blob: a86c8a7670dbc43ca6c907ab431c1e529ed9cbd9 [file] [log] [blame]
kjellander@webrtc.org851a09e2014-06-17 08:54:031# 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/arm.gni")
10import("//build/config/crypto.gni")
11import("//build/config/linux/pkg_config.gni")
12import("build/webrtc.gni")
13
14# Contains the defines and includes in common.gypi that are duplicated both as
15# target_defaults and direct_dependent_settings.
16config("common_inherited_config") {
17 defines = []
18 if (build_with_mozilla) {
19 defines += [ "WEBRTC_MOZILLA_BUILD" ]
20 }
21 if (build_with_chromium) {
22 defines = [
23 "WEBRTC_CHROMIUM_BUILD",
24 "LOGGING_INSIDE_WEBRTC",
25 ]
26 include_dirs = [
27 # overrides must be included first as that is the mechanism for
28 # selecting the override headers in Chromium.
29 "overrides",
30 # Allow includes to be prefixed with webrtc/ in case it is not an
31 # immediate subdirectory of the top-level.
32 "..",
33 ]
34 }
35 if (is_posix) {
36 defines += [ "WEBRTC_POSIX" ]
37 }
38 if (is_ios) {
39 defines += [
40 "WEBRTC_MAC",
41 "WEBRTC_IOS",
42 ]
43 }
44 if (is_linux) {
45 defines += [ "WEBRTC_LINUX" ]
46 }
47 if (is_mac) {
48 defines += [ "WEBRTC_MAC" ]
49 }
50 if (is_win) {
51 defines += [ "WEBRTC_WIN" ]
52 }
53 if (is_android) {
54 defines += [
55 "WEBRTC_LINUX",
56 "WEBRTC_ANDROID",
57 ]
58 if (enable_android_opensl) {
59 defines += [ "WEBRTC_ANDROID_OPENSLES" ]
60 }
61 }
62}
63
64pkg_config("dbus-glib") {
65 packages = [ "dbus-glib-1" ]
66}
67
68config("common_config") {
69 if (restrict_webrtc_logging) {
70 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
71 }
72
73 if (have_dbus_glib) {
74 defines += [ "HAVE_DBUS_GLIB" ]
75 # TODO(kjellander): Investigate this, it seems like include <dbus/dbus.h>
76 # is still not found even if the execution of
77 # build/config/linux/pkg-config.py dbus-glib-1 returns correct include
78 # dirs on Linux.
79 all_dependent_configs = [ "dbus-glib" ]
80 }
81
82 if (enable_video) {
83 defines += [ "WEBRTC_MODULE_UTILITY_VIDEO" ]
84 }
85
86 if (!build_with_chromium) {
87 if (is_posix) {
88 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
89 # for targets that can handle it. For Android/arm64 right now
90 # there will be an "enumeral and non-enumeral type in conditional
91 # expression" warning in android_tools/ndk_experimental"s version
92 # of stlport.
93 # See: https://code.google.com/p/chromium/issues/detail?id=379699
94 if (cpu_arch != "arm64" || !is_android) {
95 cflags = [
96 "-Wextra",
97 # We need to repeat some flags from Chromium"s common.gypi
98 # here that get overridden by -Wextra.
99 "-Wno-unused-parameter",
100 "-Wno-missing-field-initializers",
101 "-Wno-strict-overflow",
102 ]
103 cflags_cc = [
104 "-Wnon-virtual-dtor",
105 # This is enabled for clang; enable for gcc as well.
106 "-Woverloaded-virtual",
107 ]
108 }
109 }
110
111 if (is_clang) {
112 cflags += [ "-Wthread-safety" ]
113 }
114 }
115
116 if (cpu_arch == "arm") {
117 defines += [ "WEBRTC_ARCH_ARM" ]
118 if (arm_version == 7) {
119 defines += [ "WEBRTC_ARCH_ARM_V7" ]
120 if (arm_use_neon) {
121 defines += [ "WEBRTC_ARCH_ARM_NEON" ]
122 } else {
123 defines += [ "WEBRTC_DETECT_ARM_NEON" ]
124 }
125 }
126 }
127
128 if (cpu_arch == "mipsel") {
129 defines += [ "MIPS32_LE" ]
130 if (mips_fpu) {
131 defines += [ "MIPS_FPU_LE" ]
132 cflags += [ "-mhard-float" ]
133 } else {
134 cflags += [ "-msoft-float" ]
135 }
136 if (mips_arch_variant == "mips32r2") {
137 defines += [ "MIPS32_R2_LE" ]
138 cflags += [ "-mips32r2" ]
139 cflags_cc += [ "-mips32r2" ]
140 }
141 if (mips_dsp_rev == 1) {
142 defines += [ "MIPS_DSP_R1_LE" ]
143 cflags += [ "-mdsp" ]
144 cflags_cc += [ "-mdsp" ]
145 } else if (mips_dsp_rev == 2) {
146 defines += [
147 "MIPS_DSP_R1_LE",
148 "MIPS_DSP_R2_LE",
149 ]
150 cflags += [ "-mdspr2" ]
151 cflags_cc += [ "-mdspr2" ]
152 }
153 }
154
155 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
156 # default warnings set in build/config/compiler/BUILD.gn.
157
158 if (is_android && is_clang) {
159 # The Android NDK doesn"t provide optimized versions of these
160 # functions. Ensure they are disabled for all compilers.
161 cflags += [
162 "-fno-builtin-cos",
163 "-fno-builtin-sin",
164 "-fno-builtin-cosf",
165 "-fno-builtin-sinf",
166 ]
167 }
168}
169
170static_library("webrtc") {
171 deps = [
172 "base:webrtc_base",
173 ]
174}