blob: 689de89c06e9f077f504028917ce5369664673e8 [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")
Jeremy Leconte2e7ed0d2023-09-19 08:09:0633 import("//third_party/jni_zero/jni_zero.gni")
Mirko Bonadeibb547202017-09-15 04:15:4834}
ehmaldonado37d7a222016-11-08 14:34:2035
Mirko Bonadeibb547202017-09-15 04:15:4836if (!build_with_chromium) {
Patrik Höglund29dd6d72017-12-01 10:35:2637 # This target should (transitively) cause everything to be built; if you run
38 # 'ninja default' and then 'ninja all', the second build should do no work.
Mirko Bonadeibb547202017-09-15 04:15:4839 group("default") {
40 testonly = true
Mirko Bonadeiccbe95f2020-01-21 11:10:1041 deps = [ ":webrtc" ]
Joachim Bauch93e91342017-12-07 00:25:5342 if (rtc_build_examples) {
43 deps += [ "examples" ]
44 }
45 if (rtc_build_tools) {
46 deps += [ "rtc_tools" ]
47 }
Mirko Bonadeibb547202017-09-15 04:15:4848 if (rtc_include_tests) {
Patrik Höglund29dd6d72017-12-01 10:35:2649 deps += [
Jonas Oreland989dfe32025-02-25 12:59:1950 ":rtc_p2p_unittests",
Patrik Höglund29dd6d72017-12-01 10:35:2651 ":rtc_unittests",
52 ":video_engine_tests",
Tim Na8ab3c772020-03-27 00:16:5153 ":voip_unittests",
Patrik Höglund29dd6d72017-12-01 10:35:2654 ":webrtc_nonparallel_tests",
55 ":webrtc_perf_tests",
56 "common_audio:common_audio_unittests",
57 "common_video:common_video_unittests",
Niels Möller9862c2e2018-10-30 11:20:0358 "examples:examples_unittests",
Patrik Höglund29dd6d72017-12-01 10:35:2659 "media:rtc_media_unittests",
60 "modules:modules_tests",
61 "modules:modules_unittests",
62 "modules/audio_coding:audio_coding_tests",
63 "modules/audio_processing:audio_processing_tests",
Mirko Bonadei79e4c922019-07-08 09:52:2464 "modules/remote_bitrate_estimator:rtp_to_text",
Patrik Höglund29dd6d72017-12-01 10:35:2665 "modules/rtp_rtcp:test_packet_masks_metrics",
66 "modules/video_capture:video_capture_internal_impl",
Sergey Silkin03281902023-05-19 09:10:1567 "modules/video_coding:video_codec_perf_tests",
Victor Boivie7d3c49a2021-03-25 12:11:0368 "net/dcsctp:dcsctp_unittests",
Patrik Höglund29dd6d72017-12-01 10:35:2669 "pc:peerconnection_unittests",
70 "pc:rtc_pc_unittests",
Harald Alvestrandf8f7b702022-05-05 13:21:1971 "pc:slow_peer_connection_unittests",
Florent Castelli90b74382022-04-25 15:28:0072 "pc:svc_tests",
Ilya Nikolaevskiyb41d5f12019-07-18 07:59:2573 "rtc_tools:rtp_generator",
Philipp Hanckee4e33b82023-06-14 14:55:5474 "rtc_tools:video_encoder",
Mirko Bonadeid4c3c3a2020-02-07 09:02:3175 "rtc_tools:video_replay",
Patrik Höglund29dd6d72017-12-01 10:35:2676 "stats:rtc_stats_unittests",
77 "system_wrappers:system_wrappers_unittests",
78 "test",
79 "video:screenshare_loopback",
Ilya Nikolaevskiy255d1cd2017-12-21 17:02:5980 "video:sv_loopback",
Patrik Höglund29dd6d72017-12-01 10:35:2681 "video:video_loopback",
Patrik Höglund29dd6d72017-12-01 10:35:2682 ]
Danil Chapovalovf2d31362024-08-19 14:47:1883 if (use_libfuzzer) {
84 deps += [ "test/fuzzers" ]
85 }
Mirko Bonadei6adb0a22019-10-23 14:55:0486 if (!is_asan) {
87 # Do not build :webrtc_lib_link_test because lld complains on some OS
88 # (e.g. when target_os = "mac") when is_asan=true. For more details,
89 # see bugs.webrtc.org/11027#c5.
90 deps += [ ":webrtc_lib_link_test" ]
91 }
Jeremy Leconte251eca22022-03-04 04:39:0492 if (is_ios) {
93 deps += [
94 "examples:apprtcmobile_tests",
95 "sdk:sdk_framework_unittests",
96 "sdk:sdk_unittests",
97 ]
98 }
Patrik Höglund29dd6d72017-12-01 10:35:2699 if (is_android) {
100 deps += [
Mirko Bonadei73aa2de2020-01-20 14:28:57101 "examples:android_examples_junit_tests",
Sami Kalliomäkid54f5f52018-08-03 11:23:05102 "sdk/android:android_instrumentation_test_apk",
Mirko Bonadeiccbe95f2020-01-21 11:10:10103 "sdk/android:android_sdk_junit_tests",
Patrik Höglund29dd6d72017-12-01 10:35:26104 ]
105 } else {
106 deps += [ "modules/video_capture:video_capture_tests" ]
107 }
108 if (rtc_enable_protobuf) {
109 deps += [
Mirko Bonadeiab0b9d42019-07-08 10:31:59110 "logging:rtc_event_log_rtp_dump",
Patrik Höglund83245bd2020-01-30 08:33:57111 "tools_webrtc/perf:webrtc_dashboard_upload",
Patrik Höglund29dd6d72017-12-01 10:35:26112 ]
113 }
Jan Grulich1264dc12022-10-18 12:27:17114 if ((is_linux || is_chromeos) && rtc_use_pipewire) {
115 deps += [ "modules/desktop_capture:shared_screencast_stream_test" ]
116 }
Mirko Bonadeibb547202017-09-15 04:15:48117 }
Mirko Bonadeib9857482020-12-14 14:28:43118 if (target_os == "android") {
119 deps += [ "tools_webrtc:binary_version_check" ]
120 }
Mirko Bonadeibb547202017-09-15 04:15:48121 }
122}
123
Mirko Bonadei2ab97f62019-07-18 11:44:12124# Abseil Flags by default doesn't register command line flags on mobile
125# platforms, WebRTC tests requires them (e.g. on simualtors) so this
126# config will be applied to testonly targets globally (see webrtc.gni).
127config("absl_flags_configs") {
128 defines = [ "ABSL_FLAGS_STRIP_NAMES=0" ]
129}
130
Mirko Bonadei32ce18c2018-09-18 11:15:54131config("library_impl_config") {
132 # Build targets that contain WebRTC implementation need this macro to
133 # be defined in order to correctly export symbols when is_component_build
134 # is true.
135 # For more info see: rtc_base/build/rtc_export.h.
136 defines = [ "WEBRTC_LIBRARY_IMPL" ]
137}
138
Mirko Bonadeibb547202017-09-15 04:15:48139# Contains the defines and includes in common.gypi that are duplicated both as
140# target_defaults and direct_dependent_settings.
141config("common_inherited_config") {
Mirko Bonadeia3b2dd42025-02-13 09:22:25142 defines = [ "PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0" ]
Mirko Bonadeibb547202017-09-15 04:15:48143 cflags = []
144 ldflags = []
Mirko Bonadei32ce18c2018-09-18 11:15:54145
Mirko Bonadei91304312023-07-26 11:01:43146 if (rtc_objc_prefix != "") {
147 defines += [ "RTC_OBJC_TYPE_PREFIX=${rtc_objc_prefix}" ]
148 }
149
Mirko Bonadei56ed4682021-10-12 06:55:42150 if (rtc_dlog_always_on) {
151 defines += [ "DLOG_ALWAYS_ON" ]
152 }
153
Mirko Bonadei02fac7d2019-10-15 19:25:07154 if (rtc_enable_symbol_export || is_component_build) {
Takaaki Suzuki52d97fd2021-10-09 13:16:01155 defines += [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
Mirko Bonadei028248c2018-10-10 10:19:02156 }
Mirko Bonadei5f078452021-07-30 20:32:55157 if (rtc_enable_objc_symbol_export) {
Takaaki Suzuki52d97fd2021-10-09 13:16:01158 defines += [ "WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT" ]
Mirko Bonadei5f078452021-07-30 20:32:55159 }
Mirko Bonadei028248c2018-10-10 10:19:02160
Mirko Bonadeib889a202018-08-15 09:41:27161 if (!rtc_builtin_ssl_root_certificates) {
162 defines += [ "WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS" ]
163 }
164
Artem Titov9dc209a2019-11-28 16:09:30165 if (rtc_disable_check_msg) {
166 defines += [ "RTC_DISABLE_CHECK_MSG" ]
167 }
168
Zhaoliang Ma72e43212020-08-17 09:13:41169 if (rtc_enable_avx2) {
170 defines += [ "WEBRTC_ENABLE_AVX2" ]
171 }
172
Austin Orionedc946e2021-04-05 23:30:20173 if (rtc_enable_win_wgc) {
174 defines += [ "RTC_ENABLE_WIN_WGC" ]
175 }
176
Evan Shrubsoledb50b032024-04-24 13:27:00177 if (!rtc_use_perfetto) {
178 # Some tests need to declare their own trace event handlers. If this define is
179 # not set, the first time TRACE_EVENT_* is called it will store the return
180 # value for the current handler in an static variable, so that subsequent
181 # changes to the handler for that TRACE_EVENT_* will be ignored.
182 # So when tests are included, we set this define, making it possible to use
183 # different event handlers in different tests.
184 if (rtc_include_tests) {
185 defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ]
186 } else {
187 defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ]
188 }
Mirko Bonadeibb547202017-09-15 04:15:48189 }
190 if (build_with_chromium) {
Mirko Bonadei8e5014a2018-08-02 11:36:10191 defines += [ "WEBRTC_CHROMIUM_BUILD" ]
Mirko Bonadeibb547202017-09-15 04:15:48192 include_dirs = [
193 # The overrides must be included first as that is the mechanism for
194 # selecting the override headers in Chromium.
195 "../webrtc_overrides",
196
197 # Allow includes to be prefixed with webrtc/ in case it is not an
198 # immediate subdirectory of the top-level.
199 ".",
Tomas Popela762543f2018-12-12 13:37:51200
201 # Just like the root WebRTC directory is added to include path, the
202 # corresponding directory tree with generated files needs to be added too.
203 # Note: this path does not change depending on the current target, e.g.
204 # it is always "//gen/third_party/webrtc" when building with Chromium.
205 # See also: http://cs.chromium.org/?q=%5C"default_include_dirs
206 # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir
207 target_gen_dir,
Mirko Bonadeibb547202017-09-15 04:15:48208 ]
209 }
Fabrice de Gans-Riberi09a6cd52018-03-30 17:38:06210 if (is_posix || is_fuchsia) {
Mirko Bonadeibb547202017-09-15 04:15:48211 defines += [ "WEBRTC_POSIX" ]
212 }
213 if (is_ios) {
214 defines += [
215 "WEBRTC_MAC",
216 "WEBRTC_IOS",
217 ]
218 }
Hidehiko Abef264e702020-09-10 09:10:11219 if (is_linux || is_chromeos) {
Mirko Bonadeibb547202017-09-15 04:15:48220 defines += [ "WEBRTC_LINUX" ]
221 }
222 if (is_mac) {
223 defines += [ "WEBRTC_MAC" ]
224 }
Sergey Ulanov6acefdb2017-12-12 01:38:13225 if (is_fuchsia) {
226 defines += [ "WEBRTC_FUCHSIA" ]
227 }
Mirko Bonadeibb547202017-09-15 04:15:48228 if (is_win) {
Mirko Bonadei89a87742018-04-24 07:12:13229 defines += [ "WEBRTC_WIN" ]
Mirko Bonadeibb547202017-09-15 04:15:48230 }
231 if (is_android) {
232 defines += [
233 "WEBRTC_LINUX",
234 "WEBRTC_ANDROID",
235 ]
Dan Minor9c686132018-01-15 15:20:00236
237 if (build_with_mozilla) {
238 defines += [ "WEBRTC_ANDROID_OPENSLES" ]
239 }
Mirko Bonadeibb547202017-09-15 04:15:48240 }
241 if (is_chromeos) {
242 defines += [ "CHROMEOS" ]
243 }
244
245 if (rtc_sanitize_coverage != "") {
246 assert(is_clang, "sanitizer coverage requires clang")
247 cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
248 ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
249 }
250
251 if (is_ubsan) {
252 cflags += [ "-fsanitize=float-cast-overflow" ]
253 }
Mirko Bonadeibb547202017-09-15 04:15:48254}
255
Mirko Bonadei96ede16a2018-09-06 11:45:44256# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
257# as soon as WebRTC compiles without it.
Mirko Bonadei96ede16a2018-09-06 11:45:44258config("no_global_constructors") {
259 if (is_clang) {
260 cflags = [ "-Wno-global-constructors" ]
261 }
262}
263
264config("rtc_prod_config") {
265 # Ideally, WebRTC production code (but not test code) should have these flags.
266 if (is_clang) {
267 cflags = [
268 "-Wexit-time-destructors",
269 "-Wglobal-constructors",
270 ]
271 }
272}
273
Evan Shrubsoledb50b032024-04-24 13:27:00274group("tracing") {
Evan Shrubsolecd098582024-04-30 07:57:49275 all_dependent_configs = [ "//third_party/perfetto/gn:public_config" ]
Evan Shrubsoledb50b032024-04-24 13:27:00276 if (rtc_use_perfetto) {
277 if (build_with_chromium) {
278 public_deps = # no-presubmit-check TODO(webrtc:8603)
279 [ "//third_party/perfetto:libperfetto" ]
280 } else {
Evan Shrubsolecd098582024-04-30 07:57:49281 public_deps = [ # no-presubmit-check TODO(webrtc:8603)
282 ":webrtc_libperfetto",
283 "//third_party/perfetto/include/perfetto/tracing",
284 ]
Evan Shrubsoledb50b032024-04-24 13:27:00285 }
Evan Shrubsolecd098582024-04-30 07:57:49286 } else {
287 public_deps = # no-presubmit-check TODO(webrtc:8603)
288 [ "//third_party/perfetto/include/perfetto/tracing" ]
Evan Shrubsoledb50b032024-04-24 13:27:00289 }
290}
291
292if (rtc_use_perfetto) {
293 rtc_library("webrtc_libperfetto") {
Evan Shrubsoledb50b032024-04-24 13:27:00294 deps = [
295 "//third_party/perfetto/src/tracing:client_api_without_backends",
296 "//third_party/perfetto/src/tracing:platform_impl",
297 ]
Evan Shrubsoledb50b032024-04-24 13:27:00298 }
299}
300
Mirko Bonadeibb547202017-09-15 04:15:48301config("common_config") {
302 cflags = []
Mirko Bonadeid7573562018-03-19 15:23:48303 cflags_c = []
Mirko Bonadeibb547202017-09-15 04:15:48304 cflags_cc = []
Mirko Bonadeid7573562018-03-19 15:23:48305 cflags_objc = []
Mirko Bonadeibb547202017-09-15 04:15:48306 defines = []
307
308 if (rtc_enable_protobuf) {
309 defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ]
310 } else {
311 defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
312 }
313
Emil Lundmark9109e852023-02-28 12:57:01314 if (rtc_strict_field_trials == "") {
Emil Lundmark6bf20cc2022-09-21 13:20:22315 defines += [ "WEBRTC_STRICT_FIELD_TRIALS=0" ]
Emil Lundmark9109e852023-02-28 12:57:01316 } else if (rtc_strict_field_trials == "dcheck") {
317 defines += [ "WEBRTC_STRICT_FIELD_TRIALS=1" ]
318 } else if (rtc_strict_field_trials == "warn") {
319 defines += [ "WEBRTC_STRICT_FIELD_TRIALS=2" ]
320 } else {
321 assert(false,
322 "Unsupported value for rtc_strict_field_trials: " +
323 "$rtc_strict_field_trials")
Emil Lundmark6bf20cc2022-09-21 13:20:22324 }
325
Mirko Bonadeibb547202017-09-15 04:15:48326 if (rtc_include_internal_audio_device) {
327 defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
328 }
329
Mirko Bonadei8ef57932018-11-16 13:38:03330 if (rtc_libvpx_build_vp9) {
331 defines += [ "RTC_ENABLE_VP9" ]
Mirko Bonadeibb547202017-09-15 04:15:48332 }
333
qwu16ae82df72023-09-20 05:10:31334 if (rtc_use_h265) {
335 defines += [ "RTC_ENABLE_H265" ]
336 }
337
philipelb09d8722021-11-23 10:00:24338 if (rtc_include_dav1d_in_internal_decoder_factory) {
339 defines += [ "RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY" ]
340 }
341
Mirko Bonadeibb547202017-09-15 04:15:48342 if (rtc_enable_sctp) {
Mirko Bonadei5eb43b42021-01-18 12:24:40343 defines += [ "WEBRTC_HAVE_SCTP" ]
Mirko Bonadeibb547202017-09-15 04:15:48344 }
345
346 if (rtc_enable_external_auth) {
347 defines += [ "ENABLE_EXTERNAL_AUTH" ]
348 }
349
Johannes Kronb76b9ba2019-02-08 09:13:25350 if (rtc_use_h264) {
351 defines += [ "WEBRTC_USE_H264" ]
352 }
353
Markus Handell8e75bd42020-06-05 09:47:40354 if (rtc_use_absl_mutex) {
355 defines += [ "WEBRTC_ABSL_MUTEX" ]
356 }
357
Artem Titov6a4a1462019-11-26 15:24:46358 if (rtc_disable_logging) {
359 defines += [ "RTC_DISABLE_LOGGING" ]
360 }
361
Doudou Kisabaka2dec4962019-11-28 13:24:31362 if (rtc_disable_trace_events) {
363 defines += [ "RTC_DISABLE_TRACE_EVENTS" ]
364 }
365
Ying Wangef3998f2019-12-09 12:06:53366 if (rtc_disable_metrics) {
367 defines += [ "RTC_DISABLE_METRICS" ]
368 }
369
Per Åhgrencc73ed32020-04-26 21:56:17370 if (rtc_exclude_audio_processing_module) {
371 defines += [ "WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE" ]
372 }
373
Peter Kasting47126fa2021-09-28 17:08:54374 if (is_clang) {
Mirko Bonadeice030282022-09-01 16:19:42375 cflags += [
376 # TODO(webrtc:13219): Fix -Wshadow instances and enable.
377 "-Wno-shadow",
378
379 # See https://reviews.llvm.org/D56731 for details about this
380 # warning.
381 "-Wctad-maybe-unsupported",
382 ]
Peter Kasting47126fa2021-09-28 17:08:54383 }
Mirko Bonadeicee54172019-12-05 14:30:14384
Mirko Bonadeibb547202017-09-15 04:15:48385 if (build_with_chromium) {
386 defines += [
387 # NOTICE: Since common_inherited_config is used in public_configs for our
388 # targets, there's no point including the defines in that config here.
389 # TODO(kjellander): Cleanup unused ones and move defines closer to the
390 # source when webrtc:4256 is completed.
391 "HAVE_WEBRTC_VIDEO",
Mirko Bonadeibb547202017-09-15 04:15:48392 "LOGGING_INSIDE_WEBRTC",
Mirko Bonadeibb547202017-09-15 04:15:48393 ]
394 } else {
Fabrice de Gans-Riberi09a6cd52018-03-30 17:38:06395 if (is_posix || is_fuchsia) {
Mirko Bonadeid7573562018-03-19 15:23:48396 cflags_c += [
397 # TODO(bugs.webrtc.org/9029): enable commented compiler flags.
398 # Some of these flags should also be added to cflags_objc.
399
400 # "-Wextra", (used when building C++ but not when building C)
401 # "-Wmissing-prototypes", (C/Obj-C only)
402 # "-Wmissing-declarations", (ensure this is always used C/C++, etc..)
403 "-Wstrict-prototypes",
404
405 # "-Wpointer-arith", (ensure this is always used C/C++, etc..)
406 # "-Wbad-function-cast", (C/Obj-C only)
407 # "-Wnested-externs", (C/Obj-C only)
408 ]
409 cflags_objc += [ "-Wstrict-prototypes" ]
Mirko Bonadeibb547202017-09-15 04:15:48410 cflags_cc = [
411 "-Wnon-virtual-dtor",
412
413 # This is enabled for clang; enable for gcc as well.
414 "-Woverloaded-virtual",
415 ]
416 }
417
418 if (is_clang) {
Philipp Hancke0fe3a612024-09-17 19:04:22419 cflags += [
420 "-Wc++11-narrowing",
421 "-Wundef",
422 "-Wunused-lambda-capture",
423 ]
Mirko Bonadeibb547202017-09-15 04:15:48424 }
Mirko Bonadeie7659df2018-05-16 09:50:40425
426 if (is_win && !is_clang) {
427 # MSVC warning suppressions (needed to use Abseil).
428 # TODO(bugs.webrtc.org/9274): Remove these warnings as soon as MSVC allows
429 # external headers warning suppression (or fix them upstream).
430 cflags += [ "/wd4702" ] # unreachable code
Jerome Humbert3e3c5512020-01-13 11:58:26431
432 # MSVC 2019 warning suppressions for C++17 compiling
Patrik Höglund83245bd2020-01-30 08:33:57433 cflags +=
434 [ "/wd5041" ] # out-of-line definition for constexpr static data
435 # member is not needed and is deprecated in C++17
Mirko Bonadeie7659df2018-05-16 09:50:40436 }
Mirko Bonadeibb547202017-09-15 04:15:48437 }
438
439 if (current_cpu == "arm64") {
440 defines += [ "WEBRTC_ARCH_ARM64" ]
441 defines += [ "WEBRTC_HAS_NEON" ]
442 }
443
444 if (current_cpu == "arm") {
445 defines += [ "WEBRTC_ARCH_ARM" ]
446 if (arm_version >= 7) {
447 defines += [ "WEBRTC_ARCH_ARM_V7" ]
448 if (arm_use_neon) {
449 defines += [ "WEBRTC_HAS_NEON" ]
450 }
451 }
452 }
453
454 if (current_cpu == "mipsel") {
455 defines += [ "MIPS32_LE" ]
456 if (mips_float_abi == "hard") {
457 defines += [ "MIPS_FPU_LE" ]
458 }
459 if (mips_arch_variant == "r2") {
460 defines += [ "MIPS32_R2_LE" ]
461 }
462 if (mips_dsp_rev == 1) {
463 defines += [ "MIPS_DSP_R1_LE" ]
464 } else if (mips_dsp_rev == 2) {
465 defines += [
466 "MIPS_DSP_R1_LE",
467 "MIPS_DSP_R2_LE",
468 ]
469 }
470 }
471
472 if (is_android && !is_clang) {
473 # The Android NDK doesn"t provide optimized versions of these
474 # functions. Ensure they are disabled for all compilers.
475 cflags += [
476 "-fno-builtin-cos",
477 "-fno-builtin-sin",
478 "-fno-builtin-cosf",
479 "-fno-builtin-sinf",
480 ]
481 }
482
Greg Thompson6fc4d972023-09-19 10:15:03483 if (use_fuzzing_engine) {
Mirko Bonadeibb547202017-09-15 04:15:48484 # Used in Chromium's overrides to disable logging
485 defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
486 }
Mirko Bonadei20574f42019-03-28 06:50:07487
488 if (!build_with_chromium && rtc_win_undef_unicode) {
489 cflags += [
490 "/UUNICODE",
491 "/U_UNICODE",
492 ]
493 }
Evan Shrubsoledb50b032024-04-24 13:27:00494
495 if (rtc_use_perfetto) {
496 defines += [ "RTC_USE_PERFETTO" ]
497 }
Mirko Bonadeibb547202017-09-15 04:15:48498}
499
500config("common_objc") {
Sylvain Defresnec7f0dff2020-07-03 08:19:30501 frameworks = [ "Foundation.framework" ]
Mirko Bonadeibb547202017-09-15 04:15:48502}
503
Philipp Hancke06a49f02024-08-22 18:52:33504if (!rtc_build_ssl) {
505 config("external_ssl_library") {
506 if (rtc_ssl_root != "") {
507 include_dirs = [ rtc_ssl_root ]
508 }
509 libs = [
510 "crypto",
511 "ssl",
512 ]
513 }
514}
515
Mirko Bonadeibb547202017-09-15 04:15:48516if (!build_with_chromium) {
517 # Target to build all the WebRTC production code.
518 rtc_static_library("webrtc") {
Patrik Höglundeeb79e92019-10-17 14:04:07519 # Only the root target and the test should depend on this.
520 visibility = [
521 "//:default",
522 "//:webrtc_lib_link_test",
523 ]
Mirko Bonadeibb547202017-09-15 04:15:48524
525 sources = []
526 complete_static_lib = true
Oleh Prypind2f4e8b2018-08-01 10:18:05527 suppressed_configs += [ "//build/config/compiler:thin_archive" ]
Mirko Bonadeibb547202017-09-15 04:15:48528 defines = []
529
530 deps = [
Mirko Bonadeiba700de2019-10-10 07:23:22531 "api:create_peerconnection_factory",
Danil Chapovalovb29ff002023-11-02 18:18:04532 "api:enable_media",
Yves Gerey06f6bc92018-11-09 09:22:52533 "api:libjingle_peerconnection_api",
Mirko Bonadeieaaaf412019-09-13 12:42:15534 "api:rtc_error",
Mirko Bonadeibb547202017-09-15 04:15:48535 "api:transport_api",
Patrick Reynoldsf6549982024-08-20 03:20:33536 "api/audio_codecs:opus_audio_decoder_factory",
Mirko Bonadeieaaaf412019-09-13 12:42:15537 "api/crypto",
Danil Chapovalov4ba04b72019-06-26 13:49:47538 "api/rtc_event_log:rtc_event_log_factory",
Mirko Bonadeiba700de2019-10-10 07:23:22539 "api/task_queue",
540 "api/task_queue:default_task_queue_factory",
Artem Titovc898c822022-09-14 11:14:02541 "api/test/metrics",
philipel2b00c4e2023-03-31 15:20:40542 "api/video_codecs:video_decoder_factory_template",
543 "api/video_codecs:video_decoder_factory_template_dav1d_adapter",
544 "api/video_codecs:video_decoder_factory_template_libvpx_vp8_adapter",
545 "api/video_codecs:video_decoder_factory_template_libvpx_vp9_adapter",
546 "api/video_codecs:video_decoder_factory_template_open_h264_adapter",
547 "api/video_codecs:video_encoder_factory_template",
548 "api/video_codecs:video_encoder_factory_template_libaom_av1_adapter",
549 "api/video_codecs:video_encoder_factory_template_libvpx_vp8_adapter",
550 "api/video_codecs:video_encoder_factory_template_libvpx_vp9_adapter",
551 "api/video_codecs:video_encoder_factory_template_open_h264_adapter",
Mirko Bonadeibb547202017-09-15 04:15:48552 "audio",
553 "call",
554 "common_audio",
555 "common_video",
Yves Gerey06f6bc92018-11-09 09:22:52556 "logging:rtc_event_log_api",
Mirko Bonadeibb547202017-09-15 04:15:48557 "media",
558 "modules",
559 "modules/video_capture:video_capture_internal_impl",
Yves Gerey06f6bc92018-11-09 09:22:52560 "pc:libjingle_peerconnection",
Yves Gerey06f6bc92018-11-09 09:22:52561 "pc:rtc_pc",
Mirko Bonadeibb547202017-09-15 04:15:48562 "sdk",
Mirko Bonadeibb547202017-09-15 04:15:48563 "video",
Mirko Bonadeibb547202017-09-15 04:15:48564 ]
565
Jiawei Ou08745302019-02-12 19:36:13566 if (rtc_include_builtin_audio_codecs) {
567 deps += [
568 "api/audio_codecs:builtin_audio_decoder_factory",
569 "api/audio_codecs:builtin_audio_encoder_factory",
570 ]
571 }
572
Dan Minor9c686132018-01-15 15:20:00573 if (build_with_mozilla) {
Chen Xing5d24b162019-06-10 10:59:38574 deps += [
575 "api/video:video_frame",
576 "api/video:video_rtp_headers",
577 ]
Dan Minor9c686132018-01-15 15:20:00578 } else {
579 deps += [
580 "api",
581 "logging",
582 "p2p",
583 "pc",
584 "stats",
585 ]
586 }
587
Mirko Bonadeibb547202017-09-15 04:15:48588 if (rtc_enable_protobuf) {
Mirko Bonadeibb547202017-09-15 04:15:48589 deps += [ "logging:rtc_event_log_proto" ]
590 }
591 }
Patrik Höglundeeb79e92019-10-17 14:04:07592
Mirko Bonadeic69fd592020-03-10 14:35:38593 if (rtc_include_tests && !is_asan) {
Patrik Höglund21671632019-10-18 06:04:19594 rtc_executable("webrtc_lib_link_test") {
Patrik Höglundeeb79e92019-10-17 14:04:07595 testonly = true
596
Byoungchan Lee8ed1e932021-05-20 09:30:10597 # This target is used for checking to link, so do not check dependencies
598 # on gn check.
599 check_includes = false # no-presubmit-check TODO(bugs.webrtc.org/12785)
600
Mirko Bonadeiccbe95f2020-01-21 11:10:10601 sources = [ "webrtc_lib_link_test.cc" ]
Patrik Höglundeeb79e92019-10-17 14:04:07602 deps = [
Patrik Höglund21671632019-10-18 06:04:19603 # NOTE: Don't add deps here. If this test fails to link, it means you
604 # need to add stuff to the webrtc static lib target above.
Patrik Höglundeeb79e92019-10-17 14:04:07605 ":webrtc",
Patrik Höglundeeb79e92019-10-17 14:04:07606 ]
607 }
608 }
Mirko Bonadeibb547202017-09-15 04:15:48609}
610
Nico Weberdf644be2019-03-18 01:06:11611if (use_libfuzzer || use_afl) {
Mirko Bonadeibb547202017-09-15 04:15:48612 # This target is only here for gn to discover fuzzer build targets under
613 # webrtc/test/fuzzers/.
614 group("webrtc_fuzzers_dummy") {
615 testonly = true
Mirko Bonadeiccbe95f2020-01-21 11:10:10616 deps = [ "test/fuzzers:webrtc_fuzzer_main" ]
Mirko Bonadeibb547202017-09-15 04:15:48617 }
618}
619
Andrey Logvine7c79fd2021-02-01 09:56:37620if (rtc_include_tests && !build_with_chromium) {
Jeremy Lecontee90ab592025-02-21 08:00:32621 rtc_unittests_resources = [ "resources/reference_video_640x360_30fps.y4m" ]
622
623 if (is_ios) {
624 bundle_data("rtc_unittests_bundle_data") {
625 testonly = true
626 sources = rtc_unittests_resources
627 outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
628 }
629 }
630
Mirko Bonadeibb547202017-09-15 04:15:48631 rtc_test("rtc_unittests") {
632 testonly = true
633
634 deps = [
Harald Alvestrand3cc45d42019-03-14 04:42:04635 "api:compile_all_headers",
Mirko Bonadeibb547202017-09-15 04:15:48636 "api:rtc_api_unittests",
Danil Chapovalov2dc95ba2024-10-15 10:09:49637 "api/audio:audio_api_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48638 "api/audio_codecs/test:audio_codecs_api_unittests",
Artem Titov9d777622020-09-18 16:23:08639 "api/numerics:numerics_unittests",
Artem Titovc374d112022-06-16 19:27:45640 "api/task_queue:pending_task_safety_flag_unittests",
Artem Titov27f91af2022-09-16 22:12:19641 "api/test/metrics:metrics_unittests",
Patrik Höglund56d94522019-11-18 14:53:32642 "api/transport:stun_unittest",
Fanny Linderborg39da6f32025-01-24 09:50:45643 "api/transport/rtp:corruption_detection_message_unittest",
Stefan Holmerf7044682018-07-17 08:16:41644 "api/video/test:rtc_api_video_unittests",
philipelb85b4c02024-04-24 14:31:58645 "api/video_codecs:libaom_av1_encoder_factory_test",
646 "api/video_codecs:simple_encoder_wrapper_unittests",
Anders Carlssondd3e0ab2018-06-12 09:15:56647 "api/video_codecs/test:video_codecs_api_unittests",
Tim Na76bbc982021-01-28 18:52:38648 "api/voip:compile_all_headers",
Sebastian Jansson487c09b2019-02-21 15:21:51649 "call:fake_network_pipe_unittests",
Harald Alvestrand8d4a5f12023-08-22 13:53:16650 "rtc_base:async_dns_resolver_unittests",
Per K4ac37182023-11-15 09:43:32651 "rtc_base:async_packet_socket_unittest",
Per Kjellander906deaf2024-10-31 14:10:19652 "rtc_base:async_udp_socket_unittest",
Mirko Bonadei3d259352020-10-23 10:04:40653 "rtc_base:callback_list_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48654 "rtc_base:rtc_base_approved_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48655 "rtc_base:rtc_base_unittests",
Sam Zackrissonb45bdb52018-10-02 14:25:59656 "rtc_base:rtc_json_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48657 "rtc_base:rtc_numerics_unittests",
Henrik Boström27c29362019-10-21 13:21:55658 "rtc_base:rtc_operations_chain_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48659 "rtc_base:rtc_task_queue_unittests",
Artem Titove41c4332018-07-25 13:04:28660 "rtc_base:sigslot_unittest",
Markus Handell82da9322022-12-16 14:50:24661 "rtc_base:task_queue_stdlib_unittest",
Karl Wiberg70026f92020-09-18 08:03:16662 "rtc_base:untyped_function_unittest",
Mirko Bonadeibb547202017-09-15 04:15:48663 "rtc_base:weak_ptr_unittests",
Sebastian Jansson2808ae92018-04-09 09:13:04664 "rtc_base/experiments:experiments_unittests",
Björn Tereliuscbd61562021-03-25 14:52:16665 "rtc_base/system:file_wrapper_unittests",
Evan Shrubsole45448e92021-11-15 16:27:44666 "rtc_base/task_utils:repeating_task_unittests",
Evan Shrubsole21e97f92022-01-11 12:50:00667 "rtc_base/units:units_unittests",
Niels Möllerdac03d92019-02-13 07:52:27668 "sdk:sdk_tests",
Tommi25eb47c2019-08-29 14:39:05669 "test:rtp_test_utils",
Niels Möller04a3cc12019-05-21 11:01:58670 "test:test_main",
Artem Titov386802e2019-07-05 08:48:17671 "test/network:network_emulation_unittests",
Mirko Bonadeibb547202017-09-15 04:15:48672 ]
673
Jeremy Lecontee90ab592025-02-21 08:00:32674 data = rtc_unittests_resources
philipelb85b4c02024-04-24 14:31:58675
Mirko Bonadeibb547202017-09-15 04:15:48676 if (rtc_enable_protobuf) {
Per Kjellandera0d1a512024-05-29 10:33:21677 deps += [
678 "api/test/network_emulation:network_config_schedule_proto",
679 "logging:rtc_event_log_tests",
680 ]
Mirko Bonadeibb547202017-09-15 04:15:48681 }
682
philipelb85b4c02024-04-24 14:31:58683 if (is_ios) {
Jeremy Lecontee90ab592025-02-21 08:00:32684 deps += [ ":rtc_unittests_bundle_data" ]
philipelb85b4c02024-04-24 14:31:58685 }
686
Mirko Bonadeibb547202017-09-15 04:15:48687 if (is_android) {
Sami Kalliomäki78498cf2018-02-07 15:59:33688 # Do not use Chromium's launcher. native_unittests defines its own JNI_OnLoad.
689 use_default_launcher = false
690
691 deps += [
692 "sdk/android:native_unittests",
693 "sdk/android:native_unittests_java",
Sami Kalliomäki78498cf2018-02-07 15:59:33694 ]
Mirko Bonadeibb547202017-09-15 04:15:48695 shard_timeout = 900
696 }
Mirko Bonadeibb547202017-09-15 04:15:48697 }
698
Jonas Oreland989dfe32025-02-25 12:59:19699 rtc_test("rtc_p2p_unittests") {
700 testonly = true
701
702 deps = [
703 "p2p:libstunprober_unittests",
704 "p2p:rtc_p2p_unittests",
705 "test:test_main",
706 ]
707 }
708
Peter Kasting049f5ef2023-03-14 16:56:25709 if (rtc_enable_google_benchmarks) {
Andrey Logvin5e227ab2021-01-29 10:34:55710 rtc_test("benchmarks") {
711 testonly = true
712 deps = [
713 "rtc_base/synchronization:mutex_benchmark",
714 "test:benchmark_main",
715 ]
716 }
Markus Handellf70fbc82020-06-03 22:41:20717 }
718
Mirko Bonadeibb547202017-09-15 04:15:48719 # TODO(pbos): Rename test suite, this is no longer "just" for video targets.
Mirko Bonadeibb547202017-09-15 04:15:48720 rtc_test("video_engine_tests") {
721 testonly = true
722 deps = [
723 "audio:audio_tests",
724
725 # TODO(eladalon): call_tests aren't actually video-specific, so we
726 # should move them to a more appropriate test suite.
727 "call:call_tests",
Henrik Boströmb04b2a12019-12-10 13:14:09728 "call/adaptation:resource_adaptation_tests",
Mirko Bonadeibb547202017-09-15 04:15:48729 "test:test_common",
730 "test:test_main",
731 "test:video_test_common",
732 "video:video_tests",
Henrik Boströmefbec9a2020-03-06 09:41:25733 "video/adaptation:video_adaptation_tests",
Mirko Bonadeibb547202017-09-15 04:15:48734 ]
Jeremy Leconte0f235402025-02-18 09:39:42735
736 data_deps = [ "resources:video_engine_tests_data" ]
737
Mirko Bonadeibb547202017-09-15 04:15:48738 if (is_android) {
Björn Terelius0c68a7a2022-04-19 13:32:37739 use_default_launcher = false
Björn Terelius711e1a82024-12-04 14:54:49740 deps += [ "//build/android/gtest_apk:native_test_instrumentation_test_runner_java" ]
Mirko Bonadeibb547202017-09-15 04:15:48741 shard_timeout = 900
742 }
743 if (is_ios) {
Jeremy Leconte0f235402025-02-18 09:39:42744 deps += [ "resources:video_engine_tests_bundle_data" ]
Mirko Bonadeibb547202017-09-15 04:15:48745 }
746 }
747
748 rtc_test("webrtc_perf_tests") {
749 testonly = true
Mirko Bonadeibb547202017-09-15 04:15:48750 deps = [
Mirko Bonadeibb547202017-09-15 04:15:48751 "call:call_perf_tests",
752 "modules/audio_coding:audio_coding_perf_tests",
753 "modules/audio_processing:audio_processing_perf_tests",
Seth Hampsond1003d72018-06-22 22:40:16754 "pc:peerconnection_perf_tests",
Mirko Bonadeibb547202017-09-15 04:15:48755 "test:test_main",
756 "video:video_full_stack_tests",
Artem Titov137f6c82019-05-17 08:51:15757 "video:video_pc_full_stack_tests",
Mirko Bonadeibb547202017-09-15 04:15:48758 ]
759
Jeremy Leconte0f235402025-02-18 09:39:42760 data_deps = [ "resources:webrtc_perf_tests_data" ]
761
Mirko Bonadeibb547202017-09-15 04:15:48762 if (is_android) {
Björn Terelius0c68a7a2022-04-19 13:32:37763 use_default_launcher = false
Björn Terelius711e1a82024-12-04 14:54:49764 deps += [ "//build/android/gtest_apk:native_test_instrumentation_test_runner_java" ]
Oleh Prypin2aa03792018-12-13 07:48:13765 shard_timeout = 4500
Mirko Bonadeibb547202017-09-15 04:15:48766 }
767 if (is_ios) {
Jeremy Leconte0f235402025-02-18 09:39:42768 deps += [ "resources:webrtc_perf_tests_bundle_data" ]
Mirko Bonadeibb547202017-09-15 04:15:48769 }
770 }
771
772 rtc_test("webrtc_nonparallel_tests") {
773 testonly = true
Mirko Bonadeiccbe95f2020-01-21 11:10:10774 deps = [ "rtc_base:rtc_base_nonparallel_tests" ]
Mirko Bonadeibb547202017-09-15 04:15:48775 if (is_android) {
Mirko Bonadeibb547202017-09-15 04:15:48776 shard_timeout = 900
777 }
778 }
Tim Na8ab3c772020-03-27 00:16:51779
780 rtc_test("voip_unittests") {
781 testonly = true
782 deps = [
Tim Na76bbc982021-01-28 18:52:38783 "api/voip:compile_all_headers",
Tim Nac0df5fc2020-05-05 18:03:54784 "api/voip:voip_engine_factory_unittests",
785 "audio/voip/test:audio_channel_unittests",
Tim Na8ab3c772020-03-27 00:16:51786 "audio/voip/test:audio_egress_unittests",
Tim Na11f92bc2020-04-21 16:39:25787 "audio/voip/test:audio_ingress_unittests",
Tim Nac0df5fc2020-05-05 18:03:54788 "audio/voip/test:voip_core_unittests",
Tim Na8ab3c772020-03-27 00:16:51789 "test:test_main",
790 ]
791 }
wjia@webrtc.org03cfde22014-01-14 17:48:34792}
Karl Wibergbb23c832018-04-22 17:55:00793
Philipp Hanckec1282772021-11-24 07:18:31794# Build target for standalone dcsctp
795rtc_static_library("dcsctp") {
796 # Only the root target should depend on this.
797 visibility = [ "//:default" ]
798 sources = []
799 complete_static_lib = true
800 suppressed_configs += [ "//build/config/compiler:thin_archive" ]
801 defines = []
802 deps = [
803 "net/dcsctp/public:factory",
804 "net/dcsctp/public:socket",
805 "net/dcsctp/public:types",
806 "net/dcsctp/socket:dcsctp_socket",
807 "net/dcsctp/timer:task_queue_timeout",
Philipp Hanckec1282772021-11-24 07:18:31808 ]
809}
810
Karl Wibergbb23c832018-04-22 17:55:00811# ---- Poisons ----
812#
813# Here is one empty dummy target for each poison type (needed because
814# "being poisonous with poison type foo" is implemented as "depends on
815# //:poison_foo").
816#
817# The set of poison_* targets needs to be kept in sync with the
818# `all_poison_types` list in webrtc.gni.
819#
820group("poison_audio_codecs") {
821}
Anders Carlsson1f433e42018-04-24 14:39:05822
Danil Chapovalov9fdceb82023-11-27 09:57:22823group("poison_default_echo_detector") {
Anders Carlsson1f433e42018-04-24 14:39:05824}
Danil Chapovalov41300af2019-07-10 10:44:43825
Danil Chapovalov9fdceb82023-11-27 09:57:22826group("poison_environment_construction") {
Sam Zackrisson03cb7e52021-12-06 14:40:04827}
828
Sam Zackrisson492fdf42019-10-25 08:45:58829group("poison_software_video_codecs") {
Danil Chapovalov41300af2019-07-10 10:44:43830}