BUILD.gn (3510B)
1 # Copyright (c) 2022 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 import("//chromium/build/config/linux/pkg_config.gni") 10 import("//tools/generate_stubs/rules.gni") 11 import("../../webrtc.gni") 12 13 if ((is_linux || is_chromeos) && rtc_use_pipewire) { 14 if (!build_with_mozilla) { 15 pkg_config("gio") { 16 packages = [ 17 "gio-2.0", 18 "gio-unix-2.0", 19 ] 20 } 21 22 pkg_config("pipewire") { 23 packages = [ "libpipewire-0.3" ] 24 if (!rtc_link_pipewire) { 25 ignore_libs = true 26 } 27 } 28 29 pkg_config("gbm") { 30 packages = [ "gbm" ] 31 } 32 pkg_config("gl") { 33 packages = [ "gl" ] 34 ignore_libs = true 35 } 36 pkg_config("egl") { 37 packages = [ "egl" ] 38 ignore_libs = true 39 } 40 pkg_config("libdrm") { 41 packages = [ "libdrm" ] 42 } 43 44 if (!rtc_link_pipewire) { 45 # When libpipewire is not directly linked, use stubs to allow for dlopening of 46 # the binary. 47 generate_stubs("pipewire_stubs") { 48 configs = [ 49 "../../:common_config", 50 ":pipewire", 51 ] 52 deps = [ "../../rtc_base:logging" ] 53 extra_header = "pipewire_stub_header.fragment" 54 logging_function = "RTC_LOG(LS_VERBOSE)" 55 logging_include = "rtc_base/logging.h" 56 output_name = "pipewire_stubs" 57 path_from_source = "modules/portal" 58 sigs = [ "pipewire.sigs" ] 59 if (!build_with_chromium) { 60 macro_include = "rtc_base/system/no_cfi_icall.h" 61 macro_deps = [ "../../rtc_base/system:no_cfi_icall" ] 62 } 63 } 64 } 65 66 config("pipewire_base") { 67 configs = [ 68 ":gio", 69 ":pipewire", 70 ] 71 } 72 73 config("pipewire_all") { 74 configs = [ 75 ":pipewire_base", 76 ":gbm", 77 ":gl", 78 ":egl", 79 ":libdrm", 80 ] 81 } 82 83 config("pipewire_config") { 84 defines = [ "WEBRTC_USE_PIPEWIRE" ] 85 86 # Chromecast build config overrides `WEBRTC_USE_PIPEWIRE` even when 87 # `rtc_use_pipewire` is not set, which causes pipewire_config to not be 88 # included in targets. More details in: webrtc:13898 89 if (is_linux && !is_castos) { 90 defines += [ "WEBRTC_USE_GIO" ] 91 } 92 } 93 } else { 94 config("pipewire_all") { 95 } 96 config("pipewire_config") { 97 } 98 } 99 100 rtc_library("portal") { 101 sources = [ 102 "pipewire_utils.cc", 103 "pipewire_utils.h", 104 "portal_request_response.h", 105 "scoped_glib.cc", 106 "scoped_glib.h", 107 "xdg_desktop_portal_utils.cc", 108 "xdg_desktop_portal_utils.h", 109 "xdg_session_details.h", 110 ] 111 112 configs += [ 113 ":gio", 114 ":pipewire", 115 ":pipewire_config", 116 ] 117 118 deps = [ 119 "../../rtc_base:checks", 120 "../../rtc_base:logging", 121 "../../rtc_base:sanitizer", 122 "../../rtc_base:stringutils", 123 "../../rtc_base/system:rtc_export", 124 "//third_party/abseil-cpp/absl/strings", 125 ] 126 127 if (!rtc_link_pipewire) { 128 defines = [ "WEBRTC_DLOPEN_PIPEWIRE" ] 129 130 deps += [ ":pipewire_stubs" ] 131 } 132 133 if (build_with_mozilla) { 134 configs -= [ 135 ":gio", 136 ":pipewire", 137 ":pipewire_config", 138 ] 139 deps -= [ ":pipewire_stubs" ] 140 defines -= [ "WEBRTC_DLOPEN_PIPEWIRE" ] 141 public_deps = [ 142 "../../third_party/libepoxy" 143 ] 144 defines += [ "WEBRTC_USE_PIPEWIRE" ] 145 } 146 } 147 } 148