blob: a361fc2673e53ace948db377e662ca8578f15841 [file] [log] [blame]
kjellander@webrtc.orgd6d5bff2014-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.orgb94f8472014-06-28 18:05:22 +00009# TODO(kjellander): Rebase this to webrtc/build/common.gypi changes after r6330.
10
kjellander@webrtc.orgd6d5bff2014-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",
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +000026 ]
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.org4ad10d62014-09-07 17:36:10 +000059 if (rtc_enable_android_opensl) {
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +000060 defines += [ "WEBRTC_ANDROID_OPENSLES" ]
61 }
62 }
63}
64
kjellander@webrtc.org4ad10d62014-09-07 17:36:10 +000065if (rtc_have_dbus_glib) {
kjellander@webrtc.orgb94f8472014-06-28 18:05:22 +000066 pkg_config("dbus-glib") {
67 packages = [ "dbus-glib-1" ]
68 }
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +000069}
70
71config("common_config") {
kjellander@webrtc.orga6635482014-09-04 14:10:49 +000072 cflags = []
73 cflags_cc = []
kjellander@webrtc.org4ad10d62014-09-07 17:36:10 +000074 if (rtc_restrict_logging) {
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +000075 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
76 }
77
kjellander@webrtc.org4ad10d62014-09-07 17:36:10 +000078 if (rtc_have_dbus_glib) {
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +000079 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.org4ad10d62014-09-07 17:36:10 +000087 if (rtc_enable_video) {
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +000088 defines += [ "WEBRTC_MODULE_UTILITY_VIDEO" ]
89 }
90
brettw@chromium.org02002ef2014-09-09 19:15:33 +000091 if (build_with_chromium) {
92 defines += [ "LOGGING_INSIDE_WEBRTC" ]
93 } else {
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +000094 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
123 if (cpu_arch == "arm") {
124 defines += [ "WEBRTC_ARCH_ARM" ]
125 if (arm_version == 7) {
126 defines += [ "WEBRTC_ARCH_ARM_V7" ]
127 if (arm_use_neon) {
128 defines += [ "WEBRTC_ARCH_ARM_NEON" ]
129 } else {
130 defines += [ "WEBRTC_DETECT_ARM_NEON" ]
131 }
132 }
133 }
134
135 if (cpu_arch == "mipsel") {
136 defines += [ "MIPS32_LE" ]
137 if (mips_fpu) {
138 defines += [ "MIPS_FPU_LE" ]
139 cflags += [ "-mhard-float" ]
140 } else {
141 cflags += [ "-msoft-float" ]
142 }
143 if (mips_arch_variant == "mips32r2") {
144 defines += [ "MIPS32_R2_LE" ]
145 cflags += [ "-mips32r2" ]
146 cflags_cc += [ "-mips32r2" ]
147 }
148 if (mips_dsp_rev == 1) {
149 defines += [ "MIPS_DSP_R1_LE" ]
150 cflags += [ "-mdsp" ]
151 cflags_cc += [ "-mdsp" ]
152 } else if (mips_dsp_rev == 2) {
153 defines += [
154 "MIPS_DSP_R1_LE",
155 "MIPS_DSP_R2_LE",
156 ]
157 cflags += [ "-mdspr2" ]
158 cflags_cc += [ "-mdspr2" ]
159 }
160 }
161
162 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
163 # default warnings set in build/config/compiler/BUILD.gn.
164
165 if (is_android && is_clang) {
166 # The Android NDK doesn"t provide optimized versions of these
167 # functions. Ensure they are disabled for all compilers.
168 cflags += [
169 "-fno-builtin-cos",
170 "-fno-builtin-sin",
171 "-fno-builtin-cosf",
172 "-fno-builtin-sinf",
173 ]
174 }
175}
176
177static_library("webrtc") {
kjellander@webrtc.org3610f632014-06-23 19:21:07 +0000178 sources = [
179 "call.h",
180 "config.h",
181 "experiments.h",
182 "frame_callback.h",
183 "transport.h",
184 ]
185
kjellander@webrtc.orgccf0fef2014-07-13 09:02:54 +0000186 direct_dependent_configs = [ ":common_inherited_config"]
187
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +0000188 deps = [
kjellander@webrtc.org3610f632014-06-23 19:21:07 +0000189 ":webrtc_common",
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +0000190 "base:webrtc_base",
kjellander@webrtc.org3610f632014-06-23 19:21:07 +0000191 "common_audio",
192 "common_video",
193 "modules/audio_coding",
194 "modules/audio_conference_mixer",
195 "modules/audio_device",
196 "modules/audio_processing",
197 "modules/bitrate_controller",
198 "modules/desktop_capture",
199 "modules/media_file",
200 "modules/rtp_rtcp",
201 "modules/utility",
202 "modules/video_capture",
203 "modules/video_coding",
204 "modules/video_processing",
205 "modules/video_render",
kjellander@webrtc.orgac5cd562014-06-21 14:25:16 +0000206 "system_wrappers",
kjellander@webrtc.org3610f632014-06-23 19:21:07 +0000207 "video",
208 "video_engine",
209 "voice_engine",
210 ]
211}
212
213source_set("webrtc_common") {
214 sources = [
215 "config.h",
216 "config.cc",
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +0000217 ]
kjellander@webrtc.orgccf0fef2014-07-13 09:02:54 +0000218
kjellander@webrtc.org5a2b2f12014-08-25 14:15:35 +0000219 if (is_clang) {
220 # Suppress warnings from Chrome's Clang plugins.
221 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
222 configs -= [ "//build/config/clang:find_bad_constructs" ]
223 }
224
kjellander@webrtc.orgccf0fef2014-07-13 09:02:54 +0000225 configs += [ ":common_inherited_config"]
kjellander@webrtc.orgd6d5bff2014-06-17 08:54:03 +0000226}