File tree Expand file tree Collapse file tree 2 files changed +32
-23
lines changed Expand file tree Collapse file tree 2 files changed +32
-23
lines changed Original file line number Diff line number Diff line change @@ -127,3 +127,32 @@ pub fn find_optix_root() -> Option<PathBuf> {
127
127
. or_else ( || env:: var ( "OPTIX_ROOT_DIR" ) . ok ( ) )
128
128
. map ( PathBuf :: from)
129
129
}
130
+
131
+ #[ cfg( target_family = "unix" ) ]
132
+ pub fn find_optix_root ( ) -> Option < PathBuf > {
133
+ env:: var ( "OPTIX_ROOT" )
134
+ . ok ( )
135
+ . or_else ( || env:: var ( "OPTIX_ROOT_DIR" ) . ok ( ) )
136
+ . map ( PathBuf :: from)
137
+ }
138
+
139
+ #[ cfg( target_os = "windows" ) ]
140
+ pub fn find_libnvvm_bin_dir ( ) -> String {
141
+ find_cuda_root ( )
142
+ . expect ( "Failed to find CUDA ROOT, make sure the CUDA SDK is installed and CUDA_PATH or CUDA_ROOT are set!" )
143
+ . join ( "nvvm" )
144
+ . join ( "lib" )
145
+ . join ( "x64" )
146
+ . to_string_lossy ( )
147
+ . into_owned ( )
148
+ }
149
+
150
+ #[ cfg( target_os = "linux" ) ]
151
+ pub fn find_libnvvm_bin_dir ( ) -> String {
152
+ find_cuda_root ( )
153
+ . expect ( "Failed to find CUDA ROOT, make sure the CUDA SDK is installed and CUDA_PATH or CUDA_ROOT are set!" )
154
+ . join ( "nvvm" )
155
+ . join ( "lib64" )
156
+ . to_string_lossy ( )
157
+ . into_owned ( )
158
+ }
Original file line number Diff line number Diff line change 1
- use find_cuda_helper:: find_cuda_root;
2
-
3
- #[ cfg( target_os = "windows" ) ]
4
- fn lib_search_path ( ) -> String {
5
- find_cuda_root ( )
6
- . expect ( "Failed to find CUDA ROOT, make sure the CUDA SDK is installed and CUDA_PATH or CUDA_ROOT are set!" )
7
- . join ( "nvvm" )
8
- . join ( "lib" )
9
- . join ( "x64" )
10
- . to_string_lossy ( )
11
- . into_owned ( )
12
- }
13
-
14
- #[ cfg( target_os = "linux" ) ]
15
- fn lib_search_path ( ) -> String {
16
- format ! ( "{}/nvvm/lib64" , std:: env:: var( "CUDA_ROOT" ) . unwrap( ) )
17
- }
18
-
19
- fn libnvvm_build ( ) {
20
- println ! ( "cargo:rustc-link-search={}" , lib_search_path( ) ) ;
21
- println ! ( "cargo:rustc-link-lib=dylib=nvvm" ) ;
22
- }
1
+ use find_cuda_helper:: find_libnvvm_bin_dir;
23
2
24
3
fn main ( ) {
25
- libnvvm_build ( )
4
+ println ! ( "cargo:rustc-link-search={}" , find_libnvvm_bin_dir( ) ) ;
5
+ println ! ( "cargo:rustc-link-lib=dylib=nvvm" ) ;
26
6
}
You can’t perform that action at this time.
0 commit comments