-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.rs
42 lines (38 loc) · 1.44 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
#[cfg(not(feature = "gpu"))]
fn main() {}
#[cfg(feature = "gpu")]
fn main() {
println!("cargo:rerun-if-changed=cuda/");
println!("cargo:rerun-if-changed=src/");
// Compile drillx
cc::Build::new()
.cuda(true)
.include("cuda/equix/include")
.include("cuda/equix/src")
.include("cuda/hashx/include")
.include("cuda/hashx/src")
.file("cuda/drillx.cu")
.file("cuda/equix/src/context.cu")
.file("cuda/equix/src/equix.cu")
.file("cuda/equix/src/solver.cu")
.file("cuda/hashx/src/blake2.cu")
.file("cuda/hashx/src/compiler.cu")
.file("cuda/hashx/src/context.cu")
.file("cuda/hashx/src/hashx.cu")
.file("cuda/hashx/src/program.cu")
.file("cuda/hashx/src/program_exec.cu")
.file("cuda/hashx/src/siphash.cu")
.file("cuda/hashx/src/siphash_rng.cu")
.flag("-cudart=static")
.flag("-diag-suppress=174")
.flag("-gencode=arch=compute_89,code=sm_89") // Optimize for RTX 4090
// .flag("-gencode=arch=compute_86,code=sm_86")
.compile("drillx.a");
// Add link directory
println!("cargo:rustc-link-search=native=/usr/local/cuda-12.5/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);
}