meson: Don't use x11 at all if the x11 feature is disabled.

Currently, building with -Dx11=disabled or -Dx11=auto gives identical
results.

In both cases, it only makes the x11 dependency optional: It'll still
look for libx11, and if libx11 is available, then it'll still build with
X11 support enabled.

This changes the meson build so that if you pass -Dx11=disabled, then it
will use a dummy dependency for x11, which will cause it to build as if
libx11 was not available.
This commit is contained in:
Kyle Brenneman 2021-10-04 09:23:15 -06:00
parent 7996207b3b
commit 52747d70e0

View file

@ -87,7 +87,12 @@ endif
dep_dl = cc.find_library('dl', required : false)
dep_m = cc.find_library('m', required : false)
dep_threads = dependency('threads')
dep_x11 = dependency('x11', required : get_option('x11'))
if get_option('x11').disabled()
dep_x11 = dependency('', required : false)
else
dep_x11 = dependency('x11', required : get_option('x11'))
endif
dep_x11_headers = dep_x11.partial_dependency(compile_args : true, includes : true)
if dep_x11.found()
add_project_arguments('-DUSE_X11', language : ['c'])