Use OUT_DIR in build.rs

This commit is contained in:
4JX 2023-01-23 18:50:25 +01:00
parent efa7b52f49
commit f591f5686c
3 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,3 @@
/target /target
**/*.rs.bk **/*.rs.bk
Cargo.lock Cargo.lock
src/protos/

View File

@ -1,8 +1,11 @@
fn main() { fn main() {
std::fs::create_dir_all("src/protos").unwrap(); let out_dir = format!("{}/protos", std::env::var("OUT_DIR").unwrap());
std::fs::create_dir_all(&out_dir).unwrap();
protobuf_codegen::Codegen::new() protobuf_codegen::Codegen::new()
.pure() .pure()
.out_dir("src/protos") .out_dir(out_dir)
.inputs(&["protos/rendezvous.proto", "protos/message.proto"]) .inputs(&["protos/rendezvous.proto", "protos/message.proto"])
.include("protos") .include("protos")
.customize( .customize(

View File

@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/protos/mod.rs"));