blob: 11020300f37edabfb50b91fa6c92c425fe42aa53 [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")
Peter Boström62e9bda2015-11-23 15:12:06 +010012import("//build/config/sanitizers/sanitizers.gni")
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000013import("build/webrtc.gni")
Bjorn Terelius36411852015-07-30 12:45:18 +020014import("//third_party/protobuf/proto_library.gni")
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000015
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 12:55:39 +020024 defines = [ "WEBRTC_CHROMIUM_BUILD" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000025 include_dirs = [
henrikgee2bf412015-09-30 03:48:52 -070026 # The overrides must be included first as that is the mechanism for
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000027 # selecting the override headers in Chromium.
henrikgee2bf412015-09-30 03:48:52 -070028 "../webrtc_overrides",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020029
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000030 # 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 14:34:58 -070044 if (is_ios && rtc_use_objc_h264) {
45 defines += [ "WEBRTC_OBJC_H264" ]
46 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000047 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:03 +000061 }
62}
63
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000064if (rtc_have_dbus_glib) {
kjellander@webrtc.org7497fa72014-06-28 18:05:22 +000065 pkg_config("dbus-glib") {
66 packages = [ "dbus-glib-1" ]
67 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000068}
69
70config("common_config") {
kjellander@webrtc.org79ee97c2014-09-04 14:10:49 +000071 cflags = []
72 cflags_cc = []
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000073 if (rtc_restrict_logging) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000074 defines = [ "WEBRTC_RESTRICT_LOGGING" ]
75 }
76
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000077 if (rtc_have_dbus_glib) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000078 defines += [ "HAVE_DBUS_GLIB" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020079
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000080 # 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:33 +000087 if (build_with_chromium) {
88 defines += [ "LOGGING_INSIDE_WEBRTC" ]
89 } else {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000090 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:31 +000097 if (current_cpu != "arm64" || !is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000098 cflags = [
99 "-Wextra",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200100
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000101 # 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 12:55:39 +0200109
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000110 # This is enabled for clang; enable for gcc as well.
111 "-Woverloaded-virtual",
112 ]
113 }
114 }
115
116 if (is_clang) {
kjellander3f032cf2016-04-27 07:13:46 -0700117 cflags += [
118 "-Wimplicit-fallthrough",
119 "-Wthread-safety",
nisse4996eaa2016-05-10 23:28:10 -0700120 "-Winconsistent-missing-override",
kjellander3f032cf2016-04-27 07:13:46 -0700121 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000122 }
123 }
124
phoglundff274392016-05-17 03:44:28 -0700125 if (rtc_enable_libevent) {
126 defines += [ "WEBRTC_BUILD_LIBEVENT" ]
127 }
128
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000129 if (current_cpu == "arm64") {
Andrew MacDonaldcb7f8ce2015-05-19 22:20:17 -0700130 defines += [ "WEBRTC_ARCH_ARM64" ]
131 defines += [ "WEBRTC_HAS_NEON" ]
tkchin@webrtc.org14146e42014-10-31 00:14:39 +0000132 }
133
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000134 if (current_cpu == "arm") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000135 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000136 if (arm_version >= 7) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000137 defines += [ "WEBRTC_ARCH_ARM_V7" ]
138 if (arm_use_neon) {
Andrew MacDonaldcb7f8ce2015-05-19 22:20:17 -0700139 defines += [ "WEBRTC_HAS_NEON" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000140 }
141 }
142 }
143
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000144 if (current_cpu == "mipsel") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000145 defines += [ "MIPS32_LE" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000146 if (mips_float_abi == "hard") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000147 defines += [ "MIPS_FPU_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000148 }
kjellander@webrtc.orgacb80852015-01-25 19:17:56 +0000149 if (mips_arch_variant == "r2") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000150 defines += [ "MIPS32_R2_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000151 }
152 if (mips_dsp_rev == 1) {
153 defines += [ "MIPS_DSP_R1_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000154 } else if (mips_dsp_rev == 2) {
155 defines += [
156 "MIPS_DSP_R1_LE",
157 "MIPS_DSP_R2_LE",
158 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000159 }
160 }
161
Henrik Kjellanderc0c7d2e2015-09-07 12:57:42 +0200162 if (is_android && !is_clang) {
Henrik Kjellander5bfc6cb2015-09-21 16:50:45 +0200163 # The Android NDK doesn"t provide optimized versions of these
164 # functions. Ensure they are disabled for all compilers.
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000165 cflags += [
166 "-fno-builtin-cos",
167 "-fno-builtin-sin",
168 "-fno-builtin-cosf",
169 "-fno-builtin-sinf",
170 ]
171 }
katrielcbf81d682016-05-26 01:03:02 -0700172
173 if (use_libfuzzer || use_drfuzz) {
174 # Used in Chromium's overrides to disable logging
175 defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
176 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000177}
178
kjellander@webrtc.org14ea50a2014-11-12 07:56:21 +0000179source_set("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000180 sources = [
181 "call.h",
kjellander84f8df72016-05-18 05:00:50 -0700182 "config.h",
kjellander7324eb92016-02-25 08:36:42 -0800183 "transport.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000184 ]
185
Bjorn Terelius36411852015-07-30 12:45:18 +0200186 defines = []
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000187 configs += [ ":common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200188 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000189
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000190 deps = [
Henrik Kjellanderc4ef1432015-10-26 17:39:11 +0100191 ":webrtc_common",
Peter Boström62e9bda2015-11-23 15:12:06 +0100192 "audio",
kjellander@webrtc.orgc429b822015-01-21 20:22:33 +0000193 "base:rtc_base",
Peter Boström5c389d32015-09-25 13:58:30 +0200194 "call",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000195 "common_audio",
196 "common_video",
197 "modules/audio_coding",
198 "modules/audio_conference_mixer",
199 "modules/audio_device",
200 "modules/audio_processing",
201 "modules/bitrate_controller",
202 "modules/desktop_capture",
203 "modules/media_file",
204 "modules/rtp_rtcp",
205 "modules/utility",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000206 "modules/video_coding",
207 "modules/video_processing",
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000208 "system_wrappers",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000209 "tools",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000210 "video",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000211 "voice_engine",
212 ]
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +0000213
214 if (build_with_chromium) {
nisseb99395a2016-04-29 00:58:42 -0700215 deps += [ "modules/video_capture" ]
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +0000216 }
Bjorn Terelius36411852015-07-30 12:45:18 +0200217
218 if (rtc_enable_protobuf) {
219 defines += [ "ENABLE_RTC_EVENT_LOG" ]
220 deps += [ ":rtc_event_log_proto" ]
221 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000222}
223
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000224if (!build_with_chromium) {
225 executable("webrtc_tests") {
226 testonly = true
227 deps = [
228 ":webrtc",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000229 "modules/video_capture:video_capture_internal_impl",
230 "test",
231 ]
232 }
233}
234
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000235source_set("webrtc_common") {
236 sources = [
kjellander@webrtc.org50772f12016-02-29 06:49:43 +0100237 "audio_sink.h",
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000238 "common_types.cc",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000239 "common_types.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000240 "config.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200241 "config.h",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000242 "engine_configurations.h",
243 "typedefs.h",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000244 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000245
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000246 configs += [ ":common_config" ]
247 public_configs = [ ":common_inherited_config" ]
aluebs688e3082016-01-14 04:32:46 -0800248
249 if (is_clang && !is_nacl) {
250 # Suppress warnings from Chrome's Clang plugins.
251 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
252 configs -= [ "//build/config/clang:find_bad_constructs" ]
253 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000254}
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000255
Bjorn Terelius36411852015-07-30 12:45:18 +0200256if (rtc_enable_protobuf) {
257 proto_library("rtc_event_log_proto") {
258 sources = [
Peter Boström5c389d32015-09-25 13:58:30 +0200259 "call/rtc_event_log.proto",
Bjorn Terelius36411852015-07-30 12:45:18 +0200260 ]
Peter Boström5c389d32015-09-25 13:58:30 +0200261 proto_out_dir = "webrtc/call"
Bjorn Terelius36411852015-07-30 12:45:18 +0200262 }
263}
264
265source_set("rtc_event_log") {
266 sources = [
Peter Boström5c389d32015-09-25 13:58:30 +0200267 "call/rtc_event_log.cc",
268 "call/rtc_event_log.h",
terelius4311ba52016-04-22 12:40:37 -0700269 "call/rtc_event_log_helper_thread.cc",
270 "call/rtc_event_log_helper_thread.h",
Bjorn Terelius36411852015-07-30 12:45:18 +0200271 ]
272
273 defines = []
274 configs += [ ":common_config" ]
275 public_configs = [ ":common_inherited_config" ]
276
277 deps = [
278 ":webrtc_common",
279 ]
280
281 if (rtc_enable_protobuf) {
282 defines += [ "ENABLE_RTC_EVENT_LOG" ]
283 deps += [ ":rtc_event_log_proto" ]
284 }
sergeyu4df08ff2015-09-02 14:22:40 -0700285 if (is_clang && !is_nacl) {
Bjorn Terelius36411852015-07-30 12:45:18 +0200286 # Suppress warnings from Chrome's Clang plugins.
287 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
288 configs -= [ "//build/config/clang:find_bad_constructs" ]
289 }
290}
Peter Boström62e9bda2015-11-23 15:12:06 +0100291
tereliusd5c1a0b2016-05-13 00:42:59 -0700292if (rtc_enable_protobuf) {
293 source_set("rtc_event_log_parser") {
294 sources = [
295 "call/rtc_event_log_parser.cc",
296 "call/rtc_event_log_parser.h",
297 ]
298
299 configs += [ ":common_config" ]
300 public_configs = [ ":common_inherited_config" ]
301
302 deps = [
303 ":rtc_event_log_proto",
304 ":webrtc_common",
305 ]
306
307 if (is_clang && !is_nacl) {
308 # Suppress warnings from Chrome's Clang plugins.
309 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
310 configs -= [ "//build/config/clang:find_bad_constructs" ]
311 }
312 }
313}
314
pbos3514cbe2015-12-16 18:36:14 -0800315if (use_libfuzzer || use_drfuzz) {
Peter Boström1e0cfd92015-12-17 14:28:16 +0100316 # This target is only here for gn to discover fuzzer build targets under
317 # webrtc/test/fuzzers/.
318 group("webrtc_fuzzers_dummy") {
Peter Boström62e9bda2015-11-23 15:12:06 +0100319 testonly = true
320 deps = [
Peter Boström1e0cfd92015-12-17 14:28:16 +0100321 "test/fuzzers:webrtc_fuzzer_main",
Peter Boström62e9bda2015-11-23 15:12:06 +0100322 ]
323 }
324}