blob: 6f9f06807f71b4afd9775ead18a688777c4ab1e3 [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") {
73 if (restrict_webrtc_logging) {
74 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
75 }
76
77 if (have_dbus_glib) {
78 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
86 if (enable_video) {
87 defines += [ "WEBRTC_MODULE_UTILITY_VIDEO" ]
88 }
89
90 if (!build_with_chromium) {
91 if (is_posix) {
92 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
93 # for targets that can handle it. For Android/arm64 right now
94 # there will be an "enumeral and non-enumeral type in conditional
95 # expression" warning in android_tools/ndk_experimental"s version
96 # of stlport.
97 # See: https://code.google.com/p/chromium/issues/detail?id=379699
98 if (cpu_arch != "arm64" || !is_android) {
99 cflags = [
100 "-Wextra",
101 # We need to repeat some flags from Chromium"s common.gypi
102 # here that get overridden by -Wextra.
103 "-Wno-unused-parameter",
104 "-Wno-missing-field-initializers",
105 "-Wno-strict-overflow",
106 ]
107 cflags_cc = [
108 "-Wnon-virtual-dtor",
109 # This is enabled for clang; enable for gcc as well.
110 "-Woverloaded-virtual",
111 ]
112 }
113 }
114
115 if (is_clang) {
116 cflags += [ "-Wthread-safety" ]
117 }
118 }
119
120 if (cpu_arch == "arm") {
121 defines += [ "WEBRTC_ARCH_ARM" ]
122 if (arm_version == 7) {
123 defines += [ "WEBRTC_ARCH_ARM_V7" ]
124 if (arm_use_neon) {
125 defines += [ "WEBRTC_ARCH_ARM_NEON" ]
126 } else {
127 defines += [ "WEBRTC_DETECT_ARM_NEON" ]
128 }
129 }
130 }
131
132 if (cpu_arch == "mipsel") {
133 defines += [ "MIPS32_LE" ]
134 if (mips_fpu) {
135 defines += [ "MIPS_FPU_LE" ]
136 cflags += [ "-mhard-float" ]
137 } else {
138 cflags += [ "-msoft-float" ]
139 }
140 if (mips_arch_variant == "mips32r2") {
141 defines += [ "MIPS32_R2_LE" ]
142 cflags += [ "-mips32r2" ]
143 cflags_cc += [ "-mips32r2" ]
144 }
145 if (mips_dsp_rev == 1) {
146 defines += [ "MIPS_DSP_R1_LE" ]
147 cflags += [ "-mdsp" ]
148 cflags_cc += [ "-mdsp" ]
149 } else if (mips_dsp_rev == 2) {
150 defines += [
151 "MIPS_DSP_R1_LE",
152 "MIPS_DSP_R2_LE",
153 ]
154 cflags += [ "-mdspr2" ]
155 cflags_cc += [ "-mdspr2" ]
156 }
157 }
158
159 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
160 # default warnings set in build/config/compiler/BUILD.gn.
161
162 if (is_android && is_clang) {
163 # The Android NDK doesn"t provide optimized versions of these
164 # functions. Ensure they are disabled for all compilers.
165 cflags += [
166 "-fno-builtin-cos",
167 "-fno-builtin-sin",
168 "-fno-builtin-cosf",
169 "-fno-builtin-sinf",
170 ]
171 }
172}
173
174static_library("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000175 sources = [
176 "call.h",
177 "config.h",
178 "experiments.h",
179 "frame_callback.h",
180 "transport.h",
181 ]
182
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000183 deps = [
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000184 ":webrtc_common",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000185 "base:webrtc_base",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000186 "common_audio",
187 "common_video",
188 "modules/audio_coding",
189 "modules/audio_conference_mixer",
190 "modules/audio_device",
191 "modules/audio_processing",
192 "modules/bitrate_controller",
193 "modules/desktop_capture",
194 "modules/media_file",
195 "modules/rtp_rtcp",
196 "modules/utility",
197 "modules/video_capture",
198 "modules/video_coding",
199 "modules/video_processing",
200 "modules/video_render",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000201 "system_wrappers",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000202 "video",
203 "video_engine",
204 "voice_engine",
205 ]
206}
207
208source_set("webrtc_common") {
209 sources = [
210 "config.h",
211 "config.cc",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000212 ]
213}