blob: fdcfdaad2390e5bf64cf3c11a1a71848900db782 [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/crypto.gni")
12import("//build/config/linux/pkg_config.gni")
13import("build/webrtc.gni")
14
15# Contains the defines and includes in common.gypi that are duplicated both as
16# target_defaults and direct_dependent_settings.
17config("common_inherited_config") {
18 defines = []
19 if (build_with_mozilla) {
20 defines += [ "WEBRTC_MOZILLA_BUILD" ]
21 }
22 if (build_with_chromium) {
23 defines = [
24 "WEBRTC_CHROMIUM_BUILD",
kjellander@webrtc.org851a09e2014-06-17 08:54:0325 ]
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 ]
kjellander@webrtc.org6d08ca62014-09-07 17:36:1058 if (rtc_enable_android_opensl) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0359 defines += [ "WEBRTC_ANDROID_OPENSLES" ]
60 }
61 }
62}
63
kjellander@webrtc.org6d08ca62014-09-07 17:36:1064if (rtc_have_dbus_glib) {
kjellander@webrtc.org7497fa72014-06-28 18:05:2265 pkg_config("dbus-glib") {
66 packages = [ "dbus-glib-1" ]
67 }
kjellander@webrtc.org851a09e2014-06-17 08:54:0368}
69
70config("common_config") {
kjellander@webrtc.org79ee97c2014-09-04 14:10:4971 cflags = []
72 cflags_cc = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:1073 if (rtc_restrict_logging) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0374 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
75 }
76
kjellander@webrtc.org6d08ca62014-09-07 17:36:1077 if (rtc_have_dbus_glib) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0378 defines += [ "HAVE_DBUS_GLIB" ]
79 # TODO(kjellander): Investigate this, it seems like include <dbus/dbus.h>
80 # is still not found even if the execution of
81 # build/config/linux/pkg-config.py dbus-glib-1 returns correct include
82 # dirs on Linux.
83 all_dependent_configs = [ "dbus-glib" ]
84 }
85
kjellander@webrtc.org6d08ca62014-09-07 17:36:1086 if (rtc_enable_video) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0387 defines += [ "WEBRTC_MODULE_UTILITY_VIDEO" ]
88 }
89
brettw@chromium.org9fe11012014-09-09 19:15:3390 if (build_with_chromium) {
91 defines += [ "LOGGING_INSIDE_WEBRTC" ]
92 } else {
kjellander@webrtc.org851a09e2014-06-17 08:54:0393 if (is_posix) {
94 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
95 # for targets that can handle it. For Android/arm64 right now
96 # there will be an "enumeral and non-enumeral type in conditional
97 # expression" warning in android_tools/ndk_experimental"s version
98 # of stlport.
99 # See: https://code.google.com/p/chromium/issues/detail?id=379699
100 if (cpu_arch != "arm64" || !is_android) {
101 cflags = [
102 "-Wextra",
103 # We need to repeat some flags from Chromium"s common.gypi
104 # here that get overridden by -Wextra.
105 "-Wno-unused-parameter",
106 "-Wno-missing-field-initializers",
107 "-Wno-strict-overflow",
108 ]
109 cflags_cc = [
110 "-Wnon-virtual-dtor",
111 # This is enabled for clang; enable for gcc as well.
112 "-Woverloaded-virtual",
113 ]
114 }
115 }
116
117 if (is_clang) {
118 cflags += [ "-Wthread-safety" ]
119 }
120 }
121
tkchin@webrtc.org14146e42014-10-31 00:14:39122 if (cpu_arch == "arm64") {
123 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40124 # TODO(zhongwei) Defining an unique WEBRTC_NEON and
125 # distinguishing ARMv7 NEON and ARM64 NEON by
126 # WEBRTC_ARCH_ARM_V7 and WEBRTC_ARCH_ARM64 should be better.
127
128 # This macro is used to distinguish ARMv7 NEON and ARM64 NEON
129 defines += [ "WEBRTC_ARCH_ARM64_NEON" ]
tkchin@webrtc.org14146e42014-10-31 00:14:39130 }
131
kjellander@webrtc.org851a09e2014-06-17 08:54:03132 if (cpu_arch == "arm") {
133 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40134 if (arm_version >= 7) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03135 defines += [ "WEBRTC_ARCH_ARM_V7" ]
136 if (arm_use_neon) {
137 defines += [ "WEBRTC_ARCH_ARM_NEON" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40138 } else if (is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03139 defines += [ "WEBRTC_DETECT_ARM_NEON" ]
140 }
141 }
142 }
143
144 if (cpu_arch == "mipsel") {
145 defines += [ "MIPS32_LE" ]
146 if (mips_fpu) {
147 defines += [ "MIPS_FPU_LE" ]
148 cflags += [ "-mhard-float" ]
149 } else {
150 cflags += [ "-msoft-float" ]
151 }
kjellander@webrtc.orgacb80852015-01-25 19:17:56152 if (mips_arch_variant == "r2") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03153 defines += [ "MIPS32_R2_LE" ]
154 cflags += [ "-mips32r2" ]
155 cflags_cc += [ "-mips32r2" ]
156 }
157 if (mips_dsp_rev == 1) {
158 defines += [ "MIPS_DSP_R1_LE" ]
159 cflags += [ "-mdsp" ]
160 cflags_cc += [ "-mdsp" ]
161 } else if (mips_dsp_rev == 2) {
162 defines += [
163 "MIPS_DSP_R1_LE",
164 "MIPS_DSP_R2_LE",
165 ]
166 cflags += [ "-mdspr2" ]
167 cflags_cc += [ "-mdspr2" ]
168 }
169 }
170
171 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
172 # default warnings set in build/config/compiler/BUILD.gn.
173
174 if (is_android && is_clang) {
175 # The Android NDK doesn"t provide optimized versions of these
176 # functions. Ensure they are disabled for all compilers.
177 cflags += [
178 "-fno-builtin-cos",
179 "-fno-builtin-sin",
180 "-fno-builtin-cosf",
181 "-fno-builtin-sinf",
182 ]
183 }
184}
185
kjellander@webrtc.org14ea50a2014-11-12 07:56:21186source_set("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07187 sources = [
188 "call.h",
189 "config.h",
190 "experiments.h",
191 "frame_callback.h",
192 "transport.h",
193 ]
194
kjellander@webrtc.orgf21ea912014-09-28 17:37:22195 configs += [ ":common_config" ]
196 public_configs = [ ":common_inherited_config"]
kjellander@webrtc.org9bef5512014-07-13 09:02:54197
kjellander@webrtc.org851a09e2014-06-17 08:54:03198 deps = [
kjellander@webrtc.org1227ab82014-06-23 19:21:07199 ":webrtc_common",
kjellander@webrtc.orgc429b822015-01-21 20:22:33200 "base:rtc_base",
kjellander@webrtc.org1227ab82014-06-23 19:21:07201 "common_audio",
202 "common_video",
203 "modules/audio_coding",
204 "modules/audio_conference_mixer",
205 "modules/audio_device",
206 "modules/audio_processing",
207 "modules/bitrate_controller",
208 "modules/desktop_capture",
209 "modules/media_file",
210 "modules/rtp_rtcp",
211 "modules/utility",
212 "modules/video_capture",
213 "modules/video_coding",
214 "modules/video_processing",
215 "modules/video_render",
kjellander@webrtc.org78f440c2014-06-21 14:25:16216 "system_wrappers",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02217 "tools",
kjellander@webrtc.org1227ab82014-06-23 19:21:07218 "video",
219 "video_engine",
220 "voice_engine",
221 ]
222}
223
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02224if (!build_with_chromium) {
225 executable("webrtc_tests") {
226 testonly = true
227 deps = [
228 ":webrtc",
229 "modules/video_render:video_render_internal_impl",
230 "modules/video_capture:video_capture_internal_impl",
231 "test",
232 ]
233 }
234}
235
kjellander@webrtc.org1227ab82014-06-23 19:21:07236source_set("webrtc_common") {
237 sources = [
238 "config.h",
239 "config.cc",
kjellander@webrtc.org851a09e2014-06-17 08:54:03240 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54241
kjellander@webrtc.org42ee5b52014-08-25 14:15:35242 if (is_clang) {
243 # Suppress warnings from Chrome's Clang plugins.
244 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
245 configs -= [ "//build/config/clang:find_bad_constructs" ]
246 }
247
kjellander@webrtc.orgf21ea912014-09-28 17:37:22248 configs += [ ":common_config" ]
249 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03250}