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
macos/v1.5.9
Emmanuele Bassi 6 years ago
parent 350a98a308
commit 8c3d371187
  1. 31
      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;
}

Loading…
Cancel
Save