From 21b75e5d1207e25ad8848e0b077c2754a5e9dc0b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 8 Oct 2019 19:30:49 +0300 Subject: [PATCH] build: simplify by using disabler deps --- examples/meson.build | 35 ++++++++++------------------------- meson.build | 2 +- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/examples/meson.build b/examples/meson.build index 869384c2..4a6d1634 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,10 +1,10 @@ threads = dependency('threads') wayland_cursor = dependency('wayland-cursor') -libpng = dependency('libpng', required: false) +libpng = dependency('libpng', required: false, disabler: true) # These versions correspond to ffmpeg 4.0 -libavutil = dependency('libavutil', version: '>=56.14.100', required: false) -libavcodec = dependency('libavcodec', version: '>=58.18.100', required: false) -libavformat = dependency('libavformat', version: '>=58.12.100', required: false) +libavutil = dependency('libavutil', version: '>=56.14.100', required: false, disabler: true) +libavcodec = dependency('libavcodec', version: '>=58.18.100', required: false, disabler: true) +libavformat = dependency('libavformat', version: '>=58.12.100', required: false, disabler: true) # epoll is a separate library in FreeBSD if host_machine.system() == 'freebsd' @@ -13,13 +13,6 @@ else libepoll = [] endif -# Small hack until https://github.com/mesonbuild/meson/pull/3386/ is merged -foreach dep : ['libpng', 'libavutil', 'libavcodec', 'libavformat'] - if not get_variable(dep).found() - set_variable(dep, disabler()) - endif -endforeach - # Check if libavutil is found because of https://github.com/mesonbuild/meson/issues/6010 if libavutil.found() and not cc.has_header('libavutil/hwcontext_drm.h', dependencies: libavutil) libavutil = disabler() @@ -121,18 +114,10 @@ examples = { } foreach name, info : examples - all_dep_found = true - foreach d : info.get('dep') - all_dep_found = all_dep_found and d.found() - endforeach - if all_dep_found - executable( - name, - info.get('src'), - dependencies: info.get('dep'), - build_by_default: get_option('examples'), - ) - else - warning('Dependencies not satisfied for ' + name) - endif + executable( + name, + info.get('src'), + dependencies: info.get('dep'), + build_by_default: get_option('examples'), + ) endforeach diff --git a/meson.build b/meson.build index 3775e14c..473f49e3 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,7 @@ project( 'c', version: '0.8.1', license: 'MIT', - meson_version: '>=0.48.0', + meson_version: '>=0.49.0', default_options: [ 'c_std=c11', 'warning_level=2',