blob: 45e7c144fd920661aaa029a207d5592658b6b52a [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/linux/pkg_config.gni")
12import("build/webrtc.gni")
Bjorn Terelius36411852015-07-30 12:45:18 +020013import("//third_party/protobuf/proto_library.gni")
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000014
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) {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020023 defines = [ "WEBRTC_CHROMIUM_BUILD" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000024 include_dirs = [
henrikgee2bf412015-09-30 03:48:52 -070025 # The overrides must be included first as that is the mechanism for
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000026 # selecting the override headers in Chromium.
henrikgee2bf412015-09-30 03:48:52 -070027 "../webrtc_overrides",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020028
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000029 # Allow includes to be prefixed with webrtc/ in case it is not an
30 # immediate subdirectory of the top-level.
31 "..",
32 ]
33 }
34 if (is_posix) {
35 defines += [ "WEBRTC_POSIX" ]
36 }
37 if (is_ios) {
38 defines += [
39 "WEBRTC_MAC",
40 "WEBRTC_IOS",
41 ]
42 }
Zeke Chin71f6f442015-06-29 14:34:58 -070043 if (is_ios && rtc_use_objc_h264) {
44 defines += [ "WEBRTC_OBJC_H264" ]
45 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000046 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 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000060 }
61}
62
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000063if (rtc_have_dbus_glib) {
kjellander@webrtc.org7497fa72014-06-28 18:05:22 +000064 pkg_config("dbus-glib") {
65 packages = [ "dbus-glib-1" ]
66 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000067}
68
69config("common_config") {
kjellander@webrtc.org79ee97c2014-09-04 14:10:49 +000070 cflags = []
71 cflags_cc = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000072 if (rtc_restrict_logging) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000073 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
74 }
75
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000076 if (rtc_have_dbus_glib) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000077 defines += [ "HAVE_DBUS_GLIB" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020078
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000079 # 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
brettw@chromium.org9fe11012014-09-09 19:15:33 +000086 if (build_with_chromium) {
87 defines += [ "LOGGING_INSIDE_WEBRTC" ]
88 } else {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000089 if (is_posix) {
90 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
91 # for targets that can handle it. For Android/arm64 right now
92 # there will be an "enumeral and non-enumeral type in conditional
93 # expression" warning in android_tools/ndk_experimental"s version
94 # of stlport.
95 # See: https://code.google.com/p/chromium/issues/detail?id=379699
kjellander@webrtc.org72273912015-02-23 19:08:31 +000096 if (current_cpu != "arm64" || !is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000097 cflags = [
98 "-Wextra",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020099
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000100 # We need to repeat some flags from Chromium"s common.gypi
101 # here that get overridden by -Wextra.
102 "-Wno-unused-parameter",
103 "-Wno-missing-field-initializers",
104 "-Wno-strict-overflow",
105 ]
106 cflags_cc = [
107 "-Wnon-virtual-dtor",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200108
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000109 # 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
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000120 if (current_cpu == "arm64") {
Andrew MacDonaldcb7f8ce2015-05-19 22:20:17 -0700121 defines += [ "WEBRTC_ARCH_ARM64" ]
122 defines += [ "WEBRTC_HAS_NEON" ]
tkchin@webrtc.org14146e42014-10-31 00:14:39 +0000123 }
124
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000125 if (current_cpu == "arm") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000126 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000127 if (arm_version >= 7) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000128 defines += [ "WEBRTC_ARCH_ARM_V7" ]
129 if (arm_use_neon) {
Andrew MacDonaldcb7f8ce2015-05-19 22:20:17 -0700130 defines += [ "WEBRTC_HAS_NEON" ]
131 } else if (arm_optionally_use_neon) {
132 defines += [ "WEBRTC_DETECT_NEON" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000133 }
134 }
135 }
136
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000137 if (current_cpu == "mipsel") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000138 defines += [ "MIPS32_LE" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000139 if (mips_float_abi == "hard") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000140 defines += [ "MIPS_FPU_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000141 }
kjellander@webrtc.orgacb80852015-01-25 19:17:56 +0000142 if (mips_arch_variant == "r2") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000143 defines += [ "MIPS32_R2_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000144 }
145 if (mips_dsp_rev == 1) {
146 defines += [ "MIPS_DSP_R1_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000147 } else if (mips_dsp_rev == 2) {
148 defines += [
149 "MIPS_DSP_R1_LE",
150 "MIPS_DSP_R2_LE",
151 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000152 }
153 }
154
Henrik Kjellanderc0c7d2e2015-09-07 12:57:42 +0200155 if (is_android && !is_clang) {
Henrik Kjellander5bfc6cb2015-09-21 16:50:45 +0200156 # The Android NDK doesn"t provide optimized versions of these
157 # functions. Ensure they are disabled for all compilers.
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000158 cflags += [
159 "-fno-builtin-cos",
160 "-fno-builtin-sin",
161 "-fno-builtin-cosf",
162 "-fno-builtin-sinf",
163 ]
164 }
165}
166
kjellander@webrtc.org14ea50a2014-11-12 07:56:21 +0000167source_set("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000168 sources = [
169 "call.h",
170 "config.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000171 "frame_callback.h",
172 "transport.h",
173 ]
174
Bjorn Terelius36411852015-07-30 12:45:18 +0200175 defines = []
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000176 configs += [ ":common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200177 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000178
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000179 deps = [
tfarinaf0548192015-10-26 05:15:27 -0700180 "audio",
Henrik Kjellanderc4ef1432015-10-26 17:39:11 +0100181 ":webrtc_common",
kjellander@webrtc.orgc429b822015-01-21 20:22:33 +0000182 "base:rtc_base",
Peter Boström5c389d32015-09-25 13:58:30 +0200183 "call",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000184 "common_audio",
185 "common_video",
186 "modules/audio_coding",
187 "modules/audio_conference_mixer",
188 "modules/audio_device",
189 "modules/audio_processing",
190 "modules/bitrate_controller",
191 "modules/desktop_capture",
192 "modules/media_file",
193 "modules/rtp_rtcp",
194 "modules/utility",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000195 "modules/video_coding",
196 "modules/video_processing",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000197 "system_wrappers",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000198 "tools",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000199 "video",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000200 "voice_engine",
201 ]
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +0000202
203 if (build_with_chromium) {
204 deps += [
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200205 "modules/video_capture",
206 "modules/video_render",
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +0000207 ]
208 }
Bjorn Terelius36411852015-07-30 12:45:18 +0200209
210 if (rtc_enable_protobuf) {
211 defines += [ "ENABLE_RTC_EVENT_LOG" ]
212 deps += [ ":rtc_event_log_proto" ]
213 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000214}
215
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000216if (!build_with_chromium) {
217 executable("webrtc_tests") {
218 testonly = true
219 deps = [
220 ":webrtc",
221 "modules/video_render:video_render_internal_impl",
222 "modules/video_capture:video_capture_internal_impl",
223 "test",
224 ]
225 }
226}
227
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000228source_set("webrtc_common") {
229 sources = [
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000230 "common_types.cc",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000231 "common_types.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000232 "config.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200233 "config.h",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000234 "engine_configurations.h",
235 "typedefs.h",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000236 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000237
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000238 configs += [ ":common_config" ]
239 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000240}
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000241
242source_set("gtest_prod") {
243 sources = [
244 "test/testsupport/gtest_prod_util.h",
245 ]
246}
Bjorn Terelius36411852015-07-30 12:45:18 +0200247
248if (rtc_enable_protobuf) {
249 proto_library("rtc_event_log_proto") {
250 sources = [
Peter Boström5c389d32015-09-25 13:58:30 +0200251 "call/rtc_event_log.proto",
Bjorn Terelius36411852015-07-30 12:45:18 +0200252 ]
Peter Boström5c389d32015-09-25 13:58:30 +0200253 proto_out_dir = "webrtc/call"
Bjorn Terelius36411852015-07-30 12:45:18 +0200254 }
255}
256
257source_set("rtc_event_log") {
258 sources = [
Peter Boström5c389d32015-09-25 13:58:30 +0200259 "call/rtc_event_log.cc",
260 "call/rtc_event_log.h",
Bjorn Terelius36411852015-07-30 12:45:18 +0200261 ]
262
263 defines = []
264 configs += [ ":common_config" ]
265 public_configs = [ ":common_inherited_config" ]
266
267 deps = [
268 ":webrtc_common",
269 ]
270
271 if (rtc_enable_protobuf) {
272 defines += [ "ENABLE_RTC_EVENT_LOG" ]
273 deps += [ ":rtc_event_log_proto" ]
274 }
sergeyu4df08ff2015-09-02 14:22:40 -0700275 if (is_clang && !is_nacl) {
Bjorn Terelius36411852015-07-30 12:45:18 +0200276 # Suppress warnings from Chrome's Clang plugins.
277 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
278 configs -= [ "//build/config/clang:find_bad_constructs" ]
279 }
280}