net/mlx: workaround static linkage with meson
[dpdk.git] / drivers / common / mlx5 / meson.build
index 206ef75..089494e 100644 (file)
@@ -29,16 +29,26 @@ foreach libname:libnames
        endif
        if lib.found()
                libs += lib
+               if not static_ibverbs
+                       ext_deps += lib
+               endif
        else
                build = false
                reason = 'missing dependency, "' + libname + '"'
                subdir_done()
        endif
 endforeach
+if static_ibverbs
+       # Build without adding shared libs to Requires.private
+       ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout()
+       ext_deps += declare_dependency(compile_args: ibv_cflags.split())
+       # Add static deps ldflags to internal apps and Libs.private
+       ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout()
+       ext_deps += declare_dependency(link_args:ibv_ldflags.split())
+endif
 
 allow_experimental_apis = true
 deps += ['hash', 'pci', 'net', 'eal', 'kvargs']
-ext_deps += libs
 sources = files(
        'mlx5_devx_cmds.c',
        'mlx5_common.c',