File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1369,7 +1369,7 @@ impl Build {
13691369 if !msvc || !is_asm || !is_arm {
13701370 cmd. arg ( "-c" ) ;
13711371 }
1372- if self . cuda && self . files . len ( ) > 1 {
1372+ if self . cuda && self . cuda_file_count ( ) > 1 {
13731373 cmd. arg ( "--device-c" ) ;
13741374 }
13751375 if is_asm {
@@ -2037,7 +2037,7 @@ impl Build {
20372037 self . assemble_progressive ( dst, chunk) ?;
20382038 }
20392039
2040- if self . cuda {
2040+ if self . cuda && self . cuda_file_count ( ) > 0 {
20412041 // Link the device-side code and add it to the target library,
20422042 // so that non-CUDA linker can link the final binary.
20432043
@@ -3012,6 +3012,13 @@ impl Build {
30123012 cache. insert ( sdk. into ( ) , ret. clone ( ) ) ;
30133013 Ok ( ret)
30143014 }
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+ }
30153022}
30163023
30173024impl Default for Build {
You can’t perform that action at this time.
0 commit comments