-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbuild.rs
More file actions
24 lines (19 loc) · 767 Bytes
/
build.rs
File metadata and controls
24 lines (19 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::{env, path::PathBuf, process::exit};
use openvm_cuda_builder::{cuda_available, CudaBuilder};
fn main() {
if cuda_available() {
println!("cargo:rerun-if-changed=cuda");
println!("cargo:rerun-if-changed=include");
let builder = CudaBuilder::new()
.library_name("vmm_shim")
.flag("-Xcompiler=-fPIC")
.file("cuda/src/vpmm_shim.cu");
builder.clone().build();
builder.emit_link_directives();
let include_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("include");
println!("cargo:include={}", include_path.display()); // -> DEP_CUDA_COMMON_INCLUDE
} else {
eprintln!("cargo:warning=CUDA is not available");
exit(1);
}
}