]> git.r.bdr.sh - rbdr/tree-sitter-api-notation/blob - bindings/rust/build.rs
Initial Commit
[rbdr/tree-sitter-api-notation] / bindings / rust / build.rs
1 fn main() {
2 let src_dir = std::path::Path::new("src");
3
4 let mut c_config = cc::Build::new();
5 c_config.include(&src_dir);
6 c_config
7 .flag_if_supported("-Wno-unused-parameter")
8 .flag_if_supported("-Wno-unused-but-set-variable")
9 .flag_if_supported("-Wno-trigraphs");
10 let parser_path = src_dir.join("parser.c");
11 c_config.file(&parser_path);
12
13 // If your language uses an external scanner written in C,
14 // then include this block of code:
15
16 /*
17 let scanner_path = src_dir.join("scanner.c");
18 c_config.file(&scanner_path);
19 println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
20 */
21
22 c_config.compile("parser");
23 println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
24
25 // If your language uses an external scanner written in C++,
26 // then include this block of code:
27
28 /*
29 let mut cpp_config = cc::Build::new();
30 cpp_config.cpp(true);
31 cpp_config.include(&src_dir);
32 cpp_config
33 .flag_if_supported("-Wno-unused-parameter")
34 .flag_if_supported("-Wno-unused-but-set-variable");
35 let scanner_path = src_dir.join("scanner.cc");
36 cpp_config.file(&scanner_path);
37 cpp_config.compile("scanner");
38 println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
39 */
40 }