From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 064BAA00E6 for ; Wed, 20 Mar 2019 01:41:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0DFAB4CA0; Wed, 20 Mar 2019 01:41:04 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 246171B19 for ; Wed, 20 Mar 2019 01:40:53 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Mar 2019 17:40:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,246,1549958400"; d="scan'208";a="135513420" Received: from anandraw-devbx.amr.corp.intel.com ([10.19.242.57]) by orsmga003.jf.intel.com with ESMTP; 19 Mar 2019 17:40:51 -0700 From: Anand Rawat To: dev@dpdk.org Cc: anand.rawat@intel.com, pallavi.kadam@intel.com, ranjit.menon@intel.com, jeffrey.b.shaw@intel.com, bruce.richardson@intel.com, thomas@monjalon.net Date: Tue, 19 Mar 2019 17:40:44 -0700 Message-Id: <20190320004050.13184-3-anand.rawat@intel.com> X-Mailer: git-send-email 2.17.1.windows.2 In-Reply-To: <20190320004050.13184-1-anand.rawat@intel.com> References: <20190306041634.12976-1-anand.rawat@intel.com> <20190320004050.13184-1-anand.rawat@intel.com> Subject: [dpdk-dev] [PATCH v3 2/8] eal: add header files to support windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190320004044.ywqgNNR9ZR6lffH5m6o_0z5opJ4U0JVpfO95T4WEByg@z> 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 Signed-off-by: Pallavi Kadam Signed-off-by: Bruce Richardson Reviewed-by: Jeff Shaw Reviewed-by: Ranjit Menon --- lib/librte_eal/common/include/rte_common.h | 7 ++++- .../common/include/rte_string_fns.h | 4 ++- lib/librte_eal/rte_eal_exports.def | 2 ++ .../windows/eal/include/rte_windows.h | 30 +++++++++++++++++++ lib/librte_eal/windows/eal/meson.build | 2 ++ lib/meson.build | 19 ++++++++++-- 6 files changed, 59 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 +/* windows specific*/ +#ifdef RTE_EXEC_ENV_WINDOWS +#include +#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 #include +#include + /** * 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..e20319ecf --- /dev/null +++ b/lib/librte_eal/rte_eal_exports.def @@ -0,0 +1,2 @@ +EXPORTS + __rte_panic \ 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 + +/* 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