blob: 31b324cfa264c0bea2280a1ec05d344d815ba244 [file] [log] [blame]
# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/android/rules.gni")
import("//device/vr/buildflags/buildflags.gni")
source_set("android_utils") {
sources = [
"webxr_utils.cc",
"webxr_utils.h",
]
deps = [
"//base",
"//content/public/browser",
]
}
source_set("android") {
# TODO(https://crbug.com/1426233): Investigate why this cannot simply be an
# assert(enable_vr).
if (enable_vr) {
sources = [
"xr_session_coordinator.cc",
"xr_session_coordinator.h",
]
if (enable_arcore) {
sources += [
"ar_compositor_delegate_provider.cc",
"ar_compositor_delegate_provider.h",
"arcore_device_provider.cc",
"arcore_device_provider.h",
"arcore_install_helper.cc",
"arcore_install_helper.h",
]
}
if (enable_cardboard) {
sources += [
"cardboard_device_provider.cc",
"cardboard_device_provider.h",
"vr_compositor_delegate_provider.cc",
"vr_compositor_delegate_provider.h",
]
}
deps = [
":android_utils",
":xr_jni_headers",
"//base",
"//components/messages/android",
"//components/resources:android_resources",
"//components/strings",
"//components/webxr:webxr",
"//content/public/browser",
"//device/vr/android:vr_android",
"//ui/android",
"//ui/base",
]
if (enable_arcore) {
deps += [ "//device/vr/android/arcore" ]
}
if (enable_cardboard) {
deps += [ "//device/vr/android/cardboard:vr_cardboard" ]
}
libs = [ "android" ]
}
}
# Does not cause the necessary .so files to be bundled.
# Look for "libarcore_sdk_c.so" for examples of how to add it in.
android_library("xr_java") {
# Contains interfaces that should be permanently, and publicly, available and
# can thus be depended on outside of this directory, regardless of whether xr
# is enabled or not.
sources = [
"//components/webxr/android/java/src/org/chromium/components/webxr/XrDelegate.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/XrDelegateProvider.java",
]
deps = [
"//base:base_java",
"//build/android:build_java",
"//components/browser_ui/widget/android:java",
]
public_deps = []
# Contains the interfaces that are present if any runtimes are enabled.
# These are essentially the implementations of the above, interfaces those
# classes need to talk to, or other common classes that more than one runtime
# leverages.
if (enable_arcore || enable_cardboard) {
sources += [
"//components/webxr/android/java/src/org/chromium/components/webxr/ArCompositorDelegate.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/ArCompositorDelegateProvider.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/VrCompositorDelegate.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/VrCompositorDelegateProvider.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/XrDelegateImpl.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/XrImmersiveOverlay.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/XrSessionCoordinator.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/XrSessionTypeSupplier.java",
]
deps += [
"//base:jni_java",
"//content/public/android:content_java",
"//third_party/androidx:androidx_annotation_annotation_java",
"//ui/android:ui_no_recycler_view_java",
]
}
# Contains the ARCore-specific implementations of the above interfaces and any
# and all classes that they need to talk to that aren't shared with the other
# runtime implementations.
if (enable_arcore) {
sources += [
"//components/webxr/android/java/src/org/chromium/components/webxr/ArClassProvider.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/ArCoreInstallUtils.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/ArCoreShim.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/ArCoreShimImpl.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/ArOverlayDelegate.java",
]
# We have to use the bundle templates to include some of the native ARCore
# code, rather than just including things in our deps here; but that means
# that the include of the Java code needs to be a public_dep so that those
# targets can see and rely on this.
public_deps +=
[ "//third_party/arcore-android-sdk-client:com_google_ar_core_java" ]
srcjar_deps = [ ":webxr_ar_android_enums" ]
} else if (enable_cardboard) {
# These stub classes are needed for the general Xr infrastructure code, but
# are not needed for the more broad always-available code. So we check that
# the non-arcore parts of the "general xr" sources are still true before
# we attempt to compile these bits in.
sources += [ "//components/webxr/android/stubs/java/src/org/chromium/components/webxr/ArClassProvider.java" ]
}
# Contains the cardboard specific implementations of the above interfaces and
# any and all classes that they need to talk to that aren't shared with the
# other runtime implementations.
# Also includes any cardboard-specific java runtime dependencies that the
# native files in this folder may depend upon.
if (enable_cardboard) {
sources += [
"//components/webxr/android/java/src/org/chromium/components/webxr/CardboardClassProvider.java",
"//components/webxr/android/java/src/org/chromium/components/webxr/CardboardOverlayDelegate.java",
]
deps += [ "//third_party/cardboard:cardboard_java" ]
} else if (enable_arcore) {
# These stub classes are needed for the general Xr infrastructure code, but
# are not needed for the more broad always-available code. So we check that
# the non-cardboard parts of the "general xr" sources are still true before
# we attempt to compile these bits in.
sources += [ "//components/webxr/android/stubs/java/src/org/chromium/components/webxr/CardboardClassProvider.java" ]
}
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
resources_package = "org.chromium.components.webxr"
}
generate_jni("xr_jni_headers") {
sources = [ "//components/webxr/android/java/src/org/chromium/components/webxr/XrSessionCoordinator.java" ]
if (enable_arcore) {
sources += [ "//components/webxr/android/java/src/org/chromium/components/webxr/ArCoreInstallUtils.java" ]
}
}
if (enable_arcore) {
java_cpp_enum("webxr_ar_android_enums") {
sources = [ "arcore_install_helper.h" ]
}
}