I’ve made a simple “build rule” for .cu files for Visual Studio 2005. This makes it so you don’t have to manually define a custom build rule for every CUDA file in your project.
It simply invokes nvcc on the file and forwards the C/C++ options to cl.exe. You can also specify whether or not to compile emulation code.
To install the rule:
right-click on your project in Visual Studio 2005
click Custom Build Rules…
click Find Existing…
browse to cuda.rules
check the box next to the CUDA listing in the Available Rule Files pane
Now you can compile .cu files in the same way as .c/.cpp.
Unfortunately, I don’t see a way to easily fill in the default options for the different Debug,EmuDebug, etc configurations, so for now you have to do it by hand. The way I dealt with it is to make a template CUDA project, and fill in the defaults. I’ve also attached this template. To use it, you should have CUDA_INC_PATH, CUDA_LIB_PATH, CUDA_BIN_PATH, and CUDA_LIBRARIES defined in your environment.
Extending the rules to support the rest of the nvcc options would be simple but tedious, but if anyone does, please post it here so we can all use it! :)