summaryrefslogtreecommitdiff
path: root/build_extra/rust/rust.gni
diff options
context:
space:
mode:
Diffstat (limited to 'build_extra/rust/rust.gni')
-rw-r--r--build_extra/rust/rust.gni14
1 files changed, 13 insertions, 1 deletions
diff --git a/build_extra/rust/rust.gni b/build_extra/rust/rust.gni
index 787888bc2..ba8cc781f 100644
--- a/build_extra/rust/rust.gni
+++ b/build_extra/rust/rust.gni
@@ -62,8 +62,9 @@ template("_rust_crate") {
"crate_version",
"deps",
"edition",
- "inputs",
"features",
+ "generated_source_dir",
+ "inputs",
"is_test",
"libs",
"source_root",
@@ -237,6 +238,17 @@ template("_rust_crate") {
"--color=always",
]
+ if (defined(generated_source_dir)) {
+ args += [
+ # Some crates (e.g. 'typenum') generate source files and place them in
+ # the directory indicated by the 'OUT_DIR' environment variable, which
+ # is normally set by Cargo. This flag tells run.py to set 'OUT_DIR' to
+ # the path where the current crate can find its generated sources.
+ "--generated-source-dir=" +
+ rebase_path(generated_source_dir, root_build_dir),
+ ]
+ }
+
if (defined(crate_version)) {
args += [
# This is used to set env variables for Cargo build compatibility