2 let src_dir = std::path::Path::new("src");
4 let mut c_config = cc::Build::new();
5 c_config.include(&src_dir);
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);
13 // If your language uses an external scanner written in C,
14 // then include this block of code:
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());
22 c_config.compile("parser");
23 println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
25 // If your language uses an external scanner written in C++,
26 // then include this block of code:
29 let mut cpp_config = cc::Build::new();
31 cpp_config.include(&src_dir);
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());