Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/tree-sitter-omega/blob/main/bindings/rust/build.rs # tree-sitter-omega aien-dev/tree-sitter-omega Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `tree-sitter-omega / bindings / rust / build.rs` 46 lines ยท 1856 bytes Raw Blame History 1 fn main() { 2 let src_dir = std::path::Path::new("src"); 3 4 let mut c_config = cc::Build::new(); 5 c_config.std("c11").include(src_dir); 6 7 #[cfg(target_env = "msvc")] 8 c_config.flag("-utf-8"); 9 10 if std::env::var("TARGET").unwrap() == "wasm32-unknown-unknown" { 11 let Ok(wasm_headers) = std::env::var("DEP_TREE_SITTER_LANGUAGE_WASM_HEADERS") else { 12 panic!("Environment variable DEP_TREE_SITTER_LANGUAGE_WASM_HEADERS must be set by the language crate"); 13 }; 14 15 c_config.include(&wasm_headers); 16 } 17 18 let parser_path = src_dir.join("parser.c"); 19 c_config.file(&parser_path); 20 println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); 21 22 let scanner_path = src_dir.join("scanner.c"); 23 if scanner_path.exists() { 24 c_config.file(&scanner_path); 25 println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); 26 } 27 28 c_config.compile("tree-sitter-omega"); 29 30 println!("cargo:rustc-check-cfg=cfg(with_highlights_query)"); 31 if !"queries/highlights.scm".is_empty() && std::path::Path::new("queries/highlights.scm").exists() { 32 println!("cargo:rustc-cfg=with_highlights_query"); 33 } 34 println!("cargo:rustc-check-cfg=cfg(with_injections_query)"); 35 if !"queries/injections.scm".is_empty() && std::path::Path::new("queries/injections.scm").exists() { 36 println!("cargo:rustc-cfg=with_injections_query"); 37 } 38 println!("cargo:rustc-check-cfg=cfg(with_locals_query)"); 39 if !"queries/locals.scm".is_empty() && std::path::Path::new("queries/locals.scm").exists() { 40 println!("cargo:rustc-cfg=with_locals_query"); 41 } 42 println!("cargo:rustc-check-cfg=cfg(with_tags_query)"); 43 if !"queries/tags.scm".is_empty() && std::path::Path::new("queries/tags.scm").exists() { 44 println!("cargo:rustc-cfg=with_tags_query"); 45 } 46 }