Assume:
- Windows 7 OS
- Visual Studio Express 2010 SP1 just installed (and not modified with any
*.rules
or whatever) - CUDA SDK installed
- GPU computing SDK installed
- clean/empty environment variable set (so, we need to run vcvars and whatever..)
Correct answer provides then:
- batch file contents
- source (and project, if needed) file contents (including at least one
.cu
file to be acually utilized)
(Answering the inevitable "Why are not you.." comment)
The default setup does work not for me already, and my choice is to try the way this question is about.
(Extra ranty question)
Or is this not possible at all and we are doomed to explore GUI checkboxes brute-force-style?
Anyone? :)
Be my initial question requirements exotic or not, there turns out to be a rather simple way to suffice them, providing for:
.*proj
file and its intricaciescutil
andshrutils
utility librarires built with default GPU computing SDK setup (building them "by hand" (i.e. without a.*proj
file), I think, will also impose no problems)PATH
components are needed (i.e. CUDA_PATH (or whatever it is -- CUDA_PATH_4_1?) and friends can go away from your global environment), see below)To begin with, suppose we have NVIDIA "template" project's set of source files compiled completely from scratch without any VS
.*proj
files under:The source files are under
"C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.1\C\src\template"
by default (there're others but they will not be needed):The batch commands to prepare the environment are (fix the first three to accomodate your setup, if does not match the default one):
The batch file (I called mine
cuda_build.bat
) to build is (assuming you will need bothcutil
andshrutil
which are heavily used by SDK samples):To build, pass the list of
.cpp
and.cu
files to the batch file above:To build more or less silently and not retain any intermediate files, remove
--verbose --keep
keys fromcuda_build.bat
.The resulting a.exe can be run as long as the paths are set with the first portions of commands in this post (i.e., any necessary
.dll
will be already on path).Note (if you are interested), that the minimum environment to start with is merely (in shell commands, change apporpriately according to your setup), or even smaller (I have not tried, but linker fails at least in absence of temp dirs):
P.S. To build a larger example, one should follow similair steps, but adding (or copying) source files like
rendercheck_gl.cpp
if referenced in project to the list of source files to build. I've tested it withnbody
,fluidsGL
,simpleGL
andoceanFFT
example projects, and it works. (particle
example breaks onthrust
library header inclusion -- but compiling via .*proj file fails the same way -- looks (to me) like some template magic is incompatible with VC10).Hope, anyone interested in the topic and disliking MS IDE configuration mess as much as I do, will like this. :)