Execute shell command at start of every "cargo test / cargo build"


#1

=== Short Version:

Every time I run “cargo test” or “cargo build”, before rustc is called, I want cargo to execute a shell command of my choosing.

=== Long Version:

I have a bunch of *.cu files I need to clobber together & call nvcc on to generate ptx. This ptx file is then linked into my rust program at COMPILE TIME via include_str!

For this to work properly, I want, on every call of cargo test / cargo build, before rustc is called on any file, to run my external script to generate the PTX file.


#2

You need to use a build script.