Specifying multiple architectures on Visual Studio, JIT

On Linux I can compile CUDA code for several different gencodes, and then the nvcc will do a JIT to pick the right version to use. This technique is shown in basically every CUDA sample’s makefile:

# CUDA code generation flags
ifneq ($(OS_ARCH),armv7l)
GENCODE_SM10    := -gencode arch=compute_10,code=sm_10
endif
GENCODE_SM20	:= -gencode arch=compute_20,code=sm_20
GENCODE_SM30	:= -gencode arch=compute_30,code=sm_30
GENCODE_SM32	:= -gencode arch=compute_32,code=sm_32
GENCODE_SM35	:= -gencode arch=compute_35,code=sm_35
GENCODE_SM50	:= -gencode arch=compute_50,code=sm_50
GENCODE_SMXX	:= -gencode arch=compute_50,code=compute_50
GENCODE_FLAGS	?= $(GENCODE_SM10) $(GENCODE_SM20) $(GENCODE_SM30) $(GENCODE_SM32) $(GENCODE_SM35) $(GENCODE_SM50) $(GENCODE_SMXX)

How do I do this in Visual Studio? Is it possible? Right now I have a props file with just this line:

<CodeGeneration>compute_20,sm_20</CodeGeneration>

I tried:

<CodeGeneration>compute_20,sm_20,compute_30,sm_30</CodeGeneration>

But get this error:
Code Generation value is not in the expected format ‘[Arch],[Code]’.

I looked this up on google but haven’t found any one trying to compile for more than one architecture at a time on Visual Studio.

The cuda samples provided with windows install already indicate how to do this. All of the cuda sample projects are already set up to compile for multiple architectures. Typically you would go into the project properties and select the code generation there (under cuda compiler settings). It can also be done on a file-by-file basis. I wouldn’t suggest modifying props file as the way to do this.

Look at the first answer here:

http://stackoverflow.com/questions/14411435/how-to-set-cuda-compiler-flags-in-visual-studio-2010

Yes, it only has one target specified, but if you look at the sample code projects in the same area, you will find out how multiple targets are specified.

So simple once you know where to look! Thanks txbob!