meson: Make SDL2 and libsndfile dependencies configurable

This is important for cross-platform build frameworks such as Yocto
where the build configurations must be deterministic. In this case, if
some other build dependency pulled in SDL2, then the meson.build logic
would suddenly enable extra features that would not have been built
otherwise. By allowing for explicitely enabling/disabling SDL2 and sndfile
depending bits, this problem is fixed.
This commit is contained in:
Carlos Rafael Giani 2021-02-15 11:59:10 +01:00
parent 0b2d3730b6
commit b17fe4aba4
2 changed files with 10 additions and 2 deletions

View file

@ -330,9 +330,9 @@ rt_lib = cc.find_library('rt', required : false) # clock_gettime
dl_lib = cc.find_library('dl', required : false)
pthread_lib = dependency('threads')
dbus_dep = dependency('dbus-1')
sdl_dep = dependency('sdl2', required : false)
sdl_dep = dependency('sdl2', required : get_option('sdl2'))
ncurses_dep = dependency('ncurses', required : false)
sndfile_dep = dependency('sndfile', version : '>= 1.0.20', required : false)
sndfile_dep = dependency('sndfile', version : '>= 1.0.20', required : get_option('sndfile'))
if get_option('gstreamer')
glib_dep = dependency('glib-2.0', version : '>=2.32.0')

View file

@ -151,3 +151,11 @@ option('udevrulesdir',
option('systemd-user-unit-dir',
type : 'string',
description : 'Directory for user systemd units (defaults to /usr/lib/systemd/user)')
option('sdl2',
description: 'Enable code that depends on SDL 2',
type: 'feature',
value: 'auto')
option('sndfile',
description: 'Enable code that depends on libsndfile',
type: 'feature',
value: 'auto')