build: simplify by using disabler deps

master
Simon Ser 5 years ago committed by Drew DeVault
parent 480a31ea4e
commit 21b75e5d12

@ -1,10 +1,10 @@
threads = dependency('threads') threads = dependency('threads')
wayland_cursor = dependency('wayland-cursor') wayland_cursor = dependency('wayland-cursor')
libpng = dependency('libpng', required: false) libpng = dependency('libpng', required: false, disabler: true)
# These versions correspond to ffmpeg 4.0 # These versions correspond to ffmpeg 4.0
libavutil = dependency('libavutil', version: '>=56.14.100', required: false) libavutil = dependency('libavutil', version: '>=56.14.100', required: false, disabler: true)
libavcodec = dependency('libavcodec', version: '>=58.18.100', required: false) libavcodec = dependency('libavcodec', version: '>=58.18.100', required: false, disabler: true)
libavformat = dependency('libavformat', version: '>=58.12.100', required: false) libavformat = dependency('libavformat', version: '>=58.12.100', required: false, disabler: true)
# epoll is a separate library in FreeBSD # epoll is a separate library in FreeBSD
if host_machine.system() == 'freebsd' if host_machine.system() == 'freebsd'
@ -13,13 +13,6 @@ else
libepoll = [] libepoll = []
endif 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 # 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) if libavutil.found() and not cc.has_header('libavutil/hwcontext_drm.h', dependencies: libavutil)
libavutil = disabler() libavutil = disabler()
@ -121,18 +114,10 @@ examples = {
} }
foreach name, info : examples foreach name, info : examples
all_dep_found = true executable(
foreach d : info.get('dep') name,
all_dep_found = all_dep_found and d.found() info.get('src'),
endforeach dependencies: info.get('dep'),
if all_dep_found build_by_default: get_option('examples'),
executable( )
name,
info.get('src'),
dependencies: info.get('dep'),
build_by_default: get_option('examples'),
)
else
warning('Dependencies not satisfied for ' + name)
endif
endforeach endforeach

@ -3,7 +3,7 @@ project(
'c', 'c',
version: '0.8.1', version: '0.8.1',
license: 'MIT', license: 'MIT',
meson_version: '>=0.48.0', meson_version: '>=0.49.0',
default_options: [ default_options: [
'c_std=c11', 'c_std=c11',
'warning_level=2', 'warning_level=2',

Loading…
Cancel
Save