-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.rs
29 lines (25 loc) · 870 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fn main() {
#[cfg(feature = "gpu")]
build_cuda_libs();
}
#[cfg(feature = "gpu")]
fn build_cuda_libs() {
println!("cargo::rerun-if-changed=kernels/");
cc::Build::new()
.cuda(true)
.file("kernels/utils.cu")
.file("kernels/vanity.cu")
.file("kernels/base58.cu")
.file("kernels/sha256.cu")
.flag("-cudart=static")
.flag("-gencode=arch=compute_89,code=sm_89")
.flag("-gencode=arch=compute_89,code=compute_89")
.compile("libvanity.a");
// Add link directory
println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");
println!("cargo:rustc-link-lib=cudart");
println!("cargo:rustc-link-lib=cuda");
// Emit the location of the compiled library
let out_dir = std::env::var("OUT_DIR").unwrap();
println!("cargo:rustc-link-search=native={}", out_dir);
}