How to compile CUDA C files and Nvidia OptiX files inside the same Visual Studio project

I have a running OpTiX (v. 3.0.0) project running on MS Visual Studio Ultimate 2012 and I want to post process some data using C CUDA kernels (v. 5.5).

I can not find information on how to reconfigure the original OpTiX project such that it recognizes and launches the CUDA kernels. The ocean sample in the OptIX SDK does not seem to help since it uses the CuFFT library.

In particular I want to add the following example code in my project:

// CUDA runtime
#include <cuda_runtime.h>

// test for CUDA within holorenderer
global void propagate_kernel(float *OPL_L) {

host void propagate (float OPL_L) {
// launch the kernel

If I add it as a .c file MSVS returns the following compile time error:
error C2059: syntax error : ‘<’ propagation.c
which indicates that the C compiler does not recognize the CUDA kernel launch operator

If I add it as a .cu file MSVS returns the following linker error:
error LNK2019: unresolved external symbol _propagate referenced in function …
which seems to indicate that the resulting file is not being linked in . This is expected since OpTiX loads the ptx files in runtime…

Any example on how to configure this project?
I saw in a reference to a similar question in:

but I do not manage to access this link.

Did you try to use CMake to configure the project?
The OptiX SDK uses it and you can adapt its CMake setup for your project.

BTW: OptiX currently only supports CUDA up to version 5.0:

If you are using CMake to configure your build, take a look at the ocean or collision samples in the SDK. Here you can set a per file property to mark a given CUDA C file for runtime use.

# Tag for OBJ format intead of PTX (which is the default for
  # OPTIX_add_test_executable).  Do this before calling OPTIX_add_test_executable.

If you are using the CUDA Toolkit VS build rule, then you need to make sure that you select the correct value for “NVCC Compilation Type” in the GUI configuration. Make sure it is ‘-c/–compile’ instead of ‘-ptx’.