tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

BUILD.gn (27208B)


      1 # 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 
      9 # 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 
     15 # 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 
     24 import("//chromium/build/config/linux/pkg_config.gni")
     25 import("//chromium/build/config/sanitizers/sanitizers.gni")
     26 import("webrtc.gni")
     27 if (rtc_enable_protobuf) {
     28   import("//third_party/protobuf/proto_library.gni")
     29 }
     30 if (is_android) {
     31   import("//chromium/build/config/android/config.gni")
     32   import("//chromium/build/config/android/rules.gni")
     33   import("//third_party/jni_zero/jni_zero.gni")
     34 }
     35 
     36 if (!build_with_chromium && !build_with_mozilla) {
     37   # 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.
     39   group("default") {
     40     testonly = true
     41     deps = [ ":webrtc" ]
     42     if (rtc_build_examples) {
     43       deps += [ "examples" ]
     44     }
     45     if (rtc_build_tools) {
     46       deps += [ "rtc_tools" ]
     47     }
     48     if (rtc_include_tests) {
     49       deps += [
     50         ":rtc_p2p_unittests",
     51         ":rtc_unittests",
     52         ":video_engine_tests",
     53         ":voip_unittests",
     54         ":webrtc_nonparallel_tests",
     55         ":webrtc_perf_tests",
     56         "common_audio:common_audio_unittests",
     57         "common_video:common_video_unittests",
     58         "examples:examples_unittests",
     59         "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",
     64         "modules/remote_bitrate_estimator:rtp_to_text",
     65         "modules/rtp_rtcp:test_packet_masks_metrics",
     66         "modules/video_capture:video_capture_internal_impl",
     67         "modules/video_coding:video_codec_perf_tests",
     68         "net/dcsctp:dcsctp_unittests",
     69         "pc:peerconnection_unittests",
     70         "pc:rtc_pc_unittests",
     71         "pc:slow_peer_connection_unittests",
     72         "pc:svc_tests",
     73         "rtc_tools:video_encoder",
     74         "rtc_tools:video_replay",
     75         "stats:rtc_stats_unittests",
     76         "system_wrappers:system_wrappers_unittests",
     77         "test",
     78         "video:screenshare_loopback",
     79         "video:sv_loopback",
     80         "video:video_loopback",
     81       ]
     82       if (use_libfuzzer) {
     83         deps += [ "test/fuzzers" ]
     84       }
     85 
     86       # TODO(bugs.webrtc.org/430260876): Remove once rust links with libwebrtc.
     87       if (!is_asan && !rtc_rusty_base64) {
     88         # Do not build :webrtc_lib_link_test because lld complains on some OS
     89         # (e.g. when target_os = "mac") when is_asan=true. For more details,
     90         # see bugs.webrtc.org/11027#c5.
     91         deps += [ ":webrtc_lib_link_test" ]
     92       }
     93       if (is_ios) {
     94         deps += [
     95           "examples:apprtcmobile_tests",
     96           "sdk:sdk_framework_unittests",
     97           "sdk:sdk_unittests",
     98         ]
     99       }
    100       if (is_android) {
    101         deps += [
    102           "examples:android_examples_junit_tests",
    103           "sdk/android:android_instrumentation_test_apk",
    104           "sdk/android:android_sdk_junit_tests",
    105         ]
    106       } else {
    107         deps += [ "modules/video_capture:video_capture_tests" ]
    108       }
    109       if (rtc_enable_protobuf) {
    110         deps += [
    111           "logging:rtc_event_log_rtp_dump",
    112           "tools_webrtc/perf:webrtc_dashboard_upload",
    113         ]
    114       }
    115       if ((is_linux || is_chromeos) && rtc_use_pipewire) {
    116         deps += [ "modules/desktop_capture:shared_screencast_stream_test" ]
    117       }
    118     }
    119     if (target_os == "android") {
    120       deps += [ "tools_webrtc:binary_version_check" ]
    121     }
    122   }
    123 }
    124 
    125 # Abseil Flags by default doesn't register command line flags on mobile
    126 # platforms, WebRTC tests requires them (e.g. on simualtors) so this
    127 # config will be applied to testonly targets globally (see webrtc.gni).
    128 config("absl_flags_configs") {
    129   defines = [ "ABSL_FLAGS_STRIP_NAMES=0" ]
    130 }
    131 
    132 config("library_impl_config") {
    133   # Build targets that contain WebRTC implementation need this macro to
    134   # be defined in order to correctly export symbols when is_component_build
    135   # is true.
    136   # For more info see: rtc_base/build/rtc_export.h.
    137   defines = [ "WEBRTC_LIBRARY_IMPL" ]
    138 }
    139 
    140 # Contains the defines and includes in common.gypi that are duplicated both as
    141 # target_defaults and direct_dependent_settings.
    142 config("common_inherited_config") {
    143   defines = [ "PROTOBUF_ENABLE_DEBUG_LOGGING_MAY_LEAK_PII=0" ]
    144   cflags = []
    145   ldflags = []
    146 
    147   if (rtc_objc_prefix != "") {
    148     defines += [ "RTC_OBJC_TYPE_PREFIX=${rtc_objc_prefix}" ]
    149   }
    150 
    151   if (rtc_dlog_always_on) {
    152     defines += [ "DLOG_ALWAYS_ON" ]
    153   }
    154 
    155   if (rtc_enable_symbol_export || is_component_build) {
    156     defines += [ "WEBRTC_ENABLE_SYMBOL_EXPORT" ]
    157   }
    158   if (rtc_enable_objc_symbol_export) {
    159     defines += [ "WEBRTC_ENABLE_OBJC_SYMBOL_EXPORT" ]
    160   }
    161 
    162   if (build_with_mozilla) {
    163     defines += [ "WEBRTC_MOZILLA_BUILD" ]
    164   }
    165 
    166   if (!rtc_builtin_ssl_root_certificates) {
    167     defines += [ "WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS" ]
    168   }
    169 
    170   if (rtc_disable_check_msg) {
    171     defines += [ "RTC_DISABLE_CHECK_MSG" ]
    172   }
    173 
    174   if (rtc_enable_avx2) {
    175     defines += [ "WEBRTC_ENABLE_AVX2" ]
    176   }
    177 
    178   if (rtc_enable_win_wgc) {
    179     defines += [ "RTC_ENABLE_WIN_WGC" ]
    180   }
    181 
    182   if (!rtc_use_perfetto) {
    183     # Some tests need to declare their own trace event handlers. If this define is
    184     # not set, the first time TRACE_EVENT_* is called it will store the return
    185     # value for the current handler in an static variable, so that subsequent
    186     # changes to the handler for that TRACE_EVENT_* will be ignored.
    187     # So when tests are included, we set this define, making it possible to use
    188     # different event handlers in different tests.
    189     if (rtc_include_tests) {
    190       defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1" ]
    191     } else {
    192       defines += [ "WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0" ]
    193     }
    194   }
    195   if (build_with_chromium) {
    196     defines += [ "WEBRTC_CHROMIUM_BUILD" ]
    197     include_dirs = [
    198       # The overrides must be included first as that is the mechanism for
    199       # selecting the override headers in Chromium.
    200       "../webrtc_overrides",
    201 
    202       # Allow includes to be prefixed with webrtc/ in case it is not an
    203       # immediate subdirectory of the top-level.
    204       ".",
    205 
    206       # Just like the root WebRTC directory is added to include path, the
    207       # corresponding directory tree with generated files needs to be added too.
    208       # Note: this path does not change depending on the current target, e.g.
    209       # it is always "//gen/third_party/webrtc" when building with Chromium.
    210       # See also: http://cs.chromium.org/?q=%5C"default_include_dirs
    211       # https://gn.googlesource.com/gn/+/master/docs/reference.md#target_gen_dir
    212       target_gen_dir,
    213     ]
    214   }
    215   if (is_posix || is_fuchsia) {
    216     defines += [ "WEBRTC_POSIX" ]
    217   }
    218   if (is_ios) {
    219     defines += [
    220       "WEBRTC_MAC",
    221       "WEBRTC_IOS",
    222     ]
    223   }
    224   if (is_linux || is_chromeos) {
    225     defines += [ "WEBRTC_LINUX" ]
    226   }
    227   if (is_bsd) {
    228     defines += [ "WEBRTC_BSD" ]
    229   }
    230   if (is_mac) {
    231     defines += [ "WEBRTC_MAC" ]
    232   }
    233   if (is_fuchsia) {
    234     defines += [ "WEBRTC_FUCHSIA" ]
    235   }
    236   if (is_win) {
    237     defines += [ "WEBRTC_WIN" ]
    238   }
    239   if (is_android) {
    240     defines += [
    241       "WEBRTC_LINUX",
    242       "WEBRTC_ANDROID",
    243     ]
    244 
    245     if (build_with_mozilla) {
    246       defines += [ "WEBRTC_ANDROID_OPENSLES" ]
    247     }
    248   }
    249   if (is_chromeos) {
    250     defines += [ "CHROMEOS" ]
    251   }
    252 
    253   if (rtc_sanitize_coverage != "") {
    254     assert(is_clang, "sanitizer coverage requires clang")
    255     cflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
    256     ldflags += [ "-fsanitize-coverage=${rtc_sanitize_coverage}" ]
    257   }
    258 
    259   if (is_ubsan) {
    260     cflags += [ "-fsanitize=float-cast-overflow" ]
    261   }
    262 }
    263 
    264 # TODO(bugs.webrtc.org/9693): Remove the possibility to suppress this warning
    265 # as soon as WebRTC compiles without it.
    266 config("no_global_constructors") {
    267   if (is_clang) {
    268     cflags = [ "-Wno-global-constructors" ]
    269   }
    270 }
    271 
    272 config("rtc_prod_config") {
    273   # Ideally, WebRTC production code (but not test code) should have these flags.
    274   if (is_clang) {
    275     cflags = [
    276       "-Wexit-time-destructors",
    277       "-Wglobal-constructors",
    278     ]
    279   }
    280 }
    281 
    282 group("tracing") {
    283 if (!build_with_mozilla) {
    284   all_dependent_configs = [ "//third_party/perfetto/gn:public_config" ]
    285   if (rtc_use_perfetto) {
    286     if (build_with_chromium) {
    287       public_deps =  # no-presubmit-check TODO(webrtc:8603)
    288           [ "//third_party/perfetto:libperfetto" ]
    289     } else {
    290       public_deps = [  # no-presubmit-check TODO(webrtc:8603)
    291         ":webrtc_libperfetto",
    292         "//third_party/perfetto/include/perfetto/tracing",
    293       ]
    294     }
    295   } else {
    296     public_deps =  # no-presubmit-check TODO(webrtc:8603)
    297         [ "//third_party/perfetto/include/perfetto/tracing" ]
    298   }
    299 }
    300 }
    301 
    302 if (rtc_use_perfetto) {
    303   rtc_library("webrtc_libperfetto") {
    304     deps = [
    305       "//third_party/perfetto/src/tracing:client_api_without_backends",
    306       "//third_party/perfetto/src/tracing:platform_impl",
    307     ]
    308   }
    309 }
    310 
    311 config("common_config") {
    312   cflags = []
    313   cflags_c = []
    314   cflags_cc = []
    315   cflags_objc = []
    316   defines = []
    317 
    318   if (rtc_enable_protobuf) {
    319     defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ]
    320   } else {
    321     defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
    322   }
    323 
    324   if (rtc_strict_field_trials == "") {
    325     defines += [ "WEBRTC_STRICT_FIELD_TRIALS=0" ]
    326   } else if (rtc_strict_field_trials == "dcheck") {
    327     defines += [ "WEBRTC_STRICT_FIELD_TRIALS=1" ]
    328   } else if (rtc_strict_field_trials == "warn") {
    329     defines += [ "WEBRTC_STRICT_FIELD_TRIALS=2" ]
    330   } else {
    331     assert(false,
    332            "Unsupported value for rtc_strict_field_trials: " +
    333                "$rtc_strict_field_trials")
    334   }
    335 
    336   if (rtc_include_internal_audio_device) {
    337     defines += [ "WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE" ]
    338   }
    339 
    340   if (rtc_libvpx_build_vp9) {
    341     defines += [ "RTC_ENABLE_VP9" ]
    342   }
    343 
    344   if (rtc_use_h265) {
    345     defines += [ "RTC_ENABLE_H265" ]
    346   }
    347 
    348   if (rtc_include_dav1d_in_internal_decoder_factory) {
    349     defines += [ "RTC_DAV1D_IN_INTERNAL_DECODER_FACTORY" ]
    350   }
    351 
    352   if (rtc_enable_sctp) {
    353     defines += [ "WEBRTC_HAVE_SCTP" ]
    354   }
    355 
    356   if (rtc_enable_external_auth) {
    357     defines += [ "ENABLE_EXTERNAL_AUTH" ]
    358   }
    359 
    360   if (rtc_use_h264) {
    361     defines += [ "WEBRTC_USE_H264" ]
    362   }
    363 
    364   if (rtc_use_absl_mutex) {
    365     defines += [ "WEBRTC_ABSL_MUTEX" ]
    366   }
    367 
    368   if (rtc_disable_logging) {
    369     defines += [ "RTC_DISABLE_LOGGING" ]
    370   }
    371 
    372   if (rtc_disable_trace_events) {
    373     defines += [ "RTC_DISABLE_TRACE_EVENTS" ]
    374   }
    375 
    376   if (rtc_disable_metrics) {
    377     defines += [ "RTC_DISABLE_METRICS" ]
    378   }
    379 
    380   if (rtc_exclude_audio_processing_module) {
    381     defines += [ "WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE" ]
    382   }
    383 
    384   if (rtc_video_psnr) {
    385     defines += [ "WEBRTC_ENCODER_PSNR_STATS" ]
    386   }
    387 
    388   if (is_clang) {
    389     cflags += [
    390       "-Wshadow",
    391 
    392       # See https://reviews.llvm.org/D56731 for details about this
    393       # warning.
    394       "-Wctad-maybe-unsupported",
    395     ]
    396   }
    397 
    398   if (build_with_chromium) {
    399     defines += [
    400       # NOTICE: Since common_inherited_config is used in public_configs for our
    401       # targets, there's no point including the defines in that config here.
    402       # TODO(kjellander): Cleanup unused ones and move defines closer to the
    403       # source when webrtc:4256 is completed.
    404       "HAVE_WEBRTC_VIDEO",
    405       "LOGGING_INSIDE_WEBRTC",
    406     ]
    407   } else {
    408     if (is_posix || is_fuchsia) {
    409       cflags_c += [
    410         # TODO(bugs.webrtc.org/9029): enable commented compiler flags.
    411         # Some of these flags should also be added to cflags_objc.
    412 
    413         # "-Wextra",  (used when building C++ but not when building C)
    414         # "-Wmissing-prototypes",  (C/Obj-C only)
    415         # "-Wmissing-declarations",  (ensure this is always used C/C++, etc..)
    416         "-Wstrict-prototypes",
    417 
    418         # "-Wpointer-arith",  (ensure this is always used C/C++, etc..)
    419         # "-Wbad-function-cast",  (C/Obj-C only)
    420         # "-Wnested-externs",  (C/Obj-C only)
    421       ]
    422       cflags_objc += [ "-Wstrict-prototypes" ]
    423       cflags_cc = [
    424         "-Wnon-virtual-dtor",
    425 
    426         # This is enabled for clang; enable for gcc as well.
    427         "-Woverloaded-virtual",
    428       ]
    429     }
    430 
    431     if (is_clang) {
    432       cflags += [
    433         "-Wc++11-narrowing",
    434         "-Wundef",
    435         "-Wunused-lambda-capture",
    436       ]
    437     }
    438 
    439     if (is_win && !is_clang) {
    440       # MSVC warning suppressions (needed to use Abseil).
    441       # TODO(bugs.webrtc.org/9274): Remove these warnings as soon as MSVC allows
    442       # external headers warning suppression (or fix them upstream).
    443       cflags += [ "/wd4702" ]  # unreachable code
    444 
    445       # MSVC 2019 warning suppressions for C++17 compiling
    446       cflags +=
    447           [ "/wd5041" ]  # out-of-line definition for constexpr static data
    448                          # member is not needed and is deprecated in C++17
    449     }
    450   }
    451 
    452   if (target_cpu == "arm64") {
    453     defines += [ "WEBRTC_ARCH_ARM64" ]
    454     defines += [ "WEBRTC_HAS_NEON" ]
    455   }
    456 
    457   if (target_cpu == "arm") {
    458     defines += [ "WEBRTC_ARCH_ARM" ]
    459     if (arm_version >= 7) {
    460       defines += [ "WEBRTC_ARCH_ARM_V7" ]
    461       if (arm_use_neon) {
    462         defines += [ "WEBRTC_HAS_NEON" ]
    463       }
    464     }
    465   }
    466 
    467   if (target_cpu == "mipsel") {
    468     defines += [ "MIPS32_LE" ]
    469     if (mips_float_abi == "hard") {
    470       defines += [ "MIPS_FPU_LE" ]
    471     }
    472     if (mips_arch_variant == "r2") {
    473       defines += [ "MIPS32_R2_LE" ]
    474     }
    475     if (mips_dsp_rev == 1) {
    476       defines += [ "MIPS_DSP_R1_LE" ]
    477     } else if (mips_dsp_rev == 2) {
    478       defines += [
    479         "MIPS_DSP_R1_LE",
    480         "MIPS_DSP_R2_LE",
    481       ]
    482     }
    483   }
    484 
    485   if (is_android && !is_clang) {
    486     # The Android NDK doesn"t provide optimized versions of these
    487     # functions. Ensure they are disabled for all compilers.
    488     cflags += [
    489       "-fno-builtin-cos",
    490       "-fno-builtin-sin",
    491       "-fno-builtin-cosf",
    492       "-fno-builtin-sinf",
    493     ]
    494   }
    495 
    496   if (use_fuzzing_engine) {
    497     # Used in Chromium's overrides to disable logging
    498     defines += [ "WEBRTC_UNSAFE_FUZZER_MODE" ]
    499   }
    500 
    501   if (!build_with_chromium && rtc_win_undef_unicode) {
    502     cflags += [
    503       "/UUNICODE",
    504       "/U_UNICODE",
    505     ]
    506   }
    507 
    508   if (rtc_use_perfetto) {
    509     defines += [ "RTC_USE_PERFETTO" ]
    510   }
    511 }
    512 
    513 if (is_mac) {
    514 config("common_objc") {
    515   frameworks = [ "Foundation.framework" ]
    516 }
    517 }
    518 
    519 if (!rtc_build_ssl) {
    520   config("external_ssl_library") {
    521     if (rtc_ssl_root != "") {
    522       include_dirs = [ rtc_ssl_root ]
    523     }
    524     libs = [
    525       "crypto",
    526       "ssl",
    527     ]
    528     if (build_with_mozilla) {
    529       libs = []
    530     }
    531   }
    532 }
    533 
    534 if (!build_with_chromium) {
    535   # Target to build all the WebRTC production code.
    536   rtc_static_library("webrtc") {
    537     # Only the root target and the test should depend on this.
    538     visibility = [
    539       "//:default",
    540       "//:webrtc_lib_link_test",
    541     ]
    542 
    543     sources = []
    544 
    545     complete_static_lib = true
    546     suppressed_configs += [ "//chromium/build/config/compiler:thin_archive" ]
    547     defines = []
    548 
    549     deps = [
    550       "api:create_modular_peer_connection_factory",
    551       "api:create_peerconnection_factory",
    552       "api:enable_media",
    553       "api:libjingle_peerconnection_api",
    554       "api:rtc_error",
    555       "api:transport_api",
    556       "api/audio_codecs:opus_audio_decoder_factory",
    557       "api/crypto",
    558       "api/rtc_event_log:rtc_event_log_factory",
    559       "api/task_queue",
    560       "api/task_queue:default_task_queue_factory",
    561       "api/video_codecs:video_decoder_factory_template",
    562       "api/video_codecs:video_decoder_factory_template_dav1d_adapter",
    563       "api/video_codecs:video_decoder_factory_template_libvpx_vp8_adapter",
    564       "api/video_codecs:video_decoder_factory_template_libvpx_vp9_adapter",
    565       "api/video_codecs:video_decoder_factory_template_open_h264_adapter",
    566       "api/video_codecs:video_encoder_factory_template",
    567       "api/video_codecs:video_encoder_factory_template_libaom_av1_adapter",
    568       "api/video_codecs:video_encoder_factory_template_libvpx_vp8_adapter",
    569       "api/video_codecs:video_encoder_factory_template_libvpx_vp9_adapter",
    570       "api/video_codecs:video_encoder_factory_template_open_h264_adapter",
    571       "audio",
    572       "call",
    573       "common_audio",
    574       "common_video",
    575       ":dcsctp",
    576       "logging:rtc_event_log_api",
    577       "media",
    578       "modules",
    579       "modules/video_capture:video_capture_internal_impl",
    580       "pc:libjingle_peerconnection",
    581       "pc:rtc_pc",
    582       "sdk",
    583       "video",
    584     ]
    585     if (build_with_mozilla) {
    586       deps -= [
    587         "api:create_modular_peer_connection_factory",
    588         "api:create_peerconnection_factory",
    589         "api:enable_media",
    590         "api:rtc_error",
    591         "api:transport_api",
    592         "api/crypto",
    593         "api/rtc_event_log:rtc_event_log_factory",
    594         "api/task_queue",
    595         "api/task_queue:default_task_queue_factory",
    596         "api/video_codecs:video_decoder_factory_template",
    597         "api/video_codecs:video_decoder_factory_template_dav1d_adapter",
    598         "api/video_codecs:video_decoder_factory_template_libvpx_vp8_adapter",
    599         "api/video_codecs:video_decoder_factory_template_libvpx_vp9_adapter",
    600         "api/video_codecs:video_decoder_factory_template_open_h264_adapter",
    601         "api/video_codecs:video_encoder_factory_template",
    602         "api/video_codecs:video_encoder_factory_template_libaom_av1_adapter",
    603         "api/video_codecs:video_encoder_factory_template_libvpx_vp8_adapter",
    604         "api/video_codecs:video_encoder_factory_template_libvpx_vp9_adapter",
    605         "api/video_codecs:video_encoder_factory_template_open_h264_adapter",
    606         "logging:rtc_event_log_api",
    607         "pc:libjingle_peerconnection",
    608         "pc:rtc_pc",
    609         "sdk",
    610       ]
    611     }
    612 
    613     if (rtc_include_builtin_audio_codecs) {
    614       deps += [
    615         "api/audio_codecs:builtin_audio_decoder_factory",
    616         "api/audio_codecs:builtin_audio_encoder_factory",
    617       ]
    618     }
    619 
    620     if (build_with_mozilla) {
    621       deps += [
    622         "api:frame_transformer_factory",
    623         "api/audio:builtin_audio_processing_builder",
    624         "api/environment:environment_factory",
    625         "api/video:video_frame",
    626         "api/video:video_rtp_headers",
    627         "api/video_codecs:builtin_video_decoder_factory",
    628         "test:rtp_test_utils",
    629       ]
    630       # Added when we removed deps in other places to avoid building
    631       # unreachable sources.  See Bug 1820869.
    632       deps += [
    633         "api/video_codecs:video_codecs_api",
    634         "api/video_codecs:rtc_software_fallback_wrappers",
    635         "media:rtc_simulcast_encoder_adapter",
    636         "modules/video_coding:webrtc_vp8",
    637         "modules/video_coding:webrtc_vp9",
    638       ]
    639     }
    640 
    641     if (build_with_mozilla && is_mac) {
    642       deps += [ "sdk:videocapture_objc" ]
    643     }
    644 
    645     if (rtc_enable_protobuf) {
    646       deps += [ "logging:rtc_event_log_proto" ]
    647     }
    648 
    649     if (rtc_include_internal_audio_device) {
    650       deps += [ "api/audio:create_audio_device_module" ]
    651     }
    652   }
    653 
    654   # TODO(bugs.webrtc.org/430260876): Compile webrtc lib with rust once toolchain
    655   # is working.
    656   if (rtc_include_tests && !is_asan && !rtc_rusty_base64) {
    657     rtc_executable("webrtc_lib_link_test") {
    658       testonly = true
    659 
    660       # This target is used for checking to link, so do not check dependencies
    661       # on gn check.
    662       check_includes = false  # no-presubmit-check TODO(bugs.webrtc.org/12785)
    663 
    664       sources = [ "webrtc_lib_link_test.cc" ]
    665       deps = [
    666         # NOTE: Don't add deps here. If this test fails to link, it means you
    667         # need to add stuff to the webrtc static lib target above.
    668         ":webrtc",
    669       ]
    670     }
    671   }
    672 }
    673 
    674 if (use_libfuzzer || use_afl) {
    675   # This target is only here for gn to discover fuzzer build targets under
    676   # webrtc/test/fuzzers/.
    677   group("webrtc_fuzzers_dummy") {
    678     testonly = true
    679     deps = [ "test/fuzzers:webrtc_fuzzer_main" ]
    680   }
    681 }
    682 
    683 if (rtc_include_tests && !build_with_chromium) {
    684   rtc_unittests_resources = [ "resources/reference_video_640x360_30fps.y4m" ]
    685 
    686   if (is_ios) {
    687     bundle_data("rtc_unittests_bundle_data") {
    688       testonly = true
    689       sources = rtc_unittests_resources
    690       outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
    691     }
    692   }
    693 
    694   rtc_test("rtc_unittests") {
    695     testonly = true
    696 
    697     deps = [
    698       "api:compile_all_headers",
    699       "api:rtc_api_unittests",
    700       "api/audio:audio_api_unittests",
    701       "api/audio_codecs/test:audio_codecs_api_unittests",
    702       "api/crypto:crypto_options_unittest",
    703       "api/crypto:options",
    704       "api/numerics:numerics_unittests",
    705       "api/task_queue:pending_task_safety_flag_unittests",
    706       "api/test/metrics:metrics_unittests",
    707       "api/test/network_emulation:network_queue_unittests",
    708       "api/transport:stun_unittest",
    709       "api/transport/rtp:corruption_detection_message_unittest",
    710       "api/video/test:rtc_api_video_unittests",
    711       "api/video_codecs:libaom_av1_encoder_factory_test",
    712       "api/video_codecs:simple_encoder_wrapper_unittests",
    713       "api/video_codecs/test:video_codecs_api_unittests",
    714       "api/voip:compile_all_headers",
    715       "call:fake_network_pipe_unittests",
    716       "rtc_base:async_dns_resolver_unittests",
    717       "rtc_base:async_packet_socket_unittest",
    718       "rtc_base:async_tcp_socket_unittest",
    719       "rtc_base:async_udp_socket_unittest",
    720       "rtc_base:callback_list_unittests",
    721       "rtc_base:rtc_base_approved_unittests",
    722       "rtc_base:rtc_base_unittests",
    723       "rtc_base:rtc_json_unittests",
    724       "rtc_base:rtc_numerics_unittests",
    725       "rtc_base:rtc_operations_chain_unittests",
    726       "rtc_base:rtc_task_queue_unittests",
    727       "rtc_base:sigslot_trampoline_unittest",
    728       "rtc_base:sigslot_unittest",
    729       "rtc_base:task_queue_stdlib_unittest",
    730       "rtc_base:untyped_function_unittest",
    731       "rtc_base:weak_ptr_unittests",
    732       "rtc_base/experiments:experiments_unittests",
    733       "rtc_base/system:file_wrapper_unittests",
    734       "rtc_base/task_utils:repeating_task_unittests",
    735       "rtc_base/units:units_unittests",
    736       "sdk:sdk_tests",
    737       "test:rtp_test_utils",
    738       "test:test_main",
    739       "test/network:network_emulation_unittests",
    740     ]
    741 
    742     data = rtc_unittests_resources
    743 
    744     if (rtc_enable_protobuf) {
    745       deps += [
    746         "api/test/network_emulation:network_config_schedule_proto",
    747         "logging:rtc_event_log_tests",
    748       ]
    749     }
    750 
    751     if (is_ios) {
    752       deps += [ ":rtc_unittests_bundle_data" ]
    753     }
    754 
    755     if (is_android) {
    756       # Do not use Chromium's launcher. native_unittests defines its own JNI_OnLoad.
    757       use_default_launcher = false
    758 
    759       deps += [
    760         "sdk/android:native_unittests",
    761         "sdk/android:native_unittests_java",
    762       ]
    763       shard_timeout = 900
    764     }
    765   }
    766 
    767   rtc_test("rtc_p2p_unittests") {
    768     testonly = true
    769 
    770     deps = [
    771       "p2p:rtc_p2p_unittests",
    772       "test:test_main",
    773     ]
    774   }
    775 
    776   if (rtc_enable_google_benchmarks) {
    777     rtc_test("benchmarks") {
    778       testonly = true
    779       deps = [
    780         "rtc_base/synchronization:mutex_benchmark",
    781         "test:benchmark_main",
    782       ]
    783     }
    784   }
    785 
    786   # TODO(pbos): Rename test suite, this is no longer "just" for video targets.
    787   rtc_test("video_engine_tests") {
    788     testonly = true
    789     deps = [
    790       "audio:audio_tests",
    791 
    792       # TODO(eladalon): call_tests aren't actually video-specific, so we
    793       # should move them to a more appropriate test suite.
    794       "call:call_tests",
    795       "call/adaptation:resource_adaptation_tests",
    796       "test:test_common",
    797       "test:test_main",
    798       "test:video_test_common",
    799       "video:video_tests",
    800       "video/adaptation:video_adaptation_tests",
    801     ]
    802 
    803     data_deps = [ "resources:video_engine_tests_data" ]
    804 
    805     if (is_android) {
    806       use_default_launcher = false
    807       deps += [ "//build/android/gtest_apk:native_test_instrumentation_test_runner_java" ]
    808       shard_timeout = 900
    809     }
    810     if (is_ios) {
    811       deps += [ "resources:video_engine_tests_bundle_data" ]
    812     }
    813   }
    814 
    815   rtc_test("webrtc_perf_tests") {
    816     testonly = true
    817     deps = [
    818       "call:call_perf_tests",
    819       "modules/audio_coding:audio_coding_perf_tests",
    820       "modules/audio_processing:audio_processing_perf_tests",
    821       "pc:peerconnection_perf_tests",
    822       "test:test_main",
    823       "video:video_full_stack_tests",
    824       "video:video_pc_full_stack_tests",
    825     ]
    826 
    827     data_deps = [ "resources:webrtc_perf_tests_data" ]
    828 
    829     if (is_android) {
    830       use_default_launcher = false
    831       deps += [ "//build/android/gtest_apk:native_test_instrumentation_test_runner_java" ]
    832       shard_timeout = 4500
    833     }
    834     if (is_ios) {
    835       deps += [ "resources:webrtc_perf_tests_bundle_data" ]
    836     }
    837   }
    838 
    839   rtc_test("webrtc_nonparallel_tests") {
    840     testonly = true
    841     deps = [ "rtc_base:rtc_base_nonparallel_tests" ]
    842     if (is_android) {
    843       shard_timeout = 900
    844     }
    845   }
    846 
    847   rtc_test("voip_unittests") {
    848     testonly = true
    849     deps = [
    850       "api/voip:compile_all_headers",
    851       "api/voip:voip_engine_factory_unittests",
    852       "audio/voip/test:audio_channel_unittests",
    853       "audio/voip/test:audio_egress_unittests",
    854       "audio/voip/test:audio_ingress_unittests",
    855       "audio/voip/test:voip_core_unittests",
    856       "test:test_main",
    857     ]
    858   }
    859 }
    860 
    861 # Build target for standalone dcsctp
    862 rtc_static_library("dcsctp") {
    863   # Only the root target should depend on this.
    864   visibility = [ "//:default", "//libwebrtc:webrtc" ]
    865   sources = []
    866   complete_static_lib = true
    867   suppressed_configs += [ "//chromium/build/config/compiler:thin_archive" ]
    868   defines = []
    869   deps = [
    870     "net/dcsctp/public:factory",
    871     "net/dcsctp/public:socket",
    872     "net/dcsctp/public:types",
    873     "net/dcsctp/socket:dcsctp_socket",
    874     "net/dcsctp/timer:task_queue_timeout",
    875   ]
    876 }
    877 
    878 # ---- Poisons ----
    879 #
    880 # Here is one empty dummy target for each poison type (needed because
    881 # "being poisonous with poison type foo" is implemented as "depends on
    882 # //:poison_foo").
    883 #
    884 # The set of poison_* targets needs to be kept in sync with the
    885 # `all_poison_types` list in webrtc.gni.
    886 #
    887 group("poison_audio_codecs") {
    888 }
    889 
    890 group("poison_default_echo_detector") {
    891 }
    892 
    893 group("poison_environment_construction") {
    894 }
    895 
    896 group("poison_software_video_codecs") {
    897 }
    898 
    899 group("poison_default_neural_residual_echo_estimator") {
    900 }
    901 
    902 if (!build_with_chromium) {
    903   # Write debug logs to gn_logs.txt.
    904   # This is also required for Siso builds.
    905   import("//chromium/build/gn_logs.gni")
    906   lines = [
    907             "Generated during 'gn gen' by //BUILD.gn.",
    908             "",
    909           ] + build_gn_logs
    910   write_file("$root_build_dir/gn_logs.txt", lines)
    911 }