mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-02 14:18:49 +00:00
fix: basalt build
This commit is contained in:
parent
faaa750ccb
commit
ada31c5606
2 changed files with 30 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
|||
use std::collections::HashMap;
|
||||
use crate::runner::Runner;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Cmake {
|
||||
|
@ -12,8 +12,10 @@ pub struct Cmake {
|
|||
impl Cmake {
|
||||
pub fn get_prepare_runner(&self) -> Runner {
|
||||
let mut args = vec![
|
||||
"-B".into(), self.build_dir.clone(),
|
||||
"-G".into(), "Ninja".into(),
|
||||
"-B".into(),
|
||||
self.build_dir.clone(),
|
||||
"-G".into(),
|
||||
"Ninja".into(),
|
||||
];
|
||||
if self.vars.is_some() {
|
||||
for (k, v) in self.vars.as_ref().unwrap() {
|
||||
|
@ -21,10 +23,9 @@ impl Cmake {
|
|||
panic!("Cmake vars cannot contain spaces!");
|
||||
}
|
||||
if v.contains(" ") {
|
||||
args.push(format!("-D{k}=\"{v}\"", k=k, v=v));
|
||||
}
|
||||
else {
|
||||
args.push(format!("-D{k}={v}", k=k, v=v));
|
||||
args.push(format!("-D{k}=\"{v}\"", k = k, v = v));
|
||||
} else {
|
||||
args.push(format!("-D{k}={v}", k = k, v = v));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,14 +34,18 @@ impl Cmake {
|
|||
}
|
||||
|
||||
pub fn get_build_runner(&self) -> Runner {
|
||||
Runner::new(self.env.clone(), "cmake".into(), vec![
|
||||
"--build".into(), self.build_dir.clone()
|
||||
])
|
||||
Runner::new(
|
||||
self.env.clone(),
|
||||
"cmake".into(),
|
||||
vec!["--build".into(), self.build_dir.clone()],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_install_runner(&self) -> Runner {
|
||||
Runner::new(self.env.clone(), "cmake".into(), vec![
|
||||
"--install".into(), self.build_dir.clone()
|
||||
])
|
||||
Runner::new(
|
||||
self.env.clone(),
|
||||
"cmake".into(),
|
||||
vec!["--install".into(), self.build_dir.clone()],
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::{
|
||||
build_tools::{cmake::Cmake, git::Git},
|
||||
constants::pkg_data_dir,
|
||||
file_utils::rm_rf,
|
||||
profile::Profile,
|
||||
runner::Runner,
|
||||
|
@ -32,12 +31,22 @@ pub fn get_build_basalt_runners(profile: &Profile, clean_build: bool) -> Vec<Run
|
|||
format!("{}/lib", profile.prefix),
|
||||
);
|
||||
|
||||
let mut cmake_env: HashMap<String, String> = HashMap::new();
|
||||
cmake_env.insert("CMAKE_BUILD_PARALLEL_LEVEL".into(), "2".into());
|
||||
|
||||
let cmake = Cmake {
|
||||
env: None,
|
||||
env: Some(cmake_env),
|
||||
vars: Some(cmake_vars),
|
||||
source_dir: profile.features.basalt.path.as_ref().unwrap().clone(),
|
||||
build_dir: build_dir.clone(),
|
||||
};
|
||||
runners.push(Runner::new(None, "bash".into(), vec![
|
||||
"-c".into(),
|
||||
format!(
|
||||
"cd {repo}/thirdparty/Pangolin && git checkout include/pangolin/utils/picojson.h && curl -sSL 'https://aur.archlinux.org/cgit/aur.git/plain/279c17d9c9eb9374c89489b449f92cb93350e8cd.patch?h=basalt-monado-git' -o picojson_fix.patch && git apply picojson_fix.patch && sed -i '1s/^/#include <stdint.h>\\n/' include/pangolin/platform.h",
|
||||
repo = git.dir
|
||||
),
|
||||
]));
|
||||
if !Path::new(&build_dir).is_dir() || clean_build {
|
||||
rm_rf(&build_dir);
|
||||
runners.push(cmake.get_prepare_runner());
|
||||
|
@ -62,7 +71,7 @@ pub fn get_build_basalt_runners(profile: &Profile, clean_build: bool) -> Vec<Run
|
|||
vec![
|
||||
"-Ra".into(),
|
||||
format!(
|
||||
"{}/basalt/thirdparty/basalt-headers/thirdparty/eigen",
|
||||
"{}/thirdparty/basalt-headers/thirdparty/eigen",
|
||||
profile.features.basalt.path.as_ref().unwrap().clone()
|
||||
),
|
||||
format!("{}/share/basalt/thirdparty", profile.prefix),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue