build.rs 666 B

1234567891011121314151617181920212223242526
  1. extern crate vergen;
  2. #[cfg(feature = "with-syntex")]
  3. fn codegen() {
  4. extern crate json_macros;
  5. extern crate protobuf_macros;
  6. extern crate serde_codegen;
  7. use std::env;
  8. use std::path::PathBuf;
  9. let out = PathBuf::from(env::var("OUT_DIR").unwrap());
  10. json_macros::expand("src/lib.in.rs", &out.join("lib.tmp0.rs")).unwrap();
  11. serde_codegen::expand(&out.join("lib.tmp0.rs"), &out.join("lib.tmp1.rs")).unwrap();
  12. protobuf_macros::expand(&out.join("lib.tmp1.rs"), &out.join("lib.rs")).unwrap();
  13. }
  14. #[cfg(not(feature = "with-syntex"))]
  15. fn codegen() { }
  16. fn main() {
  17. vergen::vergen(vergen::OutputFns::all()).unwrap();
  18. codegen();
  19. }