CMake Errors building Optix Prime Samples

I am using Visual Studio 2017 on Windows 10 to build the sample programs that ship with Optix 6.0.0. I have CUDA 10.0 installed and working on my NVIDIA Quadro P4000 GPU.

I am able to build most of the samples after following the “INSTALL-WIN.txt” instructions closely. I did need to upgrade my video driver to version 418.81.

Here are the error messages I am getting for the Prime program samples and one Optix sample:

CMake Error at optixRaycasting_generated_optixRaycastingKernels.cu.obj.cmake:259 (message):
Error generating C:/ProgramData/NVIDIA Corporation/OptiX SDK
6.0.0/SDK/build/lib/ptx/Debug/optixRaycasting_generated_optixRaycastingKernels.cu.obj

optixMDLSphere.vcxproj -> C:\ProgramData\NVIDIA Corporation\OptiX SDK 6.0.0\SDK\build\bin\Debug\optixMDLSphere.exe
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: “cmd.exe” exited with code 1.
Done building project “optixRaycasting.vcxproj” – FAILED.

CMake Error at primeSimplePP_generated_primeKernels.cu.obj.cmake:259 (message):
Error generating C:/ProgramData/NVIDIA Corporation/OptiX SDK
6.0.0/SDK/build/lib/ptx/Debug/primeSimplePP_generated_primeKernels.cu.obj

CMake Error at primeMasking_generated_primeKernels.cu.obj.cmake:259 (message):
Error generating C:/ProgramData/NVIDIA Corporation/OptiX SDK
6.0.0/SDK/build/lib/ptx/Debug/primeMasking_generated_primeKernels.cu.obj

CMake Error at primeInstancing_generated_primeKernels.cu.obj.cmake:259 (message):
Error generating C:/ProgramData/NVIDIA Corporation/OptiX SDK
6.0.0/SDK/build/lib/ptx/Debug/primeInstancing_generated_primeKernels.cu.obj

CMake Error at primeMultiBuffering_generated_primeKernels.cu.obj.cmake:259 (message):
Error generating C:/ProgramData/NVIDIA Corporation/OptiX SDK
6.0.0/SDK/build/lib/ptx/Debug/primeMultiBuffering_generated_primeKernels.cu.obj

CMake Error at primeMultiGpu_generated_primeKernels.cu.obj.cmake:259 (message):
Error generating C:/ProgramData/NVIDIA Corporation/OptiX SDK
6.0.0/SDK/build/lib/ptx/Debug/primeMultiGpu_generated_primeKernels.cu.obj

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: “cmd.exe” exited with code 1.
Done building project “primeSimplePP.vcxproj” – FAILED.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: “cmd.exe” exited with code 1.
Done building project “primeMasking.vcxproj” – FAILED.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: “cmd.exe” exited with code 1.
Done building project “primeMultiBuffering.vcxproj” – FAILED.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: “cmd.exe” exited with code 1.
Done building project “primeInstancing.vcxproj” – FAILED.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: “cmd.exe” exited with code 1.
Done building project “primeMultiGpu.vcxproj” – FAILED.

Here are my questions:

-How do I fix this issue?
-What is the easiest way to get CMake to print verbosely so I can see what is failing?
-Is it possible to build these projects in Visual Studio 2017? Or, is there a compatibility issue?

Just as a side note, I am able to build and run CUDA 10.0 projects successfully with Visual Studio 2017. Also, all the other Optix samples are build-able with Visual Studio 2017.

Thanks for your help!

Internally, we recommend people use VS 2015 rather than fight with VS 2017. That said, we do have some notes on how to get VS 2017 to work. I’m not sure if they’ll work for you, but maybe. The notes predate OptiX 6, so I’m not sure if anyone here has tried VS 2017 with OptiX 6. YMMV :)

To generate a Visual Studio 2017 solution, you must :

  1. Select Visual Studio 15 2017 Win64 in the tool chain

  2. Change the variable BAT_PATH_TO_VCVARSALL in CmakeList.txt:
    set(BAT_PATH_TO_VCVARSALL “$(VCInstallDir)vcvarsall.bat”)

  3. In cmake to set the CUDA_HOST_COMPILER to C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe

Again, no guarantees, I haven’t tried it, don’t know if it works, so I hope it’s a helpful hint and not a waste of time. Good luck!