-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathbuild.rs
More file actions
28 lines (23 loc) · 763 Bytes
/
build.rs
File metadata and controls
28 lines (23 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::path::PathBuf;
fn main() {
let dirs: Vec<PathBuf> = [
&["grammars", "tree-sitter-typescript", "typescript", "src"][..],
&["grammars", "tree-sitter-rust", "src"][..],
&["grammars", "tree-sitter-python", "src"][..],
&["grammars", "tree-sitter-javascript", "src"][..],
&["grammars", "tree-sitter-c", "src"][..],
]
.iter()
.map(|path| path.iter().collect::<PathBuf>())
.collect();
let mut cc_build = cc::Build::new();
for dir in dirs {
cc_build
.include(&dir)
.file(dir.join("parser.c"));
if !dir.ends_with("tree-sitter-c/src") {
cc_build.file(dir.join("scanner.c"));
}
}
cc_build.compile("tree-sitter-languages");
}