blob: fe957f9befee8e687fa9e1e2f924a3036ebca802 [file] [log] [blame]
Brian Silverman0aa13732022-05-19 23:14:08 -07001# A fake Cargo.toml for cargo-raze. This will not work well if you try actually
2# running cargo.
3#
4# cargo-raze generates BUILD files etc for all dependencies listed here and in the workspace
5# members. Hand-written BUILD files can then depend on the corresponding targets that they need.
6#
7# To generate BUILD files from this:
8# ```console
9# $ bazel run @cargo_raze//:raze -- --manifest-path=$(realpath Cargo.toml) --generate-lockfile
10# ```
11# To remove unnecessary redundant BUILD files afterwards:
12# ```console
13# $ bazel run //tools/rust:tweak_cargo_raze_output -- $(readlink -f .)
14# ```
15#
16# # Generated targets
17# //third_party/cargo has forwarding targets for the individual crates. Don't
18# reference the repositories by name, because those change when they're
19# upgraded. If you need to access another target, set `extra_aliased_targets`
20# for the crate.
21#
22# See here for what you can set in the package.metadata.raze sections:
23# https://github.com/google/cargo-raze/blob/main/impl/src/settings.rs
24[package]
25name = "compile_with_bazel"
26version = "0.0.0"
27
28# Mandatory (or Cargo tooling is unhappy)
29[lib]
30path = "fake_lib.rs"
31
32[workspace]
33members = [
34 "third_party/autocxx",
35 "third_party/autocxx/engine",
36 "third_party/autocxx/parser",
37 "third_party/autocxx/gen/cmd",
38 "third_party/autocxx/macro",
39 "third_party/autocxx/integration-tests",
40 "third_party/flatbuffers/rust/flatbuffers",
41]
42
43[dependencies]
44cxx = "1.0"
45cxxbridge-macro = "1.0"
46cxxbridge-cmd = "1.0"
47uuid = "1.0"
48toml = "0.5"
49anyhow = "1.0"
50
51# For bindgen.
52bindgen = "0.58.1"
53libloading = "=0.6.3"
54
55# Bazel toolchains take care of linking the C++ standard library, so don't add
56# an extra flag via Rust by enabling the `nothing` feature. I'm not even sure
57# it would end up on the link command line, but this crate's build.rs attempts
58# to find a C++ compiler itself otherwise which definitely doesn't work.
59link-cplusplus = { version = "1.0", features = ["nothing"] }
60
61[package.metadata.raze.binary_deps]
62# Needed if we want to generate BUILD files for autocxx-gen.
63#autocxx-gen = "0.16.0"
64
65[workspace.metadata.raze]
66# `cargo raze` will generate Bazel-compatible BUILD files into this path.
67workspace_path = "//third_party/cargo"
68
69# Put the aliases in the same package as the BUILD files.
70package_aliases_dir = "third_party/cargo"
71
72# The set of targets to generate BUILD rules for.
73targets = [
74 "x86_64-unknown-linux-gnu",
75 "arm-unknown-linux-gnueabi",
76 "armv7-unknown-linux-gnueabihf",
77 "aarch64-unknown-linux-gnueabi",
78]
79
80# Reference crates by URL, instead of vendoring them all.
81genmode = "Remote"
82
83# TODO(Brian): This isn't great for being hermetic or repeatable, but it is the
84# default. A lot of the problematic crates probably have pre-written versions
85# which avoid build.rs in cargo-raze itself or elsewhere. rules_rust is another
86# place to look.
87# https://github.com/bazelbuild/rules_rust/blob/main/bindgen/raze/Cargo.toml
Brian Silverman4e278082022-05-19 22:47:41 -070088# https://github.com/google/cargo-raze/blob/main/impl/Cargo.toml
Brian Silverman0aa13732022-05-19 23:14:08 -070089default_gen_buildrs = true
90
91[package.metadata.raze.crates.cxx.'*']
92gen_buildrs = false
93additional_build_file = "third_party/cargo/cxx/include.BUILD.bazel"
94extra_aliased_targets = ["cxx_cc"]
95
96[package.metadata.raze.crates.cxxbridge-cmd.'*']
97compile_data_attr = "[\"src/gen/include/cxx.h\"]"
98extra_aliased_targets = ["cargo_bin_cxxbridge"]
99
100[package.metadata.raze.crates.cxx-gen.'*']
101compile_data_attr = "[\"src/gen/include/cxx.h\"]"
102
103[package.metadata.raze.crates.supports-hyperlinks.'*']
104compile_data_attr = "[\"README.md\"]"
105
106[package.metadata.raze.crates.supports-unicode.'*']
107compile_data_attr = "[\"README.md\"]"
108
109[package.metadata.raze.crates.autocxx.'*']
110compile_data_attr = "[\"README.md\"]"
111
112[package.metadata.raze.crates.autocxx-gen.'*']
113extra_aliased_targets = ["cargo_bin_autocxx_gen"]
114
115[package.metadata.raze.crates.bindgen.'*']
116extra_aliased_targets = ["cargo_bin_bindgen"]
117
118[package.metadata.raze.crates.log.'*']
119additional_flags = [
120 "--cfg=atomic_cas",
121]