Pārlūkot izejas kodu

Add library name override macros

Camilla Löwy 8 gadi atpakaļ
vecāks
revīzija
d099181307
5 mainītis faili ar 27 papildinājumiem un 7 dzēšanām
  1. 6 0
      docs/compile.dox
  2. 12 4
      src/egl_context.c
  3. 3 1
      src/glx_context.c
  4. 3 1
      src/osmesa_context.c
  5. 3 1
      src/vulkan.c

+ 6 - 0
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
 must also define @b _GLFW_VULKAN_STATIC.  Otherwise, GLFW will attempt to use the
 external version.
 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:
 For the EGL context creation API, the following options are available:
 
 
  - @b _GLFW_USE_EGLPLATFORM_H to use `EGL/eglplatform.h` for native handle
  - @b _GLFW_USE_EGLPLATFORM_H to use `EGL/eglplatform.h` for native handle

+ 12 - 4
src/egl_context.c

@@ -286,7 +286,9 @@ GLFWbool _glfwInitEGL(void)
     int i;
     int i;
     const char* sonames[] =
     const char* sonames[] =
     {
     {
-#if defined(_GLFW_WIN32)
+#if defined(_GLFW_EGL_LIBRARY)
+        _GLFW_EGL_LIBRARY,
+#elif defined(_GLFW_WIN32)
         "libEGL.dll",
         "libEGL.dll",
         "EGL.dll",
         "EGL.dll",
 #elif defined(_GLFW_COCOA)
 #elif defined(_GLFW_COCOA)
@@ -601,7 +603,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
         const char** sonames;
         const char** sonames;
         const char* es1sonames[] =
         const char* es1sonames[] =
         {
         {
-#if defined(_GLFW_WIN32)
+#if defined(_GLFW_GLESV1_LIBRARY)
+            _GLFW_GLESV1_LIBRARY,
+#elif defined(_GLFW_WIN32)
             "GLESv1_CM.dll",
             "GLESv1_CM.dll",
             "libGLES_CM.dll",
             "libGLES_CM.dll",
 #elif defined(_GLFW_COCOA)
 #elif defined(_GLFW_COCOA)
@@ -614,7 +618,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
         };
         };
         const char* es2sonames[] =
         const char* es2sonames[] =
         {
         {
-#if defined(_GLFW_WIN32)
+#if defined(_GLFW_GLESV2_LIBRARY)
+            _GLFW_GLESV2_LIBRARY,
+#elif defined(_GLFW_WIN32)
             "GLESv2.dll",
             "GLESv2.dll",
             "libGLESv2.dll",
             "libGLESv2.dll",
 #elif defined(_GLFW_COCOA)
 #elif defined(_GLFW_COCOA)
@@ -628,7 +634,9 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
         };
         };
         const char* glsonames[] =
         const char* glsonames[] =
         {
         {
-#if defined(_GLFW_WIN32)
+#if defined(_GLFW_OPENGL_LIBRARY)
+            _GLFW_OPENGL_LIBRARY,
+#elif defined(_GLFW_WIN32)
 #elif defined(_GLFW_COCOA)
 #elif defined(_GLFW_COCOA)
 #else
 #else
             "libGL.so.1",
             "libGL.so.1",

+ 3 - 1
src/glx_context.c

@@ -244,7 +244,9 @@ GLFWbool _glfwInitGLX(void)
     int i;
     int i;
     const char* sonames[] =
     const char* sonames[] =
     {
     {
-#if defined(__CYGWIN__)
+#if defined(_GLFW_GLX_LIBRARY)
+        _GLFW_GLX_LIBRARY,
+#elif defined(__CYGWIN__)
         "libGL-1.so",
         "libGL-1.so",
 #else
 #else
         "libGL.so.1",
         "libGL.so.1",

+ 3 - 1
src/osmesa_context.c

@@ -113,7 +113,9 @@ GLFWbool _glfwInitOSMesa(void)
     int i;
     int i;
     const char* sonames[] =
     const char* sonames[] =
     {
     {
-#if defined(_WIN32)
+#if defined(_GLFW_OSMESA_LIBRARY)
+        _GLFW_OSMESA_LIBRARY,
+#elif defined(_WIN32)
         "libOSMesa.dll",
         "libOSMesa.dll",
         "OSMesa.dll",
         "OSMesa.dll",
 #elif defined(__APPLE__)
 #elif defined(__APPLE__)

+ 3 - 1
src/vulkan.c

@@ -49,7 +49,9 @@ GLFWbool _glfwInitVulkan(int mode)
         return GLFW_TRUE;
         return GLFW_TRUE;
 
 
 #if !defined(_GLFW_VULKAN_STATIC)
 #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");
     _glfw.vk.handle = _glfw_dlopen("vulkan-1.dll");
 #elif defined(_GLFW_COCOA)
 #elif defined(_GLFW_COCOA)
     _glfw.vk.handle = _glfw_dlopen("libMoltenVK.dylib");
     _glfw.vk.handle = _glfw_dlopen("libMoltenVK.dylib");