Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow setting nvcc program via CUDACXX #997

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
//! be logged to stdout. This is useful for debugging build script issues, but can be
//! overly verbose for normal use.
//! * `CXX...` - see [C++ Support](#c-support).
//! * `CUDACXX` - the nvcc program to invoke. Similar to `CC`, this must be an exact
//! executable name and cannot contain extra flags.
//!
//! Furthermore, projects using this crate may specify custom environment variables
//! to be inspected, for example via the `Build::try_flags_from_environment`
Expand Down Expand Up @@ -2402,7 +2404,8 @@ impl Build {
let dlink = out_dir.join(lib_name.to_owned() + "_dlink.o");
let mut nvcc = self.get_compiler().to_command();
nvcc.arg("--device-link").arg("-o").arg(&dlink).arg(dst);
run(&mut nvcc, "nvcc", &self.cargo_output)?;
let program = env::var("CUDACXX").unwrap_or_else(|_| String::from("nvcc"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might need to modify cc::Build::get_base_compiler.

This line you modified is for linking with cuda-specific part only.

P.S. I'm not so familiar with the cuda compilation part, so feel free to point out any mistake.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspected this was too easy. I'll take a look.

run(&mut nvcc, &program, &self.cargo_output)?;
self.assemble_progressive(dst, &[dlink.as_path()])?;
}

Expand Down