Skip to content

Commit

Permalink
Merge branch 'tpetazzoni-make-egl-optional'
Browse files Browse the repository at this point in the history
Allow optionally disabling EGL support, just like we allow disabling GLX
support.

Closes anholt#123
  • Loading branch information
ebassi committed Jun 6, 2017
2 parents 64e9428 + 3103a27 commit eaaafd5
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 12 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ before_script:
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && CC=$CC ./epoxy-run-tests.sh" ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && CC=$CC ./epoxy-run-tests.sh -Denable-glx=no" ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && CC=$CC ./epoxy-run-tests.sh -Denable-egl=no" ; fi
32 changes: 27 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,34 @@ AS_CASE([$enable_glx],
[AC_MSG_ERROR([Invalid value "$enable_glx" for option "--enable-glx"])]
])

# The remaining platform specific API for GL/GLES are enabled
# depending on the platform we're building for
AC_ARG_ENABLE([egl],
[AC_HELP_STRING([--enable-egl=@<:@auto,yes,no@:>@], [Enable EGL support @<:@default=auto@:>@])],
[enable_egl=$enableval],
[enable_egl=auto])

AS_CASE([$enable_egl],
[auto], [
AS_CASE([$host_os],
[mingw*], [build_egl=no],
[darwin*], [build_egl=no],
[build_egl=yes])
],

[yes], [
build_egl=yes
],

[no], [
build_egl=no
],

[AC_MSG_ERROR([Invalid value "$enable_egl" for option "--enable-egl"])]
])

# The remaining platform specific API are enabled depending on the
# platform we're building for
AS_CASE([$host_os],
[mingw*], [
build_egl=no
build_wgl=yes
has_znow=yes
# On windows, the DLL has to have all of its functions
Expand All @@ -108,15 +131,13 @@ AS_CASE([$host_os],
],

[darwin*], [
build_egl=no
build_wgl=no
build_apple=yes
has_znow=no
EPOXY_LINK_LIBS=""
],

[
build_egl=yes
build_wgl=no
has_znow=yes
# On platforms with dlopen, we load everything dynamically and
Expand All @@ -131,6 +152,7 @@ AM_CONDITIONAL(BUILD_EGL, test x$build_egl = xyes)
if test x$build_egl = xyes; then
PKG_CHECK_MODULES(EGL, [egl])
AC_DEFINE([BUILD_EGL], [1], [build EGL tests])
AC_DEFINE(ENABLE_EGL, [1], [Whether EGL support is enabled])
fi

AM_CONDITIONAL(BUILD_GLX, test x$build_glx = xyes)
Expand Down
21 changes: 18 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,41 @@ elif enable_glx == 'no'
build_glx = false
endif

enable_egl = get_option('enable-egl')
if enable_egl == 'auto'
if host_system == 'windows'
build_egl = false
elif host_system == 'darwin'
build_egl = false
elif host_system == 'android'
build_egl = true
else
build_egl = true
endif
elif enable_egl == 'yes'
build_egl = true
elif enable_egl == 'no'
build_egl = false
endif

# The remaining platform specific API for GL/GLES are enabled
# depending on the platform we're building for
if host_system == 'windows'
build_egl = false
build_apple = false
build_wgl = true
has_znow = true
elif host_system == 'darwin'
build_egl = false
build_apple = true
build_wgl = false
has_znow = false
else
build_egl = true
build_apple = false
build_wgl = false
has_znow = true
endif

conf.set10('ENABLE_GLX', build_glx)
conf.set10('ENABLE_EGL', build_egl)

# Compiler flags, taken from the Xorg macros
if cc.get_id() == 'msvc'
Expand Down
5 changes: 5 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ option('enable-glx',
choices: [ 'auto', 'yes', 'no' ],
value: 'auto',
description: 'Enable GLX support')
option('enable-egl',
type: 'combo',
choices: [ 'auto', 'yes', 'no' ],
value: 'auto',
description: 'Enable EGL support')
8 changes: 4 additions & 4 deletions src/dispatch_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
#include "config.h"

#ifdef _WIN32
#define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_EGL ENABLE_EGL
#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)
#define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_EGL ENABLE_EGL
#define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 0
#else
#define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_EGL ENABLE_EGL
#define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 0
#endif
Expand Down

0 comments on commit eaaafd5

Please sign in to comment.