From 1a1f1f55c345cb8e58f16c1ccfa4fe544be673c5 Mon Sep 17 00:00:00 2001 From: Riccardo Zaglia Date: Wed, 13 Nov 2024 03:00:16 +0100 Subject: [PATCH] feat(xtask): :sparkles: Add Pico store build; fix Pico 4e and G3 --- alvr/client_openxr/Cargo.toml | 26 +++++++++---- alvr/client_openxr/src/lib.rs | 2 +- alvr/xtask/src/dependencies.rs | 70 +++++++++++++++++++++------------- alvr/xtask/src/main.rs | 34 +++++++++++------ alvr/xtask/src/packaging.rs | 27 +++++++++++-- 5 files changed, 109 insertions(+), 50 deletions(-) diff --git a/alvr/client_openxr/Cargo.toml b/alvr/client_openxr/Cargo.toml index b8941d8a0c..c4be08a16d 100644 --- a/alvr/client_openxr/Cargo.toml +++ b/alvr/client_openxr/Cargo.toml @@ -48,6 +48,7 @@ required = true [[package.metadata.android.uses_feature]] name = "android.hardware.vr.headtracking" required = true +version = 1 [[package.metadata.android.uses_feature]] opengles_version = [3, 2] required = true @@ -71,6 +72,8 @@ name = "org.khronos.openxr.permission.OPENXR" [[package.metadata.android.uses_permission]] name = "org.khronos.openxr.permission.OPENXR_SYSTEM" +[[package.metadata.android.queries.intent]] +actions = ["org.khronos.openxr.OpenXRRuntimeService"] [[package.metadata.android.queries.provider]] name = "org.khronos.openxr" authorities = "org.khronos.openxr.runtime_broker;org.khronos.openxr.system_runtime_broker" @@ -160,17 +163,26 @@ value = "3,6DoF" [[package.metadata.android.uses_permission]] name = "com.picovr.permission.EYE_TRACKING" [[package.metadata.android.application.meta_data]] -name = "pvr.app.type" -value = "vr" -[[package.metadata.android.application.meta_data]] -name = "picovr.software.eye_tracking" -value = "true" -[[package.metadata.android.application.meta_data]] name = "eyetracking_calibration" value = "true" [[package.metadata.android.application.meta_data]] name = "handtracking" value = "1" +[[package.metadata.android.application.meta_data]] +name = "picovr.software.eye_tracking" +value = "1" +[[package.metadata.android.application.meta_data]] +name = "pvr.app.type" +value = "vr" +[[package.metadata.android.application.meta_data]] +name = "pvr.display.orientation" +value = "180" +[[package.metadata.android.application.meta_data]] +name = "pvr.sdk.version" +value = "OpenXR" +[[package.metadata.android.application.meta_data]] +name = "pxr.sdk.version_code" +value = "5900" # Yvr entries [[package.metadata.android.application.meta_data]] @@ -178,8 +190,6 @@ name = "com.yvr.intent.category.VR" value = "vr_only" # Lynx entries -[[package.metadata.android.queries.intent]] -actions = ["org.khronos.openxr.OpenXRRuntimeService"] [[package.metadata.android.queries.package]] name = "com.ultraleap.tracking.service" [[package.metadata.android.queries.package]] diff --git a/alvr/client_openxr/src/lib.rs b/alvr/client_openxr/src/lib.rs index 6fd31cdc4f..f1c085b29e 100644 --- a/alvr/client_openxr/src/lib.rs +++ b/alvr/client_openxr/src/lib.rs @@ -120,7 +120,7 @@ pub fn entry_point() { let loader_suffix = match platform { Platform::Quest1 => "_quest1", - Platform::PicoNeo3 => "_pn3", + Platform::PicoNeo3 | Platform::PicoG3 | Platform::Pico4 => "_pico_old", Platform::Yvr => "_yvr", Platform::Lynx => "_lynx", _ => "", diff --git a/alvr/xtask/src/dependencies.rs b/alvr/xtask/src/dependencies.rs index 25c581e38e..68cc37a239 100644 --- a/alvr/xtask/src/dependencies.rs +++ b/alvr/xtask/src/dependencies.rs @@ -3,6 +3,12 @@ use alvr_filesystem as afs; use std::{fs, path::Path}; use xshell::{cmd, Shell}; +pub enum OpenXRLoadersSelection { + OnlyGeneric, + OnlyPico, + All, +} + pub fn update_submodules(sh: &Shell) { let dir = sh.push_dir(afs::workspace_dir()); cmd!(sh, "git submodule update --init --recursive") @@ -293,7 +299,7 @@ pub fn prepare_macos_deps() { update_submodules(&sh); } -fn get_android_openxr_loaders(only_khronos_loader: bool) { +fn get_android_openxr_loaders(selection: OpenXRLoadersSelection) { fn get_openxr_loader(name: &str, url: &str, source_dir: &str) { let sh = Shell::new().unwrap(); let temp_dir = afs::build_dir().join("temp_download"); @@ -320,34 +326,44 @@ fn get_android_openxr_loaders(only_khronos_loader: bool) { "prefab/modules/openxr_loader/libs/android.arm64-v8a", ); - if !only_khronos_loader { - get_openxr_loader( - "_quest1", - "https://securecdn.oculus.com/binaries/download/?id=7577210995650755", // Version 64 - "OpenXR/Libs/Android/arm64-v8a/Release", - ); - - get_openxr_loader( - "_pn3", - "https://sdk.picovr.com/developer-platform/sdk/PICO_OpenXR_SDK_220.zip", - "libs/android.arm64-v8a", - ); - - get_openxr_loader( - "_yvr", - "https://developer.yvrdream.com/yvrdoc/sdk/openxr/yvr_openxr_mobile_sdk_2.0.0.zip", - "yvr_openxr_mobile_sdk_2.0.0/OpenXR/Libs/Android/arm64-v8a", - ); - - get_openxr_loader( - "_lynx", - "https://portal.lynx-r.com/downloads/download/16", // version 1.0.0 - "jni/arm64-v8a", - ); + if matches!(selection, OpenXRLoadersSelection::OnlyGeneric) { + return; + } + + get_openxr_loader( + "_pico_old", + "https://sdk.picovr.com/developer-platform/sdk/PICO_OpenXR_SDK_220.zip", + "libs/android.arm64-v8a", + ); + + if matches!(selection, OpenXRLoadersSelection::OnlyPico) { + return; } + + get_openxr_loader( + "_quest1", + "https://securecdn.oculus.com/binaries/download/?id=7577210995650755", // Version 64 + "OpenXR/Libs/Android/arm64-v8a/Release", + ); + + get_openxr_loader( + "_yvr", + "https://developer.yvrdream.com/yvrdoc/sdk/openxr/yvr_openxr_mobile_sdk_2.0.0.zip", + "yvr_openxr_mobile_sdk_2.0.0/OpenXR/Libs/Android/arm64-v8a", + ); + + get_openxr_loader( + "_lynx", + "https://portal.lynx-r.com/downloads/download/16", // version 1.0.0 + "jni/arm64-v8a", + ); } -pub fn build_android_deps(skip_admin_priv: bool, all_targets: bool, only_khronos_loader: bool) { +pub fn build_android_deps( + skip_admin_priv: bool, + all_targets: bool, + openxr_loaders_selection: OpenXRLoadersSelection, +) { let sh = Shell::new().unwrap(); update_submodules(&sh); @@ -378,5 +394,5 @@ pub fn build_android_deps(skip_admin_priv: bool, all_targets: bool, only_khronos .run() .unwrap(); - get_android_openxr_loaders(only_khronos_loader); + get_android_openxr_loaders(openxr_loaders_selection); } diff --git a/alvr/xtask/src/main.rs b/alvr/xtask/src/main.rs index 546162f69f..b0f8ad3e42 100644 --- a/alvr/xtask/src/main.rs +++ b/alvr/xtask/src/main.rs @@ -8,6 +8,8 @@ mod version; use crate::build::Profile; use afs::Layout; use alvr_filesystem as afs; +use dependencies::OpenXRLoadersSelection; +use packaging::ReleaseFlavor; use pico_args::Arguments; use std::{fs, time::Instant}; use xshell::{cmd, Shell}; @@ -27,7 +29,6 @@ SUBCOMMANDS: build-client Build client, then copy binaries to build folder build-client-lib Build a C-ABI ALVR client library and header build-client-xr-lib Build a C-ABI ALVR OpenXR entry point client library and header - build-meta-store Prepare dependencies and build client for Meta Store run-streamer Build streamer and then open the dashboard run-launcher Build launcher and then open it format Autoformat all code @@ -55,6 +56,8 @@ FLAGS: --ci Do some CI related tweaks. Depends on the other flags and subcommand --no-stdcpp Disable linking to libc++_shared with build-client-lib --all-targets For prepare-deps and build-client-lib subcommand, will build for all android supported ABI targets + --meta-store For package-client subcommand, build for Meta Store + --pico-store For package-client subcommand, build for Pico Store ARGS: --platform Name of the platform (operative system or hardware name). snake_case @@ -176,6 +179,14 @@ fn main() { let version: Option = args.opt_value_from_str("--version").unwrap(); let root: Option = args.opt_value_from_str("--root").unwrap(); + let package_flavor = if args.contains("--meta-store") { + ReleaseFlavor::MetaStore + } else if args.contains("--pico-store") { + ReleaseFlavor::PicoStore + } else { + ReleaseFlavor::GitHub + }; + if args.finish().is_empty() { match subcommand.as_str() { "prepare-deps" => { @@ -184,9 +195,11 @@ fn main() { "windows" => dependencies::prepare_windows_deps(for_ci), "linux" => dependencies::prepare_linux_deps(!no_nvidia), "macos" => dependencies::prepare_macos_deps(), - "android" => { - dependencies::build_android_deps(for_ci, all_targets, false) - } + "android" => dependencies::build_android_deps( + for_ci, + all_targets, + OpenXRLoadersSelection::All, + ), _ => panic!("Unrecognized platform."), } } else { @@ -196,7 +209,11 @@ fn main() { dependencies::prepare_linux_deps(!no_nvidia); } - dependencies::build_android_deps(for_ci, all_targets, false); + dependencies::build_android_deps( + for_ci, + all_targets, + OpenXRLoadersSelection::All, + ); } } "build-streamer" => { @@ -233,7 +250,7 @@ fn main() { } "package-streamer" => packaging::package_streamer(gpl, root, appimage, zsync), "package-launcher" => packaging::package_launcher(appimage), - "package-client" => build::build_android_client(Profile::Distribution), + "package-client" => packaging::package_client_openxr(package_flavor), "package-client-lib" => packaging::package_client_lib(link_stdcpp, all_targets), "format" => format::format(), "check-format" => format::check_format(), @@ -242,11 +259,6 @@ fn main() { "clippy" => clippy(), "check-msrv" => version::check_msrv(), "kill-oculus" => kill_oculus_processes(), - "build-meta-store" => { - clean(); - dependencies::build_android_deps(false, false, true); - packaging::package_client_openxr(true); - } _ => { println!("\nUnrecognized subcommand."); println!("{HELP_STR}"); diff --git a/alvr/xtask/src/packaging.rs b/alvr/xtask/src/packaging.rs index 55b6e7a023..9775bcbc82 100644 --- a/alvr/xtask/src/packaging.rs +++ b/alvr/xtask/src/packaging.rs @@ -1,6 +1,8 @@ use crate::{ build::{self, Profile}, - command, version, + command, + dependencies::{self, OpenXRLoadersSelection}, + version, }; use alvr_filesystem as afs; use std::{ @@ -10,6 +12,12 @@ use std::{ }; use xshell::{cmd, Shell}; +pub enum ReleaseFlavor { + GitHub, + MetaStore, + PicoStore, +} + fn build_windows_installer() { let sh = Shell::new().unwrap(); @@ -203,12 +211,25 @@ pub fn replace_client_openxr_manifest(from_pattern: &str, to: &str) { fs::write(manifest_path, manifest_string).unwrap(); } -pub fn package_client_openxr(for_meta_store: bool) { - if for_meta_store { +pub fn package_client_openxr(flavor: ReleaseFlavor) { + crate::clean(); + + let openxr_selection = match flavor { + ReleaseFlavor::GitHub => OpenXRLoadersSelection::All, + ReleaseFlavor::MetaStore => OpenXRLoadersSelection::OnlyGeneric, + ReleaseFlavor::PicoStore => OpenXRLoadersSelection::OnlyPico, + }; + + dependencies::build_android_deps(false, false, openxr_selection); + + if !matches!(flavor, ReleaseFlavor::GitHub) { replace_client_openxr_manifest( r#"package = "alvr.client.stable""#, r#"package = "alvr.client""#, ); + } + + if matches!(flavor, ReleaseFlavor::MetaStore) { replace_client_openxr_manifest(r#"value = "all""#, r#"value = "quest2|questpro|quest3""#); }