From 55134df54c99b09556d3d0f60b9b4f029123af0e Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sun, 28 Oct 2018 14:54:52 +0000 Subject: [PATCH] meson: Add a feature option for the MSDK plugin --- meson_options.txt | 1 + sys/msdk/meson.build | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index fbcc453..a4c9dcf 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -110,6 +110,7 @@ option('libmms', type : 'feature', value : 'auto', description : 'Microsoft mult option('lv2', type : 'feature', value : 'auto', description : 'LV2 audio plugin bridge') option('mpeg2enc', type : 'feature', value : 'auto', description : 'mpeg2enc video encoder plugin') option('mplex', type : 'feature', value : 'auto', description : 'mplex audio/video multiplexer plugin') +option('msdk', type : 'feature', value : 'auto', description : 'Intel Media SDK video encoder/decoder plugin') option('musepack', type : 'feature', value : 'auto', description : 'libmpcdec Musepack decoder plugin') option('neon', type : 'feature', value : 'auto', description : 'NEON HTTP source plugin') option('openh264', type : 'feature', value : 'auto', description : 'H.264 video codec plugin') diff --git a/sys/msdk/meson.build b/sys/msdk/meson.build index 554d01d..fa4fa3c 100644 --- a/sys/msdk/meson.build +++ b/sys/msdk/meson.build @@ -30,25 +30,33 @@ else msdk_sources += ['msdk_libva.c', 'gstmsdkallocator_libva.c'] endif -# FIXME: automagic +msdk_option = get_option('msdk') +if msdk_option.disabled() + subdir_done() +endif + msdk_root = run_command(python3, '-c', 'import os; print(os.environ.get("INTELMEDIASDKROOT", os.environ.get("MFX_HOME", "")))').stdout().strip() +if msdk_root == '' and msdk_option.enabled() + error('msdk plugin enabled but Intel Media SDK not found: neither INTELMEDIASDKROOT nor MFX_HOME were set') +endif + have_msdk = false msdk_dep = [] if msdk_root != '' msdk_libdir = [msdk_root + '/lib/lin_x64', msdk_root + '/lib/x64'] msdk_incdir = include_directories(msdk_root + '/include') - msdk_lib = cxx.find_library('mfx', dirs: msdk_libdir, required: false) + msdk_lib = cxx.find_library('mfx', dirs: msdk_libdir, required: msdk_option) if host_machine.system() == 'windows' - legacy_stdio_dep = cc.find_library('legacy_stdio_definitions', required: false) - d3d11_dep = cc.find_library('d3d11', required: false) + legacy_stdio_dep = cc.find_library('legacy_stdio_definitions', required: msdk_option) + d3d11_dep = cc.find_library('d3d11', required: msdk_option) msdk_dep = declare_dependency(include_directories: msdk_incdir, dependencies: [msdk_lib, d3d11_dep, legacy_stdio_dep]) msdk_dep_found = msdk_lib.found() and d3d11_dep.found() and legacy_stdio_dep.found() and cc.get_id() == 'msvc' else - libva_dep = dependency('libva-drm', required: false) - libdl_dep = cc.find_library('dl', required: false) - libgudev_dep = dependency('gudev-1.0', required : false) + libva_dep = dependency('libva-drm', required: msdk_option) + libdl_dep = cc.find_library('dl', required: msdk_option) + libgudev_dep = dependency('gudev-1.0', required: msdk_option) msdk_dep = declare_dependency(include_directories: msdk_incdir, dependencies: [msdk_lib, libva_dep, libdl_dep, libgudev_dep]) msdk_dep_found = msdk_lib.found() and libva_dep.found() and libdl_dep.found() and libgudev_dep.found() endif -- 2.7.4