diff --git a/meson.build b/meson.build index c8e45cd..9c44d3c 100644 --- a/meson.build +++ b/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('HAVE_KHRPLATFORM_H', cc.has_header('KHR/khrplatform.h', required: false)) -if host_system == 'windows' +# 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' + 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_apple = false build_wgl = true has_znow = true elif host_system == 'darwin' - build_glx = false build_egl = false build_apple = true build_wgl = false has_znow = false else - build_glx = true build_egl = true build_apple = false build_wgl = false has_znow = true endif +conf.set10('ENABLE_GLX', build_glx) + # Compiler flags, taken from the Xorg macros test_cflags = [ '-Wpointer-arith', diff --git a/meson_options.txt b/meson_options.txt index 4eaa634..18932f5 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,8 @@ option('enable-docs', type: 'boolean', value: false, 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') diff --git a/src/dispatch_common.h b/src/dispatch_common.h index 40d4bbc..b41f54b 100644 --- a/src/dispatch_common.h +++ b/src/dispatch_common.h @@ -23,15 +23,13 @@ #include "config.h" -#include - #ifdef _WIN32 #define PLATFORM_HAS_EGL 0 -#define PLATFORM_HAS_GLX 0 +#define PLATFORM_HAS_GLX ENABLE_GLX #define PLATFORM_HAS_WGL 1 #elif defined(__APPLE__) #define PLATFORM_HAS_EGL 0 -#define PLATFORM_HAS_GLX 0 +#define PLATFORM_HAS_GLX ENABLE_GLX #define PLATFORM_HAS_WGL 0 #elif defined(ANDROID) #define PLATFORM_HAS_EGL 1 @@ -39,7 +37,7 @@ #define PLATFORM_HAS_WGL 0 #else #define PLATFORM_HAS_EGL 1 -#define PLATFORM_HAS_GLX 1 +#define PLATFORM_HAS_GLX ENABLE_GLX #define PLATFORM_HAS_WGL 0 #endif diff --git a/test/meson.build b/test/meson.build index 857a980..2340fc6 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 = x11_dep.found() +build_x11_tests = build_glx and x11_dep.found() test_cflags = common_cflags + [ '-D_XOPEN_SOURCE',