From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com,
Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v2 1/3] build: unblock the use of the MSVC compiler
Date: Thu, 26 Jan 2023 10:03:22 -0800 [thread overview]
Message-ID: <1674756204-25965-2-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1674756204-25965-1-git-send-email-roretzla@linux.microsoft.com>
Detect when MSVC toolset is available and tweak toolchain arguments
where the meson build system offers no abstraction.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
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
--
1.8.3.1
next prev parent reply other threads:[~2023-01-26 18:03 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 19:25 [PATCH 0/3] unblock the use of the MSVC compiler Tyler Retzlaff
2023-01-25 19:25 ` [PATCH 1/3] build: " Tyler Retzlaff
2023-01-26 10:07 ` Bruce Richardson
2023-01-25 19:25 ` [PATCH 2/3] build: determine execution environment at config time Tyler Retzlaff
2023-01-26 10:09 ` Bruce Richardson
2023-01-25 19:25 ` [PATCH 3/3] build: limit what is built when using MSVC compiler Tyler Retzlaff
2023-01-26 11:10 ` Bruce Richardson
2023-01-26 17:28 ` Tyler Retzlaff
2023-01-26 17:34 ` Bruce Richardson
2023-01-26 17:36 ` Tyler Retzlaff
2023-01-26 18:03 ` [PATCH v2 0/3] unblock the use of the " Tyler Retzlaff
2023-01-26 18:03 ` Tyler Retzlaff [this message]
2023-01-26 18:03 ` [PATCH v2 2/3] build: determine execution environment at config time Tyler Retzlaff
2023-01-26 18:03 ` [PATCH v2 3/3] build: limit what is built when using MSVC compiler Tyler Retzlaff
2023-01-26 18:18 ` Bruce Richardson
2023-01-26 18:05 ` [PATCH v2 0/3] unblock the use of the " Tyler Retzlaff
2023-04-25 20:08 ` [PATCH v3 0/4] enable " Tyler Retzlaff
2023-04-25 20:08 ` [PATCH v3 1/4] build: unblock the " Tyler Retzlaff
2023-08-11 13:31 ` David Marchand
2023-04-25 20:08 ` [PATCH v3 2/4] build: determine execution environment at config time Tyler Retzlaff
2023-04-25 20:08 ` [PATCH v3 3/4] build: limit what is built when using MSVC compiler Tyler Retzlaff
2023-08-11 13:31 ` David Marchand
2023-04-25 20:08 ` [PATCH v3 4/4] build: enable MSVC specific compiler options Tyler Retzlaff
2023-08-11 18:24 ` [PATCH v4 0/4] enable use of the MSVC compiler Tyler Retzlaff
2023-08-11 18:24 ` [PATCH v4 1/4] build: unblock the " Tyler Retzlaff
2023-08-14 8:27 ` Bruce Richardson
2023-08-14 9:07 ` Dmitry Kozlyuk
2023-08-14 9:12 ` Bruce Richardson
2023-08-11 18:24 ` [PATCH v4 2/4] build: determine execution environment at config time Tyler Retzlaff
2023-08-11 18:24 ` [PATCH v4 3/4] build: limit what is built when using MSVC compiler Tyler Retzlaff
2023-08-11 18:26 ` Tyler Retzlaff
2023-08-11 18:24 ` [PATCH v4 4/4] build: enable MSVC specific compiler options Tyler Retzlaff
2023-08-14 8:30 ` Bruce Richardson
2023-08-14 16:10 ` Tyler Retzlaff
2023-08-14 16:46 ` Bruce Richardson
2023-08-14 18:28 ` Morten Brørup
2023-08-15 13:21 ` David Marchand
2023-08-16 21:56 ` [PATCH v5 0/4] enable use of the MSVC compiler Tyler Retzlaff
2023-08-16 21:56 ` [PATCH v5 1/4] build: unblock the " Tyler Retzlaff
2023-08-16 21:56 ` [PATCH v5 2/4] build: determine execution environment at config time Tyler Retzlaff
2023-08-16 21:56 ` [PATCH v5 3/4] build: limit what is built when using MSVC compiler Tyler Retzlaff
2023-08-16 21:56 ` [PATCH v5 4/4] build: enable MSVC specific compiler options Tyler Retzlaff
2023-08-17 8:33 ` Bruce Richardson
2023-08-25 8:43 ` [PATCH v5 0/4] enable use of the MSVC compiler David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1674756204-25965-2-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.