summaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/build.rs b/build.rs
index 73baa3fa..420e04e9 100644
--- a/build.rs
+++ b/build.rs
@@ -21,11 +21,27 @@ const MAC_CLANG_DIR: &'static [&'static str] = &[
];
const WIN_CLANG_DIRS: &'static [&'static str] = &["C:\\Program Files\\LLVM\\bin", "C:\\Program Files\\LLVM\\lib"];
-fn path_exists(path: &Path) -> bool {
- fs::metadata(path).is_ok()
+mod codegen {
+ extern crate quasi_codegen;
+ use std::path::Path;
+ use std::env;
+
+ pub fn main() {
+ let out_dir = env::var_os("OUT_DIR").unwrap();
+ let src = Path::new("src/gen.rs");
+ let dst = Path::new(&out_dir).join("gen.rs");
+
+ quasi_codegen::expand(&src, &dst).unwrap();
+ println!("cargo:rerun-if-changed=src/gen.rs");
+ }
}
fn main() {
+ codegen::main();
+ search_libclang();
+}
+
+fn search_libclang() {
let use_static_lib = env::var_os("LIBCLANG_STATIC").is_some() || cfg!(feature = "static");
let possible_clang_dirs = if let Ok(dir) = env::var("LIBCLANG_PATH") {
@@ -153,3 +169,7 @@ fn main() {
panic!("Unable to find {}", clang_lib);
}
}
+
+fn path_exists(path: &Path) -> bool {
+ fs::metadata(path).is_ok()
+}