diff options
author | Bert Belder <bertbelder@gmail.com> | 2019-08-09 09:58:34 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2019-08-22 14:12:49 -0700 |
commit | 31aa7c1a5d8a27c720b6255dc3eceda3707b1826 (patch) | |
tree | c08fdea438d9f9e8a8798ba91a3d8b3143c16519 /build_extra/rust/rust.gni | |
parent | 6c7d337960b3745a7b614a18150862279ef1c942 (diff) |
build: support rust crates that generate sources in their build script
Diffstat (limited to 'build_extra/rust/rust.gni')
-rw-r--r-- | build_extra/rust/rust.gni | 14 |
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 |