From b17fe4aba450f48e0da498cc8de9ec766055591e Mon Sep 17 00:00:00 2001 From: Carlos Rafael Giani Date: Mon, 15 Feb 2021 11:59:10 +0100 Subject: [PATCH] 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. --- meson.build | 4 ++-- meson_options.txt | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 429ac249e..9fd96aa16 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/meson_options.txt b/meson_options.txt index 200a8fa24..2c2a4683b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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')