blob: ea14644a2c2470e922b5882ac312f5cd061994d9 [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
kjellander@webrtc.org7497fa72014-06-28 18:05:229# TODO(kjellander): Rebase this to webrtc/build/common.gypi changes after r6330.
10
kjellander@webrtc.org851a09e2014-06-17 08:54:0311import("//build/config/arm.gni")
12import("//build/config/crypto.gni")
13import("//build/config/linux/pkg_config.gni")
14import("build/webrtc.gni")
15
16# Contains the defines and includes in common.gypi that are duplicated both as
17# target_defaults and direct_dependent_settings.
18config("common_inherited_config") {
19 defines = []
20 if (build_with_mozilla) {
21 defines += [ "WEBRTC_MOZILLA_BUILD" ]
22 }
23 if (build_with_chromium) {
24 defines = [
25 "WEBRTC_CHROMIUM_BUILD",
kjellander@webrtc.org851a09e2014-06-17 08:54:0326 ]
27 include_dirs = [
28 # overrides must be included first as that is the mechanism for
29 # selecting the override headers in Chromium.
30 "overrides",
31 # Allow includes to be prefixed with webrtc/ in case it is not an
32 # immediate subdirectory of the top-level.
33 "..",
34 ]
35 }
36 if (is_posix) {
37 defines += [ "WEBRTC_POSIX" ]
38 }
39 if (is_ios) {
40 defines += [
41 "WEBRTC_MAC",
42 "WEBRTC_IOS",
43 ]
44 }
45 if (is_linux) {
46 defines += [ "WEBRTC_LINUX" ]
47 }
48 if (is_mac) {
49 defines += [ "WEBRTC_MAC" ]
50 }
51 if (is_win) {
52 defines += [ "WEBRTC_WIN" ]
53 }
54 if (is_android) {
55 defines += [
56 "WEBRTC_LINUX",
57 "WEBRTC_ANDROID",
58 ]
kjellander@webrtc.org6d08ca62014-09-07 17:36:1059 if (rtc_enable_android_opensl) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0360 defines += [ "WEBRTC_ANDROID_OPENSLES" ]
61 }
62 }
63}
64
kjellander@webrtc.org6d08ca62014-09-07 17:36:1065if (rtc_have_dbus_glib) {
kjellander@webrtc.org7497fa72014-06-28 18:05:2266 pkg_config("dbus-glib") {
67 packages = [ "dbus-glib-1" ]
68 }
kjellander@webrtc.org851a09e2014-06-17 08:54:0369}
70
71config("common_config") {
kjellander@webrtc.org79ee97c2014-09-04 14:10:4972 cflags = []
73 cflags_cc = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:1074 if (rtc_restrict_logging) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0375 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
76 }
77
kjellander@webrtc.org6d08ca62014-09-07 17:36:1078 if (rtc_have_dbus_glib) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0379 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
83 # dirs on Linux.
84 all_dependent_configs = [ "dbus-glib" ]
85 }
86
kjellander@webrtc.org6d08ca62014-09-07 17:36:1087 if (rtc_enable_video) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0388 defines += [ "WEBRTC_MODULE_UTILITY_VIDEO" ]
89 }
90
brettw@chromium.org9fe11012014-09-09 19:15:3391 if (build_with_chromium) {
92 defines += [ "LOGGING_INSIDE_WEBRTC" ]
93 } else {
kjellander@webrtc.org851a09e2014-06-17 08:54:0394 if (is_posix) {
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
99 # of stlport.
100 # See: https://code.google.com/p/chromium/issues/detail?id=379699
101 if (cpu_arch != "arm64" || !is_android) {
102 cflags = [
103 "-Wextra",
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",
109 ]
110 cflags_cc = [
111 "-Wnon-virtual-dtor",
112 # This is enabled for clang; enable for gcc as well.
113 "-Woverloaded-virtual",
114 ]
115 }
116 }
117
118 if (is_clang) {
119 cflags += [ "-Wthread-safety" ]
120 }
121 }
122
tkchin@webrtc.org14146e42014-10-31 00:14:39123 if (cpu_arch == "arm64") {
124 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40125 # TODO(zhongwei) Defining an unique WEBRTC_NEON and
126 # distinguishing ARMv7 NEON and ARM64 NEON by
127 # WEBRTC_ARCH_ARM_V7 and WEBRTC_ARCH_ARM64 should be better.
128
129 # This macro is used to distinguish ARMv7 NEON and ARM64 NEON
130 defines += [ "WEBRTC_ARCH_ARM64_NEON" ]
tkchin@webrtc.org14146e42014-10-31 00:14:39131 }
132
kjellander@webrtc.org851a09e2014-06-17 08:54:03133 if (cpu_arch == "arm") {
134 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40135 if (arm_version >= 7) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03136 defines += [ "WEBRTC_ARCH_ARM_V7" ]
137 if (arm_use_neon) {
138 defines += [ "WEBRTC_ARCH_ARM_NEON" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40139 } else if (is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03140 defines += [ "WEBRTC_DETECT_ARM_NEON" ]
141 }
142 }
143 }
144
145 if (cpu_arch == "mipsel") {
146 defines += [ "MIPS32_LE" ]
147 if (mips_fpu) {
148 defines += [ "MIPS_FPU_LE" ]
149 cflags += [ "-mhard-float" ]
150 } else {
151 cflags += [ "-msoft-float" ]
152 }
153 if (mips_arch_variant == "mips32r2") {
154 defines += [ "MIPS32_R2_LE" ]
155 cflags += [ "-mips32r2" ]
156 cflags_cc += [ "-mips32r2" ]
157 }
158 if (mips_dsp_rev == 1) {
159 defines += [ "MIPS_DSP_R1_LE" ]
160 cflags += [ "-mdsp" ]
161 cflags_cc += [ "-mdsp" ]
162 } else if (mips_dsp_rev == 2) {
163 defines += [
164 "MIPS_DSP_R1_LE",
165 "MIPS_DSP_R2_LE",
166 ]
167 cflags += [ "-mdspr2" ]
168 cflags_cc += [ "-mdspr2" ]
169 }
170 }
171
172 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
173 # default warnings set in build/config/compiler/BUILD.gn.
174
175 if (is_android && is_clang) {
176 # The Android NDK doesn"t provide optimized versions of these
177 # functions. Ensure they are disabled for all compilers.
178 cflags += [
179 "-fno-builtin-cos",
180 "-fno-builtin-sin",
181 "-fno-builtin-cosf",
182 "-fno-builtin-sinf",
183 ]
184 }
185}
186
kjellander@webrtc.org14ea50a2014-11-12 07:56:21187source_set("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07188 sources = [
189 "call.h",
190 "config.h",
191 "experiments.h",
192 "frame_callback.h",
193 "transport.h",
194 ]
195
kjellander@webrtc.orgf21ea912014-09-28 17:37:22196 configs += [ ":common_config" ]
197 public_configs = [ ":common_inherited_config"]
kjellander@webrtc.org9bef5512014-07-13 09:02:54198
kjellander@webrtc.org851a09e2014-06-17 08:54:03199 deps = [
kjellander@webrtc.org1227ab82014-06-23 19:21:07200 ":webrtc_common",
kjellander@webrtc.org851a09e2014-06-17 08:54:03201 "base:webrtc_base",
kjellander@webrtc.org1227ab82014-06-23 19:21:07202 "common_audio",
203 "common_video",
204 "modules/audio_coding",
205 "modules/audio_conference_mixer",
206 "modules/audio_device",
207 "modules/audio_processing",
208 "modules/bitrate_controller",
209 "modules/desktop_capture",
210 "modules/media_file",
211 "modules/rtp_rtcp",
212 "modules/utility",
213 "modules/video_capture",
214 "modules/video_coding",
215 "modules/video_processing",
216 "modules/video_render",
kjellander@webrtc.org78f440c2014-06-21 14:25:16217 "system_wrappers",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02218 "tools",
kjellander@webrtc.org1227ab82014-06-23 19:21:07219 "video",
220 "video_engine",
221 "voice_engine",
222 ]
223}
224
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02225if (!build_with_chromium) {
226 executable("webrtc_tests") {
227 testonly = true
228 deps = [
229 ":webrtc",
230 "modules/video_render:video_render_internal_impl",
231 "modules/video_capture:video_capture_internal_impl",
232 "test",
233 ]
234 }
235}
236
kjellander@webrtc.org1227ab82014-06-23 19:21:07237source_set("webrtc_common") {
238 sources = [
239 "config.h",
240 "config.cc",
kjellander@webrtc.org851a09e2014-06-17 08:54:03241 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54242
kjellander@webrtc.org42ee5b52014-08-25 14:15:35243 if (is_clang) {
244 # Suppress warnings from Chrome's Clang plugins.
245 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
246 configs -= [ "//build/config/clang:find_bad_constructs" ]
247 }
248
kjellander@webrtc.orgf21ea912014-09-28 17:37:22249 configs += [ ":common_config" ]
250 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03251}