blob: 20290ebb37fd9de4dca4e084440fafe455be1618 [file] [log] [blame]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +00001# 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:22 +00009# TODO(kjellander): Rebase this to webrtc/build/common.gypi changes after r6330.
10
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000011import("//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",
26 "LOGGING_INSIDE_WEBRTC",
27 ]
28 include_dirs = [
29 # overrides must be included first as that is the mechanism for
30 # selecting the override headers in Chromium.
31 "overrides",
32 # Allow includes to be prefixed with webrtc/ in case it is not an
33 # immediate subdirectory of the top-level.
34 "..",
35 ]
36 }
37 if (is_posix) {
38 defines += [ "WEBRTC_POSIX" ]
39 }
40 if (is_ios) {
41 defines += [
42 "WEBRTC_MAC",
43 "WEBRTC_IOS",
44 ]
45 }
46 if (is_linux) {
47 defines += [ "WEBRTC_LINUX" ]
48 }
49 if (is_mac) {
50 defines += [ "WEBRTC_MAC" ]
51 }
52 if (is_win) {
53 defines += [ "WEBRTC_WIN" ]
54 }
55 if (is_android) {
56 defines += [
57 "WEBRTC_LINUX",
58 "WEBRTC_ANDROID",
59 ]
60 if (enable_android_opensl) {
61 defines += [ "WEBRTC_ANDROID_OPENSLES" ]
62 }
63 }
64}
65
kjellander@webrtc.org7497fa72014-06-28 18:05:22 +000066if (have_dbus_glib) {
67 pkg_config("dbus-glib") {
68 packages = [ "dbus-glib-1" ]
69 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000070}
71
72config("common_config") {
kjellander@webrtc.org79ee97c2014-09-04 14:10:49 +000073 cflags = []
74 cflags_cc = []
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000075 if (restrict_webrtc_logging) {
76 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
77 }
78
79 if (have_dbus_glib) {
80 defines += [ "HAVE_DBUS_GLIB" ]
81 # TODO(kjellander): Investigate this, it seems like include <dbus/dbus.h>
82 # is still not found even if the execution of
83 # build/config/linux/pkg-config.py dbus-glib-1 returns correct include
84 # dirs on Linux.
85 all_dependent_configs = [ "dbus-glib" ]
86 }
87
88 if (enable_video) {
89 defines += [ "WEBRTC_MODULE_UTILITY_VIDEO" ]
90 }
91
92 if (!build_with_chromium) {
93 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
122 if (cpu_arch == "arm") {
123 defines += [ "WEBRTC_ARCH_ARM" ]
124 if (arm_version == 7) {
125 defines += [ "WEBRTC_ARCH_ARM_V7" ]
126 if (arm_use_neon) {
127 defines += [ "WEBRTC_ARCH_ARM_NEON" ]
128 } else {
129 defines += [ "WEBRTC_DETECT_ARM_NEON" ]
130 }
131 }
132 }
133
134 if (cpu_arch == "mipsel") {
135 defines += [ "MIPS32_LE" ]
136 if (mips_fpu) {
137 defines += [ "MIPS_FPU_LE" ]
138 cflags += [ "-mhard-float" ]
139 } else {
140 cflags += [ "-msoft-float" ]
141 }
142 if (mips_arch_variant == "mips32r2") {
143 defines += [ "MIPS32_R2_LE" ]
144 cflags += [ "-mips32r2" ]
145 cflags_cc += [ "-mips32r2" ]
146 }
147 if (mips_dsp_rev == 1) {
148 defines += [ "MIPS_DSP_R1_LE" ]
149 cflags += [ "-mdsp" ]
150 cflags_cc += [ "-mdsp" ]
151 } else if (mips_dsp_rev == 2) {
152 defines += [
153 "MIPS_DSP_R1_LE",
154 "MIPS_DSP_R2_LE",
155 ]
156 cflags += [ "-mdspr2" ]
157 cflags_cc += [ "-mdspr2" ]
158 }
159 }
160
161 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
162 # default warnings set in build/config/compiler/BUILD.gn.
163
164 if (is_android && is_clang) {
165 # The Android NDK doesn"t provide optimized versions of these
166 # functions. Ensure they are disabled for all compilers.
167 cflags += [
168 "-fno-builtin-cos",
169 "-fno-builtin-sin",
170 "-fno-builtin-cosf",
171 "-fno-builtin-sinf",
172 ]
173 }
174}
175
176static_library("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000177 sources = [
178 "call.h",
179 "config.h",
180 "experiments.h",
181 "frame_callback.h",
182 "transport.h",
183 ]
184
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000185 direct_dependent_configs = [ ":common_inherited_config"]
186
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000187 deps = [
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000188 ":webrtc_common",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000189 "base:webrtc_base",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000190 "common_audio",
191 "common_video",
192 "modules/audio_coding",
193 "modules/audio_conference_mixer",
194 "modules/audio_device",
195 "modules/audio_processing",
196 "modules/bitrate_controller",
197 "modules/desktop_capture",
198 "modules/media_file",
199 "modules/rtp_rtcp",
200 "modules/utility",
201 "modules/video_capture",
202 "modules/video_coding",
203 "modules/video_processing",
204 "modules/video_render",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000205 "system_wrappers",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000206 "video",
207 "video_engine",
208 "voice_engine",
209 ]
210}
211
212source_set("webrtc_common") {
213 sources = [
214 "config.h",
215 "config.cc",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000216 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000217
kjellander@webrtc.org42ee5b52014-08-25 14:15:35 +0000218 if (is_clang) {
219 # Suppress warnings from Chrome's Clang plugins.
220 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
221 configs -= [ "//build/config/clang:find_bad_constructs" ]
222 }
223
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000224 configs += [ ":common_inherited_config"]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000225}