mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-03 06:38:52 +00:00
feat: add support for vapor openvr compatibility module
This commit is contained in:
parent
f38199601e
commit
2fc33b10b0
4 changed files with 100 additions and 4 deletions
85
src/builders/build_vapor.rs
Normal file
85
src/builders/build_vapor.rs
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
use crate::{
|
||||||
|
build_tools::{cmake::Cmake, git::Git},
|
||||||
|
profile::Profile,
|
||||||
|
termcolor::TermColor,
|
||||||
|
ui::job_worker::job::{FuncWorkerData, FuncWorkerOut, WorkerJob},
|
||||||
|
util::file_utils::{copy_file, rm_rf},
|
||||||
|
};
|
||||||
|
use std::{
|
||||||
|
collections::{HashMap, VecDeque},
|
||||||
|
fs::create_dir_all,
|
||||||
|
path::Path,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn get_build_vapor_jobs(profile: &Profile, clean_build: bool) -> VecDeque<WorkerJob> {
|
||||||
|
let mut jobs = VecDeque::<WorkerJob>::new();
|
||||||
|
jobs.push_back(WorkerJob::new_printer(
|
||||||
|
"Building VapoR...",
|
||||||
|
Some(TermColor::Blue),
|
||||||
|
));
|
||||||
|
|
||||||
|
let git = Git {
|
||||||
|
repo: profile
|
||||||
|
.ovr_comp
|
||||||
|
.repo
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_or(&"https://github.com/micheal65536/VapoR.git".into())
|
||||||
|
.clone(),
|
||||||
|
dir: profile.ovr_comp.path.clone(),
|
||||||
|
branch: profile
|
||||||
|
.ovr_comp
|
||||||
|
.branch
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_or(&"master".into())
|
||||||
|
.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
jobs.extend(git.get_pre_build_jobs(profile.pull_on_build));
|
||||||
|
|
||||||
|
let build_dir = profile.ovr_comp.path.join("build");
|
||||||
|
let cmake = Cmake {
|
||||||
|
env: None,
|
||||||
|
vars: Some({
|
||||||
|
let mut cmake_vars: HashMap<String, String> = HashMap::new();
|
||||||
|
for (k, v) in [
|
||||||
|
("VAPOR_LOG_SILENT=ON", "ON"),
|
||||||
|
("CMAKE_BUILD_TYPE", "RelWithDebInfo"),
|
||||||
|
] {
|
||||||
|
cmake_vars.insert(k.to_string(), v.to_string());
|
||||||
|
}
|
||||||
|
cmake_vars
|
||||||
|
}),
|
||||||
|
source_dir: profile.ovr_comp.path.clone(),
|
||||||
|
build_dir: build_dir.clone(),
|
||||||
|
};
|
||||||
|
if !Path::new(&build_dir).is_dir() || clean_build {
|
||||||
|
rm_rf(&build_dir);
|
||||||
|
jobs.push_back(cmake.get_prepare_job());
|
||||||
|
}
|
||||||
|
jobs.push_back(cmake.get_build_job());
|
||||||
|
jobs.push_back(WorkerJob::Func(FuncWorkerData {
|
||||||
|
func: Box::new(move || {
|
||||||
|
let dest_dir = build_dir.join("bin/linux64");
|
||||||
|
if let Err(e) = create_dir_all(&dest_dir) {
|
||||||
|
return FuncWorkerOut {
|
||||||
|
success: false,
|
||||||
|
out: vec![format!(
|
||||||
|
"failed to create dir {}: {e}",
|
||||||
|
dest_dir.to_string_lossy()
|
||||||
|
)],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
copy_file(
|
||||||
|
&build_dir.join("src/vrclient.so"),
|
||||||
|
&dest_dir.join("vrclient.so"),
|
||||||
|
);
|
||||||
|
|
||||||
|
FuncWorkerOut {
|
||||||
|
success: true,
|
||||||
|
out: Vec::default(),
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
|
jobs
|
||||||
|
}
|
|
@ -4,5 +4,6 @@ pub mod build_mercury;
|
||||||
pub mod build_monado;
|
pub mod build_monado;
|
||||||
pub mod build_opencomposite;
|
pub mod build_opencomposite;
|
||||||
pub mod build_openhmd;
|
pub mod build_openhmd;
|
||||||
|
pub mod build_vapor;
|
||||||
pub mod build_wivrn;
|
pub mod build_wivrn;
|
||||||
pub mod build_xrizer;
|
pub mod build_xrizer;
|
||||||
|
|
|
@ -265,6 +265,7 @@ pub enum OvrCompatibilityModuleType {
|
||||||
#[default]
|
#[default]
|
||||||
Opencomposite,
|
Opencomposite,
|
||||||
Xrizer,
|
Xrizer,
|
||||||
|
Vapor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for OvrCompatibilityModuleType {
|
impl Display for OvrCompatibilityModuleType {
|
||||||
|
@ -272,13 +273,14 @@ impl Display for OvrCompatibilityModuleType {
|
||||||
f.write_str(match self {
|
f.write_str(match self {
|
||||||
Self::Opencomposite => "OpenComposite",
|
Self::Opencomposite => "OpenComposite",
|
||||||
Self::Xrizer => "xrizer",
|
Self::Xrizer => "xrizer",
|
||||||
|
Self::Vapor => "VapoR",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl OvrCompatibilityModuleType {
|
impl OvrCompatibilityModuleType {
|
||||||
pub fn iter() -> Iter<'static, Self> {
|
pub fn iter() -> Iter<'static, Self> {
|
||||||
[Self::Opencomposite, Self::Xrizer].iter()
|
[Self::Opencomposite, Self::Xrizer, Self::Vapor].iter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +291,7 @@ impl FromStr for OvrCompatibilityModuleType {
|
||||||
match s.to_lowercase().trim() {
|
match s.to_lowercase().trim() {
|
||||||
"opencomposite" => Ok(Self::Opencomposite),
|
"opencomposite" => Ok(Self::Opencomposite),
|
||||||
"xrizer" => Ok(Self::Xrizer),
|
"xrizer" => Ok(Self::Xrizer),
|
||||||
|
"vapor" => Ok(Self::Vapor),
|
||||||
_ => Err(format!("no match for ovr compatibility module `{s}`")),
|
_ => Err(format!("no match for ovr compatibility module `{s}`")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +302,8 @@ impl From<u32> for OvrCompatibilityModuleType {
|
||||||
match value {
|
match value {
|
||||||
0 => Self::Opencomposite,
|
0 => Self::Opencomposite,
|
||||||
1 => Self::Xrizer,
|
1 => Self::Xrizer,
|
||||||
_ => panic!("OvrCompatibilityModuleType index out of bounds"),
|
2 => Self::Vapor,
|
||||||
|
_ => panic!("OvrCompatibilityModuleType index out of bounds"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +331,9 @@ impl ProfileOvrCompatibilityModule {
|
||||||
/// this should correspond to the build output directory
|
/// this should correspond to the build output directory
|
||||||
pub fn runtime_dir(&self) -> PathBuf {
|
pub fn runtime_dir(&self) -> PathBuf {
|
||||||
match self.mod_type {
|
match self.mod_type {
|
||||||
OvrCompatibilityModuleType::Opencomposite => self.path.join("build"),
|
OvrCompatibilityModuleType::Opencomposite | OvrCompatibilityModuleType::Vapor => {
|
||||||
|
self.path.join("build")
|
||||||
|
}
|
||||||
OvrCompatibilityModuleType::Xrizer => self.path.join("target/release"),
|
OvrCompatibilityModuleType::Xrizer => self.path.join("target/release"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,8 @@ use crate::{
|
||||||
build_basalt::get_build_basalt_jobs, build_libsurvive::get_build_libsurvive_jobs,
|
build_basalt::get_build_basalt_jobs, build_libsurvive::get_build_libsurvive_jobs,
|
||||||
build_mercury::get_build_mercury_jobs, build_monado::get_build_monado_jobs,
|
build_mercury::get_build_mercury_jobs, build_monado::get_build_monado_jobs,
|
||||||
build_opencomposite::get_build_opencomposite_jobs, build_openhmd::get_build_openhmd_jobs,
|
build_opencomposite::get_build_opencomposite_jobs, build_openhmd::get_build_openhmd_jobs,
|
||||||
build_wivrn::get_build_wivrn_jobs, build_xrizer::get_build_xrizer_jobs,
|
build_vapor::get_build_vapor_jobs, build_wivrn::get_build_wivrn_jobs,
|
||||||
|
build_xrizer::get_build_xrizer_jobs,
|
||||||
},
|
},
|
||||||
config::{Config, PluginConfig},
|
config::{Config, PluginConfig},
|
||||||
constants::APP_NAME,
|
constants::APP_NAME,
|
||||||
|
@ -533,6 +534,9 @@ impl AsyncComponent for App {
|
||||||
OvrCompatibilityModuleType::Xrizer => {
|
OvrCompatibilityModuleType::Xrizer => {
|
||||||
get_build_xrizer_jobs(&profile, clean_build)
|
get_build_xrizer_jobs(&profile, clean_build)
|
||||||
}
|
}
|
||||||
|
OvrCompatibilityModuleType::Vapor => {
|
||||||
|
get_build_vapor_jobs(&profile, clean_build)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
let missing_deps = profile.missing_dependencies();
|
let missing_deps = profile.missing_dependencies();
|
||||||
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