Change the 'libcef_static' target type from static_library to source_set

Using a source_set here keeps the linker on Windows from discarding exported
compilation units that are not directly called from inside libcef_static.

This may also fix linker errors on Linux due to CEF's use of an intermediate
static library (see https://crbug.com/1319006#c2).
This commit is contained in:
Marshall Greenblatt 2022-07-29 12:21:17 -04:00
parent bbc08e4f5e
commit 27525523be
4 changed files with 1 additions and 36 deletions

View File

@ -406,7 +406,7 @@ test("libcef_static_unittests") {
]
}
static_library("libcef_static") {
source_set("libcef_static") {
sources = includes_common +
gypi_paths.autogen_cpp_includes + [
"libcef/browser/alloy/alloy_browser_context.cc",

View File

@ -73,15 +73,6 @@ AlloyMainDelegate::AlloyMainDelegate(CefMainRunnerHandler* runner,
CefSettings* settings,
CefRefPtr<CefApp> application)
: runner_(runner), settings_(settings), application_(application) {
// Necessary so that exported functions from base_impl.cc will be included
// in the binary.
extern void base_impl_stub();
base_impl_stub();
// Necessary so that exported functions from time_impl.cc will be included
// in the binary.
extern void time_impl_stub();
time_impl_stub();
#if BUILDFLAG(IS_LINUX)
resource_util::OverrideAssetPath();
#endif

View File

@ -22,19 +22,6 @@ constexpr const char kCategory[] = "cef.client";
} // namespace
// The contents of this file are a compilation unit that is not called by other
// functions in the the library. Consiquently MSVS will exclude it during the
// linker stage if we don't call a stub function.
#if defined(COMPILER_MSVC)
#pragma optimize("", off)
#endif
void base_impl_stub() {}
#if defined(COMPILER_MSVC)
#pragma optimize("", on)
#endif
CEF_EXPORT void cef_trace_event_instant(const char* /* category */,
const char* name,
const char* arg1_name,

View File

@ -9,19 +9,6 @@
#include <limits>
#include <tuple>
// The contents of this file are a compilation unit that is not called by other
// functions in the the library. Consiquently MSVS will exclude it during the
// linker stage if we don't call a stub function.
#if defined(COMPILER_MSVC)
#pragma optimize("", off)
#endif
void time_impl_stub() {}
#if defined(COMPILER_MSVC)
#pragma optimize("", on)
#endif
#if BUILDFLAG(IS_WIN)
namespace {