tree-sitter/lib/build.rs

27 lines
711 B
Rust
Raw Normal View History

2016-07-10 14:03:00 -07:00
extern crate cc;
use std::env;
2018-05-18 10:01:37 -07:00
use std::path::PathBuf;
2016-07-10 14:03:00 -07:00
fn main() {
let mut config = cc::Build::new();
let src_path: PathBuf = ["src"].iter().collect();
config
2018-05-18 10:27:36 -07:00
.define("UTF8PROC_STATIC", "")
2018-05-18 10:01:37 -07:00
.flag_if_supported("-std=c99")
.flag_if_supported("-Wno-unused-parameter")
.include("include")
.include("utf8proc")
.file(src_path.join("runtime.c"));
2016-07-10 14:03:00 -07:00
if env::var("RUST_TREE_SITTER_TEST").is_ok() {
2018-05-18 10:01:37 -07:00
let parser_dir: PathBuf = ["fixtures", "tree-sitter-rust", "src"].iter().collect();
config
.file(parser_dir.join("parser.c"))
.file(parser_dir.join("scanner.c"));
2016-07-10 14:03:00 -07:00
}
2018-05-18 10:01:37 -07:00
config.compile("tree-sitter-runtime");
2016-07-10 14:03:00 -07:00
}