@@ -277,6 +277,7 @@ pub struct Build {
277
277
cpp_set_stdlib : Option < Arc < str > > ,
278
278
cuda : bool ,
279
279
cudart : Option < Arc < str > > ,
280
+ ccbin : bool ,
280
281
std : Option < Arc < str > > ,
281
282
target : Option < Arc < str > > ,
282
283
host : Option < Arc < str > > ,
@@ -402,6 +403,7 @@ impl Build {
402
403
cpp_set_stdlib : None ,
403
404
cuda : false ,
404
405
cudart : None ,
406
+ ccbin : true ,
405
407
std : None ,
406
408
target : None ,
407
409
host : None ,
@@ -850,6 +852,18 @@ impl Build {
850
852
self
851
853
}
852
854
855
+ /// Set CUDA host compiler.
856
+ ///
857
+ /// By default, a `-ccbin` flag will be passed to NVCC to specify the
858
+ /// underlying host compiler. The value of `-ccbin` is the same as the
859
+ /// chosen C++ compiler. This is not always desired, because NVCC might
860
+ /// not support that compiler. In this case, you can remove the `-ccbin`
861
+ /// flag so that NVCC will choose the host compiler by itself.
862
+ pub fn ccbin ( & mut self , ccbin : bool ) -> & mut Build {
863
+ self . ccbin = ccbin;
864
+ self
865
+ }
866
+
853
867
/// Specify the C or C++ language standard version.
854
868
///
855
869
/// These values are common to modern versions of GCC, Clang and MSVC:
@@ -2915,9 +2929,11 @@ impl Build {
2915
2929
& self . cargo_output ,
2916
2930
out_dir,
2917
2931
) ;
2918
- nvcc_tool
2919
- . args
2920
- . push ( format ! ( "-ccbin={}" , tool. path. display( ) ) . into ( ) ) ;
2932
+ if self . ccbin {
2933
+ nvcc_tool
2934
+ . args
2935
+ . push ( format ! ( "-ccbin={}" , tool. path. display( ) ) . into ( ) ) ;
2936
+ }
2921
2937
nvcc_tool. family = tool. family ;
2922
2938
nvcc_tool
2923
2939
} else {
0 commit comments