blob: 05e2e1930626c20612e8cd7114d4a82bf72cd4e1 [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")
Bjorn Terelius36411852015-07-30 10:45:1814import("//third_party/protobuf/proto_library.gni")
kjellander@webrtc.org851a09e2014-06-17 08:54:0315
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) {
Henrik Kjellander57e5fd22015-05-25 10:55:3924 defines = [ "WEBRTC_CHROMIUM_BUILD" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:0325 include_dirs = [
26 # overrides must be included first as that is the mechanism for
27 # selecting the override headers in Chromium.
28 "overrides",
Henrik Kjellander57e5fd22015-05-25 10:55:3929
kjellander@webrtc.org851a09e2014-06-17 08:54:0330 # 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 }
Zeke Chin71f6f442015-06-29 21:34:5844 if (is_ios && rtc_use_objc_h264) {
45 defines += [ "WEBRTC_OBJC_H264" ]
46 }
kjellander@webrtc.org851a09e2014-06-17 08:54:0347 if (is_linux) {
48 defines += [ "WEBRTC_LINUX" ]
49 }
50 if (is_mac) {
51 defines += [ "WEBRTC_MAC" ]
52 }
53 if (is_win) {
54 defines += [ "WEBRTC_WIN" ]
55 }
56 if (is_android) {
57 defines += [
58 "WEBRTC_LINUX",
59 "WEBRTC_ANDROID",
60 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:0361 }
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" ]
Henrik Kjellander57e5fd22015-05-25 10:55:3979
kjellander@webrtc.org851a09e2014-06-17 08:54:0380 # 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
brettw@chromium.org9fe11012014-09-09 19:15:3387 if (build_with_chromium) {
88 defines += [ "LOGGING_INSIDE_WEBRTC" ]
89 } else {
kjellander@webrtc.org851a09e2014-06-17 08:54:0390 if (is_posix) {
91 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
92 # for targets that can handle it. For Android/arm64 right now
93 # there will be an "enumeral and non-enumeral type in conditional
94 # expression" warning in android_tools/ndk_experimental"s version
95 # of stlport.
96 # See: https://code.google.com/p/chromium/issues/detail?id=379699
kjellander@webrtc.org72273912015-02-23 19:08:3197 if (current_cpu != "arm64" || !is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:0398 cflags = [
99 "-Wextra",
Henrik Kjellander57e5fd22015-05-25 10:55:39100
kjellander@webrtc.org851a09e2014-06-17 08:54:03101 # 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",
Henrik Kjellander57e5fd22015-05-25 10:55:39109
kjellander@webrtc.org851a09e2014-06-17 08:54:03110 # This is enabled for clang; enable for gcc as well.
111 "-Woverloaded-virtual",
112 ]
113 }
114 }
115
116 if (is_clang) {
117 cflags += [ "-Wthread-safety" ]
118 }
119 }
120
kjellander@webrtc.org72273912015-02-23 19:08:31121 if (current_cpu == "arm64") {
Andrew MacDonaldcb7f8ce2015-05-20 05:20:17122 defines += [ "WEBRTC_ARCH_ARM64" ]
123 defines += [ "WEBRTC_HAS_NEON" ]
tkchin@webrtc.org14146e42014-10-31 00:14:39124 }
125
kjellander@webrtc.org72273912015-02-23 19:08:31126 if (current_cpu == "arm") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03127 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40128 if (arm_version >= 7) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03129 defines += [ "WEBRTC_ARCH_ARM_V7" ]
130 if (arm_use_neon) {
Andrew MacDonaldcb7f8ce2015-05-20 05:20:17131 defines += [ "WEBRTC_HAS_NEON" ]
132 } else if (arm_optionally_use_neon) {
133 defines += [ "WEBRTC_DETECT_NEON" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03134 }
135 }
136 }
137
kjellander@webrtc.org72273912015-02-23 19:08:31138 if (current_cpu == "mipsel") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03139 defines += [ "MIPS32_LE" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31140 if (mips_float_abi == "hard") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03141 defines += [ "MIPS_FPU_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03142 }
kjellander@webrtc.orgacb80852015-01-25 19:17:56143 if (mips_arch_variant == "r2") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03144 defines += [ "MIPS32_R2_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03145 }
146 if (mips_dsp_rev == 1) {
147 defines += [ "MIPS_DSP_R1_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03148 } else if (mips_dsp_rev == 2) {
149 defines += [
150 "MIPS_DSP_R1_LE",
151 "MIPS_DSP_R2_LE",
152 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03153 }
154 }
155
156 # TODO(kjellander): Handle warnings on Windows where WebRTC differ from the
157 # default warnings set in build/config/compiler/BUILD.gn.
158
159 if (is_android && is_clang) {
160 # The Android NDK doesn"t provide optimized versions of these
161 # functions. Ensure they are disabled for all compilers.
162 cflags += [
163 "-fno-builtin-cos",
164 "-fno-builtin-sin",
165 "-fno-builtin-cosf",
166 "-fno-builtin-sinf",
167 ]
168 }
169}
170
kjellander@webrtc.org14ea50a2014-11-12 07:56:21171source_set("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07172 sources = [
173 "call.h",
174 "config.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07175 "frame_callback.h",
176 "transport.h",
177 ]
178
Bjorn Terelius36411852015-07-30 10:45:18179 defines = []
kjellander@webrtc.orgf21ea912014-09-28 17:37:22180 configs += [ ":common_config" ]
Henrik Kjellander57e5fd22015-05-25 10:55:39181 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54182
kjellander@webrtc.org851a09e2014-06-17 08:54:03183 deps = [
kjellander@webrtc.org1227ab82014-06-23 19:21:07184 ":webrtc_common",
kjellander@webrtc.orgc429b822015-01-21 20:22:33185 "base:rtc_base",
kjellander@webrtc.org1227ab82014-06-23 19:21:07186 "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",
kjellander@webrtc.org1227ab82014-06-23 19:21:07197 "modules/video_coding",
198 "modules/video_processing",
kjellander@webrtc.org78f440c2014-06-21 14:25:16199 "system_wrappers",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02200 "tools",
kjellander@webrtc.org1227ab82014-06-23 19:21:07201 "video",
kjellander@webrtc.org1227ab82014-06-23 19:21:07202 "voice_engine",
203 ]
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00204
205 if (build_with_chromium) {
206 deps += [
Henrik Kjellander57e5fd22015-05-25 10:55:39207 "modules/video_capture",
208 "modules/video_render",
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00209 ]
210 }
Bjorn Terelius36411852015-07-30 10:45:18211
212 if (rtc_enable_protobuf) {
213 defines += [ "ENABLE_RTC_EVENT_LOG" ]
214 deps += [ ":rtc_event_log_proto" ]
215 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07216}
217
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02218if (!build_with_chromium) {
219 executable("webrtc_tests") {
220 testonly = true
221 deps = [
222 ":webrtc",
223 "modules/video_render:video_render_internal_impl",
224 "modules/video_capture:video_capture_internal_impl",
225 "test",
226 ]
227 }
228}
229
kjellander@webrtc.org1227ab82014-06-23 19:21:07230source_set("webrtc_common") {
231 sources = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22232 "common_types.cc",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26233 "common_types.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07234 "config.cc",
Henrik Kjellander57e5fd22015-05-25 10:55:39235 "config.h",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26236 "engine_configurations.h",
237 "typedefs.h",
kjellander@webrtc.org851a09e2014-06-17 08:54:03238 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54239
kjellander@webrtc.orgf21ea912014-09-28 17:37:22240 configs += [ ":common_config" ]
241 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03242}
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26243
244source_set("gtest_prod") {
245 sources = [
246 "test/testsupport/gtest_prod_util.h",
247 ]
248}
Bjorn Terelius36411852015-07-30 10:45:18249
250if (rtc_enable_protobuf) {
251 proto_library("rtc_event_log_proto") {
252 sources = [
253 "video/rtc_event_log.proto",
254 ]
255 proto_out_dir = "webrtc/video"
256 }
257}
258
259source_set("rtc_event_log") {
260 sources = [
261 "video/rtc_event_log.cc",
262 "video/rtc_event_log.h",
263 ]
264
265 defines = []
266 configs += [ ":common_config" ]
267 public_configs = [ ":common_inherited_config" ]
268
269 deps = [
270 ":webrtc_common",
271 ]
272
273 if (rtc_enable_protobuf) {
274 defines += [ "ENABLE_RTC_EVENT_LOG" ]
275 deps += [ ":rtc_event_log_proto" ]
276 }
sergeyu4df08ff2015-09-02 21:22:40277 if (is_clang && !is_nacl) {
Bjorn Terelius36411852015-07-30 10:45:18278 # Suppress warnings from Chrome's Clang plugins.
279 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
280 configs -= [ "//build/config/clang:find_bad_constructs" ]
281 }
282}