Adds a new 'bzl' feature that is used to adjust import paths that need to change in the Cargo build vs Blaze build. This protobuf rust crate is a single crate that merges all of our current crates (protobuf, rust/upb, and utf8). PiperOrigin-RevId: 656405153pull/17578/head
parent
1e6abadc2b
commit
6f58085577
10 changed files with 68 additions and 11 deletions
@ -0,0 +1,20 @@ |
||||
[package] |
||||
name = "protobuf" |
||||
version = "4.27.3-beta.0" |
||||
edition = "2021" |
||||
links = "upb" |
||||
|
||||
[lib] |
||||
path = "src/shared.rs" |
||||
|
||||
[dependencies] |
||||
paste = "1.0.15" |
||||
|
||||
[dev-dependencies] |
||||
googletest = {git = "https://github.com/google/googletest-rust.git" } |
||||
|
||||
[build-dependencies] |
||||
cmake = "0.1.50" |
||||
|
||||
[lints.rust] |
||||
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(bzl)', 'cfg(cpp_kernel)', 'cfg(upb_kernel)'] } |
@ -0,0 +1,16 @@ |
||||
fn main() { |
||||
cc::Build::new() |
||||
.flag("-std=c99") |
||||
// TODO: Come up with a way to enable lto
|
||||
// .flag("-flto=thin")
|
||||
.warnings(false) |
||||
.include("src") |
||||
.file("src/upb.c") |
||||
.file("src/utf8_range.c") |
||||
.file("src/upb/upb_api.c") |
||||
.define("UPB_BUILD_API", Some("1")) |
||||
.define("PROTOBUF_CARGO", Some("1")) |
||||
.compile("upb"); |
||||
let path = std::path::Path::new("src"); |
||||
println!("cargo:include={}", path.canonicalize().unwrap().display()) |
||||
} |
Loading…
Reference in new issue