Tweak build script for windows

This commit is contained in:
Max Brunsfeld 2018-05-18 10:01:37 -07:00
parent 29c0cd3aa4
commit 8d485857e1

View file

@ -1,18 +1,18 @@
extern crate cc;
use std::env;
use std::path::Path;
use std::path::PathBuf;
fn main() {
let mut config = cc::Build::new();
let root_path = Path::new("vendor/tree-sitter");
let root_path: PathBuf = ["vendor", "tree-sitter"].iter().collect();
config
.flag("-std=c99")
.flag("-Wno-unused-parameter")
.include(root_path.join(Path::new("src")))
.include(root_path.join(Path::new("include")))
.include(root_path.join(Path::new("externals/utf8proc")));
.flag_if_supported("-std=c99")
.flag_if_supported("-Wno-unused-parameter")
.include(root_path.join("src"))
.include(root_path.join("include"))
.include(root_path.join("externals").join("utf8proc"));
let source_filenames = [
"get_changed_ranges.c",
@ -29,18 +29,19 @@ fn main() {
config.files(source_filenames.iter().map(|source_filename| {
root_path
.join(Path::new(&"src/runtime"))
.join(Path::new(&source_filename))
.join("src")
.join("runtime")
.join(&source_filename)
}));
config.file(root_path.join(Path::new("externals/utf8proc/utf8proc.c")));
config.file(root_path.join("externals").join("utf8proc").join("utf8proc.c"));
if env::var("RUST_TREE_SITTER_TEST").is_ok() {
let parser_dir = Path::new("fixtures/tree-sitter-rust/src");
let parser_dir: PathBuf = ["fixtures", "tree-sitter-rust", "src"].iter().collect();
config
.file(parser_dir.join("parser.c"))
.file(parser_dir.join("scanner.c"));
}
config.compile("treesitter_ffi");
config.compile("tree-sitter-runtime");
}