diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2018-02-23 15:44:50 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2018-02-23 16:05:50 +0000 |
commit | ce8cbdbe064f5fd7f3e78b6349fa86604e6189d7 (patch) | |
tree | 8b497a038caebc24a74c64d0d8ebc596c9b081fe | |
parent | baa75c4a92bff37cb742a8c3ad42ab93e4f2a3d6 (diff) | |
download | libepoxy-ce8cbdbe064f5fd7f3e78b6349fa86604e6189d7.tar.gz |
Allow building Epoxy without X11
Epoxy can be compiled with GLX and X11 native resources on EGL. We can
disable the former, but the latter is always built in when enabling EGL
support.
Some platforms do not support X11 at all, so we need a way to disable
X11 when configuring Epoxy.
-rw-r--r-- | configure.ac | 27 | ||||
-rw-r--r-- | meson.build | 9 | ||||
-rw-r--r-- | meson_options.txt | 4 | ||||
-rw-r--r-- | src/dispatch_common.h | 7 | ||||
-rw-r--r-- | test/meson.build | 9 |
5 files changed, 48 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac index 045f920..2a4fed4 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,11 @@ AC_CHECK_HEADER([KHR/khrplatform.h], # uintptr_t to a void *") by default. Kill that. XORG_TESTSET_CFLAG(CWARNFLAGS, [-Wno-int-conversion]) +AC_ARG_ENABLE([x11], + [AC_HELP_STRING([--enable-x11=@<:@yes,no@:>@], [Enable X11 support @<:@default=yes@:>@])], + [enable_x11=$enableval], + [enable_x11=yes]) + AC_ARG_ENABLE([glx], [AC_HELP_STRING([--enable-glx=@<:@auto,yes,no@:>@], [Enable GLX support @<:@default=auto@:>@])], [enable_glx=$enableval], @@ -148,6 +153,13 @@ AS_CASE([$host_os], AC_SUBST(EPOXY_LINK_LIBS) +if test x$enable_x11 = xno; then + if test x$enable_glx = xyes; then + AC_MSG_ERROR([GLX support is explicitly enabled, but X11 was disabled]) + fi + build_glx=no +fi + AM_CONDITIONAL(BUILD_EGL, test x$build_egl = xyes) if test x$build_egl = xyes; then PKG_CHECK_MODULES(EGL, [egl]) @@ -214,14 +226,17 @@ AS_CASE(["$host"], AC_SUBST([VISIBILITY_CFLAGS]) +if test x$enable_x11 = xyes; then + PKG_CHECK_MODULES(X11, [x11], [x11=yes], [x11=no]) + if test x$x11 = xno -a x$build_glx = xyes; then + AC_MSG_ERROR([libX11 headers (libx11-dev) are required to build with GLX support]) + fi +else + x11=no +fi + if test x$build_glx = xyes; then - PKG_CHECK_MODULES(X11, [x11], [x11=yes], [x11=no]) - if test x$x11 = xno -a x$build_glx = xyes; then - AC_MSG_ERROR([libX11 headers (libx11-dev) required to build with GLX support]) - fi AC_DEFINE(ENABLE_GLX, [1], [Whether GLX support is enabled]) -else - x11=no fi AM_CONDITIONAL(HAVE_X11, test x$x11 = xyes) diff --git a/meson.build b/meson.build index 026d359..2def595 100644 --- a/meson.build +++ b/meson.build @@ -70,6 +70,14 @@ elif enable_egl == 'no' build_egl = false endif +enable_x11 = get_option('x11') +if not enable_x11 + if enable_glx == 'yes' + error('GLX support is explicitly enabled, but X11 was disabled') + endif + build_glx = false +endif + # The remaining platform specific API for GL/GLES are enabled # depending on the platform we're building for if host_system == 'windows' @@ -88,6 +96,7 @@ endif conf.set10('ENABLE_GLX', build_glx) conf.set10('ENABLE_EGL', build_egl) +conf.set10('ENABLE_X11', enable_x11) # Compiler flags, taken from the Xorg macros if cc.get_id() == 'msvc' diff --git a/meson_options.txt b/meson_options.txt index 244476a..fc3371c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -11,3 +11,7 @@ option('enable-egl', choices: [ 'auto', 'yes', 'no' ], value: 'auto', description: 'Enable EGL support') +option('x11', + type: 'boolean', + value: true, + description: 'Enable X11 support (GLX or EGL-X11)') diff --git a/src/dispatch_common.h b/src/dispatch_common.h index 28135c7..9675cff 100644 --- a/src/dispatch_common.h +++ b/src/dispatch_common.h @@ -46,6 +46,13 @@ #include "epoxy/glx.h" #endif #if PLATFORM_HAS_EGL +# if !ENABLE_X11 +/* Mesa uses this symbol to avoid including X11 headers when including + * EGL.h; since X11 was explicitly disabled at configuration time, we + * should do the same + */ +# define MESA_EGL_NO_X11_HEADERS 1 +# endif #include "epoxy/egl.h" #endif #if PLATFORM_HAS_WGL diff --git a/test/meson.build b/test/meson.build index 2340fc6..a72d02f 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,6 +1,6 @@ has_gles1 = gles1_dep.found() has_gles2 = gles2_dep.found() -build_x11_tests = build_glx and x11_dep.found() +build_x11_tests = enable_x11 and x11_dep.found() test_cflags = common_cflags + [ '-D_XOPEN_SOURCE', @@ -39,11 +39,16 @@ if build_egl and build_x11_tests egl_tests = [ [ 'egl_has_extension_nocontext', [], [ 'egl_has_extension_nocontext.c' ], true, ], - [ 'egl_gl', [], [ 'egl_gl.c' ], true, ], [ 'egl_gles1_without_glx', [ '-DGLES_VERSION=1', ], [ 'egl_without_glx.c' ], has_gles1, ], [ 'egl_gles2_without_glx', [ '-DGLES_VERSION=2', ], [ 'egl_without_glx.c' ], has_gles2, ], ] + if build_glx + egl_tests += [ + [ 'egl_gl', [], [ 'egl_gl.c' ], true, ], + ] + endif + foreach test: egl_tests test_name = test[0] test_source = test[2] |