blob: 8f57539b1837a636226a822c66d50afdf3509ebd [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"
Brian Silverman53b0cfb2022-07-23 16:38:26 -070050futures = "0.3"
51once_cell = "1.13"
52thiserror = "1.0"
53bitflags = "1.3"
54smallvec = "1.9"
Brian Silverman0aa13732022-05-19 23:14:08 -070055
56# For bindgen.
57bindgen = "0.58.1"
58libloading = "=0.6.3"
59
60# Bazel toolchains take care of linking the C++ standard library, so don't add
61# an extra flag via Rust by enabling the `nothing` feature. I'm not even sure
62# it would end up on the link command line, but this crate's build.rs attempts
63# to find a C++ compiler itself otherwise which definitely doesn't work.
64link-cplusplus = { version = "1.0", features = ["nothing"] }
65
66[package.metadata.raze.binary_deps]
67# Needed if we want to generate BUILD files for autocxx-gen.
68#autocxx-gen = "0.16.0"
69
70[workspace.metadata.raze]
71# `cargo raze` will generate Bazel-compatible BUILD files into this path.
72workspace_path = "//third_party/cargo"
73
74# Put the aliases in the same package as the BUILD files.
75package_aliases_dir = "third_party/cargo"
76
77# The set of targets to generate BUILD rules for.
78targets = [
79 "x86_64-unknown-linux-gnu",
80 "arm-unknown-linux-gnueabi",
81 "armv7-unknown-linux-gnueabihf",
82 "aarch64-unknown-linux-gnueabi",
83]
84
85# Reference crates by URL, instead of vendoring them all.
86genmode = "Remote"
87
88# TODO(Brian): This isn't great for being hermetic or repeatable, but it is the
89# default. A lot of the problematic crates probably have pre-written versions
90# which avoid build.rs in cargo-raze itself or elsewhere. rules_rust is another
91# place to look.
92# https://github.com/bazelbuild/rules_rust/blob/main/bindgen/raze/Cargo.toml
Brian Silverman4e278082022-05-19 22:47:41 -070093# https://github.com/google/cargo-raze/blob/main/impl/Cargo.toml
Brian Silverman0aa13732022-05-19 23:14:08 -070094default_gen_buildrs = true
95
96[package.metadata.raze.crates.cxx.'*']
97gen_buildrs = false
98additional_build_file = "third_party/cargo/cxx/include.BUILD.bazel"
99extra_aliased_targets = ["cxx_cc"]
100
101[package.metadata.raze.crates.cxxbridge-cmd.'*']
102compile_data_attr = "[\"src/gen/include/cxx.h\"]"
103extra_aliased_targets = ["cargo_bin_cxxbridge"]
104
105[package.metadata.raze.crates.cxx-gen.'*']
106compile_data_attr = "[\"src/gen/include/cxx.h\"]"
107
108[package.metadata.raze.crates.supports-hyperlinks.'*']
109compile_data_attr = "[\"README.md\"]"
110
111[package.metadata.raze.crates.supports-unicode.'*']
112compile_data_attr = "[\"README.md\"]"
113
114[package.metadata.raze.crates.autocxx.'*']
115compile_data_attr = "[\"README.md\"]"
116
117[package.metadata.raze.crates.autocxx-gen.'*']
118extra_aliased_targets = ["cargo_bin_autocxx_gen"]
119
120[package.metadata.raze.crates.bindgen.'*']
121extra_aliased_targets = ["cargo_bin_bindgen"]
122
123[package.metadata.raze.crates.log.'*']
124additional_flags = [
125 "--cfg=atomic_cas",
126]