Set FUCHSIA_GEN_ROOT so that the FIDL facade crates will compile
Also fixed a doc error.
Change-Id: I564beba6fd1886ccc01d90124f13695271cbff6f
diff --git a/src/lib.rs b/src/lib.rs
index c147a39..5f2f296 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -39,7 +39,7 @@
use clap::{App, AppSettings, Arg, SubCommand};
use cross::{pkg_config_path, run_configure, run_pkg_config};
use device::{netaddr, netls, scp_to_device, ssh, start_emulator, stop_emulator};
-use sdk::{clang_linker_path, sysroot_path};
+use sdk::{clang_linker_path, sysroot_path, target_gen_dir};
pub use sdk::TargetOptions;
use std::fs;
use std::path::PathBuf;
@@ -246,7 +246,7 @@
/// use fargo::{run_cargo, TargetOptions};
///
/// let target_options = TargetOptions::new(true, None);
-/// run_cargo(false, true, false, &["--help"], &target_options, None);
+/// run_cargo(false, true, false, &["--help"], &target_options, None, None);
///
/// ```
pub fn run_cargo(
@@ -322,6 +322,7 @@
.env("PKG_CONFIG_ALLOW_CROSS", "1")
.env("PKG_CONFIG_PATH", "")
.env("PKG_CONFIG_LIBDIR", pkg_path)
+ .env("FUCHSIA_GEN_ROOT", target_gen_dir(target_options)?)
.args(args)
.args(target_args);
diff --git a/src/sdk.rs b/src/sdk.rs
index b731f39..db4eb9a 100644
--- a/src/sdk.rs
+++ b/src/sdk.rs
@@ -80,16 +80,18 @@
possible_target_out_dir(&fuchsia_root, options)
}
+pub fn target_gen_dir(options: &TargetOptions) -> Result<PathBuf> {
+ let target_out_dir = target_out_dir(options)?;
+ Ok(target_out_dir.join("gen"))
+}
+
pub fn strip_tool_path(target_options: &TargetOptions) -> Result<PathBuf> {
Ok(toolchain_path(target_options)?.join("bin/strip"))
}
pub fn sysroot_path(options: &TargetOptions) -> Result<PathBuf> {
- let zircon_name = if options.target_cpu == "x86-64" {
- "build-user-x86-64"
- } else {
- "build-user-arm64"
- };
+ let zircon_name =
+ if options.target_cpu == "x86-64" { "build-user-x86-64" } else { "build-user-arm64" };
Ok(fuchsia_root(&options)?.join("out").join("build-zircon").join(zircon_name).join("sysroot"))
}