blob: d5289b85d761d98f6eb310a0a449e959ea1bef2b [file] [log] [blame]
wjia@webrtc.org03cfde22014-01-14 17:48:341# 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
Patrik Höglund29dd6d72017-12-01 10:35:269# This is the root build file for GN. GN will start processing by loading this
10# file, and recursively load all dependencies until all dependencies are either
11# resolved or known not to exist (which will cause the build to fail). So if
12# you add a new build file, there must be some path of dependencies from this
13# file to your new one or GN won't know about it.
14
Harald Alvestrande47493b2022-02-15 12:45:0215# Use of visibility = clauses:
16# The default visibility for all rtc_ targets is equivalent to "//*", or
17# "all targets in webrtc can depend on this, nothing outside can".
18#
19# When overriding, the choices are:
20# - visibility = [ "*" ] - public. Stuff outside webrtc can use this.
21# - visibility = [ ":*" ] - directory private.
22# As a general guideline, only targets in api/ should have public visibility.
23
Mirko Bonadeibb547202017-09-15 04:15:4824import("//build/config/linux/pkg_config.gni")
25import("//build/config/sanitizers/sanitizers.gni")
26import("webrtc.gni")
Kimmo Kinnunen08f6a6c2019-02-26 09:46:1727if (rtc_enable_protobuf) {
Dan Minor9c686132018-01-15 15:20:0028 import("//third_party/protobuf/proto_library.gni")
29}
Mirko Bonadeibb547202017-09-15 04:15:4830if (is_android) {
31 import("//build/config/android/config.gni")
32 import("//build/config/android/rules.gni")
33}
ehmaldonado37d7a222016-11-08 14:34:2034
Mirko Bonadeibb547202017-09-15 04:15:4835if (!build_with_chromium) {
Patrik Höglund29dd6d72017-12-01 10:35:2636 # This target should (transitively) cause everything to be built; if you run
37 # 'ninja default' and then 'ninja all', the second build should do no work.
Mirko Bonadeibb547202017-09-15 04:15:4838 group("default") {
39 testonly = true
Mirko Bonadeiccbe95f2020-01-21 11:10:1040 deps = [ ":webrtc" ]
Joachim Bauch93e91342017-12-07 00:25:5341 if (rtc_build_examples) {
42 deps += [ "examples" ]
43 }
44 if (rtc_build_tools) {
45 deps += [ "rtc_tools" ]
46 }
Mirko Bonadeibb547202017-09-15 04:15:4847 if (rtc_include_tests) {
Patrik Höglund29dd6d72017-12-01 10:35:2648 deps += [
49 ":rtc_unittests",
50 ":video_engine_tests",
Tim Na8ab3c772020-03-27 00:16:5151 ":voip_unittests",
Patrik Höglund29dd6d72017-12-01 10:35:2652 ":webrtc_nonparallel_tests",
53 ":webrtc_perf_tests",
54 "common_audio:common_audio_unittests",
55 "common_video:common_video_unittests",
Niels Möller9862c2e2018-10-30 11:20:0356 "examples:examples_unittests",
Patrik Höglund29dd6d72017-12-01 10:35:2657 "media:rtc_media_unittests",
58 "modules:modules_tests",
59 "modules:modules_unittests",
60 "modules/audio_coding:audio_coding_tests",
61 "modules/audio_processing:audio_processing_tests",
Mirko Bonadei79e4c922019-07-08 09:52:2462 "modules/remote_bitrate_estimator:rtp_to_text",
Patrik Höglund29dd6d72017-12-01 10:35:2663 "modules/rtp_rtcp:test_packet_masks_metrics",
64 "modules/video_capture:video_capture_internal_impl",
Victor Boivie7d3c49a2021-03-25 12:11:0365 "net/dcsctp:dcsctp_unittests",
Harald Alvestrandff16f5f2023-03-07 07:53:1666 "pc:peer_connection_mediachannel_split_unittests",
Patrik Höglund29dd6d72017-12-01 10:35:2667 "pc:peerconnection_unittests",
68 "pc:rtc_pc_unittests",
Harald Alvestrandf8f7b702022-05-05 13:21:1969 "pc:slow_peer_connection_unittests",
Florent Castelli90b74382022-04-25 15:28:0070 "pc:svc_tests",
Ilya Nikolaevskiyb41d5f12019-07-18 07:59:2571 "rtc_tools:rtp_generator",
Mirko Bonadeid4c3c3a2020-02-07 09:02:3172 "rtc_tools:video_replay",
Patrik Höglund29dd6d72017-12-01 10:35:2673 "stats:rtc_stats_unittests",
74 "system_wrappers:system_wrappers_unittests",
75 "test",
76 "video:screenshare_loopback",
Ilya Nikolaevskiy255d1cd2017-12-21 17:02:5977 "video:sv_loopback",
Patrik Höglund29dd6d72017-12-01 10:35:2678 "video:video_loopback",
Patrik Höglund29dd6d72017-12-01 10:35:2679 ]
Mirko Bonadei6adb0a22019-10-23 14:55:0480 if (!is_asan) {
81 # Do not build :webrtc_lib_link_test because lld complains on some OS
82 # (e.g. when target_os = "mac") when is_asan=true. For more details,
83 # see bugs.webrtc.org/11027#c5.
84 deps += [ ":webrtc_lib_link_test" ]
85 }
Jeremy Leconte251eca22022-03-04 04:39:0486 if (is_ios) {
87 deps += [
88 "examples:apprtcmobile_tests",
89 "sdk:sdk_framework_unittests",
90 "sdk:sdk_unittests",
91 ]
92 }
Patrik Höglund29dd6d72017-12-01 10:35:2693 if (is_android) {
94 deps += [
Mirko Bonadei73aa2de2020-01-20 14:28:5795 "examples:android_examples_junit_tests",
Sami Kalliomäkid54f5f52018-08-03 11:23:0596 "sdk/android:android_instrumentation_test_apk",
Mirko Bonadeiccbe95f2020-01-21 11:10:1097 "sdk/android:android_sdk_junit_tests",
Patrik Höglund29dd6d72017-12-01 10:35:2698 ]
99 } else {
100 deps += [ "modules/video_capture:video_capture_tests" ]
101 }
102 if (rtc_enable_protobuf) {
103 deps += [
Jeremy Leconte251eca22022-03-04 04:39:04104 "audio:low_bandwidth_audio_perf_test",
Mirko Bonadeiab0b9d42019-07-08 10:31:59105 "logging:rtc_event_log_rtp_dump",
Patrik Höglund83245bd2020-01-30 08:33:57106 "tools_webrtc/perf:webrtc_dashboard_upload",
Patrik Höglund29dd6d72017-12-01 10:35:26107 ]
108 }
Jan Grulich1264dc12022-10-18 12:27:17109 if ((is_linux || is_chromeos) && rtc_use_pipewire) {
110 deps += [ "modules/desktop_capture:shared_screencast_stream_test" ]
111 }
Jeremy Leconte128afb12023-01-11 09:55:35112 if (is_fuchsia) {
113 deps += [ ":fuchsia_perf_tests" ]
114 }
Mirko Bonadeibb547202017-09-15 04:15:48115 }
Mirko Bonadeib9857482020-12-14 14:28:43116 if (target_os == "android") {
117 deps += [ "tools_webrtc:binary_version_check" ]
118 }
Mirko Bonadeibb547202017-09-15 04:15:48119 }
120}
121
Mirko Bonadei2ab97f62019-07-18 11:44:12122# Abseil Flags by default doesn't register command line flags on mobile
123# platforms, WebRTC tests requires them (e.g. on simualtors) so this
124# config will be applied to testonly targets globally (see webrtc.gni).
125config("absl_flags_configs") {
126 defines = [ "ABSL_FLAGS_STRIP_NAMES=0" ]
127}
128
Mirko Bonadei32ce18c2018-09-18 11:15:54129config("library_impl_config") {
130 # Build targets that contain WebRTC implementation need this macro to
131 # be defined in order to correctly export symbols when is_component_build
132 # is true.
133 # For more info see: rtc_base/build/rtc_export.h.
134 defines = [ "WEBRTC_LIBRARY_IMPL" ]
135}
136
Mirko Bonadeibb547202017-09-15 04:15:48137# Contains the defines and includes in common.gypi that are duplicated both as
138# target_defaults and direct_dependent_settings.
139config("common_inherited_config") {
140 defines = []
141 cflags = []
142 ldflags = []
Mirko Bonadei32ce18c2018-09-18 11:15:54143
Mirko Bonadei56ed4682021-10-12 06:55:42144 if (rtc_dlog_always_on) {
145 defines += [ "DLOG_ALWAYS_ON" ]
146 }
147
Mirko Bonadei02fac7d2019-10-15 19:25:07148 if (rtc_enable_symbol_export || is_component_build) {
Takaaki Suzuki52d97fd2021-10-09 13:16:01149 defines += [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
Mirko Bonadei028248c2018-10-10 10:19:02150 }
Mirko Bonadei5f078452021-07-30 20:32:55151 if (rtc_enable_objc_symbol_export) {
Takaaki Suzuki52d97fd2021-10-09 13:16:01152 defines += [ "WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT" ]
Mirko Bonadei5f078452021-07-30 20:32:55153 }
Mirko Bonadei028248c2018-10-10 10:19:02154
Mirko Bonadeib889a202018-08-15 09:41:27155 if (!rtc_builtin_ssl_root_certificates) {
156 defines += [ "WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS" ]
157 }
158
Artem Titov9dc209a2019-11-28 16:09:30159 if (rtc_disable_check_msg) {
160 defines += [ "RTC_DISABLE_CHECK_MSG" ]
161 }
162
Zhaoliang Ma72e43212020-08-17 09:13:41163 if (rtc_enable_avx2) {
164 defines += [ "WEBRTC_ENABLE_AVX2" ]
165 }
166
Austin Orionedc946e2021-04-05 23:30:20167 if (rtc_enable_win_wgc) {
168 defines += [ "RTC_ENABLE_WIN_WGC" ]
169 }
170
Mirko Bonadeibb547202017-09-15 04:15:48171 # Some tests need to declare their own trace event handlers. If this define is
172 # not set, the first time TRACE_EVENT_* is called it will store the return
173 # value for the current handler in an static variable, so that subsequent
174 # changes to the handler for that TRACE_EVENT_* will be ignored.
175 # So when tests are included, we set this define, making it possible to use
176 # different event handlers in different tests.
ehmaldonado37d7a222016-11-08 14:34:20177 if (rtc_include_tests) {
Mirko Bonadeibb547202017-09-15 04:15:48178 defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ]
179 } else {
180 defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ]
181 }
182 if (build_with_chromium) {
Mirko Bonadei8e5014a2018-08-02 11:36:10183 defines += [ "WEBRTC_CHROMIUM_BUILD" ]
Mirko Bonadeibb547202017-09-15 04:15:48184 include_dirs = [
185 # The overrides must be included first as that is the mechanism for
186 # selecting the override headers in Chromium.
187 "../webrtc_overrides",
188
189 # Allow includes to be prefixed with webrtc/ in case it is not an
190 # immediate subdirectory of the top-level.
191 ".",
Tomas Popela762543f2018-12-12 13:37:51192
193 # Just like the root WebRTC directory is added to include path, the
194 # corresponding directory tree with generated files needs to be added too.
195 # Note: this path does not change depending on the current target, e.g.
196 # it is always "//gen/third_party/webrtc" when building with Chromium.
197 # See also: http://cs.chromium.org/?q=%5C"default_include_dirs
198 # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir
199 target_gen_dir,
Mirko Bonadeibb547202017-09-15 04:15:48200 ]
201 }
Fabrice de Gans-Riberi09a6cd52018-03-30 17:38:06202 if (is_posix || is_fuchsia) {
Mirko Bonadeibb547202017-09-15 04:15:48203 defines += [ "WEBRTC_POSIX" ]
204 }
205 if (is_ios) {
206 defines += [
207 "WEBRTC_MAC",
208 "WEBRTC_IOS",
209 ]
210 }
Hidehiko Abef264e702020-09-10 09:10:11211 if (is_linux || is_chromeos) {
Mirko Bonadeibb547202017-09-15 04:15:48212 defines += [ "WEBRTC_LINUX" ]
213 }
214 if (is_mac) {
215 defines += [ "WEBRTC_MAC" ]
216 }
Sergey Ulanov6acefdb2017-12-12 01:38:13217 if (is_fuchsia) {
218 defines += [ "WEBRTC_FUCHSIA" ]
219 }
Mirko Bonadeibb547202017-09-15 04:15:48220 if (is_win) {
Mirko Bonadei89a87742018-04-24 07:12:13221 defines += [ "WEBRTC_WIN" ]
Mirko Bonadeibb547202017-09-15 04:15:48222 }
223 if (is_android) {
224 defines += [
225 "WEBRTC_LINUX",
226 "WEBRTC_ANDROID",
227 ]
Dan Minor9c686132018-01-15 15:20:00228
229 if (build_with_mozilla) {
230 defines += [ "WEBRTC_ANDROID_OPENSLES" ]
231 }
Mirko Bonadeibb547202017-09-15 04:15:48232 }
233 if (is_chromeos) {
234 defines += [ "CHROMEOS" ]
235 }
236
237 if (rtc_sanitize_coverage != "") {
238 assert(is_clang, "sanitizer coverage requires clang")
239 cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
240 ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
241 }
242
243 if (is_ubsan) {
244 cflags += [ "-fsanitize=float-cast-overflow" ]
245 }
Mirko Bonadeibb547202017-09-15 04:15:48246}
247
Mirko Bonadei96ede16a2018-09-06 11:45:44248# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
249# as soon as WebRTC compiles without it.
Mirko Bonadei96ede16a2018-09-06 11:45:44250config("no_global_constructors") {
251 if (is_clang) {
252 cflags = [ "-Wno-global-constructors" ]
253 }
254}
255
256config("rtc_prod_config") {
257 # Ideally, WebRTC production code (but not test code) should have these flags.
258 if (is_clang) {
259 cflags = [
260 "-Wexit-time-destructors",
261 "-Wglobal-constructors",
262 ]
263 }
264}
265
Mirko Bonadeibb547202017-09-15 04:15:48266config("common_config") {
267 cflags = []
Mirko Bonadeid7573562018-03-19 15:23:48268 cflags_c = []
Mirko Bonadeibb547202017-09-15 04:15:48269 cflags_cc = []
Mirko Bonadeid7573562018-03-19 15:23:48270 cflags_objc = []
Mirko Bonadeibb547202017-09-15 04:15:48271 defines = []
272
273 if (rtc_enable_protobuf) {
274 defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ]
275 } else {
276 defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
277 }
278
Emil Lundmark9109e852023-02-28 12:57:01279 if (rtc_strict_field_trials == "") {
Emil Lundmark6bf20cc2022-09-21 13:20:22280 defines += [ "WEBRTC_STRICT_FIELD_TRIALS=0" ]
Emil Lundmark9109e852023-02-28 12:57:01281 } else if (rtc_strict_field_trials == "dcheck") {
282 defines += [ "WEBRTC_STRICT_FIELD_TRIALS=1" ]
283 } else if (rtc_strict_field_trials == "warn") {
284 defines += [ "WEBRTC_STRICT_FIELD_TRIALS=2" ]
285 } else {
286 assert(false,
287 "Unsupported value for rtc_strict_field_trials: " +
288 "$rtc_strict_field_trials")
Emil Lundmark6bf20cc2022-09-21 13:20:22289 }
290
Mirko Bonadeibb547202017-09-15 04:15:48291 if (rtc_include_internal_audio_device) {
292 defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
293 }
294
Mirko Bonadei8ef57932018-11-16 13:38:03295 if (rtc_libvpx_build_vp9) {
296 defines += [ "RTC_ENABLE_VP9" ]
Mirko Bonadeibb547202017-09-15 04:15:48297 }
298
philipelb09d8722021-11-23 10:00:24299 if (rtc_include_dav1d_in_internal_decoder_factory) {
300 defines += [ "RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY" ]
301 }
302
Mirko Bonadeibb547202017-09-15 04:15:48303 if (rtc_enable_sctp) {
Mirko Bonadei5eb43b42021-01-18 12:24:40304 defines += [ "WEBRTC_HAVE_SCTP" ]
Mirko Bonadeibb547202017-09-15 04:15:48305 }
306
307 if (rtc_enable_external_auth) {
308 defines += [ "ENABLE_EXTERNAL_AUTH" ]
309 }
310
Johannes Kronb76b9ba2019-02-08 09:13:25311 if (rtc_use_h264) {
312 defines += [ "WEBRTC_USE_H264" ]
313 }
314
Markus Handell8e75bd42020-06-05 09:47:40315 if (rtc_use_absl_mutex) {
316 defines += [ "WEBRTC_ABSL_MUTEX" ]
317 }
318
Artem Titov6a4a1462019-11-26 15:24:46319 if (rtc_disable_logging) {
320 defines += [ "RTC_DISABLE_LOGGING" ]
321 }
322
Doudou Kisabaka2dec4962019-11-28 13:24:31323 if (rtc_disable_trace_events) {
324 defines += [ "RTC_DISABLE_TRACE_EVENTS" ]
325 }
326
Ying Wangef3998f2019-12-09 12:06:53327 if (rtc_disable_metrics) {
328 defines += [ "RTC_DISABLE_METRICS" ]
329 }
330
sazaaa42ecd2020-04-01 13:24:40331 if (rtc_exclude_transient_suppressor) {
332 defines += [ "WEBRTC_EXCLUDE_TRANSIENT_SUPPRESSOR" ]
333 }
334
Per Åhgrencc73ed32020-04-26 21:56:17335 if (rtc_exclude_audio_processing_module) {
336 defines += [ "WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE" ]
337 }
338
Peter Kasting47126fa2021-09-28 17:08:54339 if (is_clang) {
Mirko Bonadeice030282022-09-01 16:19:42340 cflags += [
341 # TODO(webrtc:13219): Fix -Wshadow instances and enable.
342 "-Wno-shadow",
343
344 # See https://reviews.llvm.org/D56731 for details about this
345 # warning.
346 "-Wctad-maybe-unsupported",
347 ]
Peter Kasting47126fa2021-09-28 17:08:54348 }
Mirko Bonadeicee54172019-12-05 14:30:14349
Mirko Bonadeibb547202017-09-15 04:15:48350 if (build_with_chromium) {
351 defines += [
352 # NOTICE: Since common_inherited_config is used in public_configs for our
353 # targets, there's no point including the defines in that config here.
354 # TODO(kjellander): Cleanup unused ones and move defines closer to the
355 # source when webrtc:4256 is completed.
356 "HAVE_WEBRTC_VIDEO",
Mirko Bonadeibb547202017-09-15 04:15:48357 "LOGGING_INSIDE_WEBRTC",
Mirko Bonadeibb547202017-09-15 04:15:48358 ]
359 } else {
Fabrice de Gans-Riberi09a6cd52018-03-30 17:38:06360 if (is_posix || is_fuchsia) {
Mirko Bonadeid7573562018-03-19 15:23:48361 cflags_c += [
362 # TODO(bugs.webrtc.org/9029): enable commented compiler flags.
363 # Some of these flags should also be added to cflags_objc.
364
365 # "-Wextra", (used when building C++ but not when building C)
366 # "-Wmissing-prototypes", (C/Obj-C only)
367 # "-Wmissing-declarations", (ensure this is always used C/C++, etc..)
368 "-Wstrict-prototypes",
369
370 # "-Wpointer-arith", (ensure this is always used C/C++, etc..)
371 # "-Wbad-function-cast", (C/Obj-C only)
372 # "-Wnested-externs", (C/Obj-C only)
373 ]
374 cflags_objc += [ "-Wstrict-prototypes" ]
Mirko Bonadeibb547202017-09-15 04:15:48375 cflags_cc = [
376 "-Wnon-virtual-dtor",
377
378 # This is enabled for clang; enable for gcc as well.
379 "-Woverloaded-virtual",
380 ]
381 }
382
383 if (is_clang) {
Sarah Phame9c3f012022-05-23 03:54:34384 cflags += [ "-Wc++11-narrowing" ]
385
386 if (!is_fuchsia) {
387 # Compiling with the Fuchsia SDK results in Wundef errors
388 # TODO(bugs.fuchsia.dev/100722): Remove from (!is_fuchsia) branch when
389 # Fuchsia build errors are fixed.
390 cflags += [ "-Wundef" ]
391 }
Mirko Bonadeibb547202017-09-15 04:15:48392
Mirko Bonadei1a75d5e2021-11-19 07:46:19393 if (!is_nacl) {
394 # Flags NaCl (Clang 3.7) do not recognize.
Mirko Bonadeibb547202017-09-15 04:15:48395 cflags += [ "-Wunused-lambda-capture" ]
396 }
397 }
Mirko Bonadeie7659df2018-05-16 09:50:40398
399 if (is_win && !is_clang) {
400 # MSVC warning suppressions (needed to use Abseil).
401 # TODO(bugs.webrtc.org/9274): Remove these warnings as soon as MSVC allows
402 # external headers warning suppression (or fix them upstream).
403 cflags += [ "/wd4702" ] # unreachable code
Jerome Humbert3e3c5512020-01-13 11:58:26404
405 # MSVC 2019 warning suppressions for C++17 compiling
Patrik Höglund83245bd2020-01-30 08:33:57406 cflags +=
407 [ "/wd5041" ] # out-of-line definition for constexpr static data
408 # member is not needed and is deprecated in C++17
Mirko Bonadeie7659df2018-05-16 09:50:40409 }
Mirko Bonadeibb547202017-09-15 04:15:48410 }
411
412 if (current_cpu == "arm64") {
413 defines += [ "WEBRTC_ARCH_ARM64" ]
414 defines += [ "WEBRTC_HAS_NEON" ]
415 }
416
417 if (current_cpu == "arm") {
418 defines += [ "WEBRTC_ARCH_ARM" ]
419 if (arm_version >= 7) {
420 defines += [ "WEBRTC_ARCH_ARM_V7" ]
421 if (arm_use_neon) {
422 defines += [ "WEBRTC_HAS_NEON" ]
423 }
424 }
425 }
426
427 if (current_cpu == "mipsel") {
428 defines += [ "MIPS32_LE" ]
429 if (mips_float_abi == "hard") {
430 defines += [ "MIPS_FPU_LE" ]
431 }
432 if (mips_arch_variant == "r2") {
433 defines += [ "MIPS32_R2_LE" ]
434 }
435 if (mips_dsp_rev == 1) {
436 defines += [ "MIPS_DSP_R1_LE" ]
437 } else if (mips_dsp_rev == 2) {
438 defines += [
439 "MIPS_DSP_R1_LE",
440 "MIPS_DSP_R2_LE",
441 ]
442 }
443 }
444
445 if (is_android && !is_clang) {
446 # The Android NDK doesn"t provide optimized versions of these
447 # functions. Ensure they are disabled for all compilers.
448 cflags += [
449 "-fno-builtin-cos",
450 "-fno-builtin-sin",
451 "-fno-builtin-cosf",
452 "-fno-builtin-sinf",
453 ]
454 }
455
Max Moroza61fa6e2018-05-29 02:26:58456 if (use_fuzzing_engine && optimize_for_fuzzing) {
Mirko Bonadeibb547202017-09-15 04:15:48457 # Used in Chromium's overrides to disable logging
458 defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
459 }
Mirko Bonadei20574f42019-03-28 06:50:07460
461 if (!build_with_chromium && rtc_win_undef_unicode) {
462 cflags += [
463 "/UUNICODE",
464 "/U_UNICODE",
465 ]
466 }
Mirko Bonadeibb547202017-09-15 04:15:48467}
468
469config("common_objc") {
Sylvain Defresnec7f0dff2020-07-03 08:19:30470 frameworks = [ "Foundation.framework" ]
Mirko Bonadeibb547202017-09-15 04:15:48471}
472
473if (!build_with_chromium) {
474 # Target to build all the WebRTC production code.
475 rtc_static_library("webrtc") {
Patrik Höglundeeb79e92019-10-17 14:04:07476 # Only the root target and the test should depend on this.
477 visibility = [
478 "//:default",
479 "//:webrtc_lib_link_test",
480 ]
Mirko Bonadeibb547202017-09-15 04:15:48481
482 sources = []
483 complete_static_lib = true
Oleh Prypind2f4e8b2018-08-01 10:18:05484 suppressed_configs += [ "//build/config/compiler:thin_archive" ]
Mirko Bonadeibb547202017-09-15 04:15:48485 defines = []
486
487 deps = [
Mirko Bonadeiba700de2019-10-10 07:23:22488 "api:create_peerconnection_factory",
Yves Gerey06f6bc92018-11-09 09:22:52489 "api:libjingle_peerconnection_api",
Mirko Bonadeieaaaf412019-09-13 12:42:15490 "api:rtc_error",
Mirko Bonadeibb547202017-09-15 04:15:48491 "api:transport_api",
Mirko Bonadeieaaaf412019-09-13 12:42:15492 "api/crypto",
Danil Chapovalov4ba04b72019-06-26 13:49:47493 "api/rtc_event_log:rtc_event_log_factory",
Mirko Bonadeiba700de2019-10-10 07:23:22494 "api/task_queue",
495 "api/task_queue:default_task_queue_factory",
Artem Titovc898c822022-09-14 11:14:02496 "api/test/metrics",
philipel2b00c4e2023-03-31 15:20:40497 "api/video_codecs:video_decoder_factory_template",
498 "api/video_codecs:video_decoder_factory_template_dav1d_adapter",
499 "api/video_codecs:video_decoder_factory_template_libvpx_vp8_adapter",
500 "api/video_codecs:video_decoder_factory_template_libvpx_vp9_adapter",
501 "api/video_codecs:video_decoder_factory_template_open_h264_adapter",
502 "api/video_codecs:video_encoder_factory_template",
503 "api/video_codecs:video_encoder_factory_template_libaom_av1_adapter",
504 "api/video_codecs:video_encoder_factory_template_libvpx_vp8_adapter",
505 "api/video_codecs:video_encoder_factory_template_libvpx_vp9_adapter",
506 "api/video_codecs:video_encoder_factory_template_open_h264_adapter",
Mirko Bonadeibb547202017-09-15 04:15:48507 "audio",
508 "call",
509 "common_audio",
510 "common_video",
Yves Gerey06f6bc92018-11-09 09:22:52511 "logging:rtc_event_log_api",
Mirko Bonadeibb547202017-09-15 04:15:48512 "media",
513 "modules",
514 "modules/video_capture:video_capture_internal_impl",
Yves Gerey06f6bc92018-11-09 09:22:52515 "p2p:rtc_p2p",
516 "pc:libjingle_peerconnection",
Yves Gerey06f6bc92018-11-09 09:22:52517 "pc:rtc_pc",
Mirko Bonadeibb547202017-09-15 04:15:48518 "sdk",
Mirko Bonadeibb547202017-09-15 04:15:48519 "video",
Mirko Bonadeibb547202017-09-15 04:15:48520 ]
521
Jiawei Ou08745302019-02-12 19:36:13522 if (rtc_include_builtin_audio_codecs) {
523 deps += [
524 "api/audio_codecs:builtin_audio_decoder_factory",
525 "api/audio_codecs:builtin_audio_encoder_factory",
526 ]
527 }
528
Dan Minor9c686132018-01-15 15:20:00529 if (build_with_mozilla) {
Chen Xing5d24b162019-06-10 10:59:38530 deps += [
531 "api/video:video_frame",
532 "api/video:video_rtp_headers",
533 ]
Dan Minor9c686132018-01-15 15:20:00534 } else {
535 deps += [
536 "api",
537 "logging",
538 "p2p",
539 "pc",
540 "stats",
541 ]
542 }
543
Mirko Bonadeibb547202017-09-15 04:15:48544 if (rtc_enable_protobuf) {
Mirko Bonadeibb547202017-09-15 04:15:48545 deps += [ "logging:rtc_event_log_proto" ]
546 }
547 }
Patrik Höglundeeb79e92019-10-17 14:04:07548
Mirko Bonadeic69fd592020-03-10 14:35:38549 if (rtc_include_tests && !is_asan) {
Patrik Höglund21671632019-10-18 06:04:19550 rtc_executable("webrtc_lib_link_test") {
Patrik Höglundeeb79e92019-10-17 14:04:07551 testonly = true
552
Byoungchan Lee8ed1e932021-05-20 09:30:10553 # This target is used for checking to link, so do not check dependencies
554 # on gn check.
555 check_includes = false # no-presubmit-check TODO(bugs.webrtc.org/12785)
556
Mirko Bonadeiccbe95f2020-01-21 11:10:10557 sources = [ "webrtc_lib_link_test.cc" ]
Patrik Höglundeeb79e92019-10-17 14:04:07558 deps = [
Patrik Höglund21671632019-10-18 06:04:19559 # NOTE: Don't add deps here. If this test fails to link, it means you
560 # need to add stuff to the webrtc static lib target above.
Patrik Höglundeeb79e92019-10-17 14:04:07561 ":webrtc",
Patrik Höglundeeb79e92019-10-17 14:04:07562 ]
563 }
564 }
Mirko Bonadeibb547202017-09-15 04:15:48565}
566
Nico Weberdf644be2019-03-18 01:06:11567if (use_libfuzzer || use_afl) {
Mirko Bonadeibb547202017-09-15 04:15:48568 # This target is only here for gn to discover fuzzer build targets under
569 # webrtc/test/fuzzers/.
570 group("webrtc_fuzzers_dummy") {
571 testonly = true
Mirko Bonadeiccbe95f2020-01-21 11:10:10572 deps = [ "test/fuzzers:webrtc_fuzzer_main" ]
Mirko Bonadeibb547202017-09-15 04:15:48573 }
574}
575
Andrey Logvine7c79fd2021-02-01 09:56:37576if (rtc_include_tests && !build_with_chromium) {
Mirko Bonadeibb547202017-09-15 04:15:48577 rtc_test("rtc_unittests") {
578 testonly = true
579
580 deps = [
Harald Alvestrand3cc45d42019-03-14 04:42:04581 "api:compile_all_headers",
Mirko Bonadeibb547202017-09-15 04:15:48582 "api:rtc_api_unittests",
Fredrik Solenbergbbf21a32018-04-12 20:44:09583 "api/audio/test:audio_api_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48584 "api/audio_codecs/test:audio_codecs_api_unittests",
Artem Titov9d777622020-09-18 16:23:08585 "api/numerics:numerics_unittests",
Artem Titovc374d112022-06-16 19:27:45586 "api/task_queue:pending_task_safety_flag_unittests",
Artem Titov27f91af2022-09-16 22:12:19587 "api/test/metrics:metrics_unittests",
Patrik Höglund56d94522019-11-18 14:53:32588 "api/transport:stun_unittest",
Stefan Holmerf7044682018-07-17 08:16:41589 "api/video/test:rtc_api_video_unittests",
Anders Carlssondd3e0ab2018-06-12 09:15:56590 "api/video_codecs/test:video_codecs_api_unittests",
Tim Na76bbc982021-01-28 18:52:38591 "api/voip:compile_all_headers",
Sebastian Jansson487c09b2019-02-21 15:21:51592 "call:fake_network_pipe_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48593 "p2p:libstunprober_unittests",
594 "p2p:rtc_p2p_unittests",
Mirko Bonadei3d259352020-10-23 10:04:40595 "rtc_base:callback_list_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48596 "rtc_base:rtc_base_approved_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48597 "rtc_base:rtc_base_unittests",
Sam Zackrissonb45bdb52018-10-02 14:25:59598 "rtc_base:rtc_json_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48599 "rtc_base:rtc_numerics_unittests",
Henrik Boström27c29362019-10-21 13:21:55600 "rtc_base:rtc_operations_chain_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48601 "rtc_base:rtc_task_queue_unittests",
Artem Titove41c4332018-07-25 13:04:28602 "rtc_base:sigslot_unittest",
Markus Handell82da9322022-12-16 14:50:24603 "rtc_base:task_queue_stdlib_unittest",
Karl Wiberg70026f92020-09-18 08:03:16604 "rtc_base:untyped_function_unittest",
Mirko Bonadeibb547202017-09-15 04:15:48605 "rtc_base:weak_ptr_unittests",
Sebastian Jansson2808ae92018-04-09 09:13:04606 "rtc_base/experiments:experiments_unittests",
Björn Tereliuscbd61562021-03-25 14:52:16607 "rtc_base/system:file_wrapper_unittests",
Evan Shrubsole45448e92021-11-15 16:27:44608 "rtc_base/task_utils:repeating_task_unittests",
Evan Shrubsole21e97f92022-01-11 12:50:00609 "rtc_base/units:units_unittests",
Niels Möllerdac03d92019-02-13 07:52:27610 "sdk:sdk_tests",
Tommi25eb47c2019-08-29 14:39:05611 "test:rtp_test_utils",
Niels Möller04a3cc12019-05-21 11:01:58612 "test:test_main",
Artem Titov386802e2019-07-05 08:48:17613 "test/network:network_emulation_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48614 ]
615
616 if (rtc_enable_protobuf) {
617 deps += [ "logging:rtc_event_log_tests" ]
618 }
619
620 if (is_android) {
Sami Kalliomäki78498cf2018-02-07 15:59:33621 # Do not use Chromium's launcher. native_unittests defines its own JNI_OnLoad.
622 use_default_launcher = false
623
624 deps += [
625 "sdk/android:native_unittests",
626 "sdk/android:native_unittests_java",
627 "//testing/android/native_test:native_test_support",
628 ]
Mirko Bonadeibb547202017-09-15 04:15:48629 shard_timeout = 900
630 }
Mirko Bonadeibb547202017-09-15 04:15:48631 }
632
Peter Kasting049f5ef2023-03-14 16:56:25633 if (rtc_enable_google_benchmarks) {
Andrey Logvin5e227ab2021-01-29 10:34:55634 rtc_test("benchmarks") {
635 testonly = true
636 deps = [
637 "rtc_base/synchronization:mutex_benchmark",
638 "test:benchmark_main",
639 ]
640 }
Markus Handellf70fbc82020-06-03 22:41:20641 }
642
Mirko Bonadeibb547202017-09-15 04:15:48643 # TODO(pbos): Rename test suite, this is no longer "just" for video targets.
644 video_engine_tests_resources = [
Mirko Bonadei92ea95e2017-09-15 04:47:31645 "resources/foreman_cif_short.yuv",
646 "resources/voice_engine/audio_long16.pcm",
Mirko Bonadeibb547202017-09-15 04:15:48647 ]
648
649 if (is_ios) {
650 bundle_data("video_engine_tests_bundle_data") {
651 testonly = true
652 sources = video_engine_tests_resources
Mirko Bonadeiccbe95f2020-01-21 11:10:10653 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
Mirko Bonadeibb547202017-09-15 04:15:48654 }
655 }
656
657 rtc_test("video_engine_tests") {
658 testonly = true
659 deps = [
660 "audio:audio_tests",
661
662 # TODO(eladalon): call_tests aren't actually video-specific, so we
663 # should move them to a more appropriate test suite.
664 "call:call_tests",
Henrik Boströmb04b2a12019-12-10 13:14:09665 "call/adaptation:resource_adaptation_tests",
Mirko Bonadeibb547202017-09-15 04:15:48666 "test:test_common",
667 "test:test_main",
668 "test:video_test_common",
669 "video:video_tests",
Henrik Boströmefbec9a2020-03-06 09:41:25670 "video/adaptation:video_adaptation_tests",
Mirko Bonadeibb547202017-09-15 04:15:48671 ]
672 data = video_engine_tests_resources
Mirko Bonadeibb547202017-09-15 04:15:48673 if (is_android) {
Björn Terelius0c68a7a2022-04-19 13:32:37674 use_default_launcher = false
675 deps += [
676 "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
677 "//testing/android/native_test:native_test_java",
678 "//testing/android/native_test:native_test_support",
679 ]
Mirko Bonadeibb547202017-09-15 04:15:48680 shard_timeout = 900
681 }
682 if (is_ios) {
683 deps += [ ":video_engine_tests_bundle_data" ]
684 }
685 }
686
687 webrtc_perf_tests_resources = [
Natalie Chouinard65bbcab2019-12-23 22:02:25688 "resources/ConferenceMotion_1280_720_50.yuv",
Mirko Bonadei92ea95e2017-09-15 04:47:31689 "resources/audio_coding/speech_mono_16kHz.pcm",
690 "resources/audio_coding/speech_mono_32_48kHz.pcm",
691 "resources/audio_coding/testfile32kHz.pcm",
Mirko Bonadei92ea95e2017-09-15 04:47:31692 "resources/difficult_photo_1850_1110.yuv",
693 "resources/foreman_cif.yuv",
Mirko Bonadei92ea95e2017-09-15 04:47:31694 "resources/paris_qcif.yuv",
695 "resources/photo_1850_1110.yuv",
696 "resources/presentation_1850_1110.yuv",
Mirko Bonadei92ea95e2017-09-15 04:47:31697 "resources/voice_engine/audio_long16.pcm",
698 "resources/web_screenshot_1850_1110.yuv",
Mirko Bonadeibb547202017-09-15 04:15:48699 ]
700
701 if (is_ios) {
702 bundle_data("webrtc_perf_tests_bundle_data") {
703 testonly = true
704 sources = webrtc_perf_tests_resources
Mirko Bonadeiccbe95f2020-01-21 11:10:10705 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
Mirko Bonadeibb547202017-09-15 04:15:48706 }
707 }
708
709 rtc_test("webrtc_perf_tests") {
710 testonly = true
Mirko Bonadeibb547202017-09-15 04:15:48711 deps = [
Mirko Bonadeibb547202017-09-15 04:15:48712 "call:call_perf_tests",
713 "modules/audio_coding:audio_coding_perf_tests",
714 "modules/audio_processing:audio_processing_perf_tests",
Seth Hampsond1003d72018-06-22 22:40:16715 "pc:peerconnection_perf_tests",
Mirko Bonadeibb547202017-09-15 04:15:48716 "test:test_main",
717 "video:video_full_stack_tests",
Artem Titov137f6c82019-05-17 08:51:15718 "video:video_pc_full_stack_tests",
Mirko Bonadeibb547202017-09-15 04:15:48719 ]
720
Artem Titarenko01d04fa2019-07-12 09:19:54721 data = webrtc_perf_tests_resources
Mirko Bonadeibb547202017-09-15 04:15:48722 if (is_android) {
Björn Terelius0c68a7a2022-04-19 13:32:37723 use_default_launcher = false
724 deps += [
725 "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
726 "//testing/android/native_test:native_test_java",
727 "//testing/android/native_test:native_test_support",
728 ]
Oleh Prypin2aa03792018-12-13 07:48:13729 shard_timeout = 4500
Mirko Bonadeibb547202017-09-15 04:15:48730 }
731 if (is_ios) {
732 deps += [ ":webrtc_perf_tests_bundle_data" ]
733 }
734 }
735
Jeremy Leconte128afb12023-01-11 09:55:35736 if (is_fuchsia) {
737 rtc_test("fuchsia_perf_tests") {
738 testonly = true
739 deps = [
740 #TODO(fxbug.dev/115601) - Enable when fixed
Christoffer Jansson73918992023-01-18 13:46:34741 "call:call_perf_tests",
Jeremy Leconte128afb12023-01-11 09:55:35742 "modules/audio_coding:audio_coding_perf_tests",
743 "modules/audio_processing:audio_processing_perf_tests",
744 "pc:peerconnection_perf_tests",
745 "test:test_main",
746 "video:video_full_stack_tests",
Christoffer Jansson73918992023-01-18 13:46:34747 "video:video_pc_full_stack_tests",
Jeremy Leconte128afb12023-01-11 09:55:35748 ]
Jeremy Leconted0eaa542022-12-02 19:54:15749
Jeremy Leconte128afb12023-01-11 09:55:35750 data = webrtc_perf_tests_resources
751 }
Jeremy Leconted0eaa542022-12-02 19:54:15752 }
753
Mirko Bonadeibb547202017-09-15 04:15:48754 rtc_test("webrtc_nonparallel_tests") {
755 testonly = true
Mirko Bonadeiccbe95f2020-01-21 11:10:10756 deps = [ "rtc_base:rtc_base_nonparallel_tests" ]
Mirko Bonadeibb547202017-09-15 04:15:48757 if (is_android) {
758 deps += [ "//testing/android/native_test:native_test_support" ]
759 shard_timeout = 900
760 }
761 }
Tim Na8ab3c772020-03-27 00:16:51762
763 rtc_test("voip_unittests") {
764 testonly = true
765 deps = [
Tim Na76bbc982021-01-28 18:52:38766 "api/voip:compile_all_headers",
Tim Nac0df5fc2020-05-05 18:03:54767 "api/voip:voip_engine_factory_unittests",
768 "audio/voip/test:audio_channel_unittests",
Tim Na8ab3c772020-03-27 00:16:51769 "audio/voip/test:audio_egress_unittests",
Tim Na11f92bc2020-04-21 16:39:25770 "audio/voip/test:audio_ingress_unittests",
Tim Nac0df5fc2020-05-05 18:03:54771 "audio/voip/test:voip_core_unittests",
Tim Na8ab3c772020-03-27 00:16:51772 "test:test_main",
773 ]
774 }
wjia@webrtc.org03cfde22014-01-14 17:48:34775}
Karl Wibergbb23c832018-04-22 17:55:00776
Philipp Hanckec1282772021-11-24 07:18:31777# Build target for standalone dcsctp
778rtc_static_library("dcsctp") {
779 # Only the root target should depend on this.
780 visibility = [ "//:default" ]
781 sources = []
782 complete_static_lib = true
783 suppressed_configs += [ "//build/config/compiler:thin_archive" ]
784 defines = []
785 deps = [
786 "net/dcsctp/public:factory",
787 "net/dcsctp/public:socket",
788 "net/dcsctp/public:types",
789 "net/dcsctp/socket:dcsctp_socket",
790 "net/dcsctp/timer:task_queue_timeout",
Philipp Hanckec1282772021-11-24 07:18:31791 ]
792}
793
Karl Wibergbb23c832018-04-22 17:55:00794# ---- Poisons ----
795#
796# Here is one empty dummy target for each poison type (needed because
797# "being poisonous with poison type foo" is implemented as "depends on
798# //:poison_foo").
799#
800# The set of poison_* targets needs to be kept in sync with the
801# `all_poison_types` list in webrtc.gni.
802#
803group("poison_audio_codecs") {
804}
Anders Carlsson1f433e42018-04-24 14:39:05805
Sam Zackrisson492fdf42019-10-25 08:45:58806group("poison_default_task_queue") {
Anders Carlsson1f433e42018-04-24 14:39:05807}
Danil Chapovalov41300af2019-07-10 10:44:43808
Sam Zackrisson03cb7e52021-12-06 14:40:04809group("poison_default_echo_detector") {
810}
811
Sam Zackrisson492fdf42019-10-25 08:45:58812group("poison_rtc_json") {
813}
814
815group("poison_software_video_codecs") {
Danil Chapovalov41300af2019-07-10 10:44:43816}