mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-21 20:00:11 +00:00
Adjust loading procedure of the vk::detail::DynamicLoader on MacOS (#1991)
This commit is contained in:
parent
6902b578be
commit
43f7a18b02
@ -10,37 +10,57 @@
|
||||
{
|
||||
if ( !vulkanLibraryName.empty() )
|
||||
{
|
||||
# if defined( __unix__ ) || defined( __APPLE__ ) || defined( __QNX__ ) || defined(__Fuchsia__)
|
||||
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||
# elif defined( _WIN32 )
|
||||
# if defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( vulkanLibraryName.c_str() );
|
||||
# elif defined( __unix__ ) || defined( __APPLE__ ) || defined( __QNX__ ) || defined(__Fuchsia__)
|
||||
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
}
|
||||
else
|
||||
{
|
||||
# if defined( __unix__ ) || defined( __QNX__ ) || defined(__Fuchsia__)
|
||||
# if defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
# elif defined( __APPLE__ )
|
||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libMoltenVK.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
// Add support for using Vulkan and MoltenVK in a Framework. App store rules for iOS
|
||||
// strictly enforce no .dylib's. If they aren't found it just falls through
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "vulkan.framework/vulkan", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "MoltenVK.framework/MoltenVK", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
// modern versions of macOS don't search /usr/local/lib automatically contrary to what man dlopen says
|
||||
// Vulkan SDK uses this as the system-wide installation location, so we're going to fallback to this if all else fails
|
||||
if ( !m_library && ( getenv("DYLD_FALLBACK_LIBRARY_PATH") == NULL ) )
|
||||
{
|
||||
m_library = dlopen( "/usr/local/lib/libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# elif defined( __unix__ ) || defined( __QNX__ ) || defined(__Fuchsia__)
|
||||
m_library = dlopen( "libvulkan.so", RTLD_NOW | RTLD_LOCAL );
|
||||
if ( m_library == nullptr )
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# elif defined( __APPLE__ )
|
||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
if (m_library == nullptr)
|
||||
{
|
||||
m_library = dlopen("libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL);
|
||||
}
|
||||
# elif defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
}
|
||||
|
||||
#ifndef VULKAN_HPP_NO_EXCEPTIONS
|
||||
if ( m_library == nullptr )
|
||||
if ( !m_library )
|
||||
{
|
||||
// NOTE there should be an InitializationFailedError, but msvc insists on the symbol does not exist within the scope of this function.
|
||||
throw std::runtime_error( "Failed to load vulkan library!" );
|
||||
|
@ -17175,37 +17175,57 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
if ( !vulkanLibraryName.empty() )
|
||||
{
|
||||
# if defined( __unix__ ) || defined( __APPLE__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
|
||||
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||
# elif defined( _WIN32 )
|
||||
# if defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( vulkanLibraryName.c_str() );
|
||||
# elif defined( __unix__ ) || defined( __APPLE__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
|
||||
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
}
|
||||
else
|
||||
{
|
||||
# if defined( __unix__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
|
||||
m_library = dlopen( "libvulkan.so", RTLD_NOW | RTLD_LOCAL );
|
||||
if ( m_library == nullptr )
|
||||
{
|
||||
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# if defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
# elif defined( __APPLE__ )
|
||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
if ( m_library == nullptr )
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# elif defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libMoltenVK.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
// Add support for using Vulkan and MoltenVK in a Framework. App store rules for iOS
|
||||
// strictly enforce no .dylib's. If they aren't found it just falls through
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "vulkan.framework/vulkan", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "MoltenVK.framework/MoltenVK", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
// modern versions of macOS don't search /usr/local/lib automatically contrary to what man dlopen says
|
||||
// Vulkan SDK uses this as the system-wide installation location, so we're going to fallback to this if all else fails
|
||||
if ( !m_library && ( getenv( "DYLD_FALLBACK_LIBRARY_PATH" ) == NULL ) )
|
||||
{
|
||||
m_library = dlopen( "/usr/local/lib/libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# elif defined( __unix__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
|
||||
m_library = dlopen( "libvulkan.so", RTLD_NOW | RTLD_LOCAL );
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
}
|
||||
|
||||
# ifndef VULKAN_HPP_NO_EXCEPTIONS
|
||||
if ( m_library == nullptr )
|
||||
if ( !m_library )
|
||||
{
|
||||
// NOTE there should be an InitializationFailedError, but msvc insists on the symbol does not exist within the scope of this function.
|
||||
throw std::runtime_error( "Failed to load vulkan library!" );
|
||||
|
@ -7081,37 +7081,57 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
if ( !vulkanLibraryName.empty() )
|
||||
{
|
||||
# if defined( __unix__ ) || defined( __APPLE__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
|
||||
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||
# elif defined( _WIN32 )
|
||||
# if defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( vulkanLibraryName.c_str() );
|
||||
# elif defined( __unix__ ) || defined( __APPLE__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
|
||||
m_library = dlopen( vulkanLibraryName.c_str(), RTLD_NOW | RTLD_LOCAL );
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
}
|
||||
else
|
||||
{
|
||||
# if defined( __unix__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
|
||||
m_library = dlopen( "libvulkan.so", RTLD_NOW | RTLD_LOCAL );
|
||||
if ( m_library == nullptr )
|
||||
{
|
||||
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# if defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
# elif defined( __APPLE__ )
|
||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
if ( m_library == nullptr )
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# elif defined( _WIN32 )
|
||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libMoltenVK.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
// Add support for using Vulkan and MoltenVK in a Framework. App store rules for iOS
|
||||
// strictly enforce no .dylib's. If they aren't found it just falls through
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "vulkan.framework/vulkan", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "MoltenVK.framework/MoltenVK", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
// modern versions of macOS don't search /usr/local/lib automatically contrary to what man dlopen says
|
||||
// Vulkan SDK uses this as the system-wide installation location, so we're going to fallback to this if all else fails
|
||||
if ( !m_library && ( getenv( "DYLD_FALLBACK_LIBRARY_PATH" ) == NULL ) )
|
||||
{
|
||||
m_library = dlopen( "/usr/local/lib/libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# elif defined( __unix__ ) || defined( __QNX__ ) || defined( __Fuchsia__ )
|
||||
m_library = dlopen( "libvulkan.so", RTLD_NOW | RTLD_LOCAL );
|
||||
if ( !m_library )
|
||||
{
|
||||
m_library = dlopen( "libvulkan.so.1", RTLD_NOW | RTLD_LOCAL );
|
||||
}
|
||||
# else
|
||||
# error unsupported platform
|
||||
# endif
|
||||
}
|
||||
|
||||
# ifndef VULKAN_HPP_NO_EXCEPTIONS
|
||||
if ( m_library == nullptr )
|
||||
if ( !m_library )
|
||||
{
|
||||
// NOTE there should be an InitializationFailedError, but msvc insists on the symbol does not exist within the scope of this function.
|
||||
throw std::runtime_error( "Failed to load vulkan library!" );
|
||||
|
Loading…
Reference in New Issue
Block a user