[v3,20/32] mlx5/windows: add mlx5 meson file

Message ID 20201213102056.11380-21-talshn@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series mlx5 Windows support - part #5 |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Tal Shnaiderman Dec. 13, 2020, 10:20 a.m. UTC
  File drivers/common/mlx5/windows/meson.build is added to enable mlx5
source files compilation under common windows directory.
A Devx SDK tool must be installed to export two external H files:
mlx5devx.h and mlx5_ifc_devx.h. The installation is based on environment
variable DEVX_INC_PATH. In addition a DLL lib file is installed based on
environment variable DEVX_LIB_PATH. The meson file is using the
environment variables for compilation and linkage.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/windows/meson.build | 42 +++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 drivers/common/mlx5/windows/meson.build
  

Patch

diff --git a/drivers/common/mlx5/windows/meson.build b/drivers/common/mlx5/windows/meson.build
new file mode 100644
index 0000000000..2b2aa3b097
--- /dev/null
+++ b/drivers/common/mlx5/windows/meson.build
@@ -0,0 +1,42 @@ 
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2019 Mellanox Technologies, Ltd
+
+includes += include_directories('.')
+
+allow_experimental_apis = true
+sources += files(
+	'mlx5_glue.c',
+)
+
+res_lib = run_command(python3, '-c', 'import os; print(os.environ["DEVX_LIB_PATH"])')
+res_inc = run_command(python3, '-c', 'import os; print(os.environ["DEVX_INC_PATH"])')
+
+if (res_lib.returncode() != 0 or res_inc.returncode() != 0)
+	build = false
+	reason = 'DevX environment variables are not set, DEVX_LIB_PATH and DEVX_INC_PATH vars must be exported'
+	subdir_done()
+endif
+
+devx_lib_dir = res_lib.stdout().strip()
+devx_inc_dir = res_inc.stdout().strip()
+
+ext_deps += cc.find_library('mlx5devx', dirs: devx_lib_dir, required: true)
+includes += include_directories(devx_inc_dir)
+cflags_options = [
+	'-std=c11',
+	'-Wno-strict-prototypes',
+	'-D_BSD_SOURCE',
+	'-D_DEFAULT_SOURCE',
+	'-D_XOPEN_SOURCE=600'
+]
+foreach option:cflags_options
+	if cc.has_argument(option)
+		cflags += option
+	endif
+endforeach
+if get_option('buildtype').contains('debug')
+	cflags += [ '-pedantic', '-DPEDANTIC' ]
+else
+	cflags += [ '-UPEDANTIC' ]
+endif
+