Files
FastDeploy/examples/application/rust/yolov8/build.rs
wanziyu 95c977c638 [PaddlePaddle Hackathon4 No.184] Add PaddleDetection Models Deployment Rust Examples (#1717)
* [PaddlePaddle Hackathon4 No.186] Add PaddleDetection Models Deployment Go Examples

Signed-off-by: wanziyu <ziyuwan@zju.edu.cn>

* Fix YOLOv8 Deployment Go Example

Signed-off-by: wanziyu <ziyuwan@zju.edu.cn>

* [Hackathon4 No.184] Add PaddleDetection Models Deployment Rust Examples

Signed-off-by: wanziyu <ziyuwan@zju.edu.cn>

* Add main and cargo files in examples

Signed-off-by: wanziyu <ziyuwan@zju.edu.cn>

---------

Signed-off-by: wanziyu <ziyuwan@zju.edu.cn>
Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com>
2023-04-03 11:19:28 +08:00

27 lines
914 B
Rust

extern crate bindgen;
use std::env;
use std::path::PathBuf;
use std::fs::canonicalize;
fn main() {
println!("cargo:rustc-link-search=./fastdeploy-linux-x64-0.0.0/lib");
println!("cargo:rustc-link-lib=fastdeploy");
println!("cargo:rerun-if-changed=wrapper.h");
let headers_dir = PathBuf::from("./fastdeploy-linux-x64-0.0.0/include");
let headers_dir_canonical = canonicalize(headers_dir).unwrap();
let include_path = headers_dir_canonical.to_str().unwrap();
let bindings = bindgen::Builder::default()
.header("wrapper.h")
.clang_arg(format!("-I{include_path}"))
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
}