Introduce absl_deps in rtc_* C++ templates.

Since dependencies on Abseil need to be statically linked in case
Chromium is built with is_component_build=true, this CL introduces a new
parameter for C++ library rtc_* templates (rtc_library, rtc_source_set
and rtc_static_library). This parameter (called "absl_deps") will result
in a dependency on the Abseil component (//third_party/abseil-cpp:absl)
when is_component_build=true or on the normal granular Abseil target
when is_component_build=false.

Bug: chromium:1046390
Change-Id: Iddca886926a7874488701bc9d79affb00cca72d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176447
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31441}
This commit is contained in:
Mirko Bonadei 2020-06-03 21:23:41 +02:00 committed by Commit Bot
parent f25761d798
commit 8b7cfa16aa
2 changed files with 47 additions and 2 deletions

View File

@ -71,8 +71,8 @@ rtc_library("rtp_headers") {
"..:webrtc_common",
"units:timestamp",
"video:video_rtp_headers",
"//third_party/abseil-cpp/absl/types:optional",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
rtc_library("rtp_packet_info") {

View File

@ -323,16 +323,19 @@ set_defaults("rtc_test") {
set_defaults("rtc_library") {
configs = rtc_add_configs
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_source_set") {
configs = rtc_add_configs
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_static_library") {
configs = rtc_add_configs
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_executable") {
@ -525,6 +528,20 @@ template("rtc_source_set") {
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
# If absl_deps if [], no action is needed. If not [], then if needs to be
# converted to //third_party/abseil-cpp:absl if is_component_build=true
# otherwise it just needs to be added to deps.
if (absl_deps != []) {
if (is_component_build && build_with_chromium) {
# TODO(crbug.com/1046390): Enable when the Abseil component will be
# available.
# deps += [ "//third_party/abseil-cpp:absl" ]
deps += absl_deps # Remove when the line above is enabled.
} else {
deps += absl_deps
}
}
}
}
@ -600,6 +617,20 @@ template("rtc_static_library") {
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
# If absl_deps if [], no action is needed. If not [], then if needs to be
# converted to //third_party/abseil-cpp:absl if is_component_build=true
# otherwise it just needs to be added to deps.
if (absl_deps != []) {
if (is_component_build && build_with_chromium) {
# TODO(crbug.com/1046390): Enable when the Abseil component will be
# available.
# deps += [ "//third_party/abseil-cpp:absl" ]
deps += absl_deps # Remove when the line above is enabled.
} else {
deps += absl_deps
}
}
}
}
@ -712,6 +743,20 @@ template("rtc_library") {
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
# If absl_deps if [], no action is needed. If not [], then if needs to be
# converted to //third_party/abseil-cpp:absl if is_component_build=true
# otherwise it just needs to be added to deps.
if (absl_deps != []) {
if (is_component_build && build_with_chromium) {
# TODO(crbug.com/1046390): Enable when the Abseil component will be
# available.
# deps += [ "//third_party/abseil-cpp:absl" ]
deps += absl_deps # Remove when the line above is enabled.
} else {
deps += absl_deps
}
}
}
}
@ -1002,7 +1047,7 @@ if (is_android) {
}
no_build_hooks = true
not_needed(["android_manifest"])
not_needed([ "android_manifest" ])
}
}