@@ -640,10 +640,12 @@ impl Build {
640
640
641
641
/// Set CUDA C++ support.
642
642
///
643
- /// Enabling CUDA will pass the detected C/C++ toolchain as an argument to
644
- /// the CUDA compiler, NVCC. NVCC itself accepts some limited GNU-like args;
645
- /// any other arguments for the C/C++ toolchain will be redirected using
646
- /// "-Xcompiler" flags.
643
+ /// Enabling CUDA will invoke the CUDA compiler, NVCC. While NVCC accepts
644
+ /// the most common compiler flags, e.g. `-std=c++17`, some project-specific
645
+ /// flags might have to be prefixed with "-Xcompiler" flag, for example as
646
+ /// `.flag("-Xcompiler").flag("-fpermissive")`. See the documentation for
647
+ /// `nvcc`, the CUDA compiler driver, at https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/
648
+ /// for more information.
647
649
///
648
650
/// If enabled, this also implicitly enables C++ support.
649
651
pub fn cuda ( & mut self , cuda : bool ) -> & mut Build {
@@ -3297,12 +3299,14 @@ impl Tool {
3297
3299
self . removed_args . push ( flag) ;
3298
3300
}
3299
3301
3300
- /// Push a flag to the end of the compiler's arguments list.
3302
+ /// Push an "exotic" flag to the end of the compiler's arguments list.
3301
3303
///
3302
- /// Currently `-Xcompiler` is inserted before the passed flag when compiling
3303
- /// CUDA sources since NVCC only accepts a limited set of GNU-like flags,
3304
- /// while the rest must be prefixed with the `-Xcompiler` flag to get passed
3305
- /// to the underlying C++ compiler.
3304
+ /// Nvidia compiler accepts only the most common compiler flags like `-D`,
3305
+ /// `-I`, `-c`, etc. Options meant specifically for the underlying
3306
+ /// host C++ compiler have to be prefixed with '-Xcompiler`.
3307
+ /// [Another possible future application for this function is passing
3308
+ /// clang-specific flags to clang-cl, which otherwise accepts only
3309
+ /// MSVC-specific options.]
3306
3310
fn push_cc_arg ( & mut self , flag : OsString ) {
3307
3311
if self . cuda {
3308
3312
self . args . push ( "-Xcompiler" . into ( ) ) ;
0 commit comments