Commit b001528f by Courtney Goeltzenleuchter Committed by Commit Bot

Use libnativewindow for Android builds

To avoid references to libEGL.so do not link with libandroid, use libnativewindow instead. libnativewindow is available in android-26 and newer. The appropriate library will be selected based on the ndk level configured. If ndk revision is 26 or higher, we'll link to libnativewindow otherwise use libandroid. The ANGLE apk needs to use 26 or higher. Bug: angleproject:2418 Change-Id: I96509e5d645d132a34734558cd0566f1812b615b Reviewed-on: https://chromium-review.googlesource.com/1066821 Commit-Queue: Courtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent 18168286
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.google.android.angle"> package="com.google.android.angle">
<uses-sdk android:minSdkVersion="24" <uses-sdk android:minSdkVersion="26"
android:targetSdkVersion="28"> android:targetSdkVersion="28">
</uses-sdk> </uses-sdk>
......
...@@ -78,11 +78,10 @@ config("internal_config") { ...@@ -78,11 +78,10 @@ config("internal_config") {
"EGL_EGLEXT_PROTOTYPES", "EGL_EGLEXT_PROTOTYPES",
] ]
if (current_cpu == "x86" || current_cpu == "arm") { if (angle_64bit_current_cpu) {
defines += [ "ANGLE_IS_32_BIT_CPU" ]
}
if (current_cpu == "x64" || current_cpu == "arm64") {
defines += [ "ANGLE_IS_64_BIT_CPU" ] defines += [ "ANGLE_IS_64_BIT_CPU" ]
} else {
defines += [ "ANGLE_IS_32_BIT_CPU" ]
} }
} }
...@@ -531,10 +530,12 @@ static_library("libANGLE") { ...@@ -531,10 +530,12 @@ static_library("libANGLE") {
sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src") sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src")
sources += sources +=
rebase_path(gles_gypi.libangle_gl_egl_android_sources, ".", "src") rebase_path(gles_gypi.libangle_gl_egl_android_sources, ".", "src")
libs += [ if (ndk_supports_nativewindow) {
"android", libs += [ "nativewindow" ]
"log", } else {
] libs += [ "android" ]
}
libs += [ "log" ]
} }
if (ozone_platform_gbm) { if (ozone_platform_gbm) {
configs += [ ":libdrm" ] configs += [ ":libdrm" ]
...@@ -840,9 +841,10 @@ foreach(is_shared_library, ...@@ -840,9 +841,10 @@ foreach(is_shared_library,
sources += rebase_path(util_gypi.util_win32_sources, ".", "util") sources += rebase_path(util_gypi.util_win32_sources, ".", "util")
} }
libs = []
if (is_linux) { if (is_linux) {
sources += rebase_path(util_gypi.util_linux_sources, ".", "util") sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
libs = [ libs += [
"rt", "rt",
"dl", "dl",
] ]
...@@ -850,7 +852,7 @@ foreach(is_shared_library, ...@@ -850,7 +852,7 @@ foreach(is_shared_library,
if (is_mac) { if (is_mac) {
sources += rebase_path(util_gypi.util_osx_sources, ".", "util") sources += rebase_path(util_gypi.util_osx_sources, ".", "util")
libs = [ libs += [
"AppKit.framework", "AppKit.framework",
"QuartzCore.framework", "QuartzCore.framework",
] ]
...@@ -869,10 +871,12 @@ foreach(is_shared_library, ...@@ -869,10 +871,12 @@ foreach(is_shared_library,
set_sources_assignment_filter([]) set_sources_assignment_filter([])
sources += rebase_path(util_gypi.util_linux_sources, ".", "util") sources += rebase_path(util_gypi.util_linux_sources, ".", "util")
sources += rebase_path(util_gypi.util_android_sources, ".", "util") sources += rebase_path(util_gypi.util_android_sources, ".", "util")
libs = [ if (ndk_supports_nativewindow) {
"android", libs += [ "nativewindow" ]
"log", } else {
] libs += [ "android" ]
}
libs += [ "log" ]
} }
if (use_ozone) { if (use_ozone) {
...@@ -932,9 +936,9 @@ if (is_android) { ...@@ -932,9 +936,9 @@ if (is_android) {
android_apk("angle_apk") { android_apk("angle_apk") {
if (build_apk_secondary_abi && android_64bit_target_cpu) { if (build_apk_secondary_abi && android_64bit_target_cpu) {
secondary_abi_shared_libraries = [ secondary_abi_shared_libraries = [
"//third_party/angle:libGLESv2${angle_libs_suffix}($android_secondary_abi_toolchain)",
"//third_party/angle:libEGL${angle_libs_suffix}($android_secondary_abi_toolchain)", "//third_party/angle:libEGL${angle_libs_suffix}($android_secondary_abi_toolchain)",
"//third_party/angle:libGLESv1_CM${angle_libs_suffix}($android_secondary_abi_toolchain)", "//third_party/angle:libGLESv1_CM${angle_libs_suffix}($android_secondary_abi_toolchain)",
"//third_party/angle:libGLESv2${angle_libs_suffix}($android_secondary_abi_toolchain)",
] ]
} }
...@@ -947,9 +951,9 @@ if (is_android) { ...@@ -947,9 +951,9 @@ if (is_android) {
apk_name = "AngleLibraries" apk_name = "AngleLibraries"
uncompress_shared_libraries = true uncompress_shared_libraries = true
shared_libraries = [ shared_libraries = [
"//third_party/angle:libGLESv2${angle_libs_suffix}",
"//third_party/angle:libEGL${angle_libs_suffix}", "//third_party/angle:libEGL${angle_libs_suffix}",
"//third_party/angle:libGLESv1_CM${angle_libs_suffix}", "//third_party/angle:libGLESv1_CM${angle_libs_suffix}",
"//third_party/angle:libGLESv2${angle_libs_suffix}",
] ]
} }
} }
...@@ -25,12 +25,28 @@ if (build_with_chromium) { ...@@ -25,12 +25,28 @@ if (build_with_chromium) {
data_dir = "angledata" data_dir = "angledata"
declare_args() { declare_args() {
if (current_cpu == "arm64" || current_cpu == "x64" ||
current_cpu == "mips64el") {
angle_64bit_current_cpu = true
} else if (current_cpu == "arm" || current_cpu == "x86" ||
current_cpu == "mipsel") {
angle_64bit_current_cpu = false
} else {
assert(false, "Unknown current CPU: $current_cpu")
}
}
declare_args() {
if (!is_android) { if (!is_android) {
ndk_supports_vulkan = false ndk_supports_vulkan = false
ndk_supports_nativewindow = false
} else { } else {
ndk_supports_vulkan = ndk_supports_vulkan =
(current_cpu == "arm" && android32_ndk_api_level >= 24) || (!angle_64bit_current_cpu && android32_ndk_api_level >= 24) ||
(current_cpu == "arm64" && android64_ndk_api_level >= 24) (angle_64bit_current_cpu && android64_ndk_api_level >= 24)
ndk_supports_nativewindow =
(!angle_64bit_current_cpu && android32_ndk_api_level >= 26) ||
(angle_64bit_current_cpu && android64_ndk_api_level >= 26)
} }
angle_shared_libvulkan = false angle_shared_libvulkan = false
angle_libs_suffix = "" angle_libs_suffix = ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment