From 56eb5a47758a5fb808d9a44e216ecb3dee89447e Mon Sep 17 00:00:00 2001 From: VladimirTechMan Date: Thu, 14 Dec 2017 23:37:45 -0500 Subject: [PATCH] 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 Commit-Queue: Frank Barchard --- BUILD.gn | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index f583edfe8..10b5b819a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -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" ]