From 31aa7c1a5d8a27c720b6255dc3eceda3707b1826 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Fri, 9 Aug 2019 09:58:34 +0200 Subject: build: support rust crates that generate sources in their build script --- build_extra/rust/rust.gni | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'build_extra/rust/rust.gni') 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 -- cgit v1.2.3