feat: valve index system profile

This commit is contained in:
Gabriele Musco 2023-06-17 20:53:35 +02:00
parent d91ed2bcd2
commit 743b51a150
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE
8 changed files with 66 additions and 21 deletions

View file

@ -14,6 +14,7 @@ pub mod profiles;
pub mod runner;
pub mod ui;
pub mod runner_pipeline;
pub mod paths;
fn main() {
let app = RelmApp::new(APP_ID);

13
src/paths.rs Normal file
View file

@ -0,0 +1,13 @@
use crate::file_utils::get_data_dir;
pub fn data_opencomposite_path() -> String {
format!("{data}/opencomposite", data = get_data_dir())
}
pub fn data_monado_path() -> String {
format!("{data}/monado", data = get_data_dir())
}
pub fn data_libsurvive_path() -> String {
format!("{data}/libsurvive", data = get_data_dir())
}

View file

@ -17,6 +17,7 @@ pub struct Profile {
pub environment: HashMap<String, String>,
/** Install prefix */
pub prefix: String,
pub can_be_built: bool,
}
impl Display for Profile {
@ -99,6 +100,7 @@ mod tests {
mercury_enabled: false,
environment: env,
prefix: String::from("/home/user/rex2prefix"),
can_be_built: true,
};
let fpath = String::from("./target/testout/testprofile.json");
dump_profile(p, &fpath);

View file

@ -1,3 +1,2 @@
pub mod valve_index;
pub mod valve_index_system;

View file

@ -1,4 +1,4 @@
use crate::{constants::APP_NAME, file_utils::get_data_dir, profile::Profile};
use crate::{constants::APP_NAME, file_utils::get_data_dir, profile::Profile, paths::{data_monado_path, data_opencomposite_path, data_libsurvive_path}};
use std::collections::HashMap;
pub fn valve_index_profile() -> Profile {
@ -12,9 +12,9 @@ pub fn valve_index_profile() -> Profile {
environment.insert("LD_LIBRARY_PATH".into(), format!("{pfx}/lib", pfx = prefix));
Profile {
name: format!("Valve Index - {name} Default", name = APP_NAME),
monado_path: format!("{data}/monado", data = data_dir),
opencomposite_path: format!("{data}/opencomposite", data = data_dir),
libsurvive_path: Some(format!("{data}/libsurvive", data = data_dir)),
monado_path: data_monado_path(),
opencomposite_path: data_opencomposite_path(),
libsurvive_path: Some(data_libsurvive_path()),
basalt_path: None,
mercury_path: None,
libsurvive_enabled: true,
@ -22,5 +22,6 @@ pub fn valve_index_profile() -> Profile {
mercury_enabled: false,
environment,
prefix,
can_be_built: true,
}
}

View file

@ -0,0 +1,24 @@
use crate::{constants::APP_NAME, paths::data_opencomposite_path, profile::Profile};
use std::collections::HashMap;
pub fn system_valve_index_profile() -> Profile {
let mut environment: HashMap<String, String> = HashMap::new();
environment.insert("XRT_COMPOSITOR_SCALE_PERCENTAGE".into(), "140".into());
environment.insert("XRT_COMPOSITOR_COMPUTE".into(), "1".into());
environment.insert("SURVIVE_GLOBALSCENESOLVER".into(), "0".into());
environment.insert("SURVIVE_TIMECODE_OFFSET_MS".into(), "-6.94".into());
Profile {
name: format!("Valve Index (System) - {name} Default", name = APP_NAME),
opencomposite_path: data_opencomposite_path(),
monado_path: "".into(),
libsurvive_path: None,
basalt_path: None,
mercury_path: None,
libsurvive_enabled: false,
mercury_enabled: false,
basalt_enabled: false,
environment,
prefix: "/usr".into(),
can_be_built: false,
}
}

View file

@ -250,22 +250,26 @@ impl SimpleComponent for App {
},
Msg::BuildProfile => {
let profile = self.get_selected_profile();
let mut missing_deps = get_missing_monado_deps();
let mut missing_deps = vec![];
let mut runners: Vec<Runner> = vec![];
if profile.libsurvive_enabled {
missing_deps.extend(get_missing_libsurvive_deps());
runners.push(get_build_libsurvive_runner(profile.clone()));
// profile per se can't be built, but we still need opencomp
if profile.can_be_built {
missing_deps.extend(get_missing_monado_deps());
if profile.libsurvive_enabled {
missing_deps.extend(get_missing_libsurvive_deps());
runners.push(get_build_libsurvive_runner(profile.clone()));
}
// if profile.basalt_enabled {
// missing_deps.extend(get_missing_basalt_deps());
// runners.push(get_build_basalt_runner(profile.clone()));
// }
// if profile.mercury_enabled {
// missing_deps.extend(get_missing_mercury_deps());
// runners.push(get_build_mercury_runner(profile.clone()));
// }
runners.push(get_build_monado_runner(profile.clone()));
// no listed deps for opencomp
}
// if profile.basalt_enabled {
// missing_deps.extend(get_missing_basalt_deps());
// runners.push(get_build_basalt_runner(profile.clone()));
// }
// if profile.mercury_enabled {
// missing_deps.extend(get_missing_mercury_deps());
// runners.push(get_build_mercury_runner(profile.clone()));
// }
runners.push(get_build_monado_runner(profile.clone()));
// no listed deps for opencomp
runners.push(get_build_opencomposite_runner(profile.clone()));
if !missing_deps.is_empty() {
self.dependencies_dialog.set_body(

View file

@ -13,5 +13,6 @@
"XRT_COMPOSITOR_COMPUTE": "1",
"SURVIVE_GLOBALSCENESOLVER": "0"
},
"prefix": "/home/user/rex2prefix"
"prefix": "/home/user/rex2prefix",
"can_be_built": true
}