mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
macOS: Fix Vulkan loader loading for Null platform
This commit is contained in:
+5
-2
@@ -145,12 +145,10 @@ endif()
|
|||||||
if (GLFW_BUILD_COCOA)
|
if (GLFW_BUILD_COCOA)
|
||||||
target_link_libraries(glfw PRIVATE "-framework Cocoa"
|
target_link_libraries(glfw PRIVATE "-framework Cocoa"
|
||||||
"-framework IOKit"
|
"-framework IOKit"
|
||||||
"-framework CoreFoundation"
|
|
||||||
"-framework QuartzCore")
|
"-framework QuartzCore")
|
||||||
|
|
||||||
list(APPEND glfw_PKG_LIBS "-framework Cocoa"
|
list(APPEND glfw_PKG_LIBS "-framework Cocoa"
|
||||||
"-framework IOKit"
|
"-framework IOKit"
|
||||||
"-framework CoreFoundation"
|
|
||||||
"-framework QuartzCore")
|
"-framework QuartzCore")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -236,6 +234,11 @@ if (UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
target_link_libraries(glfw PRIVATE "-framework CoreFoundation")
|
||||||
|
list(APPEND glfw_PKG_LIBS "-framework CoreFoundation")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (GLFW_USE_HYBRID_HPG)
|
if (GLFW_USE_HYBRID_HPG)
|
||||||
target_compile_definitions(glfw PRIVATE _GLFW_USE_HYBRID_HPG)
|
target_compile_definitions(glfw PRIVATE _GLFW_USE_HYBRID_HPG)
|
||||||
|
|||||||
@@ -450,41 +450,6 @@ static GLFWbool initializeTIS(void)
|
|||||||
|
|
||||||
@end // GLFWApplicationDelegate
|
@end // GLFWApplicationDelegate
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
////// GLFW internal API //////
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void* _glfwLoadLocalVulkanLoaderCocoa(void)
|
|
||||||
{
|
|
||||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
|
||||||
if (!bundle)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle);
|
|
||||||
if (!frameworksUrl)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
|
|
||||||
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
|
|
||||||
if (!loaderUrl)
|
|
||||||
{
|
|
||||||
CFRelease(frameworksUrl);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
char path[PATH_MAX];
|
|
||||||
void* handle = NULL;
|
|
||||||
|
|
||||||
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
|
|
||||||
handle = _glfwPlatformLoadModule(path);
|
|
||||||
|
|
||||||
CFRelease(loaderUrl);
|
|
||||||
CFRelease(frameworksUrl);
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -291,8 +291,6 @@ void _glfwRestoreVideoModeCocoa(_GLFWmonitor* monitor);
|
|||||||
|
|
||||||
float _glfwTransformYCocoa(float y);
|
float _glfwTransformYCocoa(float y);
|
||||||
|
|
||||||
void* _glfwLoadLocalVulkanLoaderCocoa(void);
|
|
||||||
|
|
||||||
GLFWbool _glfwInitNSGL(void);
|
GLFWbool _glfwInitNSGL(void);
|
||||||
void _glfwTerminateNSGL(void);
|
void _glfwTerminateNSGL(void);
|
||||||
GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window,
|
||||||
|
|||||||
+36
-3
@@ -34,6 +34,40 @@
|
|||||||
#define _GLFW_FIND_LOADER 1
|
#define _GLFW_FIND_LOADER 1
|
||||||
#define _GLFW_REQUIRE_LOADER 2
|
#define _GLFW_REQUIRE_LOADER 2
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
|
static void* loadLocalVulkanLoaderMacOS(void)
|
||||||
|
{
|
||||||
|
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||||
|
if (!bundle)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle);
|
||||||
|
if (!frameworksUrl)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
|
||||||
|
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
|
||||||
|
if (!loaderUrl)
|
||||||
|
{
|
||||||
|
CFRelease(frameworksUrl);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char path[PATH_MAX];
|
||||||
|
void* handle = NULL;
|
||||||
|
|
||||||
|
if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
|
||||||
|
handle = _glfwPlatformLoadModule(path);
|
||||||
|
|
||||||
|
CFRelease(loaderUrl);
|
||||||
|
CFRelease(frameworksUrl);
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __APPLE__
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
@@ -57,11 +91,10 @@ GLFWbool _glfwInitVulkan(int mode)
|
|||||||
_glfw.vk.handle = _glfwPlatformLoadModule(_GLFW_VULKAN_LIBRARY);
|
_glfw.vk.handle = _glfwPlatformLoadModule(_GLFW_VULKAN_LIBRARY);
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
_glfw.vk.handle = _glfwPlatformLoadModule("vulkan-1.dll");
|
_glfw.vk.handle = _glfwPlatformLoadModule("vulkan-1.dll");
|
||||||
#elif defined(_GLFW_COCOA)
|
#elif defined(__APPLE__)
|
||||||
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.1.dylib");
|
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.1.dylib");
|
||||||
if (!_glfw.vk.handle)
|
if (!_glfw.vk.handle)
|
||||||
_glfw.vk.handle = _glfwLoadLocalVulkanLoaderCocoa();
|
_glfw.vk.handle = loadLocalVulkanLoaderMacOS();
|
||||||
#elif defined(__APPLE__)
|
|
||||||
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
#elif defined(__OpenBSD__) || defined(__NetBSD__)
|
||||||
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so");
|
_glfw.vk.handle = _glfwPlatformLoadModule("libvulkan.so");
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user