From ddc15fba2be29eb667bd89625d468455b63e0bcf Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 19 Oct 2018 09:47:41 -0700 Subject: [PATCH] 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 --- meson.build | 34 ++++++++++++++++++++++++++-------- meson_options.txt | 10 ++++++---- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/meson.build b/meson.build index a637f3b1442..75e90e1ff6a 100644 --- a/meson.build +++ b/meson.build @@ -70,25 +70,43 @@ endif 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') diff --git a/meson_options.txt b/meson_options.txt index 4428745bef7..6cddf33a5c3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -181,14 +181,16 @@ option( ) option( 'gles1', - type : 'boolean', - value : true, + type : 'combo', + value : 'auto', + choices : ['auto', 'true', 'false'], description : 'Build support for OpenGL ES 1.x' ) option( 'gles2', - type : 'boolean', - value : true, + type : 'combo', + value : 'auto', + choices : ['auto', 'true', 'false'], description : 'Build support for OpenGL ES 2.x and 3.x' ) option( -- 2.30.2