File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments