This is an automated email from the ASF dual-hosted git repository.

jroesch pushed a commit to branch ci-docker-staging
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 09ff91475706a826636e7f04beb68447fd1a67e8
Author: Jared Roesch <jroe...@octoml.ai>
AuthorDate: Mon Feb 22 23:04:07 2021 -0800

    Move generated code to OUT_DIR
---
 rust/tvm-sys/build.rs   | 4 +++-
 rust/tvm-sys/src/lib.rs | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/rust/tvm-sys/build.rs b/rust/tvm-sys/build.rs
index c917328..560ab86 100644
--- a/rust/tvm-sys/build.rs
+++ b/rust/tvm-sys/build.rs
@@ -95,6 +95,8 @@ fn main() -> Result<()> {
     let dlpack_include = format!("-I{}/3rdparty/dlpack/include/", source_path);
     let tvm_include = format!("-I{}/include/", source_path);
 
+    let out_file = PathBuf::from(concat!(env!("OUT_DIR"), 
"/c_runtime_api.rs"));
+
     // @see rust-bindgen#550 for `blacklist_type`
     bindgen::Builder::default()
         .header(runtime_api.display().to_string())
@@ -108,7 +110,7 @@ fn main() -> Result<()> {
         .derive_default(true)
         .generate()
         .map_err(|()| anyhow::anyhow!("bindgen failed to generate the Rust 
bindings for the C API"))?
-        .write_to_file(PathBuf::from("src/c_runtime_api.rs"))
+        .write_to_file(out_file)
         .context("failed to write the generated Rust binding to disk")?;
 
     Ok(())
diff --git a/rust/tvm-sys/src/lib.rs b/rust/tvm-sys/src/lib.rs
index 8ed6f37..f874e67 100644
--- a/rust/tvm-sys/src/lib.rs
+++ b/rust/tvm-sys/src/lib.rs
@@ -32,7 +32,7 @@ pub mod ffi {
 
     use std::os::raw::{c_char, c_int, c_void};
 
-    include!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/c_runtime_api.rs"));
+    include!(concat!(env!("OUT_DIR"), "/c_runtime_api.rs"));
 
     pub type BackendPackedCFunc = extern "C" fn(
         args: *const TVMValue,

Reply via email to