From patchwork Thu Jan 26 18:03:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 122584 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1836D42495; Thu, 26 Jan 2023 19:03:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FF9A42D43; Thu, 26 Jan 2023 19:03:31 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D6736400D7 for ; Thu, 26 Jan 2023 19:03:26 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 24CD420E6596; Thu, 26 Jan 2023 10:03:26 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 24CD420E6596 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674756206; bh=ctHSjc2lukP/AWdj4wjPfiQJoHs9PRj2K5T4HPxBMFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T93aGw3MRrdQiwsepBFwK/i7fBNBBqw8vNy2hQH5B2/geFDSihJ5EoVsBMzshFsQi rblR7o5hhntwMVhB1MxroWLIqWYTS/kM6S80EwMD4FsHMJCoFBuR74NYPKAgTGKb7j LXV2/X98KEErIN7+lOBm0etPPebf7zCK/1grxvJ0= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, Tyler Retzlaff Subject: [PATCH v2 1/3] build: unblock the use of the MSVC compiler Date: Thu, 26 Jan 2023 10:03:22 -0800 Message-Id: <1674756204-25965-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1674756204-25965-1-git-send-email-roretzla@linux.microsoft.com> References: <1674674707-3094-1-git-send-email-roretzla@linux.microsoft.com> <1674756204-25965-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson --- buildtools/meson.build | 10 +++++++--- config/meson.build | 21 ++++++++++++++------- config/x86/meson.build | 8 +++++--- lib/meson.build | 13 ++++++++++--- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/buildtools/meson.build b/buildtools/meson.build index e1c600e..838c39f 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -4,7 +4,9 @@ pkgconf = find_program('pkg-config', 'pkgconf', required: false) check_symbols = find_program('check-symbols.sh') ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') -objdump = find_program('objdump', 'llvm-objdump') +if cc.get_id() != 'msvc' + objdump = find_program('objdump', 'llvm-objdump') +endif python3 = import('python').find_installation(required: false) if python3.found() @@ -18,8 +20,10 @@ map_to_win_cmd = py3 + files('map_to_win.py') sphinx_wrapper = py3 + files('call-sphinx-build.py') get_cpu_count_cmd = py3 + files('get-cpu-count.py') get_numa_count_cmd = py3 + files('get-numa-count.py') -binutils_avx512_check = (py3 + files('binutils-avx512-check.py') + - [objdump] + cc.cmd_array()) +if cc.get_id() != 'msvc' + binutils_avx512_check = (py3 + files('binutils-avx512-check.py') + + [objdump] + cc.cmd_array()) +endif # select library and object file format pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()] diff --git a/config/meson.build b/config/meson.build index 6d9ffd4..898b743 100644 --- a/config/meson.build +++ b/config/meson.build @@ -16,7 +16,8 @@ endforeach # MS linker requires special treatment. # TODO: use cc.get_linker_id() with Meson >= 0.54 -is_ms_linker = is_windows and (cc.get_id() == 'clang') +is_ms_compiler = is_windows and (cc.get_id() == 'msvc') +is_ms_linker = is_windows and (cc.get_id() == 'clang' or is_ms_compiler) # set the major version, which might be used by drivers and libraries # depending on the configuration options @@ -130,11 +131,13 @@ dpdk_conf.set('RTE_MACHINE', cpu_instruction_set) machine_args = [] # ppc64 does not support -march= at all, use -mcpu and -mtune for that -if host_machine.cpu_family().startswith('ppc') - machine_args += '-mcpu=' + cpu_instruction_set - machine_args += '-mtune=' + cpu_instruction_set -else - machine_args += '-march=' + cpu_instruction_set +if not is_ms_compiler + if host_machine.cpu_family().startswith('ppc') + machine_args += '-mcpu=' + cpu_instruction_set + machine_args += '-mtune=' + cpu_instruction_set + else + machine_args += '-march=' + cpu_instruction_set + endif endif toolchain = cc.get_id() @@ -252,7 +255,11 @@ if cc.get_id() == 'clang' and dpdk_conf.get('RTE_ARCH_64') == false endif # add -include rte_config to cflags -add_project_arguments('-include', 'rte_config.h', language: 'c') +if is_ms_compiler + add_project_arguments('/FI', 'rte_config.h', language: 'c') +else + add_project_arguments('-include', 'rte_config.h', language: 'c') +endif # enable extra warnings and disable any unwanted warnings # -Wall is added by default at warning level 1, and -Wextra diff --git a/config/x86/meson.build b/config/x86/meson.build index 54345c4..11f0bcc 100644 --- a/config/x86/meson.build +++ b/config/x86/meson.build @@ -25,9 +25,11 @@ if cc.has_argument('-mavx512f') endif # we require SSE4.2 for DPDK -if cc.get_define('__SSE4_2__', args: machine_args) == '' - message('SSE 4.2 not enabled by default, explicitly enabling') - machine_args += '-msse4' +if not is_ms_compiler + if cc.get_define('__SSE4_2__', args: machine_args) == '' + message('SSE 4.2 not enabled by default, explicitly enabling') + machine_args += '-msse4' + endif endif base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2'] diff --git a/lib/meson.build b/lib/meson.build index a90fee3..82e4666 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -235,9 +235,16 @@ foreach l:libraries output: '@0@_exports.def'.format(libname)) lk_deps += [def_file] - lk_args = ['-Wl,/def:' + def_file.full_path()] - if meson.version().version_compare('<0.54.0') - lk_args += ['-Wl,/implib:lib\\librte_' + l + '.dll.a'] + if is_ms_compiler + lk_args = ['/def:' + def_file.full_path()] + if meson.version().version_compare('<0.54.0') + lk_args += ['/implib:lib\\librte_' + l + '.dll.a'] + endif + else + lk_args = ['-Wl,/def:' + def_file.full_path()] + if meson.version().version_compare('<0.54.0') + lk_args += ['-Wl,/implib:lib\\librte_' + l + '.dll.a'] + endif endif else if is_windows From patchwork Thu Jan 26 18:03:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 122582 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D6A742495; Thu, 26 Jan 2023 19:03:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B35E740A79; Thu, 26 Jan 2023 19:03:29 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id DCCF640223 for ; Thu, 26 Jan 2023 19:03:26 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 30E6720E6594; Thu, 26 Jan 2023 10:03:26 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 30E6720E6594 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674756206; bh=xb7+SnlH0uXx2AtEJMQ9Tzz9IJr+Bj17o3OmXQbaDGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SlaEJNTpbLElBTj5sFPuM/T/LjssS+UpBQMPZZUGM46R9pFnjBCa5yj8aX76Jg3bW NJZSh09hbICZYgwWW9LjPQ4Oh5aszF3nGwD7OdcdniBt3nxI+RvGRxUEBPIY21iA3f r2zVIGBXEvH1LpCaOuk+KFjOP54tvJknvZ2hqvxA= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, Tyler Retzlaff Subject: [PATCH v2 2/3] build: determine execution environment at config time Date: Thu, 26 Jan 2023 10:03:23 -0800 Message-Id: <1674756204-25965-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1674756204-25965-1-git-send-email-roretzla@linux.microsoft.com> References: <1674674707-3094-1-git-send-email-roretzla@linux.microsoft.com> <1674756204-25965-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Move execution environment determination and definitions to config. The RTE_EXEC_ENV macros are actually used by libraries built before EAL. Currently it does not matter that this is determined in lib/eal since the definitions are consumed before anything is built including libs built before lib/eal. By moving this logic to config it allows kvargs and telemetry to be built without EAL. No functional change intended. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson --- config/meson.build | 8 ++++++++ lib/eal/meson.build | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/meson.build b/config/meson.build index 898b743..e0b9e4e 100644 --- a/config/meson.build +++ b/config/meson.build @@ -14,6 +14,14 @@ foreach env:supported_exec_envs set_variable('is_' + env, exec_env == env) endforeach +exec_envs = {'freebsd': 0, 'linux': 1, 'windows': 2} +foreach env, id:exec_envs + dpdk_conf.set('RTE_ENV_' + env.to_upper(), id) + dpdk_conf.set10('RTE_EXEC_ENV_IS_' + env.to_upper(), (exec_env == env)) +endforeach +dpdk_conf.set('RTE_EXEC_ENV', exec_envs[exec_env]) +dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) + # MS linker requires special treatment. # TODO: use cc.get_linker_id() with Meson >= 0.54 is_ms_compiler = is_windows and (cc.get_id() == 'msvc') diff --git a/lib/eal/meson.build b/lib/eal/meson.build index 056beb9..26c638f 100644 --- a/lib/eal/meson.build +++ b/lib/eal/meson.build @@ -10,14 +10,6 @@ if not is_windows subdir('unix') endif -exec_envs = {'freebsd': 0, 'linux': 1, 'windows': 2} -foreach env, id:exec_envs - dpdk_conf.set('RTE_ENV_' + env.to_upper(), id) - dpdk_conf.set10('RTE_EXEC_ENV_IS_' + env.to_upper(), (exec_env == env)) -endforeach -dpdk_conf.set('RTE_EXEC_ENV', exec_envs[exec_env]) - -dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) subdir(exec_env) subdir(arch_subdir) From patchwork Thu Jan 26 18:03:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 122583 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 740D542495; Thu, 26 Jan 2023 19:03:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A9AA42BFE; Thu, 26 Jan 2023 19:03:30 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EAA6540685 for ; Thu, 26 Jan 2023 19:03:26 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 3CEA620E6598; Thu, 26 Jan 2023 10:03:26 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3CEA620E6598 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674756206; bh=2KyHSleZoPK6yRWfAd4AZF6hzUUffdCiob2yZvdAH9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HNm/2hDvBBw9+E253COeMT7vZ6leqZAGR/zqwBttWcLIFvremwa8uldmpGQxoojqR 3kSIbcRU27WOJzg9A4RmZwF6X0C0tRlQ7RrmL/DAGeXm8VjSlcu8T8aQaP3KwuIChN lrTEhuj6x+5HVDYl0f44MMsdP12nb3sn+lNrCP4w= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, Tyler Retzlaff Subject: [PATCH v2 3/3] build: limit what is built when using MSVC compiler Date: Thu, 26 Jan 2023 10:03:24 -0800 Message-Id: <1674756204-25965-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1674756204-25965-1-git-send-email-roretzla@linux.microsoft.com> References: <1674674707-3094-1-git-send-email-roretzla@linux.microsoft.com> <1674756204-25965-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Build only kvargs and telemetry when is_ms_compiler. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson --- app/meson.build | 5 +++++ drivers/meson.build | 4 ++++ lib/meson.build | 7 +++++++ usertools/meson.build | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/app/meson.build b/app/meson.build index e32ea4b..a606510 100644 --- a/app/meson.build +++ b/app/meson.build @@ -1,6 +1,11 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation +if is_ms_compiler + enabled_apps = [] + subdir_done() +endif + disable_apps = ',' + get_option('disable_apps') disable_apps = run_command(list_dir_globs, disable_apps, check: true).stdout().split() diff --git a/drivers/meson.build b/drivers/meson.build index c6d6192..8ed1213 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -1,6 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation +if is_ms_compiler + subdir_done() +endif + fs = import('fs') # Defines the order of dependencies evaluation diff --git a/lib/meson.build b/lib/meson.build index 82e4666..8e99e21 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -65,6 +65,13 @@ libraries = [ 'node', ] +if is_ms_compiler + libraries = [ + 'kvargs', + 'telemetry', + ] +endif + optional_libs = [ 'bitratestats', 'cfgfile', diff --git a/usertools/meson.build b/usertools/meson.build index b6271a2..1a56248 100644 --- a/usertools/meson.build +++ b/usertools/meson.build @@ -1,6 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation +if is_ms_compiler + subdir_done() +endif + install_data([ 'dpdk-devbind.py', 'dpdk-pmdinfo.py',