MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / build

Method build

crates/cuda_builder/src/lib.rs:299–308  ·  view source on GitHub ↗

Runs rustc to build the codegen and codegens the gpu crate, returning the path of the final ptx file. If [`ptx_file_copy_path`](Self::ptx_file_copy_path) is set, this returns the copied path.

(self)

Source from the content-addressed store, hash-verified

297 /// Runs rustc to build the codegen and codegens the gpu crate, returning the path of the final
298 /// ptx file. If [`ptx_file_copy_path`](Self::ptx_file_copy_path) is set, this returns the copied path.
299 pub fn build(self) -> Result<PathBuf, CudaBuilderError> {
300 println!("cargo:rerun-if-changed={}", self.path_to_crate.display());
301 let path = invoke_rustc(&self)?;
302 if let Some(copy_path) = self.ptx_file_copy_path {
303 std::fs::copy(path, &copy_path).map_err(CudaBuilderError::FailedToCopyPtxFile)?;
304 Ok(copy_path)
305 } else {
306 Ok(path)
307 }
308 }
309}
310
311// https://github.com/rust-lang/cargo/blob/1857880b5124580c4aeb4e8bc5f1198f491d61b1/src/cargo/util/paths.rs#L29-L52

Callers

nothing calls this directly

Calls 1

invoke_rustcFunction · 0.85

Tested by

no test coverage detected