Allow enabling and disabling GLX support

Currently, GLX support in libepoxy at build time is hard coded, but
various platforms have expressed their preference for having a
configure-time option for it.

For instance:

 - various embedded distributors do not ship with X11, but wish to use
   libraries that depend on libepoxy now that Wayland is available
 - distributors for macOS still wish to retain the ability to ship
   their software with X11 enabled

By default, we want epoxy to build with GLX enabled pretty much
everywhere it makes sense, since it's only a build-time option and it's
not a run-time dependency.
macos/v1.5.9
Emmanuele Bassi 8 years ago
parent 6af57b0745
commit 476851ba41
  1. 26
      meson.build
  2. 5
      meson_options.txt
  3. 8
      src/dispatch_common.h
  4. 2
      test/meson.build

@ -30,26 +30,48 @@ conf.set_quoted('PACKAGE_LOCALEDIR', join_paths(get_option('prefix'), get_option
conf.set_quoted('PACKAGE_LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir'))) conf.set_quoted('PACKAGE_LIBEXECDIR', join_paths(get_option('prefix'), get_option('libexecdir')))
conf.set('HAVE_KHRPLATFORM_H', cc.has_header('KHR/khrplatform.h', required: false)) conf.set('HAVE_KHRPLATFORM_H', cc.has_header('KHR/khrplatform.h', required: false))
# GLX can be used on different platforms, so we expose a
# configure time switch to enable or disable it; in case
# the "auto" default value is set, we only enable GLX
# support on Linux and Unix
enable_glx = get_option('enable-glx')
if enable_glx == 'auto'
if host_system == 'windows' if host_system == 'windows'
build_glx = false build_glx = false
elif host_system == 'darwin'
build_glx = false
elif host_system == 'android'
build_glx = false
else
build_glx = true
endif
elif enable_glx == 'yes'
build_glx = true
elif enable_glx == 'no'
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'
build_egl = false build_egl = false
build_apple = false build_apple = false
build_wgl = true build_wgl = true
has_znow = true has_znow = true
elif host_system == 'darwin' elif host_system == 'darwin'
build_glx = false
build_egl = false build_egl = false
build_apple = true build_apple = true
build_wgl = false build_wgl = false
has_znow = false has_znow = false
else else
build_glx = true
build_egl = true build_egl = true
build_apple = false build_apple = false
build_wgl = false build_wgl = false
has_znow = true has_znow = true
endif endif
conf.set10('ENABLE_GLX', build_glx)
# Compiler flags, taken from the Xorg macros # Compiler flags, taken from the Xorg macros
test_cflags = [ test_cflags = [
'-Wpointer-arith', '-Wpointer-arith',

@ -1,3 +1,8 @@
option('enable-docs', option('enable-docs',
type: 'boolean', value: false, type: 'boolean', value: false,
description: 'Enable generating the Epoxy API reference (depends on Doxygen)') description: 'Enable generating the Epoxy API reference (depends on Doxygen)')
option('enable-glx',
type: 'combo',
choices: [ 'auto', 'yes', 'no' ],
value: 'auto',
description: 'Enable GLX support')

@ -23,15 +23,13 @@
#include "config.h" #include "config.h"
#include <stdbool.h>
#ifdef _WIN32 #ifdef _WIN32
#define PLATFORM_HAS_EGL 0 #define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_GLX 0 #define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 1 #define PLATFORM_HAS_WGL 1
#elif defined(__APPLE__) #elif defined(__APPLE__)
#define PLATFORM_HAS_EGL 0 #define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_GLX 0 #define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 0 #define PLATFORM_HAS_WGL 0
#elif defined(ANDROID) #elif defined(ANDROID)
#define PLATFORM_HAS_EGL 1 #define PLATFORM_HAS_EGL 1
@ -39,7 +37,7 @@
#define PLATFORM_HAS_WGL 0 #define PLATFORM_HAS_WGL 0
#else #else
#define PLATFORM_HAS_EGL 1 #define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_GLX 1 #define PLATFORM_HAS_GLX ENABLE_GLX
#define PLATFORM_HAS_WGL 0 #define PLATFORM_HAS_WGL 0
#endif #endif

@ -1,6 +1,6 @@
has_gles1 = gles1_dep.found() has_gles1 = gles1_dep.found()
has_gles2 = gles2_dep.found() has_gles2 = gles2_dep.found()
build_x11_tests = x11_dep.found() build_x11_tests = build_glx and x11_dep.found()
test_cflags = common_cflags + [ test_cflags = common_cflags + [
'-D_XOPEN_SOURCE', '-D_XOPEN_SOURCE',

Loading…
Cancel
Save