pub struct Builder { /* private fields */ }Expand description
Core builder to setup the bindings options
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn set_compute_cap(&mut self, cap: usize)
pub fn set_compute_cap(&mut self, cap: usize)
Force to use a given compute capability
Sourcepub fn get_compute_cap(&self) -> Option<usize>
pub fn get_compute_cap(&self) -> Option<usize>
Returns the detected CUDA compute capability, if available.
Sourcepub fn kernel_paths<P: Into<PathBuf>>(self, paths: Vec<P>) -> Self
pub fn kernel_paths<P: Into<PathBuf>>(self, paths: Vec<P>) -> Self
Setup the kernel paths. All path must be set at once and be valid files.
let builder = bindgen_cuda::Builder::default().kernel_paths(vec!["src/mykernel.cu"]);Sourcepub fn watch<T, P>(self, paths: T) -> Self
pub fn watch<T, P>(self, paths: T) -> Self
Setup the paths that the lib depend on but does not need to build
let builder =
bindgen_cuda::Builder::default().watch(vec!["kernels/"]);Sourcepub fn include_paths<P: Into<PathBuf>>(self, paths: Vec<P>) -> Self
pub fn include_paths<P: Into<PathBuf>>(self, paths: Vec<P>) -> Self
Setup the kernel paths. All path must be set at once and be valid files.
let builder = bindgen_cuda::Builder::default().include_paths(vec!["src/mykernel.cuh"]);Sourcepub fn kernel_paths_glob(self, glob: &str) -> Self
pub fn kernel_paths_glob(self, glob: &str) -> Self
Setup the kernels with a glob.
let builder = bindgen_cuda::Builder::default().kernel_paths_glob("src/**/*.cu");Sourcepub fn include_paths_glob(self, glob: &str) -> Self
pub fn include_paths_glob(self, glob: &str) -> Self
Setup the include files with a glob.
let builder = bindgen_cuda::Builder::default().kernel_paths_glob("src/**/*.cuh");Sourcepub fn out_dir<P: Into<PathBuf>>(self, out_dir: P) -> Self
pub fn out_dir<P: Into<PathBuf>>(self, out_dir: P) -> Self
Modifies the output directory. By default this is OUT_DIR
let builder = bindgen_cuda::Builder::default().out_dir("out/");Sourcepub fn arg(self, arg: &'static str) -> Self
pub fn arg(self, arg: &'static str) -> Self
Sets up extra nvcc compile arguments.
let builder = bindgen_cuda::Builder::default().arg("--expt-relaxed-constexpr");Sourcepub fn cuda_root<P>(&mut self, path: P)
pub fn cuda_root<P>(&mut self, path: P)
Forces the cuda root to a specific directory. By default all standard directories will be visited.
let builder = bindgen_cuda::Builder::default().cuda_root("/usr/local/cuda");Sourcepub fn build_lib<P>(&self, out_file: P)
pub fn build_lib<P>(&self, out_file: P)
Consumes the builder and create a lib in the out_dir.
It then needs to be linked against in your build.rs
let builder = bindgen_cuda::Builder::default().build_lib("libflash.a");
println!("cargo:rustc-link-lib=flash");Sourcepub fn build_ptx(&self) -> Result<Bindings, Error>
pub fn build_ptx(&self) -> Result<Bindings, Error>
Consumes the builder and outputs 1 ptx file for each kernels
found.
This function returns Bindings which can then be unused
to create a rust source file that will include those kernels.
let bindings = bindgen_cuda::Builder::default().build_ptx().unwrap();
bindings.write("src/lib.rs").unwrap();Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more