Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ANGLE on macOS #239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,42 @@ gl_dep = dependency('gl', required: false)
if not gl_dep.found() and not build_glx
gl_dep = dependency('opengl', required: false)
endif

# We have multiple checks for EGL and GLES v2/v1 to support different providers:
# 1. pkg-config for Mesa
# 2. find_library() for ANGLE, which do not support pkg-config nor CMake.
# Note that Microsoft's "link" requires "lib" prefix.
# 3. CMake for Qt 5, which bundles ANGLE.
egl_dep = dependency('egl', required: false)
elg_headers_dep = egl_dep.partial_dependency(compile_args: true, includes: true)
if not egl_dep.found()
egl_dep = cc.find_library('EGL', required: false)
endif
akihikodaki marked this conversation as resolved.
Show resolved Hide resolved
if not egl_dep.found() and host_system == 'windows'
egl_dep = cc.find_library('libEGL.dll', required: false)
endif
if not egl_dep.found()
egl_dep = dependency('Qt5Gui', modules: 'Qt5::Gui_EGL', required: false)
endif

# Optional dependencies for tests
x11_dep = dependency('x11', required: false)
x11_headers_dep = x11_dep.partial_dependency(compile_args: true, includes: true)
elg_headers_dep = egl_dep.partial_dependency(compile_args: true, includes: true)

# GLES v2 and v1 may have pkg-config files, courtesy of downstream
# packagers; let's check those first, and fall back to find_library()
# if we fail
gles2_dep = dependency('glesv2', required: false)
if not gles2_dep.found()
gles2_dep = cc.find_library('libGLESv2', required: false)
gles2_dep = cc.find_library('GLESv2', required: false)
akihikodaki marked this conversation as resolved.
Show resolved Hide resolved
endif
if not gles2_dep.found() and host_system == 'windows'
gles2_dep = cc.find_library('libGLESv2.dll', required: false)
endif
if not gles2_dep.found()
egl_dep = dependency('Qt5Gui', modules: 'Qt5::Gui_GLESv2', required: false)
endif

gles1_dep = dependency('glesv1_cm', required: false)
if not gles1_dep.found()
gles1_dep = cc.find_library('libGLESv1_CM', required: false)
gles1_dep = cc.find_library('GLESv1_CM', required: false)
endif
if not gles1_dep.found() and host_system == 'windows'
gles1_dep = cc.find_library('libGLESv1_CM.dll', required: false)
endif

# On windows, the DLL has to have all of its functions
Expand All @@ -202,6 +220,10 @@ if host_system == 'windows'
gdi32_dep = cc.find_library('gdi32', required: true)
endif

# Optional dependencies for tests
x11_dep = dependency('x11', required: false)
x11_headers_dep = x11_dep.partial_dependency(compile_args: true, includes: true)

# Generates the dispatch tables
gen_dispatch_py = find_program('src/gen_dispatch.py')

Expand Down
5 changes: 3 additions & 2 deletions src/dispatch_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@

#if defined(__APPLE__)
#define GLX_LIB "/opt/X11/lib/libGL.1.dylib"
#define EGL_LIB "libEGL.dylib"
#define OPENGL_LIB "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
#define GLES1_LIB "libGLESv1_CM.so"
#define GLES2_LIB "libGLESv2.so"
#define GLES1_LIB "libGLESv1_CM.dylib"
#define GLES2_LIB "libGLESv2.dylib"
#elif defined(__ANDROID__)
#define GLX_LIB "libGLESv2.so"
#define EGL_LIB "libEGL.so"
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 1
#elif defined(__APPLE__)
#define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_EGL ENABLE_EGL
#define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 0
#elif defined(ANDROID)
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ endif
# Maintain compatibility with autotools; see: https://github.com/anholt/libepoxy/issues/108
darwin_versions = [1, '1.0']

epoxy_deps = [ dl_dep, ]
epoxy_deps = [ dl_dep, egl_dep ]
if host_system == 'windows'
epoxy_deps += [ opengl32_dep, gdi32_dep ]
endif
Expand Down