intel / gstreamer-media-SDK

GNU Lesser General Public License v2.1
90 stars 53 forks source link

Meson build fail: Broken meson.build MediaSDK detection #148

Open eero-t opened 5 years ago

eero-t commented 5 years ago

Setup:

Problem:

This is because:

Just removing the MFX_HOME weirdness and using standard pkg-config stuff instead makes things work:

--- a/meson.build
+++ b/meson.build
@@ -25,19 +25,15 @@ configure_file (input: 'version.h.in',

 mfx_sources = []
 mfx_c_args = []
-mfx_deps = []

 mfx_c_args += ['-std=gnu99', '-fPIE', '-fPIC']

 # Check the Media SDK
-mfx_home = get_option ('MFX_HOME')
+mfx_deps = [dependency('mfx')]

-mfx_inc = include_directories(['.', 'gst/mfx', 'gst-libs/mfx', 'parsers', '@0@/include'.format(mfx_home)])
+mfx_inc = include_directories(['.', 'gst/mfx', 'gst-libs/mfx', 'parsers'])

 compiler = meson.get_compiler('c')
-libmfx = compiler.find_library('mfx', dirs: '@0@/lib/lin_x64/'.format(mfx_home))
-mfx_deps += [libmfx]
-
 libstdcc = compiler.find_library('stdc++')
 mfx_deps += [libstdcc]
eero-t commented 5 years ago

One reason why use of something like MFX_HOME is bad, is that install target for your dependencies isn't necessarily a static thing.

Every one of our builds is done to a different directory (to retain build artifacts at the build server), i.e. MFX_HOME value would need to be re-generated every build. With pkg-config, everything works automatically, as pkg-config is something already supported by (Linux) build tools, and MediaSDK.