build: simplify by using disabler deps

This commit is contained in:
Simon Ser 2019-10-08 19:30:49 +03:00 committed by Drew DeVault
parent 480a31ea4e
commit 21b75e5d12
2 changed files with 11 additions and 26 deletions

View File

@ -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

View File

@ -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',