If that is your whole CMakeLists.txt hierarchy, then you’re not including the macro itself.
Isn’t there any CMake error message when you’re configuring and generating the solution?
Please read this post I linked above again:
https://forums.developer.nvidia.com/t/why-am-i-getting-optix-dir-notfound/279085/4
You’re missing some steps described in there:
If you want to build a CMake project for OptiX from scratch, I would recommend the following:
Sync my OptiX Advanced Examples linked here.
You only need the 3rdparty/CMake
folder and two CMakeLists.txt
files from that.
Then to build a standalone OptiX project, you need to merge two CMakeLists.txt files:
1.) The root CMakeLists.txt
file which sets up all things like the CMAKE_MODULE_PATH
to find the CMake scripts without the final add_subdirectory(apps)
and
2) The contents of one CMakeLists.txt of one individual example (the intro_runtime
one when you want to use the CUDA Runtime API and any of the others when using the CUDA Driver API. The difference is just CUDA::cudart
inside thetarget_link_library()
).
3.) Then you adjust the project name everywhere, change all the find_package() statements to what you need inside your project, and replace all source code filenames with your own and that’s about it.
The point 1 above means you’re missing line 8 and 12 from here:
https://github.com/NVIDIA/OptiX_Apps/blob/master/CMakeLists.txt#L8
You’re also missing to add the generated list of PROGRAM_MODULES (the *.optixir filenames) to the executable:
Filled here by the macro: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_runtime/CMakeLists.txt#L158
Added to the executable here: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_runtime/CMakeLists.txt#L198
so that the project knows that it actually needs to build these.
The filename of the generated module should be Raytracing.optixir
(or Raytracing.ptx
when building *.ptx). The macro is stripping the *.cu extension.
If you enable this message inside the macro, you will see the generated NVCC command lines inside the CMake GUI output window:
https://github.com/NVIDIA/OptiX_Apps/blob/master/3rdparty/CMake/nvcuda_compile_module.cmake#L45
If you want to see custom build commands inside the MSVS output during compilation, you need to increase the MSBuild verbosity like described here:
https://forums.developer.nvidia.com/t/redirect-nvcc-build-output-to-visual-studio-output-window/279618/2
Also, the CUDA C/C++ entries in the project settings is gone (as intended, I suppose?)
Yes. Since all *.cu files are now built with custom build rules, the CUDA Visual Studio Integration sheets are not applicable to those.