I would like to build some of the simplest examples of optix Samples as an exe which will have all its dependencies included in that file. What configurations should I do in the solution properties of VS to achieve this? I have set the runtime to /MT but I get linker errors like this:
|Error|LNK2019|unresolved external symbol __imp_glad_glBindBuffer referenced in function public: __cdecl sutil::CUDAOutputBuffer<struct uchar4>::~CUDAOutputBuffer<struct uchar4>(void) (??1?$CUDAOutputBuffer@Uuchar4@@@sutil@@QEAA@XZ)|optixTriangle|C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.6.0\SDK\build\optixTriangle\optixTriangle.obj|1||
You seem to be missing the OpenGL helper library
glad.lib in your project settings.
The CUDAOutputBuffer.h header does
#include <glad/glad.h> at the beginning and that lies in
OptiX SDK 7.7.0\SDK\support\glad\glad.h
There is a
CMakeLists.txt inside the support folder which builds the
glad.h and glad.c to a shared library of which the export library is referenced inside the sutil build.
You should be able to see all dependencies of the individual OptiX SDK projects when looking at the Compiler and Linker Command Line inside the project’s property pages inside the Visual Studio.
The sutil library is nothing I would recommend to use inside own applications, that is, outside the OptiX SDK example framework. It’s just convenience code to make adding OptiX SDK examples easier.
If you just want to experiment with some simple examples derived from any of the OptiX SDK examples’ source code, the root CMakeLists.txt explains how to add new example folder.
Everything else, esp. commercial applications, should really not add the sutil library to their dependencies.
Read the posts of the this search for why: https://forums.developer.nvidia.com/search?q=sutil%20%23visualization%3Aoptix
You’ll find links to other OptiX 7 application frameworks not using the sutil library in that list of posts as well.
When you say “to a shared libray”, do you mean static .lib or dynamic .dll?
With shared I meant dynamic load library (DLL).
If you look at the CMakeLists.txt it contains this:
add_library( glad SHARED
See the CMake Manual for options:
I don’t think this would be required if you simply add the
glad.c to your application sources itself and just compile them instead of building a library of that. That wouldn’t help with the sutil library, but I wouldn’t use that anyway (as described inside the posts under that forum search result above).