xref: /aosp_15_r20/external/webrtc/BUILD.gn (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2*d9f75844SAndroid Build Coastguard Worker#
3*d9f75844SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license
4*d9f75844SAndroid Build Coastguard Worker# that can be found in the LICENSE file in the root of the source
5*d9f75844SAndroid Build Coastguard Worker# tree. An additional intellectual property rights grant can be found
6*d9f75844SAndroid Build Coastguard Worker# in the file PATENTS.  All contributing project authors may
7*d9f75844SAndroid Build Coastguard Worker# be found in the AUTHORS file in the root of the source tree.
8*d9f75844SAndroid Build Coastguard Worker
9*d9f75844SAndroid Build Coastguard Worker# This is the root build file for GN. GN will start processing by loading this
10*d9f75844SAndroid Build Coastguard Worker# file, and recursively load all dependencies until all dependencies are either
11*d9f75844SAndroid Build Coastguard Worker# resolved or known not to exist (which will cause the build to fail). So if
12*d9f75844SAndroid Build Coastguard Worker# you add a new build file, there must be some path of dependencies from this
13*d9f75844SAndroid Build Coastguard Worker# file to your new one or GN won't know about it.
14*d9f75844SAndroid Build Coastguard Worker
15*d9f75844SAndroid Build Coastguard Worker# Use of visibility = clauses:
16*d9f75844SAndroid Build Coastguard Worker# The default visibility for all rtc_ targets is equivalent to "//*", or
17*d9f75844SAndroid Build Coastguard Worker# "all targets in webrtc can depend on this, nothing outside can".
18*d9f75844SAndroid Build Coastguard Worker#
19*d9f75844SAndroid Build Coastguard Worker# When overriding, the choices are:
20*d9f75844SAndroid Build Coastguard Worker# - visibility = [ "*" ] - public. Stuff outside webrtc can use this.
21*d9f75844SAndroid Build Coastguard Worker# - visibility = [ ":*" ] - directory private.
22*d9f75844SAndroid Build Coastguard Worker# As a general guideline, only targets in api/ should have public visibility.
23*d9f75844SAndroid Build Coastguard Worker
24*d9f75844SAndroid Build Coastguard Workerimport("//build/config/linux/pkg_config.gni")
25*d9f75844SAndroid Build Coastguard Workerimport("//build/config/sanitizers/sanitizers.gni")
26*d9f75844SAndroid Build Coastguard Workerimport("//third_party/google_benchmark/buildconfig.gni")
27*d9f75844SAndroid Build Coastguard Workerimport("webrtc.gni")
28*d9f75844SAndroid Build Coastguard Workerif (rtc_enable_protobuf) {
29*d9f75844SAndroid Build Coastguard Worker  import("//third_party/protobuf/proto_library.gni")
30*d9f75844SAndroid Build Coastguard Worker}
31*d9f75844SAndroid Build Coastguard Workerif (is_android) {
32*d9f75844SAndroid Build Coastguard Worker  import("//build/config/android/config.gni")
33*d9f75844SAndroid Build Coastguard Worker  import("//build/config/android/rules.gni")
34*d9f75844SAndroid Build Coastguard Worker}
35*d9f75844SAndroid Build Coastguard Worker
36*d9f75844SAndroid Build Coastguard Workerif (!build_with_chromium) {
37*d9f75844SAndroid Build Coastguard Worker  # This target should (transitively) cause everything to be built; if you run
38*d9f75844SAndroid Build Coastguard Worker  # 'ninja default' and then 'ninja all', the second build should do no work.
39*d9f75844SAndroid Build Coastguard Worker  group("default") {
40*d9f75844SAndroid Build Coastguard Worker    testonly = true
41*d9f75844SAndroid Build Coastguard Worker    deps = [ ":webrtc" ]
42*d9f75844SAndroid Build Coastguard Worker    if (rtc_build_examples) {
43*d9f75844SAndroid Build Coastguard Worker      deps += [ "examples" ]
44*d9f75844SAndroid Build Coastguard Worker    }
45*d9f75844SAndroid Build Coastguard Worker    if (rtc_build_tools) {
46*d9f75844SAndroid Build Coastguard Worker      deps += [ "rtc_tools" ]
47*d9f75844SAndroid Build Coastguard Worker    }
48*d9f75844SAndroid Build Coastguard Worker    if (rtc_include_tests) {
49*d9f75844SAndroid Build Coastguard Worker      deps += [
50*d9f75844SAndroid Build Coastguard Worker        ":fuchsia_perf_tests",
51*d9f75844SAndroid Build Coastguard Worker        ":rtc_unittests",
52*d9f75844SAndroid Build Coastguard Worker        ":video_engine_tests",
53*d9f75844SAndroid Build Coastguard Worker        ":voip_unittests",
54*d9f75844SAndroid Build Coastguard Worker        ":webrtc_nonparallel_tests",
55*d9f75844SAndroid Build Coastguard Worker        ":webrtc_perf_tests",
56*d9f75844SAndroid Build Coastguard Worker        "common_audio:common_audio_unittests",
57*d9f75844SAndroid Build Coastguard Worker        "common_video:common_video_unittests",
58*d9f75844SAndroid Build Coastguard Worker        "examples:examples_unittests",
59*d9f75844SAndroid Build Coastguard Worker        "media:rtc_media_unittests",
60*d9f75844SAndroid Build Coastguard Worker        "modules:modules_tests",
61*d9f75844SAndroid Build Coastguard Worker        "modules:modules_unittests",
62*d9f75844SAndroid Build Coastguard Worker        "modules/audio_coding:audio_coding_tests",
63*d9f75844SAndroid Build Coastguard Worker        "modules/audio_processing:audio_processing_tests",
64*d9f75844SAndroid Build Coastguard Worker        "modules/remote_bitrate_estimator:rtp_to_text",
65*d9f75844SAndroid Build Coastguard Worker        "modules/rtp_rtcp:test_packet_masks_metrics",
66*d9f75844SAndroid Build Coastguard Worker        "modules/video_capture:video_capture_internal_impl",
67*d9f75844SAndroid Build Coastguard Worker        "net/dcsctp:dcsctp_unittests",
68*d9f75844SAndroid Build Coastguard Worker        "pc:peerconnection_unittests",
69*d9f75844SAndroid Build Coastguard Worker        "pc:rtc_pc_unittests",
70*d9f75844SAndroid Build Coastguard Worker        "pc:slow_peer_connection_unittests",
71*d9f75844SAndroid Build Coastguard Worker        "pc:svc_tests",
72*d9f75844SAndroid Build Coastguard Worker        "rtc_tools:rtp_generator",
73*d9f75844SAndroid Build Coastguard Worker        "rtc_tools:video_replay",
74*d9f75844SAndroid Build Coastguard Worker        "stats:rtc_stats_unittests",
75*d9f75844SAndroid Build Coastguard Worker        "system_wrappers:system_wrappers_unittests",
76*d9f75844SAndroid Build Coastguard Worker        "test",
77*d9f75844SAndroid Build Coastguard Worker        "video:screenshare_loopback",
78*d9f75844SAndroid Build Coastguard Worker        "video:sv_loopback",
79*d9f75844SAndroid Build Coastguard Worker        "video:video_loopback",
80*d9f75844SAndroid Build Coastguard Worker      ]
81*d9f75844SAndroid Build Coastguard Worker      if (!is_asan) {
82*d9f75844SAndroid Build Coastguard Worker        # Do not build :webrtc_lib_link_test because lld complains on some OS
83*d9f75844SAndroid Build Coastguard Worker        # (e.g. when target_os = "mac") when is_asan=true. For more details,
84*d9f75844SAndroid Build Coastguard Worker        # see bugs.webrtc.org/11027#c5.
85*d9f75844SAndroid Build Coastguard Worker        deps += [ ":webrtc_lib_link_test" ]
86*d9f75844SAndroid Build Coastguard Worker      }
87*d9f75844SAndroid Build Coastguard Worker      if (is_ios) {
88*d9f75844SAndroid Build Coastguard Worker        deps += [
89*d9f75844SAndroid Build Coastguard Worker          "examples:apprtcmobile_tests",
90*d9f75844SAndroid Build Coastguard Worker          "sdk:sdk_framework_unittests",
91*d9f75844SAndroid Build Coastguard Worker          "sdk:sdk_unittests",
92*d9f75844SAndroid Build Coastguard Worker        ]
93*d9f75844SAndroid Build Coastguard Worker      }
94*d9f75844SAndroid Build Coastguard Worker      if (is_android) {
95*d9f75844SAndroid Build Coastguard Worker        deps += [
96*d9f75844SAndroid Build Coastguard Worker          "examples:android_examples_junit_tests",
97*d9f75844SAndroid Build Coastguard Worker          "sdk/android:android_instrumentation_test_apk",
98*d9f75844SAndroid Build Coastguard Worker          "sdk/android:android_sdk_junit_tests",
99*d9f75844SAndroid Build Coastguard Worker        ]
100*d9f75844SAndroid Build Coastguard Worker      } else {
101*d9f75844SAndroid Build Coastguard Worker        deps += [ "modules/video_capture:video_capture_tests" ]
102*d9f75844SAndroid Build Coastguard Worker      }
103*d9f75844SAndroid Build Coastguard Worker      if (rtc_enable_protobuf) {
104*d9f75844SAndroid Build Coastguard Worker        deps += [
105*d9f75844SAndroid Build Coastguard Worker          "audio:low_bandwidth_audio_perf_test",
106*d9f75844SAndroid Build Coastguard Worker          "logging:rtc_event_log_rtp_dump",
107*d9f75844SAndroid Build Coastguard Worker          "tools_webrtc/perf:webrtc_dashboard_upload",
108*d9f75844SAndroid Build Coastguard Worker        ]
109*d9f75844SAndroid Build Coastguard Worker      }
110*d9f75844SAndroid Build Coastguard Worker      if ((is_linux || is_chromeos) && rtc_use_pipewire) {
111*d9f75844SAndroid Build Coastguard Worker        deps += [ "modules/desktop_capture:shared_screencast_stream_test" ]
112*d9f75844SAndroid Build Coastguard Worker      }
113*d9f75844SAndroid Build Coastguard Worker    }
114*d9f75844SAndroid Build Coastguard Worker    if (target_os == "android") {
115*d9f75844SAndroid Build Coastguard Worker      deps += [ "tools_webrtc:binary_version_check" ]
116*d9f75844SAndroid Build Coastguard Worker    }
117*d9f75844SAndroid Build Coastguard Worker  }
118*d9f75844SAndroid Build Coastguard Worker}
119*d9f75844SAndroid Build Coastguard Worker
120*d9f75844SAndroid Build Coastguard Worker# Abseil Flags by default doesn't register command line flags on mobile
121*d9f75844SAndroid Build Coastguard Worker# platforms, WebRTC tests requires them (e.g. on simualtors) so this
122*d9f75844SAndroid Build Coastguard Worker# config will be applied to testonly targets globally (see webrtc.gni).
123*d9f75844SAndroid Build Coastguard Workerconfig("absl_flags_configs") {
124*d9f75844SAndroid Build Coastguard Worker  defines = [ "ABSL_FLAGS_STRIP_NAMES=0" ]
125*d9f75844SAndroid Build Coastguard Worker}
126*d9f75844SAndroid Build Coastguard Worker
127*d9f75844SAndroid Build Coastguard Workerconfig("library_impl_config") {
128*d9f75844SAndroid Build Coastguard Worker  # Build targets that contain WebRTC implementation need this macro to
129*d9f75844SAndroid Build Coastguard Worker  # be defined in order to correctly export symbols when is_component_build
130*d9f75844SAndroid Build Coastguard Worker  # is true.
131*d9f75844SAndroid Build Coastguard Worker  # For more info see: rtc_base/build/rtc_export.h.
132*d9f75844SAndroid Build Coastguard Worker  defines = [ "WEBRTC_LIBRARY_IMPL" ]
133*d9f75844SAndroid Build Coastguard Worker}
134*d9f75844SAndroid Build Coastguard Worker
135*d9f75844SAndroid Build Coastguard Worker# Contains the defines and includes in common.gypi that are duplicated both as
136*d9f75844SAndroid Build Coastguard Worker# target_defaults and direct_dependent_settings.
137*d9f75844SAndroid Build Coastguard Workerconfig("common_inherited_config") {
138*d9f75844SAndroid Build Coastguard Worker  defines = []
139*d9f75844SAndroid Build Coastguard Worker  cflags = []
140*d9f75844SAndroid Build Coastguard Worker  ldflags = []
141*d9f75844SAndroid Build Coastguard Worker
142*d9f75844SAndroid Build Coastguard Worker  if (rtc_dlog_always_on) {
143*d9f75844SAndroid Build Coastguard Worker    defines += [ "DLOG_ALWAYS_ON" ]
144*d9f75844SAndroid Build Coastguard Worker  }
145*d9f75844SAndroid Build Coastguard Worker
146*d9f75844SAndroid Build Coastguard Worker  if (rtc_enable_symbol_export || is_component_build) {
147*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
148*d9f75844SAndroid Build Coastguard Worker  }
149*d9f75844SAndroid Build Coastguard Worker  if (rtc_enable_objc_symbol_export) {
150*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT" ]
151*d9f75844SAndroid Build Coastguard Worker  }
152*d9f75844SAndroid Build Coastguard Worker
153*d9f75844SAndroid Build Coastguard Worker  if (!rtc_builtin_ssl_root_certificates) {
154*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS" ]
155*d9f75844SAndroid Build Coastguard Worker  }
156*d9f75844SAndroid Build Coastguard Worker
157*d9f75844SAndroid Build Coastguard Worker  if (rtc_disable_check_msg) {
158*d9f75844SAndroid Build Coastguard Worker    defines += [ "RTC_DISABLE_CHECK_MSG" ]
159*d9f75844SAndroid Build Coastguard Worker  }
160*d9f75844SAndroid Build Coastguard Worker
161*d9f75844SAndroid Build Coastguard Worker  if (rtc_enable_avx2) {
162*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_ENABLE_AVX2" ]
163*d9f75844SAndroid Build Coastguard Worker  }
164*d9f75844SAndroid Build Coastguard Worker
165*d9f75844SAndroid Build Coastguard Worker  if (rtc_enable_win_wgc) {
166*d9f75844SAndroid Build Coastguard Worker    defines += [ "RTC_ENABLE_WIN_WGC" ]
167*d9f75844SAndroid Build Coastguard Worker  }
168*d9f75844SAndroid Build Coastguard Worker
169*d9f75844SAndroid Build Coastguard Worker  # Some tests need to declare their own trace event handlers. If this define is
170*d9f75844SAndroid Build Coastguard Worker  # not set, the first time TRACE_EVENT_* is called it will store the return
171*d9f75844SAndroid Build Coastguard Worker  # value for the current handler in an static variable, so that subsequent
172*d9f75844SAndroid Build Coastguard Worker  # changes to the handler for that TRACE_EVENT_* will be ignored.
173*d9f75844SAndroid Build Coastguard Worker  # So when tests are included, we set this define, making it possible to use
174*d9f75844SAndroid Build Coastguard Worker  # different event handlers in different tests.
175*d9f75844SAndroid Build Coastguard Worker  if (rtc_include_tests) {
176*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ]
177*d9f75844SAndroid Build Coastguard Worker  } else {
178*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ]
179*d9f75844SAndroid Build Coastguard Worker  }
180*d9f75844SAndroid Build Coastguard Worker  if (build_with_chromium) {
181*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_CHROMIUM_BUILD" ]
182*d9f75844SAndroid Build Coastguard Worker    include_dirs = [
183*d9f75844SAndroid Build Coastguard Worker      # The overrides must be included first as that is the mechanism for
184*d9f75844SAndroid Build Coastguard Worker      # selecting the override headers in Chromium.
185*d9f75844SAndroid Build Coastguard Worker      "../webrtc_overrides",
186*d9f75844SAndroid Build Coastguard Worker
187*d9f75844SAndroid Build Coastguard Worker      # Allow includes to be prefixed with webrtc/ in case it is not an
188*d9f75844SAndroid Build Coastguard Worker      # immediate subdirectory of the top-level.
189*d9f75844SAndroid Build Coastguard Worker      ".",
190*d9f75844SAndroid Build Coastguard Worker
191*d9f75844SAndroid Build Coastguard Worker      # Just like the root WebRTC directory is added to include path, the
192*d9f75844SAndroid Build Coastguard Worker      # corresponding directory tree with generated files needs to be added too.
193*d9f75844SAndroid Build Coastguard Worker      # Note: this path does not change depending on the current target, e.g.
194*d9f75844SAndroid Build Coastguard Worker      # it is always "//gen/third_party/webrtc" when building with Chromium.
195*d9f75844SAndroid Build Coastguard Worker      # See also: http://cs.chromium.org/?q=%5C"default_include_dirs
196*d9f75844SAndroid Build Coastguard Worker      # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir
197*d9f75844SAndroid Build Coastguard Worker      target_gen_dir,
198*d9f75844SAndroid Build Coastguard Worker    ]
199*d9f75844SAndroid Build Coastguard Worker  }
200*d9f75844SAndroid Build Coastguard Worker  if (is_posix || is_fuchsia) {
201*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_POSIX" ]
202*d9f75844SAndroid Build Coastguard Worker  }
203*d9f75844SAndroid Build Coastguard Worker  if (is_ios) {
204*d9f75844SAndroid Build Coastguard Worker    defines += [
205*d9f75844SAndroid Build Coastguard Worker      "WEBRTC_MAC",
206*d9f75844SAndroid Build Coastguard Worker      "WEBRTC_IOS",
207*d9f75844SAndroid Build Coastguard Worker    ]
208*d9f75844SAndroid Build Coastguard Worker  }
209*d9f75844SAndroid Build Coastguard Worker  if (is_linux || is_chromeos) {
210*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_LINUX" ]
211*d9f75844SAndroid Build Coastguard Worker  }
212*d9f75844SAndroid Build Coastguard Worker  if (is_mac) {
213*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_MAC" ]
214*d9f75844SAndroid Build Coastguard Worker  }
215*d9f75844SAndroid Build Coastguard Worker  if (is_fuchsia) {
216*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_FUCHSIA" ]
217*d9f75844SAndroid Build Coastguard Worker  }
218*d9f75844SAndroid Build Coastguard Worker  if (is_win) {
219*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_WIN" ]
220*d9f75844SAndroid Build Coastguard Worker  }
221*d9f75844SAndroid Build Coastguard Worker  if (is_android) {
222*d9f75844SAndroid Build Coastguard Worker    defines += [
223*d9f75844SAndroid Build Coastguard Worker      "WEBRTC_LINUX",
224*d9f75844SAndroid Build Coastguard Worker      "WEBRTC_ANDROID",
225*d9f75844SAndroid Build Coastguard Worker    ]
226*d9f75844SAndroid Build Coastguard Worker
227*d9f75844SAndroid Build Coastguard Worker    if (build_with_mozilla) {
228*d9f75844SAndroid Build Coastguard Worker      defines += [ "WEBRTC_ANDROID_OPENSLES" ]
229*d9f75844SAndroid Build Coastguard Worker    }
230*d9f75844SAndroid Build Coastguard Worker  }
231*d9f75844SAndroid Build Coastguard Worker  if (is_chromeos) {
232*d9f75844SAndroid Build Coastguard Worker    defines += [ "CHROMEOS" ]
233*d9f75844SAndroid Build Coastguard Worker  }
234*d9f75844SAndroid Build Coastguard Worker
235*d9f75844SAndroid Build Coastguard Worker  if (rtc_sanitize_coverage != "") {
236*d9f75844SAndroid Build Coastguard Worker    assert(is_clang, "sanitizer coverage requires clang")
237*d9f75844SAndroid Build Coastguard Worker    cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
238*d9f75844SAndroid Build Coastguard Worker    ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
239*d9f75844SAndroid Build Coastguard Worker  }
240*d9f75844SAndroid Build Coastguard Worker
241*d9f75844SAndroid Build Coastguard Worker  if (is_ubsan) {
242*d9f75844SAndroid Build Coastguard Worker    cflags += [ "-fsanitize=float-cast-overflow" ]
243*d9f75844SAndroid Build Coastguard Worker  }
244*d9f75844SAndroid Build Coastguard Worker}
245*d9f75844SAndroid Build Coastguard Worker
246*d9f75844SAndroid Build Coastguard Worker# TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
247*d9f75844SAndroid Build Coastguard Worker# as soon as WebRTC compiles without it.
248*d9f75844SAndroid Build Coastguard Workerconfig("no_global_constructors") {
249*d9f75844SAndroid Build Coastguard Worker  if (is_clang) {
250*d9f75844SAndroid Build Coastguard Worker    cflags = [ "-Wno-global-constructors" ]
251*d9f75844SAndroid Build Coastguard Worker  }
252*d9f75844SAndroid Build Coastguard Worker}
253*d9f75844SAndroid Build Coastguard Worker
254*d9f75844SAndroid Build Coastguard Workerconfig("rtc_prod_config") {
255*d9f75844SAndroid Build Coastguard Worker  # Ideally, WebRTC production code (but not test code) should have these flags.
256*d9f75844SAndroid Build Coastguard Worker  if (is_clang) {
257*d9f75844SAndroid Build Coastguard Worker    cflags = [
258*d9f75844SAndroid Build Coastguard Worker      "-Wexit-time-destructors",
259*d9f75844SAndroid Build Coastguard Worker      "-Wglobal-constructors",
260*d9f75844SAndroid Build Coastguard Worker    ]
261*d9f75844SAndroid Build Coastguard Worker  }
262*d9f75844SAndroid Build Coastguard Worker}
263*d9f75844SAndroid Build Coastguard Worker
264*d9f75844SAndroid Build Coastguard Workerconfig("common_config") {
265*d9f75844SAndroid Build Coastguard Worker  cflags = []
266*d9f75844SAndroid Build Coastguard Worker  cflags_c = []
267*d9f75844SAndroid Build Coastguard Worker  cflags_cc = []
268*d9f75844SAndroid Build Coastguard Worker  cflags_objc = []
269*d9f75844SAndroid Build Coastguard Worker  defines = []
270*d9f75844SAndroid Build Coastguard Worker
271*d9f75844SAndroid Build Coastguard Worker  if (rtc_enable_protobuf) {
272*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ]
273*d9f75844SAndroid Build Coastguard Worker  } else {
274*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
275*d9f75844SAndroid Build Coastguard Worker  }
276*d9f75844SAndroid Build Coastguard Worker
277*d9f75844SAndroid Build Coastguard Worker  if (rtc_strict_field_trials) {
278*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_STRICT_FIELD_TRIALS=1" ]
279*d9f75844SAndroid Build Coastguard Worker  } else {
280*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_STRICT_FIELD_TRIALS=0" ]
281*d9f75844SAndroid Build Coastguard Worker  }
282*d9f75844SAndroid Build Coastguard Worker
283*d9f75844SAndroid Build Coastguard Worker  if (rtc_include_internal_audio_device) {
284*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
285*d9f75844SAndroid Build Coastguard Worker  }
286*d9f75844SAndroid Build Coastguard Worker
287*d9f75844SAndroid Build Coastguard Worker  if (rtc_libvpx_build_vp9) {
288*d9f75844SAndroid Build Coastguard Worker    defines += [ "RTC_ENABLE_VP9" ]
289*d9f75844SAndroid Build Coastguard Worker  }
290*d9f75844SAndroid Build Coastguard Worker
291*d9f75844SAndroid Build Coastguard Worker  if (rtc_include_dav1d_in_internal_decoder_factory) {
292*d9f75844SAndroid Build Coastguard Worker    defines += [ "RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY" ]
293*d9f75844SAndroid Build Coastguard Worker  }
294*d9f75844SAndroid Build Coastguard Worker
295*d9f75844SAndroid Build Coastguard Worker  if (rtc_enable_sctp) {
296*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_HAVE_SCTP" ]
297*d9f75844SAndroid Build Coastguard Worker  }
298*d9f75844SAndroid Build Coastguard Worker
299*d9f75844SAndroid Build Coastguard Worker  if (rtc_enable_external_auth) {
300*d9f75844SAndroid Build Coastguard Worker    defines += [ "ENABLE_EXTERNAL_AUTH" ]
301*d9f75844SAndroid Build Coastguard Worker  }
302*d9f75844SAndroid Build Coastguard Worker
303*d9f75844SAndroid Build Coastguard Worker  if (rtc_use_h264) {
304*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_USE_H264" ]
305*d9f75844SAndroid Build Coastguard Worker  }
306*d9f75844SAndroid Build Coastguard Worker
307*d9f75844SAndroid Build Coastguard Worker  if (rtc_use_absl_mutex) {
308*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_ABSL_MUTEX" ]
309*d9f75844SAndroid Build Coastguard Worker  }
310*d9f75844SAndroid Build Coastguard Worker
311*d9f75844SAndroid Build Coastguard Worker  if (rtc_disable_logging) {
312*d9f75844SAndroid Build Coastguard Worker    defines += [ "RTC_DISABLE_LOGGING" ]
313*d9f75844SAndroid Build Coastguard Worker  }
314*d9f75844SAndroid Build Coastguard Worker
315*d9f75844SAndroid Build Coastguard Worker  if (rtc_disable_trace_events) {
316*d9f75844SAndroid Build Coastguard Worker    defines += [ "RTC_DISABLE_TRACE_EVENTS" ]
317*d9f75844SAndroid Build Coastguard Worker  }
318*d9f75844SAndroid Build Coastguard Worker
319*d9f75844SAndroid Build Coastguard Worker  if (rtc_disable_metrics) {
320*d9f75844SAndroid Build Coastguard Worker    defines += [ "RTC_DISABLE_METRICS" ]
321*d9f75844SAndroid Build Coastguard Worker  }
322*d9f75844SAndroid Build Coastguard Worker
323*d9f75844SAndroid Build Coastguard Worker  if (rtc_exclude_transient_suppressor) {
324*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_EXCLUDE_TRANSIENT_SUPPRESSOR" ]
325*d9f75844SAndroid Build Coastguard Worker  }
326*d9f75844SAndroid Build Coastguard Worker
327*d9f75844SAndroid Build Coastguard Worker  if (rtc_exclude_audio_processing_module) {
328*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE" ]
329*d9f75844SAndroid Build Coastguard Worker  }
330*d9f75844SAndroid Build Coastguard Worker
331*d9f75844SAndroid Build Coastguard Worker  if (is_clang) {
332*d9f75844SAndroid Build Coastguard Worker    cflags += [
333*d9f75844SAndroid Build Coastguard Worker      # TODO(webrtc:13219): Fix -Wshadow instances and enable.
334*d9f75844SAndroid Build Coastguard Worker      "-Wno-shadow",
335*d9f75844SAndroid Build Coastguard Worker
336*d9f75844SAndroid Build Coastguard Worker      # See https://reviews.llvm.org/D56731 for details about this
337*d9f75844SAndroid Build Coastguard Worker      # warning.
338*d9f75844SAndroid Build Coastguard Worker      "-Wctad-maybe-unsupported",
339*d9f75844SAndroid Build Coastguard Worker    ]
340*d9f75844SAndroid Build Coastguard Worker  }
341*d9f75844SAndroid Build Coastguard Worker
342*d9f75844SAndroid Build Coastguard Worker  if (build_with_chromium) {
343*d9f75844SAndroid Build Coastguard Worker    defines += [
344*d9f75844SAndroid Build Coastguard Worker      # NOTICE: Since common_inherited_config is used in public_configs for our
345*d9f75844SAndroid Build Coastguard Worker      # targets, there's no point including the defines in that config here.
346*d9f75844SAndroid Build Coastguard Worker      # TODO(kjellander): Cleanup unused ones and move defines closer to the
347*d9f75844SAndroid Build Coastguard Worker      # source when webrtc:4256 is completed.
348*d9f75844SAndroid Build Coastguard Worker      "HAVE_WEBRTC_VIDEO",
349*d9f75844SAndroid Build Coastguard Worker      "LOGGING_INSIDE_WEBRTC",
350*d9f75844SAndroid Build Coastguard Worker    ]
351*d9f75844SAndroid Build Coastguard Worker  } else {
352*d9f75844SAndroid Build Coastguard Worker    if (is_posix || is_fuchsia) {
353*d9f75844SAndroid Build Coastguard Worker      cflags_c += [
354*d9f75844SAndroid Build Coastguard Worker        # TODO(bugs.webrtc.org/9029): enable commented compiler flags.
355*d9f75844SAndroid Build Coastguard Worker        # Some of these flags should also be added to cflags_objc.
356*d9f75844SAndroid Build Coastguard Worker
357*d9f75844SAndroid Build Coastguard Worker        # "-Wextra",  (used when building C++ but not when building C)
358*d9f75844SAndroid Build Coastguard Worker        # "-Wmissing-prototypes",  (C/Obj-C only)
359*d9f75844SAndroid Build Coastguard Worker        # "-Wmissing-declarations",  (ensure this is always used C/C++, etc..)
360*d9f75844SAndroid Build Coastguard Worker        "-Wstrict-prototypes",
361*d9f75844SAndroid Build Coastguard Worker
362*d9f75844SAndroid Build Coastguard Worker        # "-Wpointer-arith",  (ensure this is always used C/C++, etc..)
363*d9f75844SAndroid Build Coastguard Worker        # "-Wbad-function-cast",  (C/Obj-C only)
364*d9f75844SAndroid Build Coastguard Worker        # "-Wnested-externs",  (C/Obj-C only)
365*d9f75844SAndroid Build Coastguard Worker      ]
366*d9f75844SAndroid Build Coastguard Worker      cflags_objc += [ "-Wstrict-prototypes" ]
367*d9f75844SAndroid Build Coastguard Worker      cflags_cc = [
368*d9f75844SAndroid Build Coastguard Worker        "-Wnon-virtual-dtor",
369*d9f75844SAndroid Build Coastguard Worker
370*d9f75844SAndroid Build Coastguard Worker        # This is enabled for clang; enable for gcc as well.
371*d9f75844SAndroid Build Coastguard Worker        "-Woverloaded-virtual",
372*d9f75844SAndroid Build Coastguard Worker      ]
373*d9f75844SAndroid Build Coastguard Worker    }
374*d9f75844SAndroid Build Coastguard Worker
375*d9f75844SAndroid Build Coastguard Worker    if (is_clang) {
376*d9f75844SAndroid Build Coastguard Worker      cflags += [ "-Wc++11-narrowing" ]
377*d9f75844SAndroid Build Coastguard Worker
378*d9f75844SAndroid Build Coastguard Worker      if (!is_fuchsia) {
379*d9f75844SAndroid Build Coastguard Worker        # Compiling with the Fuchsia SDK results in Wundef errors
380*d9f75844SAndroid Build Coastguard Worker        # TODO(bugs.fuchsia.dev/100722): Remove from (!is_fuchsia) branch when
381*d9f75844SAndroid Build Coastguard Worker        # Fuchsia build errors are fixed.
382*d9f75844SAndroid Build Coastguard Worker        cflags += [ "-Wundef" ]
383*d9f75844SAndroid Build Coastguard Worker      }
384*d9f75844SAndroid Build Coastguard Worker
385*d9f75844SAndroid Build Coastguard Worker      if (!is_nacl) {
386*d9f75844SAndroid Build Coastguard Worker        # Flags NaCl (Clang 3.7) do not recognize.
387*d9f75844SAndroid Build Coastguard Worker        cflags += [ "-Wunused-lambda-capture" ]
388*d9f75844SAndroid Build Coastguard Worker      }
389*d9f75844SAndroid Build Coastguard Worker    }
390*d9f75844SAndroid Build Coastguard Worker
391*d9f75844SAndroid Build Coastguard Worker    if (is_win && !is_clang) {
392*d9f75844SAndroid Build Coastguard Worker      # MSVC warning suppressions (needed to use Abseil).
393*d9f75844SAndroid Build Coastguard Worker      # TODO(bugs.webrtc.org/9274): Remove these warnings as soon as MSVC allows
394*d9f75844SAndroid Build Coastguard Worker      # external headers warning suppression (or fix them upstream).
395*d9f75844SAndroid Build Coastguard Worker      cflags += [ "/wd4702" ]  # unreachable code
396*d9f75844SAndroid Build Coastguard Worker
397*d9f75844SAndroid Build Coastguard Worker      # MSVC 2019 warning suppressions for C++17 compiling
398*d9f75844SAndroid Build Coastguard Worker      cflags +=
399*d9f75844SAndroid Build Coastguard Worker          [ "/wd5041" ]  # out-of-line definition for constexpr static data
400*d9f75844SAndroid Build Coastguard Worker                         # member is not needed and is deprecated in C++17
401*d9f75844SAndroid Build Coastguard Worker    }
402*d9f75844SAndroid Build Coastguard Worker  }
403*d9f75844SAndroid Build Coastguard Worker
404*d9f75844SAndroid Build Coastguard Worker  if (current_cpu == "arm64") {
405*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_ARCH_ARM64" ]
406*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_HAS_NEON" ]
407*d9f75844SAndroid Build Coastguard Worker  }
408*d9f75844SAndroid Build Coastguard Worker
409*d9f75844SAndroid Build Coastguard Worker  if (current_cpu == "arm") {
410*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_ARCH_ARM" ]
411*d9f75844SAndroid Build Coastguard Worker    if (arm_version >= 7) {
412*d9f75844SAndroid Build Coastguard Worker      defines += [ "WEBRTC_ARCH_ARM_V7" ]
413*d9f75844SAndroid Build Coastguard Worker      if (arm_use_neon) {
414*d9f75844SAndroid Build Coastguard Worker        defines += [ "WEBRTC_HAS_NEON" ]
415*d9f75844SAndroid Build Coastguard Worker      }
416*d9f75844SAndroid Build Coastguard Worker    }
417*d9f75844SAndroid Build Coastguard Worker  }
418*d9f75844SAndroid Build Coastguard Worker
419*d9f75844SAndroid Build Coastguard Worker  if (current_cpu == "mipsel") {
420*d9f75844SAndroid Build Coastguard Worker    defines += [ "MIPS32_LE" ]
421*d9f75844SAndroid Build Coastguard Worker    if (mips_float_abi == "hard") {
422*d9f75844SAndroid Build Coastguard Worker      defines += [ "MIPS_FPU_LE" ]
423*d9f75844SAndroid Build Coastguard Worker    }
424*d9f75844SAndroid Build Coastguard Worker    if (mips_arch_variant == "r2") {
425*d9f75844SAndroid Build Coastguard Worker      defines += [ "MIPS32_R2_LE" ]
426*d9f75844SAndroid Build Coastguard Worker    }
427*d9f75844SAndroid Build Coastguard Worker    if (mips_dsp_rev == 1) {
428*d9f75844SAndroid Build Coastguard Worker      defines += [ "MIPS_DSP_R1_LE" ]
429*d9f75844SAndroid Build Coastguard Worker    } else if (mips_dsp_rev == 2) {
430*d9f75844SAndroid Build Coastguard Worker      defines += [
431*d9f75844SAndroid Build Coastguard Worker        "MIPS_DSP_R1_LE",
432*d9f75844SAndroid Build Coastguard Worker        "MIPS_DSP_R2_LE",
433*d9f75844SAndroid Build Coastguard Worker      ]
434*d9f75844SAndroid Build Coastguard Worker    }
435*d9f75844SAndroid Build Coastguard Worker  }
436*d9f75844SAndroid Build Coastguard Worker
437*d9f75844SAndroid Build Coastguard Worker  if (is_android && !is_clang) {
438*d9f75844SAndroid Build Coastguard Worker    # The Android NDK doesn"t provide optimized versions of these
439*d9f75844SAndroid Build Coastguard Worker    # functions. Ensure they are disabled for all compilers.
440*d9f75844SAndroid Build Coastguard Worker    cflags += [
441*d9f75844SAndroid Build Coastguard Worker      "-fno-builtin-cos",
442*d9f75844SAndroid Build Coastguard Worker      "-fno-builtin-sin",
443*d9f75844SAndroid Build Coastguard Worker      "-fno-builtin-cosf",
444*d9f75844SAndroid Build Coastguard Worker      "-fno-builtin-sinf",
445*d9f75844SAndroid Build Coastguard Worker    ]
446*d9f75844SAndroid Build Coastguard Worker  }
447*d9f75844SAndroid Build Coastguard Worker
448*d9f75844SAndroid Build Coastguard Worker  if (use_fuzzing_engine && optimize_for_fuzzing) {
449*d9f75844SAndroid Build Coastguard Worker    # Used in Chromium's overrides to disable logging
450*d9f75844SAndroid Build Coastguard Worker    defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
451*d9f75844SAndroid Build Coastguard Worker  }
452*d9f75844SAndroid Build Coastguard Worker
453*d9f75844SAndroid Build Coastguard Worker  if (!build_with_chromium && rtc_win_undef_unicode) {
454*d9f75844SAndroid Build Coastguard Worker    cflags += [
455*d9f75844SAndroid Build Coastguard Worker      "/UUNICODE",
456*d9f75844SAndroid Build Coastguard Worker      "/U_UNICODE",
457*d9f75844SAndroid Build Coastguard Worker    ]
458*d9f75844SAndroid Build Coastguard Worker  }
459*d9f75844SAndroid Build Coastguard Worker}
460*d9f75844SAndroid Build Coastguard Worker
461*d9f75844SAndroid Build Coastguard Workerconfig("common_objc") {
462*d9f75844SAndroid Build Coastguard Worker  frameworks = [ "Foundation.framework" ]
463*d9f75844SAndroid Build Coastguard Worker}
464*d9f75844SAndroid Build Coastguard Worker
465*d9f75844SAndroid Build Coastguard Workerif (!build_with_chromium) {
466*d9f75844SAndroid Build Coastguard Worker  # Target to build all the WebRTC production code.
467*d9f75844SAndroid Build Coastguard Worker  rtc_static_library("webrtc") {
468*d9f75844SAndroid Build Coastguard Worker    # Only the root target and the test should depend on this.
469*d9f75844SAndroid Build Coastguard Worker    visibility = [
470*d9f75844SAndroid Build Coastguard Worker      "//:default",
471*d9f75844SAndroid Build Coastguard Worker      "//:webrtc_lib_link_test",
472*d9f75844SAndroid Build Coastguard Worker    ]
473*d9f75844SAndroid Build Coastguard Worker
474*d9f75844SAndroid Build Coastguard Worker    sources = []
475*d9f75844SAndroid Build Coastguard Worker    complete_static_lib = true
476*d9f75844SAndroid Build Coastguard Worker    suppressed_configs += [ "//build/config/compiler:thin_archive" ]
477*d9f75844SAndroid Build Coastguard Worker    defines = []
478*d9f75844SAndroid Build Coastguard Worker
479*d9f75844SAndroid Build Coastguard Worker    deps = [
480*d9f75844SAndroid Build Coastguard Worker      "api:create_peerconnection_factory",
481*d9f75844SAndroid Build Coastguard Worker      "api:libjingle_peerconnection_api",
482*d9f75844SAndroid Build Coastguard Worker      "api:rtc_error",
483*d9f75844SAndroid Build Coastguard Worker      "api:transport_api",
484*d9f75844SAndroid Build Coastguard Worker      "api/crypto",
485*d9f75844SAndroid Build Coastguard Worker      "api/rtc_event_log:rtc_event_log_factory",
486*d9f75844SAndroid Build Coastguard Worker      "api/task_queue",
487*d9f75844SAndroid Build Coastguard Worker      "api/task_queue:default_task_queue_factory",
488*d9f75844SAndroid Build Coastguard Worker      "api/test/metrics",
489*d9f75844SAndroid Build Coastguard Worker      "audio",
490*d9f75844SAndroid Build Coastguard Worker      "call",
491*d9f75844SAndroid Build Coastguard Worker      "common_audio",
492*d9f75844SAndroid Build Coastguard Worker      "common_video",
493*d9f75844SAndroid Build Coastguard Worker      "logging:rtc_event_log_api",
494*d9f75844SAndroid Build Coastguard Worker      "media",
495*d9f75844SAndroid Build Coastguard Worker      "modules",
496*d9f75844SAndroid Build Coastguard Worker      "modules/video_capture:video_capture_internal_impl",
497*d9f75844SAndroid Build Coastguard Worker      "p2p:rtc_p2p",
498*d9f75844SAndroid Build Coastguard Worker      "pc:libjingle_peerconnection",
499*d9f75844SAndroid Build Coastguard Worker      "pc:rtc_pc",
500*d9f75844SAndroid Build Coastguard Worker      "rtc_base",
501*d9f75844SAndroid Build Coastguard Worker      "sdk",
502*d9f75844SAndroid Build Coastguard Worker      "video",
503*d9f75844SAndroid Build Coastguard Worker    ]
504*d9f75844SAndroid Build Coastguard Worker
505*d9f75844SAndroid Build Coastguard Worker    if (rtc_include_builtin_audio_codecs) {
506*d9f75844SAndroid Build Coastguard Worker      deps += [
507*d9f75844SAndroid Build Coastguard Worker        "api/audio_codecs:builtin_audio_decoder_factory",
508*d9f75844SAndroid Build Coastguard Worker        "api/audio_codecs:builtin_audio_encoder_factory",
509*d9f75844SAndroid Build Coastguard Worker      ]
510*d9f75844SAndroid Build Coastguard Worker    }
511*d9f75844SAndroid Build Coastguard Worker
512*d9f75844SAndroid Build Coastguard Worker    if (rtc_include_builtin_video_codecs) {
513*d9f75844SAndroid Build Coastguard Worker      deps += [
514*d9f75844SAndroid Build Coastguard Worker        "api/video_codecs:builtin_video_decoder_factory",
515*d9f75844SAndroid Build Coastguard Worker        "api/video_codecs:builtin_video_encoder_factory",
516*d9f75844SAndroid Build Coastguard Worker      ]
517*d9f75844SAndroid Build Coastguard Worker    }
518*d9f75844SAndroid Build Coastguard Worker
519*d9f75844SAndroid Build Coastguard Worker    if (build_with_mozilla) {
520*d9f75844SAndroid Build Coastguard Worker      deps += [
521*d9f75844SAndroid Build Coastguard Worker        "api/video:video_frame",
522*d9f75844SAndroid Build Coastguard Worker        "api/video:video_rtp_headers",
523*d9f75844SAndroid Build Coastguard Worker      ]
524*d9f75844SAndroid Build Coastguard Worker    } else {
525*d9f75844SAndroid Build Coastguard Worker      deps += [
526*d9f75844SAndroid Build Coastguard Worker        "api",
527*d9f75844SAndroid Build Coastguard Worker        "logging",
528*d9f75844SAndroid Build Coastguard Worker        "p2p",
529*d9f75844SAndroid Build Coastguard Worker        "pc",
530*d9f75844SAndroid Build Coastguard Worker        "stats",
531*d9f75844SAndroid Build Coastguard Worker      ]
532*d9f75844SAndroid Build Coastguard Worker    }
533*d9f75844SAndroid Build Coastguard Worker
534*d9f75844SAndroid Build Coastguard Worker    if (rtc_enable_protobuf) {
535*d9f75844SAndroid Build Coastguard Worker      deps += [ "logging:rtc_event_log_proto" ]
536*d9f75844SAndroid Build Coastguard Worker    }
537*d9f75844SAndroid Build Coastguard Worker  }
538*d9f75844SAndroid Build Coastguard Worker
539*d9f75844SAndroid Build Coastguard Worker  if (rtc_include_tests && !is_asan) {
540*d9f75844SAndroid Build Coastguard Worker    rtc_executable("webrtc_lib_link_test") {
541*d9f75844SAndroid Build Coastguard Worker      testonly = true
542*d9f75844SAndroid Build Coastguard Worker
543*d9f75844SAndroid Build Coastguard Worker      # This target is used for checking to link, so do not check dependencies
544*d9f75844SAndroid Build Coastguard Worker      # on gn check.
545*d9f75844SAndroid Build Coastguard Worker      check_includes = false  # no-presubmit-check TODO(bugs.webrtc.org/12785)
546*d9f75844SAndroid Build Coastguard Worker
547*d9f75844SAndroid Build Coastguard Worker      sources = [ "webrtc_lib_link_test.cc" ]
548*d9f75844SAndroid Build Coastguard Worker      deps = [
549*d9f75844SAndroid Build Coastguard Worker        # NOTE: Don't add deps here. If this test fails to link, it means you
550*d9f75844SAndroid Build Coastguard Worker        # need to add stuff to the webrtc static lib target above.
551*d9f75844SAndroid Build Coastguard Worker        ":webrtc",
552*d9f75844SAndroid Build Coastguard Worker      ]
553*d9f75844SAndroid Build Coastguard Worker    }
554*d9f75844SAndroid Build Coastguard Worker  }
555*d9f75844SAndroid Build Coastguard Worker}
556*d9f75844SAndroid Build Coastguard Worker
557*d9f75844SAndroid Build Coastguard Workerif (use_libfuzzer || use_afl) {
558*d9f75844SAndroid Build Coastguard Worker  # This target is only here for gn to discover fuzzer build targets under
559*d9f75844SAndroid Build Coastguard Worker  # webrtc/test/fuzzers/.
560*d9f75844SAndroid Build Coastguard Worker  group("webrtc_fuzzers_dummy") {
561*d9f75844SAndroid Build Coastguard Worker    testonly = true
562*d9f75844SAndroid Build Coastguard Worker    deps = [ "test/fuzzers:webrtc_fuzzer_main" ]
563*d9f75844SAndroid Build Coastguard Worker  }
564*d9f75844SAndroid Build Coastguard Worker}
565*d9f75844SAndroid Build Coastguard Worker
566*d9f75844SAndroid Build Coastguard Workerif (rtc_include_tests && !build_with_chromium) {
567*d9f75844SAndroid Build Coastguard Worker  rtc_test("rtc_unittests") {
568*d9f75844SAndroid Build Coastguard Worker    testonly = true
569*d9f75844SAndroid Build Coastguard Worker
570*d9f75844SAndroid Build Coastguard Worker    deps = [
571*d9f75844SAndroid Build Coastguard Worker      "api:compile_all_headers",
572*d9f75844SAndroid Build Coastguard Worker      "api:rtc_api_unittests",
573*d9f75844SAndroid Build Coastguard Worker      "api/audio/test:audio_api_unittests",
574*d9f75844SAndroid Build Coastguard Worker      "api/audio_codecs/test:audio_codecs_api_unittests",
575*d9f75844SAndroid Build Coastguard Worker      "api/numerics:numerics_unittests",
576*d9f75844SAndroid Build Coastguard Worker      "api/task_queue:pending_task_safety_flag_unittests",
577*d9f75844SAndroid Build Coastguard Worker      "api/test/metrics:metrics_unittests",
578*d9f75844SAndroid Build Coastguard Worker      "api/transport:stun_unittest",
579*d9f75844SAndroid Build Coastguard Worker      "api/video/test:rtc_api_video_unittests",
580*d9f75844SAndroid Build Coastguard Worker      "api/video_codecs/test:video_codecs_api_unittests",
581*d9f75844SAndroid Build Coastguard Worker      "api/voip:compile_all_headers",
582*d9f75844SAndroid Build Coastguard Worker      "call:fake_network_pipe_unittests",
583*d9f75844SAndroid Build Coastguard Worker      "p2p:libstunprober_unittests",
584*d9f75844SAndroid Build Coastguard Worker      "p2p:rtc_p2p_unittests",
585*d9f75844SAndroid Build Coastguard Worker      "rtc_base:callback_list_unittests",
586*d9f75844SAndroid Build Coastguard Worker      "rtc_base:rtc_base_approved_unittests",
587*d9f75844SAndroid Build Coastguard Worker      "rtc_base:rtc_base_unittests",
588*d9f75844SAndroid Build Coastguard Worker      "rtc_base:rtc_json_unittests",
589*d9f75844SAndroid Build Coastguard Worker      "rtc_base:rtc_numerics_unittests",
590*d9f75844SAndroid Build Coastguard Worker      "rtc_base:rtc_operations_chain_unittests",
591*d9f75844SAndroid Build Coastguard Worker      "rtc_base:rtc_task_queue_unittests",
592*d9f75844SAndroid Build Coastguard Worker      "rtc_base:sigslot_unittest",
593*d9f75844SAndroid Build Coastguard Worker      "rtc_base:untyped_function_unittest",
594*d9f75844SAndroid Build Coastguard Worker      "rtc_base:weak_ptr_unittests",
595*d9f75844SAndroid Build Coastguard Worker      "rtc_base/experiments:experiments_unittests",
596*d9f75844SAndroid Build Coastguard Worker      "rtc_base/system:file_wrapper_unittests",
597*d9f75844SAndroid Build Coastguard Worker      "rtc_base/task_utils:repeating_task_unittests",
598*d9f75844SAndroid Build Coastguard Worker      "rtc_base/units:units_unittests",
599*d9f75844SAndroid Build Coastguard Worker      "sdk:sdk_tests",
600*d9f75844SAndroid Build Coastguard Worker      "test:rtp_test_utils",
601*d9f75844SAndroid Build Coastguard Worker      "test:test_main",
602*d9f75844SAndroid Build Coastguard Worker      "test/network:network_emulation_unittests",
603*d9f75844SAndroid Build Coastguard Worker    ]
604*d9f75844SAndroid Build Coastguard Worker
605*d9f75844SAndroid Build Coastguard Worker    if (rtc_enable_protobuf) {
606*d9f75844SAndroid Build Coastguard Worker      deps += [ "logging:rtc_event_log_tests" ]
607*d9f75844SAndroid Build Coastguard Worker    }
608*d9f75844SAndroid Build Coastguard Worker
609*d9f75844SAndroid Build Coastguard Worker    if (is_android) {
610*d9f75844SAndroid Build Coastguard Worker      # Do not use Chromium's launcher. native_unittests defines its own JNI_OnLoad.
611*d9f75844SAndroid Build Coastguard Worker      use_default_launcher = false
612*d9f75844SAndroid Build Coastguard Worker
613*d9f75844SAndroid Build Coastguard Worker      deps += [
614*d9f75844SAndroid Build Coastguard Worker        "sdk/android:native_unittests",
615*d9f75844SAndroid Build Coastguard Worker        "sdk/android:native_unittests_java",
616*d9f75844SAndroid Build Coastguard Worker        "//testing/android/native_test:native_test_support",
617*d9f75844SAndroid Build Coastguard Worker      ]
618*d9f75844SAndroid Build Coastguard Worker      shard_timeout = 900
619*d9f75844SAndroid Build Coastguard Worker    }
620*d9f75844SAndroid Build Coastguard Worker  }
621*d9f75844SAndroid Build Coastguard Worker
622*d9f75844SAndroid Build Coastguard Worker  if (enable_google_benchmarks) {
623*d9f75844SAndroid Build Coastguard Worker    rtc_test("benchmarks") {
624*d9f75844SAndroid Build Coastguard Worker      testonly = true
625*d9f75844SAndroid Build Coastguard Worker      deps = [
626*d9f75844SAndroid Build Coastguard Worker        "rtc_base/synchronization:mutex_benchmark",
627*d9f75844SAndroid Build Coastguard Worker        "test:benchmark_main",
628*d9f75844SAndroid Build Coastguard Worker      ]
629*d9f75844SAndroid Build Coastguard Worker    }
630*d9f75844SAndroid Build Coastguard Worker  }
631*d9f75844SAndroid Build Coastguard Worker
632*d9f75844SAndroid Build Coastguard Worker  # TODO(pbos): Rename test suite, this is no longer "just" for video targets.
633*d9f75844SAndroid Build Coastguard Worker  video_engine_tests_resources = [
634*d9f75844SAndroid Build Coastguard Worker    "resources/foreman_cif_short.yuv",
635*d9f75844SAndroid Build Coastguard Worker    "resources/voice_engine/audio_long16.pcm",
636*d9f75844SAndroid Build Coastguard Worker  ]
637*d9f75844SAndroid Build Coastguard Worker
638*d9f75844SAndroid Build Coastguard Worker  if (is_ios) {
639*d9f75844SAndroid Build Coastguard Worker    bundle_data("video_engine_tests_bundle_data") {
640*d9f75844SAndroid Build Coastguard Worker      testonly = true
641*d9f75844SAndroid Build Coastguard Worker      sources = video_engine_tests_resources
642*d9f75844SAndroid Build Coastguard Worker      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
643*d9f75844SAndroid Build Coastguard Worker    }
644*d9f75844SAndroid Build Coastguard Worker  }
645*d9f75844SAndroid Build Coastguard Worker
646*d9f75844SAndroid Build Coastguard Worker  rtc_test("video_engine_tests") {
647*d9f75844SAndroid Build Coastguard Worker    testonly = true
648*d9f75844SAndroid Build Coastguard Worker    deps = [
649*d9f75844SAndroid Build Coastguard Worker      "audio:audio_tests",
650*d9f75844SAndroid Build Coastguard Worker
651*d9f75844SAndroid Build Coastguard Worker      # TODO(eladalon): call_tests aren't actually video-specific, so we
652*d9f75844SAndroid Build Coastguard Worker      # should move them to a more appropriate test suite.
653*d9f75844SAndroid Build Coastguard Worker      "call:call_tests",
654*d9f75844SAndroid Build Coastguard Worker      "call/adaptation:resource_adaptation_tests",
655*d9f75844SAndroid Build Coastguard Worker      "test:test_common",
656*d9f75844SAndroid Build Coastguard Worker      "test:test_main",
657*d9f75844SAndroid Build Coastguard Worker      "test:video_test_common",
658*d9f75844SAndroid Build Coastguard Worker      "video:video_tests",
659*d9f75844SAndroid Build Coastguard Worker      "video/adaptation:video_adaptation_tests",
660*d9f75844SAndroid Build Coastguard Worker    ]
661*d9f75844SAndroid Build Coastguard Worker    data = video_engine_tests_resources
662*d9f75844SAndroid Build Coastguard Worker    if (is_android) {
663*d9f75844SAndroid Build Coastguard Worker      use_default_launcher = false
664*d9f75844SAndroid Build Coastguard Worker      deps += [
665*d9f75844SAndroid Build Coastguard Worker        "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
666*d9f75844SAndroid Build Coastguard Worker        "//testing/android/native_test:native_test_java",
667*d9f75844SAndroid Build Coastguard Worker        "//testing/android/native_test:native_test_support",
668*d9f75844SAndroid Build Coastguard Worker      ]
669*d9f75844SAndroid Build Coastguard Worker      shard_timeout = 900
670*d9f75844SAndroid Build Coastguard Worker    }
671*d9f75844SAndroid Build Coastguard Worker    if (is_ios) {
672*d9f75844SAndroid Build Coastguard Worker      deps += [ ":video_engine_tests_bundle_data" ]
673*d9f75844SAndroid Build Coastguard Worker    }
674*d9f75844SAndroid Build Coastguard Worker  }
675*d9f75844SAndroid Build Coastguard Worker
676*d9f75844SAndroid Build Coastguard Worker  webrtc_perf_tests_resources = [
677*d9f75844SAndroid Build Coastguard Worker    "resources/ConferenceMotion_1280_720_50.yuv",
678*d9f75844SAndroid Build Coastguard Worker    "resources/audio_coding/speech_mono_16kHz.pcm",
679*d9f75844SAndroid Build Coastguard Worker    "resources/audio_coding/speech_mono_32_48kHz.pcm",
680*d9f75844SAndroid Build Coastguard Worker    "resources/audio_coding/testfile32kHz.pcm",
681*d9f75844SAndroid Build Coastguard Worker    "resources/difficult_photo_1850_1110.yuv",
682*d9f75844SAndroid Build Coastguard Worker    "resources/foreman_cif.yuv",
683*d9f75844SAndroid Build Coastguard Worker    "resources/paris_qcif.yuv",
684*d9f75844SAndroid Build Coastguard Worker    "resources/photo_1850_1110.yuv",
685*d9f75844SAndroid Build Coastguard Worker    "resources/presentation_1850_1110.yuv",
686*d9f75844SAndroid Build Coastguard Worker    "resources/voice_engine/audio_long16.pcm",
687*d9f75844SAndroid Build Coastguard Worker    "resources/web_screenshot_1850_1110.yuv",
688*d9f75844SAndroid Build Coastguard Worker  ]
689*d9f75844SAndroid Build Coastguard Worker
690*d9f75844SAndroid Build Coastguard Worker  if (is_ios) {
691*d9f75844SAndroid Build Coastguard Worker    bundle_data("webrtc_perf_tests_bundle_data") {
692*d9f75844SAndroid Build Coastguard Worker      testonly = true
693*d9f75844SAndroid Build Coastguard Worker      sources = webrtc_perf_tests_resources
694*d9f75844SAndroid Build Coastguard Worker      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
695*d9f75844SAndroid Build Coastguard Worker    }
696*d9f75844SAndroid Build Coastguard Worker  }
697*d9f75844SAndroid Build Coastguard Worker
698*d9f75844SAndroid Build Coastguard Worker  rtc_test("webrtc_perf_tests") {
699*d9f75844SAndroid Build Coastguard Worker    testonly = true
700*d9f75844SAndroid Build Coastguard Worker    deps = [
701*d9f75844SAndroid Build Coastguard Worker      "audio:audio_perf_tests",
702*d9f75844SAndroid Build Coastguard Worker      "call:call_perf_tests",
703*d9f75844SAndroid Build Coastguard Worker      "modules/audio_coding:audio_coding_perf_tests",
704*d9f75844SAndroid Build Coastguard Worker      "modules/audio_processing:audio_processing_perf_tests",
705*d9f75844SAndroid Build Coastguard Worker      "pc:peerconnection_perf_tests",
706*d9f75844SAndroid Build Coastguard Worker      "test:test_main",
707*d9f75844SAndroid Build Coastguard Worker      "video:video_full_stack_tests",
708*d9f75844SAndroid Build Coastguard Worker      "video:video_pc_full_stack_tests",
709*d9f75844SAndroid Build Coastguard Worker    ]
710*d9f75844SAndroid Build Coastguard Worker
711*d9f75844SAndroid Build Coastguard Worker    data = webrtc_perf_tests_resources
712*d9f75844SAndroid Build Coastguard Worker    if (is_android) {
713*d9f75844SAndroid Build Coastguard Worker      use_default_launcher = false
714*d9f75844SAndroid Build Coastguard Worker      deps += [
715*d9f75844SAndroid Build Coastguard Worker        "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
716*d9f75844SAndroid Build Coastguard Worker        "//testing/android/native_test:native_test_java",
717*d9f75844SAndroid Build Coastguard Worker        "//testing/android/native_test:native_test_support",
718*d9f75844SAndroid Build Coastguard Worker      ]
719*d9f75844SAndroid Build Coastguard Worker      shard_timeout = 4500
720*d9f75844SAndroid Build Coastguard Worker    }
721*d9f75844SAndroid Build Coastguard Worker    if (is_ios) {
722*d9f75844SAndroid Build Coastguard Worker      deps += [ ":webrtc_perf_tests_bundle_data" ]
723*d9f75844SAndroid Build Coastguard Worker    }
724*d9f75844SAndroid Build Coastguard Worker  }
725*d9f75844SAndroid Build Coastguard Worker
726*d9f75844SAndroid Build Coastguard Worker  rtc_test("fuchsia_perf_tests") {
727*d9f75844SAndroid Build Coastguard Worker    testonly = true
728*d9f75844SAndroid Build Coastguard Worker    deps = [
729*d9f75844SAndroid Build Coastguard Worker      #TODO(fxbug.dev/115601) - Enable when fixed
730*d9f75844SAndroid Build Coastguard Worker      #"call:call_perf_tests",
731*d9f75844SAndroid Build Coastguard Worker      #"video:video_pc_full_stack_tests",
732*d9f75844SAndroid Build Coastguard Worker      "modules/audio_coding:audio_coding_perf_tests",
733*d9f75844SAndroid Build Coastguard Worker      "modules/audio_processing:audio_processing_perf_tests",
734*d9f75844SAndroid Build Coastguard Worker      "pc:peerconnection_perf_tests",
735*d9f75844SAndroid Build Coastguard Worker      "test:test_main",
736*d9f75844SAndroid Build Coastguard Worker      "video:video_full_stack_tests",
737*d9f75844SAndroid Build Coastguard Worker    ]
738*d9f75844SAndroid Build Coastguard Worker
739*d9f75844SAndroid Build Coastguard Worker    data = webrtc_perf_tests_resources
740*d9f75844SAndroid Build Coastguard Worker  }
741*d9f75844SAndroid Build Coastguard Worker
742*d9f75844SAndroid Build Coastguard Worker  rtc_test("webrtc_nonparallel_tests") {
743*d9f75844SAndroid Build Coastguard Worker    testonly = true
744*d9f75844SAndroid Build Coastguard Worker    deps = [ "rtc_base:rtc_base_nonparallel_tests" ]
745*d9f75844SAndroid Build Coastguard Worker    if (is_android) {
746*d9f75844SAndroid Build Coastguard Worker      deps += [ "//testing/android/native_test:native_test_support" ]
747*d9f75844SAndroid Build Coastguard Worker      shard_timeout = 900
748*d9f75844SAndroid Build Coastguard Worker    }
749*d9f75844SAndroid Build Coastguard Worker  }
750*d9f75844SAndroid Build Coastguard Worker
751*d9f75844SAndroid Build Coastguard Worker  rtc_test("voip_unittests") {
752*d9f75844SAndroid Build Coastguard Worker    testonly = true
753*d9f75844SAndroid Build Coastguard Worker    deps = [
754*d9f75844SAndroid Build Coastguard Worker      "api/voip:compile_all_headers",
755*d9f75844SAndroid Build Coastguard Worker      "api/voip:voip_engine_factory_unittests",
756*d9f75844SAndroid Build Coastguard Worker      "audio/voip/test:audio_channel_unittests",
757*d9f75844SAndroid Build Coastguard Worker      "audio/voip/test:audio_egress_unittests",
758*d9f75844SAndroid Build Coastguard Worker      "audio/voip/test:audio_ingress_unittests",
759*d9f75844SAndroid Build Coastguard Worker      "audio/voip/test:voip_core_unittests",
760*d9f75844SAndroid Build Coastguard Worker      "test:test_main",
761*d9f75844SAndroid Build Coastguard Worker    ]
762*d9f75844SAndroid Build Coastguard Worker  }
763*d9f75844SAndroid Build Coastguard Worker}
764*d9f75844SAndroid Build Coastguard Worker
765*d9f75844SAndroid Build Coastguard Worker# Build target for standalone dcsctp
766*d9f75844SAndroid Build Coastguard Workerrtc_static_library("dcsctp") {
767*d9f75844SAndroid Build Coastguard Worker  # Only the root target should depend on this.
768*d9f75844SAndroid Build Coastguard Worker  visibility = [ "//:default" ]
769*d9f75844SAndroid Build Coastguard Worker  sources = []
770*d9f75844SAndroid Build Coastguard Worker  complete_static_lib = true
771*d9f75844SAndroid Build Coastguard Worker  suppressed_configs += [ "//build/config/compiler:thin_archive" ]
772*d9f75844SAndroid Build Coastguard Worker  defines = []
773*d9f75844SAndroid Build Coastguard Worker  deps = [
774*d9f75844SAndroid Build Coastguard Worker    "net/dcsctp/public:factory",
775*d9f75844SAndroid Build Coastguard Worker    "net/dcsctp/public:socket",
776*d9f75844SAndroid Build Coastguard Worker    "net/dcsctp/public:types",
777*d9f75844SAndroid Build Coastguard Worker    "net/dcsctp/socket:dcsctp_socket",
778*d9f75844SAndroid Build Coastguard Worker    "net/dcsctp/timer:task_queue_timeout",
779*d9f75844SAndroid Build Coastguard Worker  ]
780*d9f75844SAndroid Build Coastguard Worker}
781*d9f75844SAndroid Build Coastguard Worker
782*d9f75844SAndroid Build Coastguard Worker# ---- Poisons ----
783*d9f75844SAndroid Build Coastguard Worker#
784*d9f75844SAndroid Build Coastguard Worker# Here is one empty dummy target for each poison type (needed because
785*d9f75844SAndroid Build Coastguard Worker# "being poisonous with poison type foo" is implemented as "depends on
786*d9f75844SAndroid Build Coastguard Worker# //:poison_foo").
787*d9f75844SAndroid Build Coastguard Worker#
788*d9f75844SAndroid Build Coastguard Worker# The set of poison_* targets needs to be kept in sync with the
789*d9f75844SAndroid Build Coastguard Worker# `all_poison_types` list in webrtc.gni.
790*d9f75844SAndroid Build Coastguard Worker#
791*d9f75844SAndroid Build Coastguard Workergroup("poison_audio_codecs") {
792*d9f75844SAndroid Build Coastguard Worker}
793*d9f75844SAndroid Build Coastguard Worker
794*d9f75844SAndroid Build Coastguard Workergroup("poison_default_task_queue") {
795*d9f75844SAndroid Build Coastguard Worker}
796*d9f75844SAndroid Build Coastguard Worker
797*d9f75844SAndroid Build Coastguard Workergroup("poison_default_echo_detector") {
798*d9f75844SAndroid Build Coastguard Worker}
799*d9f75844SAndroid Build Coastguard Worker
800*d9f75844SAndroid Build Coastguard Workergroup("poison_rtc_json") {
801*d9f75844SAndroid Build Coastguard Worker}
802*d9f75844SAndroid Build Coastguard Worker
803*d9f75844SAndroid Build Coastguard Workergroup("poison_software_video_codecs") {
804*d9f75844SAndroid Build Coastguard Worker}
805