File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1369,7 +1369,7 @@ impl Build {
1369
1369
if !msvc || !is_asm || !is_arm {
1370
1370
cmd. arg ( "-c" ) ;
1371
1371
}
1372
- if self . cuda && self . files . len ( ) > 1 {
1372
+ if self . cuda && self . cuda_file_count ( ) > 1 {
1373
1373
cmd. arg ( "--device-c" ) ;
1374
1374
}
1375
1375
if is_asm {
@@ -2037,7 +2037,7 @@ impl Build {
2037
2037
self . assemble_progressive ( dst, chunk) ?;
2038
2038
}
2039
2039
2040
- if self . cuda {
2040
+ if self . cuda && self . cuda_file_count ( ) > 0 {
2041
2041
// Link the device-side code and add it to the target library,
2042
2042
// so that non-CUDA linker can link the final binary.
2043
2043
@@ -3012,6 +3012,13 @@ impl Build {
3012
3012
cache. insert ( sdk. into ( ) , ret. clone ( ) ) ;
3013
3013
Ok ( ret)
3014
3014
}
3015
+
3016
+ fn cuda_file_count ( & self ) -> usize {
3017
+ self . files
3018
+ . iter ( )
3019
+ . filter ( |file| file. extension ( ) == Some ( OsStr :: new ( "cu" ) ) )
3020
+ . count ( )
3021
+ }
3015
3022
}
3016
3023
3017
3024
impl Default for Build {
You can’t perform that action at this time.
0 commit comments