build.rs 550 B

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