1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2018 6WIND S.A.
3 # Copyright 2018 Mellanox Technologies, Ltd
5 pmd_dlopen = (get_option('ibverbs_link') == 'dlopen')
6 LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so'
7 LIB_GLUE_VERSION = '18.02.0'
8 LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
10 dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1)
12 '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
13 '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
16 libnames = [ 'mnl', 'mlx4', 'ibverbs' ]
19 foreach libname:libnames
20 lib = dependency('lib' + libname, required:false)
22 lib = cc.find_library(libname, required:false)
32 allow_experimental_apis = true
47 sources += files('mlx4_glue.c')
52 '-Wno-strict-prototypes',
57 foreach option:cflags_options
58 if cc.has_argument(option)
62 if get_option('buildtype').contains('debug')
63 cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
65 cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
67 # To maintain the compatibility with the make build system
68 # mlx4_autoconf.h file is still generated.
69 # input array for meson member search:
70 # [ "MACRO to define if found", "header for the search",
71 # "symbol to search","struct member to search" ]
74 [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h',
75 'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ],
77 # input array for meson symbol search:
78 # [ "MACRO to define if found", "header for the search",
79 # "symbol to search" ]
81 [ 'HAVE_IBV_MLX4_BUF_ALLOCATORS', 'infiniband/mlx4dv.h',
82 'MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS' ],
83 [ 'HAVE_IBV_MLX4_UAR_MMAP_OFFSET', 'infiniband/mlx4dv.h',
84 'MLX4DV_QP_MASK_UAR_MMAP_OFFSET' ],
86 config = configuration_data()
87 foreach arg:has_sym_args
88 config.set(arg[0], cc.has_header_symbol(arg[1], arg[2]))
90 foreach arg:has_member_args
91 file_prefix = '#include<' + arg[1] + '>'
92 config.set(arg[0], cc.has_member(arg[2], arg[3],
93 prefix : file_prefix))
95 configure_file(output : 'mlx4_autoconf.h', configuration : config)
98 if pmd_dlopen and build
99 dlopen_name = 'mlx4_glue'
100 dlopen_lib_name = driver_name_fmt.format(dlopen_name)
101 dlopen_so_version = LIB_GLUE_VERSION
102 dlopen_sources = files('mlx4_glue.c')
103 dlopen_install_dir = [ eal_pmd_path + '-glue' ]
104 shared_lib = shared_library(
107 include_directories: global_inc,
111 '-Wl,-export-dynamic',
112 '-Wl,-h,@0@'.format(LIB_GLUE),
114 soversion: dlopen_so_version,
116 install_dir: dlopen_install_dir,