Skip to content

Commit c25fc9f

Browse files
committed
f
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 4d55e36 commit c25fc9f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

vortex/build.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3+
4+
use std::process::Command;
5+
6+
fn main() {
7+
// Declare the cfg so rustc doesn't warn about unexpected cfg.
8+
println!("cargo::rustc-check-cfg=cfg(cuda_available)");
9+
10+
// Only enable CUDA on Linux (matching vortex-cuda's behavior)
11+
if cfg!(not(target_os = "linux")) {
12+
return;
13+
}
14+
15+
// Check if nvcc is available
16+
if !cuda_available() {
17+
return;
18+
}
19+
20+
println!("cargo:rustc-cfg=cuda_available");
21+
22+
// Set rpath for nvCOMP dylib (re-exported by vortex-cuda).
23+
#[expect(clippy::expect_used)]
24+
let nvcomp_lib = std::env::var("DEP_VORTEX_CUDA_LIB_DIR").expect("must have nvcomp");
25+
println!("cargo:rustc-link-arg=-Wl,-rpath,{nvcomp_lib}");
26+
}
27+
28+
fn cuda_available() -> bool {
29+
Command::new("nvcc").arg("--version").output().is_ok()
30+
}

0 commit comments

Comments
 (0)