diff --git a/src/build_tools/cmake.rs b/src/build_tools/cmake.rs index c693873..83cf9a9 100644 --- a/src/build_tools/cmake.rs +++ b/src/build_tools/cmake.rs @@ -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()], + ) } } diff --git a/src/builders/build_basalt.rs b/src/builders/build_basalt.rs index cac6fed..9a7d4a0 100644 --- a/src/builders/build_basalt.rs +++ b/src/builders/build_basalt.rs @@ -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 = 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 \\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