Skip to content

Commit

Permalink
feat(xtask): ✨ Add Pico store build; fix Pico 4e and G3
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp committed Nov 13, 2024
1 parent 0430702 commit 1a1f1f5
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 50 deletions.
26 changes: 18 additions & 8 deletions alvr/client_openxr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -160,26 +163,33 @@ 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]]
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]]
Expand Down
2 changes: 1 addition & 1 deletion alvr/client_openxr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
_ => "",
Expand Down
70 changes: 43 additions & 27 deletions alvr/xtask/src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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");
Expand All @@ -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);
Expand Down Expand Up @@ -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);
}
34 changes: 23 additions & 11 deletions alvr/xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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
Expand Down Expand Up @@ -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> Name of the platform (operative system or hardware name). snake_case
Expand Down Expand Up @@ -176,6 +179,14 @@ fn main() {
let version: Option<String> = args.opt_value_from_str("--version").unwrap();
let root: Option<String> = 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" => {
Expand All @@ -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 {
Expand All @@ -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" => {
Expand Down Expand Up @@ -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(),
Expand All @@ -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}");
Expand Down
27 changes: 24 additions & 3 deletions alvr/xtask/src/packaging.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::{
build::{self, Profile},
command, version,
command,
dependencies::{self, OpenXRLoadersSelection},
version,
};
use alvr_filesystem as afs;
use std::{
Expand All @@ -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();

Expand Down Expand Up @@ -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""#);
}

Expand Down

0 comments on commit 1a1f1f5

Please sign in to comment.