summaryrefslogtreecommitdiff
path: root/helix-syntax
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-07-11 15:44:14 +0000
committerBlaž Hrastnik2021-07-14 01:00:05 +0000
commitc8dc9b64dd0f6726cd1d36a61c563212721ef249 (patch)
tree83849cda1cb67b39f1b178f044f3cc483a088a50 /helix-syntax
parentdd2903ff10387c04e933aa37846663131297b8b3 (diff)
windows: Try building inside OUT_DIR?
Diffstat (limited to 'helix-syntax')
-rw-r--r--helix-syntax/build.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/helix-syntax/build.rs b/helix-syntax/build.rs
index 02a5bf49..2882f513 100644
--- a/helix-syntax/build.rs
+++ b/helix-syntax/build.rs
@@ -7,7 +7,8 @@ use std::sync::mpsc::channel;
fn collect_tree_sitter_dirs(ignore: &[String]) -> Vec<String> {
let mut dirs = Vec::new();
- for entry in fs::read_dir("languages").unwrap().flatten() {
+ let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("languages");
+ for entry in fs::read_dir(path).unwrap().flatten() {
let path = entry.path();
let dir = path.file_name().unwrap().to_str().unwrap().to_string();
if !ignore.contains(&dir) {
@@ -54,13 +55,14 @@ fn build_library(src_path: &Path, language: &str) -> Result<()> {
if !recompile {
return Ok(());
}
-
+ let build_dir = std::env::var("OUT_DIR").unwrap();
let mut config = cc::Build::new();
config.cpp(true).opt_level(2).cargo_metadata(false);
// .target(BUILD_TARGET)
// .host(BUILD_TARGET);
let compiler = config.get_compiler();
let mut command = Command::new(compiler.path());
+ command.current_dir(build_dir);
for (key, value) in compiler.env() {
command.env(key, value);
}
@@ -185,7 +187,10 @@ fn build_dir(dir: &str, language: &str) {
std::process::exit(1);
}
- let path = Path::new("languages").join(dir).join("src");
+ let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
+ .join("languages")
+ .join(dir)
+ .join("src");
build_library(&path, language).unwrap();
}