Allow enabling libyuv symbols visibility for shared library targets

When developing WebRTC applications with custom video sources, libyuv's
API is often the required part of the project. For that, application
developers can link with a separate standalone instance of libyuv.
However, it is even better to avoid that binary code duplication and
link against libyuv as a part compiled into the WebRTC library.

When building WebRTC as a static library target, the symbols from libyuv
are normally accessible to the linker without any extra actions. When
building WebRTC as a shared library, that does not work as the exported
symbols are those marked as visible, while libyuv is built with the
hidden visibility setting by default.

This patch adds an extra flag to enable switching the symbol visibility
to default when building shared library targets depending on libyuv in
WebRTC and Chromium projects. By default the flag is not enabled,
preserving the prior behaviour.

Bug: NONE
Change-Id: I48893cb9f54b1e1b49a34e14434e67f91d3e5e79
Reviewed-on: https://chromium-review.googlesource.com/827746
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
VladimirTechMan 2017-12-14 23:37:45 -05:00 committed by Commit Bot
parent 56480051e0
commit 56eb5a4775

View File

@ -12,6 +12,11 @@ import("//testing/test.gni")
declare_args() {
# Set to false to disable building with gflags.
libyuv_use_gflags = true
# When building a shared library using a target in WebRTC or
# Chromium projects that depends on libyuv, setting this flag
# to true makes libyuv symbols visible inside that library.
libyuv_symbols_visible = false
}
config("libyuv_config") {
@ -129,6 +134,11 @@ static_library("libyuv_internal") {
defines = []
deps = []
if (libyuv_symbols_visible) {
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
if (!is_ios) {
defines += [ "HAVE_JPEG" ]