meson: switch gles1 and gles2 to auto options
This allows them to default to false on windows, but default to true
elsewhere. As a side effect turning off shared-glapi now automatically
turns off gles. Shared glapi remains a boolean defaulting to true.
v5: - new in this version
Reviewed-by: Eric Anholt <eric@anholt.net>
diff --git a/meson.build b/meson.build
index a637f3b..75e90e1 100644
--- a/meson.build
+++ b/meson.build
@@ -70,25 +70,43 @@
with_gles1 = get_option('gles1')
with_gles2 = get_option('gles2')
+if host_machine.system() == 'windows'
+ if with_gles1 == 'auto'
+ with_gles1 = 'false'
+ endif
+ if with_gles2 == 'auto'
+ with_gles2 = 'false'
+ endif
+endif
with_opengl = get_option('opengl')
-with_any_opengl = with_opengl or with_gles1 or with_gles2
-# Only build shared_glapi if at least one OpenGL API is enabled
-with_shared_glapi = get_option('shared-glapi') and with_any_opengl
-
+with_shared_glapi = get_option('shared-glapi')
# shared-glapi is required if at least two OpenGL APIs are being built
if not with_shared_glapi
- if ((with_gles1 and with_gles2) or (with_gles1 and with_opengl)
- or (with_gles2 and with_opengl))
+ if ((with_gles1 == 'true' and with_gles2 == 'true') or
+ (with_gles1 == 'true' and with_opengl) or
+ (with_gles2 == 'true' and with_opengl))
error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
endif
+ with_gles1 = 'false'
+ with_gles2 = 'false'
endif
# We require OpenGL for OpenGL ES
-if (with_gles1 or with_gles2) and not with_opengl
- error('building OpenGL ES without OpenGL is not supported.')
+if not with_opengl
+ if (with_gles1 == 'true' or with_gles2 == 'true') and not with_opengl
+ error('building OpenGL ES without OpenGL is not supported.')
+ endif
+ with_gles1 = 'false'
+ with_gles2 = 'false'
endif
+with_gles1 = with_gles1 != 'false'
+with_gles2 = with_gles2 != 'false'
+with_any_opengl = with_opengl or with_gles1 or with_gles2
+# Only build shared_glapi if at least one OpenGL API is enabled
+with_shared_glapi = get_option('shared-glapi') and with_any_opengl
+
system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'dragonfly', 'linux'].contains(host_machine.system())
dri_drivers = get_option('dri-drivers')