From d099181307253a22a57b7932ab32df02e196035f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 10 Sep 2017 21:02:26 +0200 Subject: [PATCH] Add library name override macros --- docs/compile.dox | 6 ++++++ src/egl_context.c | 16 ++++++++++++---- src/glx_context.c | 4 +++- src/osmesa_context.c | 4 +++- src/vulkan.c | 4 +++- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/docs/compile.dox b/docs/compile.dox index 75f938ca..35d65732 100644 --- a/docs/compile.dox +++ b/docs/compile.dox @@ -265,6 +265,12 @@ If you are linking the Vulkan loader statically into your application then you must also define @b _GLFW_VULKAN_STATIC. Otherwise, GLFW will attempt to use the external version. +If you are using a custom name for the Vulkan, EGL, GLX, OSMesa, OpenGL, GLESv1 +or GLESv2 library, you can override the default names by defining those you need +of @b _GLFW_VULKAN_LIBRARY, @b _GLFW_EGL_LIBRARY, @b _GLFW_GLX_LIBRARY, @b +_GLFW_OSMESA_LIBRARY, @b _GLFW_OPENGL_LIBRARY, @b _GLFW_GLESV1_LIBRARY and @b +_GLFW_GLESV2_LIBRARY. Otherwise, GLFW will use the built-in default names. + For the EGL context creation API, the following options are available: - @b _GLFW_USE_EGLPLATFORM_H to use `EGL/eglplatform.h` for native handle diff --git a/src/egl_context.c b/src/egl_context.c index d1bbbf08..54257f25 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -286,7 +286,9 @@ GLFWbool _glfwInitEGL(void) int i; const char* sonames[] = { -#if defined(_GLFW_WIN32) +#if defined(_GLFW_EGL_LIBRARY) + _GLFW_EGL_LIBRARY, +#elif defined(_GLFW_WIN32) "libEGL.dll", "EGL.dll", #elif defined(_GLFW_COCOA) @@ -601,7 +603,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, const char** sonames; const char* es1sonames[] = { -#if defined(_GLFW_WIN32) +#if defined(_GLFW_GLESV1_LIBRARY) + _GLFW_GLESV1_LIBRARY, +#elif defined(_GLFW_WIN32) "GLESv1_CM.dll", "libGLES_CM.dll", #elif defined(_GLFW_COCOA) @@ -614,7 +618,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, }; const char* es2sonames[] = { -#if defined(_GLFW_WIN32) +#if defined(_GLFW_GLESV2_LIBRARY) + _GLFW_GLESV2_LIBRARY, +#elif defined(_GLFW_WIN32) "GLESv2.dll", "libGLESv2.dll", #elif defined(_GLFW_COCOA) @@ -628,7 +634,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, }; const char* glsonames[] = { -#if defined(_GLFW_WIN32) +#if defined(_GLFW_OPENGL_LIBRARY) + _GLFW_OPENGL_LIBRARY, +#elif defined(_GLFW_WIN32) #elif defined(_GLFW_COCOA) #else "libGL.so.1", diff --git a/src/glx_context.c b/src/glx_context.c index dbac4ea7..e545fa0f 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -244,7 +244,9 @@ GLFWbool _glfwInitGLX(void) int i; const char* sonames[] = { -#if defined(__CYGWIN__) +#if defined(_GLFW_GLX_LIBRARY) + _GLFW_GLX_LIBRARY, +#elif defined(__CYGWIN__) "libGL-1.so", #else "libGL.so.1", diff --git a/src/osmesa_context.c b/src/osmesa_context.c index 46102fba..a7de33f2 100644 --- a/src/osmesa_context.c +++ b/src/osmesa_context.c @@ -113,7 +113,9 @@ GLFWbool _glfwInitOSMesa(void) int i; const char* sonames[] = { -#if defined(_WIN32) +#if defined(_GLFW_OSMESA_LIBRARY) + _GLFW_OSMESA_LIBRARY, +#elif defined(_WIN32) "libOSMesa.dll", "OSMesa.dll", #elif defined(__APPLE__) diff --git a/src/vulkan.c b/src/vulkan.c index f2473cf6..1fd15fad 100644 --- a/src/vulkan.c +++ b/src/vulkan.c @@ -49,7 +49,9 @@ GLFWbool _glfwInitVulkan(int mode) return GLFW_TRUE; #if !defined(_GLFW_VULKAN_STATIC) -#if defined(_GLFW_WIN32) +#if defined(_GLFW_VULKAN_LIBRARY) + _glfw.vk.handle = _glfw_dlopen(_GLFW_VULKAN_LIBRARY); +#elif defined(_GLFW_WIN32) _glfw.vk.handle = _glfw_dlopen("vulkan-1.dll"); #elif defined(_GLFW_COCOA) _glfw.vk.handle = _glfw_dlopen("libMoltenVK.dylib");