-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
61 lines (52 loc) · 1.77 KB
/
build.rs
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use std::path::PathBuf;
fn main() {
build_json();
build_yaml();
build_php();
}
fn build_json() {
let json_dir: PathBuf = ["tree-sitter", "tree-sitter-json", "src"].iter().collect();
cc::Build::new()
.include(&json_dir)
.file(json_dir.join("parser.c"))
.flag_if_supported("-O")
.compile("tree-sitter-json");
}
fn build_yaml() {
let yaml_dir: PathBuf = ["tree-sitter", "tree-sitter-yaml", "src"].iter().collect();
cc::Build::new()
.include(&yaml_dir)
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable")
.flag_if_supported("-Wno-trigraphs")
.flag_if_supported("-O")
.file(yaml_dir.join("parser.c"))
.compile("tree-sitter-yaml");
cc::Build::new()
.cpp(true)
.include(&yaml_dir)
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable")
.flag_if_supported("-O")
.file(yaml_dir.join("scanner.cc"))
.compile("tree-sitter-yaml-scanner");
}
fn build_php() {
let php_dir: PathBuf = ["tree-sitter", "tree-sitter-php", "src"].iter().collect();
cc::Build::new()
.include(&php_dir)
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable")
.flag_if_supported("-Wno-trigraphs")
.flag_if_supported("-O")
.file(php_dir.join("parser.c"))
.compile("tree-sitter-php");
cc::Build::new()
.cpp(true)
.include(&php_dir)
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable")
.flag_if_supported("-O")
.file(php_dir.join("scanner.cc"))
.compile("tree-sitter-php-scanner");
}