mackron/vkbind

custom path for vkbLoadVulkanSO

pjako opened this issue · 3 comments

pjako commented

While testing the library on macos I discovered that vkbind only looks for libMoltenVK.dylib in its working folder.
Would be neat to pass a path or have a define where I can set a path where it looks first for the dynamic library.

I had to actually check where I was using libMoltenVK.dylib because I didn't even remember adding that! I don't want to have a parameter because it just makes vkbInit() messier, but I'm happy to add a define. How would this work for you?

const char* vulkanSONames[] = {
#if defined(VKBIND_VULKAN_SO)
    VKBIND_VULKAN_SO,
#endif
#if defined(_WIN32)
    "vulkan-1.dll"
#elif defined(__APPLE__)
    /*
    The idea here is that since MoltenVK seems to be the de facto standard for Vulkan on Apple platforms at the moment we'll try
    that first. If Apple ever decides to officially support Vulkan we can perhaps consider dropping it to the bottom of the priority
    list. Not sure if this reasoning is sound, but it makes sense in my head!
    */
    "libMoltenVK.dylib",
    "libvulkan.dylib.1",
    "libvulkan.dylib"
#else
    "libvulkan.so.1",
    "libvulkan.so"
#endif
};

So you'd set VKBIND_VULKAN_SO to a string, and if it's defined before the implementation of vkbind (or on the command line) it'll be added to the search list.

By the way, for your purposes specifically, are you wanting to support a path that would be in a standard or at least de-facto standard location? If so, I'd be happy to just add it to list of fixed search paths.

pjako commented

Yep thats fine!

For me I just want to avoid to copy the dll over to the build folder everytime I build.
I have it in a subfolder inside my project. So its really only relevant during development (I think).

No worries. That's now in the master branch (along with an update to the latest version of Vulkan which apparently I missed...).