mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-02 22:29:01 +00:00
Merge branch 'feat/systemProfiles' into 'main'
feat: system profiles See merge request gabmus/envision!61
This commit is contained in:
commit
a56777e0c8
6 changed files with 129 additions and 43 deletions
|
@ -1,13 +1,6 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
constants::CMD_NAME,
|
constants::CMD_NAME, device_prober::PhysicalXRDevice, paths::get_config_dir, profile::Profile,
|
||||||
device_prober::PhysicalXRDevice,
|
profiles::default_profiles, util::file_utils::get_writer,
|
||||||
paths::get_config_dir,
|
|
||||||
profile::Profile,
|
|
||||||
profiles::{
|
|
||||||
lighthouse::lighthouse_profile, openhmd::openhmd_profile, simulated::simulated_profile,
|
|
||||||
survive::survive_profile, wivrn::wivrn_profile, wmr::wmr_profile,
|
|
||||||
},
|
|
||||||
util::file_utils::get_writer,
|
|
||||||
};
|
};
|
||||||
use serde::{de::Error, Deserialize, Serialize};
|
use serde::{de::Error, Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -90,14 +83,7 @@ impl Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn profiles(&self) -> Vec<Profile> {
|
pub fn profiles(&self) -> Vec<Profile> {
|
||||||
let mut profiles = vec![
|
let mut profiles = default_profiles();
|
||||||
lighthouse_profile(),
|
|
||||||
survive_profile(),
|
|
||||||
wivrn_profile(),
|
|
||||||
wmr_profile(),
|
|
||||||
openhmd_profile(),
|
|
||||||
simulated_profile(),
|
|
||||||
];
|
|
||||||
profiles.extend(self.user_profiles.clone());
|
profiles.extend(self.user_profiles.clone());
|
||||||
profiles.sort_unstable_by(|a, b| a.name.cmp(&b.name));
|
profiles.sort_unstable_by(|a, b| a.name.cmp(&b.name));
|
||||||
profiles
|
profiles
|
||||||
|
|
|
@ -265,6 +265,8 @@ pub struct Profile {
|
||||||
pub prefix: PathBuf,
|
pub prefix: PathBuf,
|
||||||
pub can_be_built: bool,
|
pub can_be_built: bool,
|
||||||
pub editable: bool,
|
pub editable: bool,
|
||||||
|
#[serde(default)]
|
||||||
|
pub is_system: bool,
|
||||||
pub pull_on_build: bool,
|
pub pull_on_build: bool,
|
||||||
#[serde(default = "LighthouseDriver::default")]
|
#[serde(default = "LighthouseDriver::default")]
|
||||||
/// Only applicable for Monado
|
/// Only applicable for Monado
|
||||||
|
@ -330,6 +332,7 @@ impl Default for Profile {
|
||||||
uuid,
|
uuid,
|
||||||
autostart_command: None,
|
autostart_command: None,
|
||||||
skip_dependency_check: false,
|
skip_dependency_check: false,
|
||||||
|
is_system: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,32 @@
|
||||||
|
use crate::profile::Profile;
|
||||||
|
use lighthouse::lighthouse_profile;
|
||||||
|
use openhmd::openhmd_profile;
|
||||||
|
use simulated::simulated_profile;
|
||||||
|
use survive::survive_profile;
|
||||||
|
use system_monado::system_monado_profile;
|
||||||
|
use system_wivrn::system_wivrn_profile;
|
||||||
|
use wivrn::wivrn_profile;
|
||||||
|
use wmr::wmr_profile;
|
||||||
|
|
||||||
pub mod lighthouse;
|
pub mod lighthouse;
|
||||||
pub mod openhmd;
|
pub mod openhmd;
|
||||||
pub mod simulated;
|
pub mod simulated;
|
||||||
pub mod survive;
|
pub mod survive;
|
||||||
|
pub mod system_monado;
|
||||||
|
pub mod system_wivrn;
|
||||||
pub mod wivrn;
|
pub mod wivrn;
|
||||||
pub mod wmr;
|
pub mod wmr;
|
||||||
|
|
||||||
|
/// get the default built-in envision profiles
|
||||||
|
pub fn default_profiles() -> Vec<Profile> {
|
||||||
|
vec![
|
||||||
|
lighthouse_profile(),
|
||||||
|
survive_profile(),
|
||||||
|
wivrn_profile(),
|
||||||
|
wmr_profile(),
|
||||||
|
openhmd_profile(),
|
||||||
|
simulated_profile(),
|
||||||
|
system_monado_profile(),
|
||||||
|
system_wivrn_profile(),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
33
src/profiles/system_monado.rs
Normal file
33
src/profiles/system_monado.rs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
use crate::{
|
||||||
|
paths::{data_monado_path, data_opencomposite_path, SYSTEM_PREFIX},
|
||||||
|
profile::{LighthouseDriver, Profile, ProfileFeatures, XRServiceType},
|
||||||
|
};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
pub fn system_monado_profile() -> Profile {
|
||||||
|
let mut environment: HashMap<String, String> = HashMap::new();
|
||||||
|
environment.insert("XRT_JSON_LOG".into(), "1".into());
|
||||||
|
environment.insert("XRT_COMPOSITOR_SCALE_PERCENTAGE".into(), "140".into());
|
||||||
|
environment.insert("XRT_COMPOSITOR_COMPUTE".into(), "1".into());
|
||||||
|
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
|
||||||
|
environment.insert("XRT_CURATED_GUI".into(), "1".into());
|
||||||
|
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
|
||||||
|
Profile {
|
||||||
|
is_system: true,
|
||||||
|
prefix: SYSTEM_PREFIX.into(),
|
||||||
|
uuid: "system-monado-default".into(),
|
||||||
|
name: "System Monado".into(),
|
||||||
|
can_be_built: false,
|
||||||
|
// does it apply to system profiles?
|
||||||
|
xrservice_path: data_monado_path(),
|
||||||
|
xrservice_type: XRServiceType::Monado,
|
||||||
|
// does it apply to system profiles?
|
||||||
|
opencomposite_path: data_opencomposite_path(),
|
||||||
|
features: ProfileFeatures::default(),
|
||||||
|
environment,
|
||||||
|
editable: false,
|
||||||
|
lighthouse_driver: LighthouseDriver::SteamVR,
|
||||||
|
pull_on_build: false,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
29
src/profiles/system_wivrn.rs
Normal file
29
src/profiles/system_wivrn.rs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
use crate::{
|
||||||
|
paths::{data_opencomposite_path, data_wivrn_path, SYSTEM_PREFIX},
|
||||||
|
profile::{Profile, ProfileFeatures, XRServiceType},
|
||||||
|
};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
pub fn system_wivrn_profile() -> Profile {
|
||||||
|
let mut environment: HashMap<String, String> = HashMap::new();
|
||||||
|
environment.insert("XRT_DEBUG_GUI".into(), "1".into());
|
||||||
|
environment.insert("XRT_CURATED_GUI".into(), "1".into());
|
||||||
|
environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into());
|
||||||
|
Profile {
|
||||||
|
is_system: true,
|
||||||
|
prefix: SYSTEM_PREFIX.into(),
|
||||||
|
uuid: "system-wivrn-default".into(),
|
||||||
|
name: "System WiVRn".into(),
|
||||||
|
can_be_built: false,
|
||||||
|
// does it apply to system profiles?
|
||||||
|
xrservice_path: data_wivrn_path(),
|
||||||
|
xrservice_type: XRServiceType::Wivrn,
|
||||||
|
// does it apply to system profiles?
|
||||||
|
opencomposite_path: data_opencomposite_path(),
|
||||||
|
features: ProfileFeatures::default(),
|
||||||
|
environment,
|
||||||
|
editable: false,
|
||||||
|
pull_on_build: false,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
|
@ -419,33 +419,42 @@ impl AsyncComponent for App {
|
||||||
let mut missing_deps = vec![];
|
let mut missing_deps = vec![];
|
||||||
let mut jobs = VecDeque::<WorkerJob>::new();
|
let mut jobs = VecDeque::<WorkerJob>::new();
|
||||||
// profile per se can't be built, but we still need opencomp
|
// profile per se can't be built, but we still need opencomp
|
||||||
if profile.can_be_built {
|
if !profile.can_be_built {
|
||||||
missing_deps.extend(match profile.xrservice_type {
|
alert(
|
||||||
XRServiceType::Monado => get_missing_monado_deps(),
|
"This profile cannot be built",
|
||||||
XRServiceType::Wivrn => get_missing_wivrn_deps(),
|
if profile.is_system {
|
||||||
});
|
Some("This is a system profile: it assumes you have everything already installed in your system using your distro package manager or other means.")
|
||||||
if profile.features.libsurvive.enabled {
|
} else {
|
||||||
missing_deps.extend(get_missing_libsurvive_deps());
|
None
|
||||||
jobs.extend(get_build_libsurvive_jobs(&profile, clean_build));
|
},
|
||||||
}
|
Some(&self.app_win.clone().upcast()),
|
||||||
if profile.features.openhmd.enabled {
|
);
|
||||||
missing_deps.extend(get_missing_openhmd_deps());
|
return;
|
||||||
jobs.extend(get_build_openhmd_jobs(&profile, clean_build));
|
|
||||||
}
|
|
||||||
if profile.features.basalt.enabled {
|
|
||||||
missing_deps.extend(get_missing_basalt_deps());
|
|
||||||
jobs.extend(get_build_basalt_jobs(&profile, clean_build));
|
|
||||||
}
|
|
||||||
if profile.features.mercury_enabled {
|
|
||||||
missing_deps.extend(get_missing_mercury_deps());
|
|
||||||
jobs.extend(get_build_mercury_jobs(&profile));
|
|
||||||
}
|
|
||||||
jobs.extend(match profile.xrservice_type {
|
|
||||||
XRServiceType::Monado => get_build_monado_jobs(&profile, clean_build),
|
|
||||||
XRServiceType::Wivrn => get_build_wivrn_jobs(&profile, clean_build),
|
|
||||||
});
|
|
||||||
// no listed deps for opencomp
|
|
||||||
}
|
}
|
||||||
|
missing_deps.extend(match profile.xrservice_type {
|
||||||
|
XRServiceType::Monado => get_missing_monado_deps(),
|
||||||
|
XRServiceType::Wivrn => get_missing_wivrn_deps(),
|
||||||
|
});
|
||||||
|
if profile.features.libsurvive.enabled {
|
||||||
|
missing_deps.extend(get_missing_libsurvive_deps());
|
||||||
|
jobs.extend(get_build_libsurvive_jobs(&profile, clean_build));
|
||||||
|
}
|
||||||
|
if profile.features.openhmd.enabled {
|
||||||
|
missing_deps.extend(get_missing_openhmd_deps());
|
||||||
|
jobs.extend(get_build_openhmd_jobs(&profile, clean_build));
|
||||||
|
}
|
||||||
|
if profile.features.basalt.enabled {
|
||||||
|
missing_deps.extend(get_missing_basalt_deps());
|
||||||
|
jobs.extend(get_build_basalt_jobs(&profile, clean_build));
|
||||||
|
}
|
||||||
|
if profile.features.mercury_enabled {
|
||||||
|
missing_deps.extend(get_missing_mercury_deps());
|
||||||
|
jobs.extend(get_build_mercury_jobs(&profile));
|
||||||
|
}
|
||||||
|
jobs.extend(match profile.xrservice_type {
|
||||||
|
XRServiceType::Monado => get_build_monado_jobs(&profile, clean_build),
|
||||||
|
XRServiceType::Wivrn => get_build_wivrn_jobs(&profile, clean_build),
|
||||||
|
});
|
||||||
jobs.extend(get_build_opencomposite_jobs(&profile, clean_build));
|
jobs.extend(get_build_opencomposite_jobs(&profile, clean_build));
|
||||||
if !(self.skip_depcheck || profile.skip_dependency_check || missing_deps.is_empty())
|
if !(self.skip_depcheck || profile.skip_dependency_check || missing_deps.is_empty())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue