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::env;
fn main() {
println!("dh-cargo:deb-built-using=tree-sitter-php=0={}", env::var("CARGO_MANIFEST_DIR").unwrap());
let root_dir = std::path::Path::new(".");
let common_dir = root_dir.join("common");
let php_dir = root_dir.join("php").join("src");
let php_only_dir = root_dir.join("php_only").join("src");
let mut c_config = cc::Build::new();
c_config.std("c11").include(&php_dir);
#[cfg(target_env = "msvc")]
c_config.flag("-utf-8");
println!("cargo:rerun-if-changed={}", common_dir.to_str().unwrap());
for dir in &[php_dir, php_only_dir] {
let parser_path = dir.join("parser.c");
let scanner_path = dir.join("scanner.c");
c_config.file(&parser_path);
c_config.file(&scanner_path);
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
}
c_config.compile("tree-sitter-php");
}
|