summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2018-05-29 22:23:23 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2018-05-29 22:58:41 +0100
commit8c3d37118752075ea84eb51772093eaad3dd7ba5 (patch)
treee22f4b22bac10f03ed6f6029ed44a714ff0331db
parent350a98a3085255e31909065d66539e0c7d58d371 (diff)
downloadlibepoxy-8c3d37118752075ea84eb51772093eaad3dd7ba5.tar.gz
Use the appropriate symbols on __APPLE__
When building on macOS we don't have access to EGL, and GLX support is conditional. We should ensure we're using the appropriate paths depending on the platform, and protect our use of macros to avoid undefined symbols. Closes: #176
-rw-r--r--src/dispatch_common.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/dispatch_common.c b/src/dispatch_common.c
index e2bb186..effd99a 100644
--- a/src/dispatch_common.c
+++ b/src/dispatch_common.c
@@ -173,26 +173,24 @@
#include "dispatch_common.h"
-#ifdef __APPLE__
+#if defined(__APPLE__)
#define GLX_LIB "/opt/X11/lib/libGL.1.dylib"
#define OPENGL_LIB "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
+#define GLES1_LIB "libGLESv1_CM.so"
+#define GLES2_LIB "libGLESv2.so"
#elif defined(__ANDROID__)
#define GLX_LIB "libGLESv2.so"
-#else
-#define GLVND_GLX_LIB "libGLX.so.1"
-#define GLX_LIB "libGL.so.1"
-#endif
-
-#ifdef __ANDROID__
#define EGL_LIB "libEGL.so"
#define GLES1_LIB "libGLESv1_CM.so"
#define GLES2_LIB "libGLESv2.so"
-#elif defined _WIN32
+#elif defined(_WIN32)
#define EGL_LIB "libEGL.dll"
#define GLES1_LIB "libGLES_CM.dll"
#define GLES2_LIB "libGLESv2.dll"
#define OPENGL_LIB "OPENGL32"
#else
+#define GLVND_GLX_LIB "libGLX.so.1"
+#define GLX_LIB "libGL.so.1"
#define EGL_LIB "libEGL.so.1"
#define GLES1_LIB "libGLESv1_CM.so.1"
#define GLES2_LIB "libGLESv2.so.2"
@@ -553,23 +551,25 @@ epoxy_internal_has_gl_extension(const char *ext, bool invalid_op_mode)
bool
epoxy_load_glx(bool exit_if_fails, bool load)
{
-#ifdef GLVND_GLX_LIB
+#ifdef PLATFORM_HAS_GLX
+# ifdef GLVND_GLX_LIB
/* prefer the glvnd library if it exists */
if (!api.glx_handle)
get_dlopen_handle(&api.glx_handle, GLVND_GLX_LIB, false, load);
-#endif
+# endif
if (!api.glx_handle)
get_dlopen_handle(&api.glx_handle, GLX_LIB, exit_if_fails, load);
-
+#endif
return api.glx_handle != NULL;
}
void *
epoxy_conservative_glx_dlsym(const char *name, bool exit_if_fails)
{
+#ifdef PLATFORM_HAS_GLX
if (epoxy_load_glx(exit_if_fails, exit_if_fails))
return do_dlsym(&api.glx_handle, name, exit_if_fails);
-
+#endif
return NULL;
}
@@ -636,15 +636,20 @@ epoxy_conservative_has_gl_extension(const char *ext)
bool
epoxy_load_egl(bool exit_if_fails, bool load)
{
+#if PLATFORM_HAS_EGL
return get_dlopen_handle(&api.egl_handle, EGL_LIB, exit_if_fails, load);
+#else
+ return false;
+#endif
}
void *
epoxy_conservative_egl_dlsym(const char *name, bool exit_if_fails)
{
+#if PLATFORM_HAS_EGL
if (epoxy_load_egl(exit_if_fails, exit_if_fails))
return do_dlsym(&api.egl_handle, name, exit_if_fails);
-
+#endif
return NULL;
}