Build errors in Optix advanced samples

I am trying to build the optix advanced samples on windows following the instructions in:

but I get errors in visual studio. I have tried Optix 4.1, Optix 7.0, CUDA 7.0, CUDA 10
together with Visual Studio 2019 but i cant get it to work.

Below is an error trying with optix 4.1 and Cuda 7. Anyone know why it fails?

------ Build started: Project: sutil_sdk, Configuration: Release x64 ------
4>Building NVCC ptx file lib/ptx/cuda_compile_ptx_generated_phong.cu.ptx
4>nvcc fatal   : Unknown option '-keep-device-functions'
4>CMake Error at cuda_compile_ptx_generated_phong.cu.ptx.cmake:245 (message):
4>  Error generating
4>  C:/Users/pajli/optix/optix_advanced_samples-master/build/lib/ptx/cuda_compile_ptx_generated_phong.cu.ptx
4>
4>
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(230,5): error MSB6006: "cmd.exe" exited with code 1.
4>Done building project "sutil_sdk.vcxproj" -- FAILED.
5>------ Build started: Project: optixParticleVolumes, Configuration: Release x64 ------
5>Building NVCC ptx file lib/ptx/optixParticleVolumes_generated_raygen.cu.ptx
5>nvcc fatal   : Unknown option '-keep-device-functions'
5>CMake Error at optixParticleVolumes_generated_raygen.cu.ptx.cmake:245 (message):
5>  Error generating
5>  C:/Users/pajli/optix/optix_advanced_samples-master/build/lib/ptx/optixParticleVolumes_generated_raygen.cu.ptx
5>
5>
5>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(230,5): error MSB6006: "cmd.exe" exited with code 1.
5>Done building project "optixParticleVolumes.vcxproj" -- FAILED.
========== Build: 3 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

This is an assortment of incompatible combinations of SDKs.
Please always check the OptiX SDK release notes for each version before setting up a development environment.
Similarly read the CUDA CUDA_Installation_Guide_.pdf for your OS to find the list of compatible host compilers.

First, the OptiX Advanced Samples are written against OptiX 5.1.0 and will still work with OptiX 6.5.0.
Looks like the install descriptions are outdated.

OptiX 7 is a completely different API and requires a rewrite of the host code and an adaption of the device code.

CUDA 7.0 is not supporting MSVS 2019 and some of the NVCC options used in the OptiX examples to make callable programs work with CUDA 8.0 and higher.

Please try OptiX 6.5.0, CUDA 10.0 (or 10.1), and MSVS 2019.

Note that the FindCUDA.cmake inside the OptiX Advanced Sample is outdated compared to the version shipped with CMake and does not set the CUDA_HOST_COMPILER correctly because that location changed betweeen MSVS 2015 and 2017 to a different folder.

The forum has a search option in the upper right corner. See this post:
https://devtalk.nvidia.com/default/topic/1063852/optix/building-advanced-sample-with-optix-6-5-0-cuda10-1-and-msvs2019/post/5387253

Thank you for the help!

I now could build the program but it crashes directly on run with error

OptiX Error: 'A supported NVIDIA GPU could not be found

I only got a 780 ti, is that too old for running optix? I have the latest drivers installed (version 441.12)

Yes, a GTX 780Ti is a Kepler GPU and those are not supported by OptiX 5 and above anymore.
Only Maxwell and newer GPU architectures will work.
This information is also part of the OptiX release notes linked directly next to the OptiX SDK download button.

Oh snap that’s too bad.

Thank you very much for the help though, I promise to be better at checking the release notes in the future!