macOS: Add angle and swiftshader libraries to the app bundle (issue #2446)"

This commit is contained in:
Marshall Greenblatt 2018-07-25 14:58:25 -04:00
parent 339ce47575
commit 7f3c21b64a
3 changed files with 66 additions and 2 deletions

View File

@ -112,6 +112,7 @@ import("//third_party/widevine/cdm/widevine.gni")
import("//tools/grit/repack.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//ui/gl/features.gni")
import("//v8/gni/v8.gni")
if (is_clang) {
import("//build/config/clang/clang.gni")
@ -1387,11 +1388,58 @@ if (is_mac) {
]
}
if (use_egl) {
# Add the ANGLE .dylibs in the MODULE_DIR of the Framework app bundle.
bundle_data("cef_framework_angle_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libEGL.dylib",
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
"//ui/gl:angle_library_copy",
]
}
# Add the SwiftShader .dylibs in the MODULE_DIR of the Framework app bundle.
bundle_data("cef_framework_swiftshader_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
"//ui/gl:swiftshader_library_copy",
]
}
}
group("cef_framework_angle_library") {
if (use_egl) {
deps = [
":cef_framework_angle_binaries",
]
}
}
group("cef_framework_swiftshader_library") {
if (use_egl) {
deps = [
":cef_framework_swiftshader_binaries",
]
}
}
mac_framework_bundle("cef_framework") {
output_name = cef_framework_name
framework_version = "A"
framework_contents = [
"Libraries",
"Resources",
]
@ -1408,8 +1456,10 @@ if (is_mac) {
# - crash_report_sender.app
deps = [
":cef_framework_angle_library",
":cef_framework_locales",
":cef_framework_resources",
":cef_framework_swiftshader_library",
":libcef_static",
]

View File

@ -367,7 +367,10 @@ patches = [
{
# macOS: Fix undesirable switch to discrete GPU during startup.
# https://bitbucket.org/chromiumembedded/cef/issues/2398
'name': 'mac_gpu_2398',
#
# macOS: Rely on symlinks to find the Libraries directory.
# https://bugs.chromium.org/p/chromium/issues/detail?id=757974#c23
'name': 'mac_gpu',
},
{
# Fix crash in CookieMonsterChangeDispatcher::Subscription destructor.

View File

@ -1,5 +1,5 @@
diff --git ui/gl/init/gl_initializer_mac.cc ui/gl/init/gl_initializer_mac.cc
index f4789ebf3b0e..a7f5b21da372 100644
index f4789ebf3b0e..73d66e8f5165 100644
--- ui/gl/init/gl_initializer_mac.cc
+++ ui/gl/init/gl_initializer_mac.cc
@@ -47,11 +47,8 @@ bool InitializeOneOffForSandbox() {
@ -16,3 +16,14 @@ index f4789ebf3b0e..a7f5b21da372 100644
if (GetGLImplementation() == kGLImplementationAppleGL) {
attribs.push_back(kCGLPFARendererID);
attribs.push_back(
@@ -146,8 +143,8 @@ bool InitializeStaticEGLInternal(GLImplementation implementation) {
// as app bundles. In that case, the .dylib is next to the executable.
base::FilePath base_dir;
if (base::mac::AmIBundled()) {
- base_dir =
- base::mac::FrameworkBundlePath().Append("Versions/Current/Libraries/");
+ // Rely on symlinks to find the correct version.
+ base_dir = base::mac::FrameworkBundlePath().Append("Libraries/");
} else {
if (!base::PathService::Get(base::FILE_EXE, &base_dir)) {
LOG(ERROR) << "PathService::Get failed.";