|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+//! To regenerate *.rs files in `src/proto/` rename this file to `build.rs`
|
|
|
2
|
+//! and add this to `Cargo.toml`:
|
|
|
3
|
+//! ```
|
|
|
4
|
+//! [build-dependencies]
|
|
|
5
|
+//! protoc-rust = "2.0"
|
|
|
6
|
+//! ```
|
|
|
7
|
+
|
|
|
8
|
+extern crate protoc_rust;
|
|
|
9
|
+
|
|
|
10
|
+fn main() {
|
|
|
11
|
+ let proto_files = ["src/proto/fileformat.proto", "src/proto/osmformat.proto"];
|
|
|
12
|
+
|
|
|
13
|
+ for path in &proto_files {
|
|
|
14
|
+ println!("cargo:rerun-if-changed={}", path);
|
|
|
15
|
+ }
|
|
|
16
|
+
|
|
|
17
|
+ protoc_rust::run(protoc_rust::Args {
|
|
|
18
|
+ out_dir: "src/proto",
|
|
|
19
|
+ input: &proto_files,
|
|
|
20
|
+ customize: protoc_rust::Customize {
|
|
|
21
|
+ ..Default::default()
|
|
|
22
|
+ },
|
|
|
23
|
+ includes: &[],
|
|
|
24
|
+ }).expect("protoc");
|
|
|
25
|
+}
|