-----Original Message-----
From: dev <dev-boun...@dpdk.org> On Behalf Of Anand Rawat
Sent: Monday, March 25, 2019 11:03 PM
To: dev@dpdk.org
Cc: anand.ra...@intel.com; pallavi.ka...@intel.com; ranjit.me...@intel.com; 
jeffrey.b.s...@intel.com; bruce.richard...@intel.com; tho...@monjalon.net
Subject: [dpdk-dev] [PATCH v5 2/8] eal: add header files to support windows

Added header files to support windows on x86 platforms.
Updated rte_common.h to include rte_windows.h for windows build. Updated 
lib/meson.build to create shared libraries on windows. Added def file to list 
the exports for the eal library.

Signed-off-by: Anand Rawat <anand.ra...@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.ka...@intel.com>
Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>
Reviewed-by: Jeff Shaw <jeffrey.b.s...@intel.com>
Reviewed-by: Ranjit Menon <ranjit.me...@intel.com>
Acked-by: Harini Ramakrishnan <harini.ramakrish...@microsoft.com>
---
 lib/librte_eal/common/include/rte_common.h    |  7 ++++-
 .../common/include/rte_string_fns.h           |  4 ++-
 lib/librte_eal/rte_eal_exports.def            |  9 ++++++
 .../windows/eal/include/rte_windows.h         | 30 +++++++++++++++++++
 lib/librte_eal/windows/eal/meson.build        |  2 ++
 lib/meson.build                               | 19 ++++++++++--
 6 files changed, 66 insertions(+), 5 deletions(-)  create mode 100644 
lib/librte_eal/rte_eal_exports.def
 create mode 100644 lib/librte_eal/windows/eal/include/rte_windows.h

diff --git a/lib/librte_eal/common/include/rte_common.h 
b/lib/librte_eal/common/include/rte_common.h
index 7178ba1e9..4775c84f5 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 #ifndef _RTE_COMMON_H_
@@ -24,6 +24,11 @@ extern "C" {
 
 #include <rte_config.h>
 
+/* windows specific*/
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <rte_windows.h>
+#endif
+
 #ifndef typeof
 #define typeof __typeof__
 #endif
diff --git a/lib/librte_eal/common/include/rte_string_fns.h 
b/lib/librte_eal/common/include/rte_string_fns.h
index 85bfe6c9a..8bac8243c 100644
--- a/lib/librte_eal/common/include/rte_string_fns.h
+++ b/lib/librte_eal/common/include/rte_string_fns.h
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2019 Intel Corporation
  */
 
 /**
@@ -18,6 +18,8 @@ extern "C" {
 #include <stdio.h>
 #include <string.h>
 
+#include <rte_common.h>
+
 /**
  * Takes string "string" parameter and splits it at character "delim"
  * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like diff 
--git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
new file mode 100644
index 000000000..7805aeeaa
--- /dev/null
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -0,0 +1,9 @@
+EXPORTS
+       __rte_panic
+       rte_eal_get_configuration
+       rte_eal_init
+       rte_eal_mp_remote_launch
+       rte_eal_mp_wait_lcore
+       rte_eal_remote_launch
+       rte_log
+       rte_vlog
\ No newline at end of file
diff --git a/lib/librte_eal/windows/eal/include/rte_windows.h 
b/lib/librte_eal/windows/eal/include/rte_windows.h
new file mode 100644
index 000000000..af24ef39f
--- /dev/null
+++ b/lib/librte_eal/windows/eal/include/rte_windows.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019 Intel Corporation
+ */
+
+#ifndef _RTE_WINDOWS_H_
+#define _RTE_WINDOWS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <BaseTsd.h>
+
+/* macro substitution for windows supported strerror_r */ #define 
+strerror_r(a, b, c) strerror_s(b, c, a)
+
+/* macro substitution for windows supported strdup */
+#define strdup(str)    _strdup(str)
+
+/* macro substitution for windows supported ssize_t type */ typedef 
+SSIZE_T ssize_t;
+
+/* macro substitution for windows supported strtok_r */ #define 
+strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_WINDOWS_H_ */
diff --git a/lib/librte_eal/windows/eal/meson.build 
b/lib/librte_eal/windows/eal/meson.build
index 8b1735623..6bc577e5c 100644
--- a/lib/librte_eal/windows/eal/meson.build
+++ b/lib/librte_eal/windows/eal/meson.build
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: BSD-3-Clause  # Copyright(c) 2019 Intel Corporation
 
+eal_inc += include_directories('include')
+
 env_objs = []
 env_headers = []
 env_sources = files('eal.c',
diff --git a/lib/meson.build b/lib/meson.build index 99957ba7d..1fe1b4677 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation
+# Copyright(c) 2017-2019 Intel Corporation
 
 
 # process all libraries equally, as far as possible @@ -64,6 +64,11 @@ foreach 
l:libraries
        dir_name = 'librte_' + l
        subdir(dir_name)
 
+       if host_machine.system() == 'windows'
+               # injecting rte_windows.h in every library in windows
+               includes += 
include_directories('librte_eal/windows/eal/include')
+       endif
+
        if build
                enabled_libs += name
                dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1) @@ -117,14 
+122,22 @@ foreach l:libraries
                        objs += static_lib.extract_all_objects(recursive: false)
                        version_map = '@0@/@1@/rte_@2@_version.map'.format(
                                        meson.current_source_dir(), dir_name, 
name)
+                       exports = '@0@/@1@/rte_@2@_exports.def'.format(
+                                       meson.current_source_dir(), dir_name, 
name)
+                       implib = dir_name + '.dll.a'
+                       if host_machine.system() == 'windows'
+                               lk_args = ['-Wl,/def:' + exports, 
'-Wl,/implib:lib\\' + implib]
+                       else
+                               lk_args = ['-Wl,--version-script=' + 
version_map]
+                       endif
                        shared_lib = shared_library(libname,
                                        sources,
                                        objects: objs,
                                        c_args: cflags,
                                        dependencies: shared_deps,
                                        include_directories: includes,
-                                       link_args: '-Wl,--version-script=' + 
version_map,
-                                       link_depends: version_map,
+                                       link_args: lk_args,
+                                       link_depends: [version_map, exports],
                                        version: lib_version,
                                        soversion: so_version,
                                        install: true)
--
2.17.1.windows.2

Reply via email to