blob: cdaa78e79d9b144e7811e7dd61b097bed0fb8ee5 [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) {
kjellanderf0e174a2016-05-30 06:27:50 -070024 defines = [
25 # TODO(kjellander): Cleanup unused ones and move defines closer to
26 # the source when webrtc:4256 is completed.
27 "FEATURE_ENABLE_SSL",
28 "FEATURE_ENABLE_VOICEMAIL",
29 "EXPAT_RELATIVE_PATH",
30 "GTEST_RELATIVE_PATH",
31 "NO_MAIN_THREAD_WRAPPING",
32 "NO_SOUND_SYSTEM",
33 "WEBRTC_CHROMIUM_BUILD",
34 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000035 include_dirs = [
henrikgee2bf412015-09-30 03:48:52 -070036 # The overrides must be included first as that is the mechanism for
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000037 # selecting the override headers in Chromium.
henrikgee2bf412015-09-30 03:48:52 -070038 "../webrtc_overrides",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +020039
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000040 # Allow includes to be prefixed with webrtc/ in case it is not an
41 # immediate subdirectory of the top-level.
42 "..",
43 ]
44 }
45 if (is_posix) {
46 defines += [ "WEBRTC_POSIX" ]
47 }
48 if (is_ios) {
49 defines += [
50 "WEBRTC_MAC",
51 "WEBRTC_IOS",
52 ]
53 }
Zeke Chin71f6f442015-06-29 14:34:58 -070054 if (is_ios && rtc_use_objc_h264) {
55 defines += [ "WEBRTC_OBJC_H264" ]
56 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000057 if (is_linux) {
58 defines += [ "WEBRTC_LINUX" ]
59 }
60 if (is_mac) {
61 defines += [ "WEBRTC_MAC" ]
62 }
63 if (is_win) {
kjellanderf0e174a2016-05-30 06:27:50 -070064 defines += [
65 "WEBRTC_WIN",
66 "_CRT_SECURE_NO_WARNINGS", # Suppress warnings about _vsnprinf
67 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000068 }
69 if (is_android) {
70 defines += [
71 "WEBRTC_LINUX",
72 "WEBRTC_ANDROID",
73 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000074 }
kjellanderf0e174a2016-05-30 06:27:50 -070075 if (is_chromeos) {
76 defines += [ "CHROMEOS" ]
77 }
78
79 # TODO(GYP): Support these in GN.
80 # if (is_bsd) {
81 # defines += [ "BSD" ]
82 # }
83 # if (is_openbsd) {
84 # defines += [ "OPENBSD" ]
85 # }
86 # if (is_freebsd) {
87 # defines += [ "FREEBSD" ]
88 # }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000089}
90
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000091if (rtc_have_dbus_glib) {
kjellander@webrtc.org7497fa72014-06-28 18:05:22 +000092 pkg_config("dbus-glib") {
93 packages = [ "dbus-glib-1" ]
94 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +000095}
96
97config("common_config") {
kjellander@webrtc.org79ee97c2014-09-04 14:10:49 +000098 cflags = []
99 cflags_cc = []
kjellanderf0e174a2016-05-30 06:27:50 -0700100 defines = []
101
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000102 if (rtc_restrict_logging) {
kjellanderf0e174a2016-05-30 06:27:50 -0700103 defines += [ "WEBRTC_RESTRICT_LOGGING" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000104 }
105
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000106 if (rtc_have_dbus_glib) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000107 defines += [ "HAVE_DBUS_GLIB" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200108
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000109 # TODO(kjellander): Investigate this, it seems like include <dbus/dbus.h>
110 # is still not found even if the execution of
111 # build/config/linux/pkg-config.py dbus-glib-1 returns correct include
112 # dirs on Linux.
113 all_dependent_configs = [ "dbus-glib" ]
114 }
115
kjellanderc76dc952016-06-03 03:09:32 -0700116 if (rtc_relative_path) {
117 defines += [ "EXPAT_RELATIVE_PATH" ]
118 }
119
brettw@chromium.org9fe11012014-09-09 19:15:33 +0000120 if (build_with_chromium) {
kjellanderf0e174a2016-05-30 06:27:50 -0700121 defines += [
122 # NOTICE: Since common_inherited_config is used in public_configs for our
123 # targets, there's no point including the defines in that config here.
124 # TODO(kjellander): Cleanup unused ones and move defines closer to the
125 # source when webrtc:4256 is completed.
126 "ENABLE_EXTERNAL_AUTH",
127 "HAVE_OPENSSL_SSL_H",
128 "HAVE_SCTP",
129 "HAVE_SRTP",
130 "HAVE_WEBRTC_VIDEO",
131 "HAVE_WEBRTC_VOICE",
132 "LOGGING_INSIDE_WEBRTC",
133 "SRTP_RELATIVE_PATH",
134 "SSL_USE_OPENSSL",
135 "USE_WEBRTC_DEV_BRANCH",
136 ]
brettw@chromium.org9fe11012014-09-09 19:15:33 +0000137 } else {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000138 if (is_posix) {
139 # -Wextra is currently disabled in Chromium"s common.gypi. Enable
140 # for targets that can handle it. For Android/arm64 right now
141 # there will be an "enumeral and non-enumeral type in conditional
142 # expression" warning in android_tools/ndk_experimental"s version
143 # of stlport.
144 # See: https://code.google.com/p/chromium/issues/detail?id=379699
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000145 if (current_cpu != "arm64" || !is_android) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000146 cflags = [
147 "-Wextra",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200148
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000149 # We need to repeat some flags from Chromium"s common.gypi
150 # here that get overridden by -Wextra.
151 "-Wno-unused-parameter",
152 "-Wno-missing-field-initializers",
153 "-Wno-strict-overflow",
154 ]
155 cflags_cc = [
156 "-Wnon-virtual-dtor",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200157
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000158 # This is enabled for clang; enable for gcc as well.
159 "-Woverloaded-virtual",
160 ]
161 }
162 }
163
164 if (is_clang) {
kjellander3f032cf2016-04-27 07:13:46 -0700165 cflags += [
166 "-Wimplicit-fallthrough",
167 "-Wthread-safety",
nisse4996eaa2016-05-10 23:28:10 -0700168 "-Winconsistent-missing-override",
kjellander3f032cf2016-04-27 07:13:46 -0700169 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000170 }
171 }
172
phoglundff274392016-05-17 03:44:28 -0700173 if (rtc_enable_libevent) {
174 defines += [ "WEBRTC_BUILD_LIBEVENT" ]
175 }
176
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000177 if (current_cpu == "arm64") {
Andrew MacDonaldcb7f8ce2015-05-19 22:20:17 -0700178 defines += [ "WEBRTC_ARCH_ARM64" ]
179 defines += [ "WEBRTC_HAS_NEON" ]
tkchin@webrtc.org14146e42014-10-31 00:14:39 +0000180 }
181
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000182 if (current_cpu == "arm") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000183 defines += [ "WEBRTC_ARCH_ARM" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000184 if (arm_version >= 7) {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000185 defines += [ "WEBRTC_ARCH_ARM_V7" ]
186 if (arm_use_neon) {
Andrew MacDonaldcb7f8ce2015-05-19 22:20:17 -0700187 defines += [ "WEBRTC_HAS_NEON" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000188 }
189 }
190 }
191
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000192 if (current_cpu == "mipsel") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000193 defines += [ "MIPS32_LE" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000194 if (mips_float_abi == "hard") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000195 defines += [ "MIPS_FPU_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000196 }
kjellander@webrtc.orgacb80852015-01-25 19:17:56 +0000197 if (mips_arch_variant == "r2") {
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000198 defines += [ "MIPS32_R2_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000199 }
200 if (mips_dsp_rev == 1) {
201 defines += [ "MIPS_DSP_R1_LE" ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000202 } else if (mips_dsp_rev == 2) {
203 defines += [
204 "MIPS_DSP_R1_LE",
205 "MIPS_DSP_R2_LE",
206 ]
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000207 }
208 }
209
Henrik Kjellanderc0c7d2e2015-09-07 12:57:42 +0200210 if (is_android && !is_clang) {
Henrik Kjellander5bfc6cb2015-09-21 16:50:45 +0200211 # The Android NDK doesn"t provide optimized versions of these
212 # functions. Ensure they are disabled for all compilers.
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000213 cflags += [
214 "-fno-builtin-cos",
215 "-fno-builtin-sin",
216 "-fno-builtin-cosf",
217 "-fno-builtin-sinf",
218 ]
219 }
katrielcbf81d682016-05-26 01:03:02 -0700220
221 if (use_libfuzzer || use_drfuzz) {
222 # Used in Chromium's overrides to disable logging
223 defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
224 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000225}
226
kjellander@webrtc.org14ea50a2014-11-12 07:56:21 +0000227source_set("webrtc") {
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000228 sources = [
229 "call.h",
kjellander84f8df72016-05-18 05:00:50 -0700230 "config.h",
kjellander7324eb92016-02-25 08:36:42 -0800231 "transport.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000232 ]
233
Bjorn Terelius36411852015-07-30 12:45:18 +0200234 defines = []
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000235 configs += [ ":common_config" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200236 public_configs = [ ":common_inherited_config" ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000237
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000238 deps = [
Henrik Kjellanderc4ef1432015-10-26 17:39:11 +0100239 ":webrtc_common",
kjellanderc76dc952016-06-03 03:09:32 -0700240
241 #"api", # TODO(kjellander): Enable when bugs.webrtc.org/4256 is fixed.
Peter Boström62e9bda2015-11-23 15:12:06 +0100242 "audio",
kjellander@webrtc.orgc429b822015-01-21 20:22:33 +0000243 "base:rtc_base",
Peter Boström5c389d32015-09-25 13:58:30 +0200244 "call",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000245 "common_audio",
246 "common_video",
kjellanderc76dc952016-06-03 03:09:32 -0700247
248 #"media", # TODO(kjellander): Enable when bugs.webrtc.org/4256 is fixed.
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000249 "modules/audio_coding",
250 "modules/audio_conference_mixer",
251 "modules/audio_device",
252 "modules/audio_processing",
253 "modules/bitrate_controller",
254 "modules/desktop_capture",
255 "modules/media_file",
256 "modules/rtp_rtcp",
257 "modules/utility",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000258 "modules/video_coding",
259 "modules/video_processing",
kjellanderc76dc952016-06-03 03:09:32 -0700260
261 #"p2p", # TODO(kjellander): Enable when bugs.webrtc.org/4256 is fixed.
262 #"pc", # TODO(kjellander): Enable when bugs.webrtc.org/4256 is fixed.
kjellander@webrtc.org78f440c2014-06-21 14:25:16 +0000263 "system_wrappers",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000264 "tools",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000265 "video",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000266 "voice_engine",
267 ]
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +0000268
269 if (build_with_chromium) {
nisseb99395a2016-04-29 00:58:42 -0700270 deps += [ "modules/video_capture" ]
kjellander@webrtc.orgf58fe0a2015-02-11 07:47:00 +0000271 }
Bjorn Terelius36411852015-07-30 12:45:18 +0200272
273 if (rtc_enable_protobuf) {
274 defines += [ "ENABLE_RTC_EVENT_LOG" ]
275 deps += [ ":rtc_event_log_proto" ]
276 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000277}
278
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000279if (!build_with_chromium) {
280 executable("webrtc_tests") {
281 testonly = true
282 deps = [
283 ":webrtc",
kjellander@webrtc.orgb8caf6a2014-09-30 18:05:02 +0000284 "modules/video_capture:video_capture_internal_impl",
285 "test",
286 ]
287 }
288}
289
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000290source_set("webrtc_common") {
291 sources = [
kjellander@webrtc.org50772f12016-02-29 06:49:43 +0100292 "audio_sink.h",
kwiberg@webrtc.orgac2d27d2015-02-26 13:59:22 +0000293 "common_types.cc",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000294 "common_types.h",
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000295 "config.cc",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200296 "config.h",
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000297 "engine_configurations.h",
298 "typedefs.h",
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000299 ]
kjellander@webrtc.org9bef5512014-07-13 09:02:54 +0000300
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000301 configs += [ ":common_config" ]
302 public_configs = [ ":common_inherited_config" ]
aluebs688e3082016-01-14 04:32:46 -0800303
304 if (is_clang && !is_nacl) {
305 # Suppress warnings from Chrome's Clang plugins.
306 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
307 configs -= [ "//build/config/clang:find_bad_constructs" ]
308 }
kjellander@webrtc.org851a09e2014-06-17 08:54:03 +0000309}
kjellander@webrtc.orgd7e34e12015-01-26 19:17:26 +0000310
Bjorn Terelius36411852015-07-30 12:45:18 +0200311if (rtc_enable_protobuf) {
312 proto_library("rtc_event_log_proto") {
313 sources = [
Peter Boström5c389d32015-09-25 13:58:30 +0200314 "call/rtc_event_log.proto",
Bjorn Terelius36411852015-07-30 12:45:18 +0200315 ]
Peter Boström5c389d32015-09-25 13:58:30 +0200316 proto_out_dir = "webrtc/call"
Bjorn Terelius36411852015-07-30 12:45:18 +0200317 }
318}
319
320source_set("rtc_event_log") {
321 sources = [
Peter Boström5c389d32015-09-25 13:58:30 +0200322 "call/rtc_event_log.cc",
323 "call/rtc_event_log.h",
terelius4311ba52016-04-22 12:40:37 -0700324 "call/rtc_event_log_helper_thread.cc",
325 "call/rtc_event_log_helper_thread.h",
Bjorn Terelius36411852015-07-30 12:45:18 +0200326 ]
327
328 defines = []
329 configs += [ ":common_config" ]
330 public_configs = [ ":common_inherited_config" ]
331
332 deps = [
333 ":webrtc_common",
334 ]
335
336 if (rtc_enable_protobuf) {
337 defines += [ "ENABLE_RTC_EVENT_LOG" ]
338 deps += [ ":rtc_event_log_proto" ]
339 }
sergeyu4df08ff2015-09-02 14:22:40 -0700340 if (is_clang && !is_nacl) {
Bjorn Terelius36411852015-07-30 12:45:18 +0200341 # Suppress warnings from Chrome's Clang plugins.
342 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
343 configs -= [ "//build/config/clang:find_bad_constructs" ]
344 }
345}
Peter Boström62e9bda2015-11-23 15:12:06 +0100346
tereliusd5c1a0b2016-05-13 00:42:59 -0700347if (rtc_enable_protobuf) {
348 source_set("rtc_event_log_parser") {
349 sources = [
350 "call/rtc_event_log_parser.cc",
351 "call/rtc_event_log_parser.h",
352 ]
353
354 configs += [ ":common_config" ]
355 public_configs = [ ":common_inherited_config" ]
356
357 deps = [
358 ":rtc_event_log_proto",
359 ":webrtc_common",
360 ]
361
362 if (is_clang && !is_nacl) {
363 # Suppress warnings from Chrome's Clang plugins.
364 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
365 configs -= [ "//build/config/clang:find_bad_constructs" ]
366 }
367 }
368}
369
pbos3514cbe2015-12-16 18:36:14 -0800370if (use_libfuzzer || use_drfuzz) {
Peter Boström1e0cfd92015-12-17 14:28:16 +0100371 # This target is only here for gn to discover fuzzer build targets under
372 # webrtc/test/fuzzers/.
373 group("webrtc_fuzzers_dummy") {
Peter Boström62e9bda2015-11-23 15:12:06 +0100374 testonly = true
375 deps = [
Peter Boström1e0cfd92015-12-17 14:28:16 +0100376 "test/fuzzers:webrtc_fuzzer_main",
Peter Boström62e9bda2015-11-23 15:12:06 +0100377 ]
378 }
379}