diff --git a/src/profile.rs b/src/profile.rs index 07154c7..b6d08e3 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -359,6 +359,12 @@ impl Profile { dup.features.openhmd.branch = self.features.openhmd.branch.clone(); dup.features.mercury_enabled = self.features.mercury_enabled; dup.environment = self.environment.clone(); + if dup.environment.contains_key("LD_LIBRARY_PATH".into()) { + dup.environment.insert( + "LD_LIBRARY_PATH".into(), + prepare_ld_library_path(&dup.prefix), + ); + } dup.pull_on_build = self.pull_on_build; dup.opencomposite_repo = self.opencomposite_repo.clone(); dup.opencomposite_branch = self.opencomposite_branch.clone(); @@ -509,3 +515,7 @@ mod tests { ); } } + +pub fn prepare_ld_library_path(prefix: &str) -> String { + format!("{pfx}/lib:{pfx}/lib64", pfx = prefix) +} diff --git a/src/profiles/lighthouse.rs b/src/profiles/lighthouse.rs index f6a1c34..43a64eb 100644 --- a/src/profiles/lighthouse.rs +++ b/src/profiles/lighthouse.rs @@ -1,7 +1,7 @@ use crate::{ constants::APP_NAME, paths::{data_monado_path, data_opencomposite_path, get_data_dir}, - profile::{LighthouseDriver, Profile, ProfileFeatures, XRServiceType}, + profile::{prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeatures, XRServiceType}, }; use std::collections::HashMap; @@ -15,10 +15,7 @@ pub fn lighthouse_profile() -> Profile { 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()); - environment.insert( - "LD_LIBRARY_PATH".into(), - format!("{pfx}/lib:{pfx}/lib64", pfx = prefix), - ); + environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); Profile { uuid: "lighthouse-default".into(), name: format!("Lighthouse Driver - {name} Default", name = APP_NAME), diff --git a/src/profiles/openhmd.rs b/src/profiles/openhmd.rs index e23ee9f..3f20432 100644 --- a/src/profiles/openhmd.rs +++ b/src/profiles/openhmd.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_NAME, paths::{data_monado_path, data_opencomposite_path, data_openhmd_path, get_data_dir}, profile::{ - LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures, - XRServiceType, + prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, + ProfileFeatures, XRServiceType, }, }; use std::collections::HashMap; @@ -18,10 +18,7 @@ pub fn openhmd_profile() -> Profile { 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()); - environment.insert( - "LD_LIBRARY_PATH".into(), - format!("{pfx}/lib:{pfx}/lib64", pfx = prefix), - ); + environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); Profile { uuid: "openhmd-default".into(), name: format!("OpenHMD - {name} Default", name = APP_NAME), diff --git a/src/profiles/survive.rs b/src/profiles/survive.rs index feb5564..ae767db 100644 --- a/src/profiles/survive.rs +++ b/src/profiles/survive.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_NAME, paths::{data_libsurvive_path, data_monado_path, data_opencomposite_path, get_data_dir}, profile::{ - LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures, - XRServiceType, + prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, + ProfileFeatures, XRServiceType, }, }; use std::collections::HashMap; @@ -20,10 +20,7 @@ pub fn survive_profile() -> Profile { 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()); - environment.insert( - "LD_LIBRARY_PATH".into(), - format!("{pfx}/lib:{pfx}/lib64", pfx = prefix), - ); + environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); Profile { uuid: "survive-default".into(), name: format!("Survive - {name} Default", name = APP_NAME), diff --git a/src/profiles/wivrn.rs b/src/profiles/wivrn.rs index 25e5cdd..6f4d0c7 100644 --- a/src/profiles/wivrn.rs +++ b/src/profiles/wivrn.rs @@ -1,7 +1,7 @@ use crate::{ constants::APP_NAME, paths::{data_opencomposite_path, data_wivrn_path, get_data_dir}, - profile::{Profile, ProfileFeatures, XRServiceType}, + profile::{prepare_ld_library_path, Profile, ProfileFeatures, XRServiceType}, }; use std::collections::HashMap; @@ -9,10 +9,7 @@ pub fn wivrn_profile() -> Profile { let data_dir = get_data_dir(); let prefix = format!("{data}/prefixes/wivrn_default", data = data_dir); let mut environment: HashMap = HashMap::new(); - environment.insert( - "LD_LIBRARY_PATH".into(), - format!("{pfx}/lib:{pfx}/lib64", pfx = prefix), - ); + environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); 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()); diff --git a/src/profiles/wmr.rs b/src/profiles/wmr.rs index 812c81a..0b1124e 100644 --- a/src/profiles/wmr.rs +++ b/src/profiles/wmr.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_NAME, paths::{data_basalt_path, data_monado_path, data_opencomposite_path, get_data_dir}, profile::{ - LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures, - XRServiceType, + prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, + ProfileFeatures, XRServiceType, }, }; use std::collections::HashMap; @@ -18,10 +18,7 @@ pub fn wmr_profile() -> Profile { 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()); - environment.insert( - "LD_LIBRARY_PATH".into(), - format!("{pfx}/lib:{pfx}/lib64", pfx = prefix), - ); + environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); Profile { uuid: "wmr-default".into(), name: format!("WMR - {name} Default", name = APP_NAME), diff --git a/src/ui/libsurvive_setup_window.rs b/src/ui/libsurvive_setup_window.rs index 1f2fb7c..c4ff1c8 100644 --- a/src/ui/libsurvive_setup_window.rs +++ b/src/ui/libsurvive_setup_window.rs @@ -1,11 +1,14 @@ -use crate::{cmd_runner::CmdRunner, profile::Profile, runner::Runner}; +use super::alert::alert; +use crate::{ + cmd_runner::CmdRunner, + profile::{prepare_ld_library_path, Profile}, + runner::Runner, +}; use adw::prelude::*; use gtk::glib; use relm4::prelude::*; use std::{cell::Cell, collections::HashMap, path::Path, rc::Rc, time::Duration}; -use super::alert::alert; - const NO_FILE_MSG: &str = "(No file selected)"; const CALIBRATION_RUN_TIME_SECONDS: f64 = 30.0; @@ -57,9 +60,10 @@ impl LibsurviveSetupWindow { fn create_calibration_runner(&mut self, survive_cli_path: String) -> CmdRunner { let lh_path = self.steam_lighthouse_path.clone(); let mut env = HashMap::new(); + let profile_prefix = &self.profile.as_ref().unwrap().prefix; env.insert( - "LD_LIBRARY_PATH".to_string(), - format!("{pfx}/lib", pfx = self.profile.as_ref().unwrap().prefix), + "LD_LIBRARY_PATH".into(), + prepare_ld_library_path(&profile_prefix), ); CmdRunner::new( Some(env), diff --git a/src/ui/main_view.rs b/src/ui/main_view.rs index 6d6acb0..2e7b49c 100644 --- a/src/ui/main_view.rs +++ b/src/ui/main_view.rs @@ -180,7 +180,7 @@ impl SimpleComponent for MainView { }, }, gtk::Button { - set_label: "Start with GDB", + set_label: "Start with gdbserver", #[track = "model.changed(Self::xrservice_active()) || model.changed(Self::enable_debug_view())"] set_visible: model.enable_debug_view && !model.xrservice_active, connect_clicked[sender] => move |_| {