Skip to content

Commit 1bc17a0

Browse files
committed
Harmonize CUDA support with NVCC default --cudart static.
This can interfere with current deployments in the wild, in which case some adjustments might be required. Most notably one might have to add .cuda("none") to the corresponding Builder instantiation to restore the original behaviour.
1 parent e57b2ca commit 1bc17a0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/lib.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,19 +613,21 @@ impl Build {
613613
self.cuda = cuda;
614614
if cuda {
615615
self.cpp = true;
616+
self.cudart = Some("static".to_string());
616617
}
617618
self
618619
}
619620

620621
/// Link CUDA run-time.
621622
///
622-
/// This option mimics the `--cudart` nvcc command-line option. Just like
623-
/// the original it accepts `{none|shared|static}`. However, in case you
624-
/// don't use this method when instantiating the `Build` class, the outcome
625-
/// is equivalent to `none`. This is different from nvcc's default 'static'.
623+
/// This option mimics the `--cudart` NVCC command-line option. Just like
624+
/// the original it accepts `{none|shared|static}`, with default being
625+
/// `static`. The method has to be invoked after `.cuda(true)`, or not
626+
/// at all, if the default is right for the project.
626627
pub fn cudart(&mut self, cudart: &str) -> &mut Build {
627-
self.cuda(true);
628-
self.cudart = Some(cudart.to_string());
628+
if self.cuda {
629+
self.cudart = Some(cudart.to_string());
630+
}
629631
self
630632
}
631633

0 commit comments

Comments
 (0)