unblock the use of the MSVC compiler
Subsystems (2)
cover unblock the use of the MSVC compiler
Introduce minimum changes to the build system to allow use of the MSVC compiler.
This change is intended to enable a phased approach to allowing DPDK to built with MSVC. Building with MSVC removes barriers to enterprise customers use of DPDK who have constraints around security policy, compliance and functional requirements.
Tyler Retzlaff (3):
build: unblock the use of the MSVC compiler
build: determine execution environment at config time
build: limit what is built when using MSVC compiler
buildtools/meson.build | 10 +++++++--- config/meson.build | 29 ++++++++++++++++++++++------- config/x86/meson.build | 8 +++++--- lib/eal/meson.build | 8 -------- lib/meson.build | 20 +++++++++++++++++--- meson.build | 13 +++++++++---- 6 files changed, 60 insertions(+), 28 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 build: unblock the use of the MSVC compiler
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
--- buildtools/meson.build | 10 +++++++--- config/meson.build | 21 ++++++++++++++------- config/x86/meson.build | 8 +++++--- lib/meson.build | 13 ++++++++++--- 4 files changed, 36 insertions(+), 16 deletions(-)
buildtools/meson.build +7 -3
@@ -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()]
config/meson.build +14 -7
@@ -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
config/x86/meson.build +5 -3
@@ -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']
lib/meson.build +10 -3
@@ -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
Signature · 1 line
1.8.3.1
Re: [PATCH 1/3] build: unblock the use of the MSVC compiler
Quoted 5 lines · Tyler Retzlaff
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
Signed-off-by Tyler Retzlaff <[email protected]>---
PATCH 2/3 build: determine execution environment at config time
In reply to Tyler RetzlaffMove 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.
--- config/meson.build | 8 ++++++++ lib/eal/meson.build | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
config/meson.build +8 -0
@@ -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')
lib/eal/meson.build +0 -8
@@ -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)
Signature · 1 line
1.8.3.1
Re: [PATCH 2/3] build: determine execution environment at config time
Quoted 8 lines · Tyler Retzlaff
Move execution environment determination and definitions to config. The
RTE_EXEC_ENVmacros 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.
Quoted 4 lines
No functional change intended.
Signed-off-by Tyler Retzlaff <[email protected]>---
Good change. This should have been done when the code was added originally.
PATCH 3/3 build: limit what is built when using MSVC compiler
In reply to Tyler RetzlaffBuild only kvargs and telemetry when is_ms_compiler.
--- lib/meson.build | 7 +++++++ meson.build | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)
lib/meson.build +7 -0
@@ -65,6 +65,13 @@ libraries = [ 'node', ] +if is_ms_compiler + libraries = [ + 'kvargs', + 'telemetry', + ] +endif + optional_libs = [ 'bitratestats', 'cfgfile',
meson.build +9 -4
@@ -76,11 +76,16 @@ subdir('config') # build libs and drivers subdir('lib') -subdir('drivers') -# build binaries and installable tools -subdir('usertools') -subdir('app') +if is_ms_compiler + enabled_apps = [] +else + subdir('drivers') + + # build binaries and installable tools + subdir('usertools') + subdir('app') +endif # build docs subdir('doc')
Signature · 1 line
1.8.3.1
Re: [PATCH 3/3] build: limit what is built when using MSVC compiler
Quoted 10 lines · Tyler Retzlaff
Build only kvargs and telemetry when
is_ms_compiler.Signed-off-by Tyler Retzlaff <[email protected]>--- lib/meson.build | 7 +++++++ meson.build | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)lib/meson.build +0
-0
<snip>
Quoted 11 lines
meson.build +0
-4@@ -76,11 +76,16 @@ subdir('config') # build libs and drivers subdir('lib') -subdir('drivers') -# build binaries and installable tools -subdir('usertools') -subdir('app')
meson.build subdir('config') · line 89
Quoted 10 lines
meson.build +9
-0+if is_ms_compiler + enabled_apps = [] +else + subdir('drivers') + + # build binaries and installable tools + subdir('usertools') + subdir('app') +endif
My own preference here would be to put the checks inside the subdirectories, and try and keep the top-level meson.build file clean. Would that work ok?
Quoted 5 lines
meson.build +0
-0# build docs subdir('doc')Signature · 1 line
1.8.3.1
Re: [PATCH 3/3] build: limit what is built when using MSVC compiler
Quoted 29 lines · Bruce Richardson
Quoted 10 lines · Tyler Retzlaff
Build only kvargs and telemetry when
is_ms_compiler.Signed-off-by Tyler Retzlaff <[email protected]>--- lib/meson.build | 7 +++++++ meson.build | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)lib/meson.build +0
-0<snip>
Quoted 17 lines
meson.build +6
-4@@ -76,11 +76,16 @@ subdir('config') # build libs and drivers subdir('lib') -subdir('drivers') -# build binaries and installable tools -subdir('usertools') -subdir('app') +if is_ms_compiler + enabled_apps = [] +else + subdir('drivers') + + # build binaries and installable tools
Quoted 8 lines
meson.build subdir('config') · line 89
Quoted 4 lines
meson.build +3
-0+ subdir('usertools') + subdir('app') +endifMy own preference here would be to put the checks inside the subdirectories, and try and keep the top-level meson.build file clean. Would that work ok?
no objection. one clarification request though.
do you mean just for drivers, usertools and app or do you mean for every lib/<foo> as well?
i'll send up a v2 once i get confirmation.
Quoted 6 lines
Quoted 6 lines
meson.build +0
-0# build docs subdir('doc')Signature · 1 line
1.8.3.1
Re: [PATCH 3/3] build: limit what is built when using MSVC compiler
Quoted 39 lines · Tyler Retzlaff
Quoted 29 lines · Bruce Richardson
Quoted 10 lines · Tyler Retzlaff
Build only kvargs and telemetry when
is_ms_compiler.Signed-off-by Tyler Retzlaff <[email protected]>--- lib/meson.build | 7 +++++++ meson.build | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)lib/meson.build +0
-0<snip>
Quoted 17 lines
meson.build +6
-4@@ -76,11 +76,16 @@ subdir('config') # build libs and drivers subdir('lib') -subdir('drivers') -# build binaries and installable tools -subdir('usertools') -subdir('app') +if is_ms_compiler + enabled_apps = [] +else + subdir('drivers') + + # build binaries and installable toolsQuoted 8 lines
meson.build subdir('config') · line 89
Quoted 4 lines
meson.build +3
-0+ subdir('usertools') + subdir('app') +endifMy own preference here would be to put the checks inside the subdirectories, and try and keep the top-level meson.build file clean. Would that work ok?
Quoted 5 lines
no objection. one clarification request though.
do you mean just for drivers, usertools and app or do you mean for every lib/<foo> as well?
No, not for every lib, there are far too many of them. What you have done there makes most sense. But for drivers/apps/usertools, putting the check in the subfolder help keep the top-level file cleaner.
Re: [PATCH 3/3] build: limit what is built when using MSVC compiler
Quoted 42 lines · Bruce Richardson
Quoted 41 lines · Tyler Retzlaff
Quoted 29 lines · Bruce Richardson
Quoted 10 lines · Tyler Retzlaff
Build only kvargs and telemetry when
is_ms_compiler.Signed-off-by Tyler Retzlaff <[email protected]>--- lib/meson.build | 7 +++++++ meson.build | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-)lib/meson.build +0
-0<snip>
Quoted 17 lines
meson.build +6
-4@@ -76,11 +76,16 @@ subdir('config') # build libs and drivers subdir('lib') -subdir('drivers') -# build binaries and installable tools -subdir('usertools') -subdir('app') +if is_ms_compiler + enabled_apps = [] +else + subdir('drivers') + + # build binaries and installable toolsQuoted 8 lines
meson.build subdir('config') · line 89
Quoted 4 lines
meson.build +3
-0+ subdir('usertools') + subdir('app') +endifMy own preference here would be to put the checks inside the subdirectories, and try and keep the top-level meson.build file clean. Would that work ok?
no objection. one clarification request though.
Quoted 7 lines
Quoted 3 lines
do you mean just for drivers, usertools and app or do you mean for every lib/<foo> as well?
No, not for every lib, there are far too many of them. What you have done there makes most sense. But for
drivers/apps/usertools, putting the check in the subfolder help keep the top-level file cleaner.
thanks, i'll fire up v2 sometime today.
v2 cover unblock the use of the MSVC compiler
In reply to Tyler RetzlaffIntroduce minimum changes to the build system to allow use of the MSVC compiler.
This change is intended to enable a phased approach to allowing DPDK to built with MSVC. Building with MSVC removes barriers to enterprise customers use of DPDK who have constraints around security policy, compliance and functional requirements.
Tyler Retzlaff (3):
build: unblock the use of the MSVC compiler
build: determine execution environment at config time
build: limit what is built when using MSVC compiler
app/meson.build | 5 +++++ buildtools/meson.build | 10 +++++++--- config/meson.build | 29 ++++++++++++++++++++++------- config/x86/meson.build | 8 +++++--- drivers/meson.build | 4 ++++ lib/eal/meson.build | 8 -------- lib/meson.build | 20 +++++++++++++++++--- usertools/meson.build | 4 ++++ 8 files changed, 64 insertions(+), 24 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/3 build: unblock the use of the MSVC compiler
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
--- buildtools/meson.build | 10 +++++++--- config/meson.build | 21 ++++++++++++++------- config/x86/meson.build | 8 +++++--- lib/meson.build | 13 ++++++++++--- 4 files changed, 36 insertions(+), 16 deletions(-)
buildtools/meson.build +7 -3
@@ -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()]
config/meson.build +14 -7
@@ -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
config/x86/meson.build +5 -3
@@ -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']
lib/meson.build +10 -3
@@ -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
Signature · 1 line
1.8.3.1
PATCH v2 2/3 build: determine execution environment at config time
In reply to Tyler RetzlaffMove 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.
--- config/meson.build | 8 ++++++++ lib/eal/meson.build | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
config/meson.build +8 -0
@@ -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')
lib/eal/meson.build +0 -8
@@ -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)
Signature · 1 line
1.8.3.1
PATCH v2 3/3 build: limit what is built when using MSVC compiler
In reply to Tyler RetzlaffBuild only kvargs and telemetry when is_ms_compiler.
--- app/meson.build | 5 +++++ drivers/meson.build | 4 ++++ lib/meson.build | 7 +++++++ usertools/meson.build | 4 ++++ 4 files changed, 20 insertions(+)
app/meson.build +5 -0
@@ -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()
drivers/meson.build +4 -0
@@ -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
lib/meson.build +7 -0
@@ -65,6 +65,13 @@ libraries = [ 'node', ] +if is_ms_compiler + libraries = [ + 'kvargs', + 'telemetry', + ] +endif + optional_libs = [ 'bitratestats', 'cfgfile',
usertools/meson.build +4 -0
@@ -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',
Signature · 1 line
1.8.3.1
Re: [PATCH v2 3/3] build: limit what is built when using MSVC compiler
Quoted 4 lines · Tyler Retzlaff
Build only kvargs and telemetry when
is_ms_compiler.Signed-off-by Tyler Retzlaff <[email protected]>---
Thanks for v2
Quoted 7 lines · Tyler Retzlaff
Introduce minimum changes to the build system to allow use of the MSVC compiler.
This change is intended to enable a phased approach to allowing DPDK to built with MSVC. Building with MSVC removes barriers to enterprise customers use of DPDK who have constraints around security policy, compliance and functional requirements.
oops, failed to update the cover letter.
v2:
* moved checks to skip drivers, apps, usertools directories in to <dir>/meson.build file and removed conditional check from root meson.build (patch 3/3).
Quoted 18 lines
Tyler Retzlaff (3):
build: unblock the use of the MSVC compiler
build: determine execution environment at config time
build: limit what is built when using MSVC compilerapp/meson.build | 5 +++++ buildtools/meson.build | 10 +++++++--- config/meson.build | 29 ++++++++++++++++++++++------- config/x86/meson.build | 8 +++++--- drivers/meson.build | 4 ++++ lib/eal/meson.build | 8 -------- lib/meson.build | 20 +++++++++++++++++--- usertools/meson.build | 4 ++++ 8 files changed, 64 insertions(+), 24 deletions(-)Signature · 1 line
1.8.3.1
v3 cover enable use of the MSVC compiler
In reply to Tyler RetzlaffIntroduce minimum changes to the build system to allow use of the MSVC compiler.
This change is intended to enable a phased approach to allowing DPDK to built with MSVC. Building with MSVC removes barriers to enterprise customers use of DPDK who have constraints around security policy, compliance and functional requirements.
v3:
* enable compilation with C11 optional atomics
* enable compilation with C23 typeof operator
* disable microsoft secure crt checks (dpdk code fails)
* force use of intrinsics
v2:
* moved checks to skip drivers, apps, usertools directories in to <dir>/meson.build file and removed conditional check from root meson.build (patch 3/3).
Tyler Retzlaff (4):
build: unblock the use of the MSVC compiler
build: determine execution environment at config time
build: limit what is built when using MSVC compiler
build: enable MSVC specific compiler options
app/meson.build | 5 +++++ buildtools/meson.build | 10 +++++++--- config/meson.build | 37 ++++++++++++++++++++++++++++++------- config/x86/meson.build | 8 +++++--- drivers/meson.build | 4 ++++ lib/eal/meson.build | 8 -------- lib/meson.build | 20 +++++++++++++++++--- usertools/meson.build | 4 ++++ 8 files changed, 72 insertions(+), 24 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v3 1/4 build: unblock the use of the MSVC compiler
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
--- buildtools/meson.build | 10 +++++++--- config/meson.build | 21 ++++++++++++++------- config/x86/meson.build | 8 +++++--- lib/meson.build | 13 ++++++++++--- 4 files changed, 36 insertions(+), 16 deletions(-)
buildtools/meson.build +7 -3
@@ -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()]
config/meson.build +14 -7
@@ -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()
@@ -253,7 +256,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
config/x86/meson.build +5 -3
@@ -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']
lib/meson.build +10 -3
@@ -241,9 +241,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
Signature · 1 line
1.8.3.1
Re: [PATCH v3 1/4] build: unblock the use of the MSVC compiler
Quoted 18 lines · Tyler Retzlaff
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
Signed-off-by Tyler Retzlaff <[email protected]>Acked-by Bruce Richardson <[email protected]>--- buildtools/meson.build | 10 +++++++--- config/meson.build | 21 ++++++++++++++------- config/x86/meson.build | 8 +++++--- lib/meson.build | 13 ++++++++++--- 4 files changed, 36 insertions(+), 16 deletions(-)buildtools/meson.build +0
-0
buildtools/meson.build line 5
Quoted 2 lines
buildtools/meson.build +0
-0@@ -4,7 +4,9 @@ pkgconf = find_program('pkg-config', 'pkgconf', required: false) check_symbols = find_program('check-symbols.sh')
I don't expect check-symbols.sh to work if objdump is not available.
buildtools/meson.build line 9
Quoted 5 lines
buildtools/meson.build +3
-1ldflags_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
Looking at objdump users in meson, I only see the avx512 stuff. The avx512 check is only called under a gcc check in config/x86/meson.build, so I would move both definitions (and potentially the script itself) under config/x86. Something like:
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
Quoted 31 lines
buildtools/meson.build +4
-2python3 = 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()]config/meson.build +2
-1@@ -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
config/meson.build dpdk_conf.set('RTE_MACHINE', cpu_instruction_set) · line 133
Quoted 3 lines
config/meson.build +0
-0@@ -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
This comment can be moved in the block too.
Quoted 33 lines
config/meson.build +12
-6-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()@@ -253,7 +256,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 -Wextraconfig/x86/meson.build +0
-0
config/x86/meson.build if cc.has_argument('-mavx512f') · line 27
Quoted 3 lines
config/x86/meson.build +0
-0@@ -25,9 +25,11 @@ if cc.has_argument('-mavx512f') endif # we require SSE4.2 for DPDK
Are there requirements we announce for MSVC builds? In any case, please move this comment in the block.
Quoted 38 lines
config/x86/meson.build +5
-3-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']lib/meson.build +10
-4@@ -241,9 +241,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
Signature · 1 line
David Marchand
PATCH v3 2/4 build: determine execution environment at config time
In reply to Tyler RetzlaffMove 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.
--- config/meson.build | 8 ++++++++ lib/eal/meson.build | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
config/meson.build +8 -0
@@ -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')
lib/eal/meson.build +0 -8
@@ -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)
Signature · 1 line
1.8.3.1
PATCH v3 3/4 build: limit what is built when using MSVC compiler
In reply to Tyler RetzlaffBuild only kvargs and telemetry when is_ms_compiler.
--- app/meson.build | 5 +++++ drivers/meson.build | 4 ++++ lib/meson.build | 7 +++++++ usertools/meson.build | 4 ++++ 4 files changed, 20 insertions(+)
app/meson.build +5 -0
@@ -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()
drivers/meson.build +4 -0
@@ -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
lib/meson.build +7 -0
@@ -66,6 +66,13 @@ libraries = [ 'node', ] +if is_ms_compiler + libraries = [ + 'kvargs', + 'telemetry', + ] +endif + optional_libs = [ 'bitratestats', 'cfgfile',
usertools/meson.build +4 -0
@@ -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',
Signature · 1 line
1.8.3.1
Re: [PATCH v3 3/4] build: limit what is built when using MSVC compiler
Quoted 17 lines · Tyler Retzlaff
Build only kvargs and telemetry when
is_ms_compiler.Signed-off-by Tyler Retzlaff <[email protected]>Acked-by Bruce Richardson <[email protected]>--- app/meson.build | 5 +++++ drivers/meson.build | 4 ++++ lib/meson.build | 7 +++++++ usertools/meson.build | 4 ++++ 4 files changed, 20 insertions(+)app/meson.build +0
-0
app/meson.build line 5
Quoted 5 lines
app/meson.build +2
-0@@ -1,6 +1,11 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation +if is_ms_compiler + enabled_apps = []
Nit: This could be moved to the top of the tree meson.build:
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
Quoted 26 lines
app/meson.build +3
-0+ subdir_done() +endif + disable_apps = ',' + get_option('disable_apps') disable_apps = run_command(list_dir_globs, disable_apps, check: true).stdout().split()drivers/meson.build +4
-0@@ -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 evaluationlib/meson.build +0
-0
lib/meson.build libraries = [ · line 70
Quoted 5 lines
lib/meson.build +2
-0@@ -66,6 +66,13 @@ libraries = [ 'node', ] +if is_ms_compiler + libraries = [
The log library must be added here, now that telemetry depends on it.
Quoted 26 lines
lib/meson.build +5
-0+ 'kvargs', + 'telemetry', + ] +endif + optional_libs = [ 'bitratestats', 'cfgfile',usertools/meson.build +4
-1@@ -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', --1.8.3.1
Signature · 1 line
David Marchand
PATCH v3 4/4 build: enable MSVC specific compiler options
In reply to Tyler Retzlaff* Enable optional use of C11 atomics support.
* Enable use of C23 typeof operator.
* Explicitly force intrinsics when building with MSVC.
* Disable MSVC C runtime checks.
--- config/meson.build | 8 ++++++++ 1 file changed, 8 insertions(+)
config/meson.build +8 -0
@@ -27,6 +27,14 @@ dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) is_ms_compiler = is_windows and (cc.get_id() == 'msvc') is_ms_linker = is_windows and (cc.get_id() == 'clang' or is_ms_compiler) +# MS compiler (except x86) does not support inline assembly +if is_ms_compiler + dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1) + dpdk_conf.set('RTE_FORCE_INTRINSICS', 1) + add_project_arguments('/experimental:c11atomics', language: 'c') + add_project_arguments('/d1experimental:typeof', language: 'c') +endif + # set the major version, which might be used by drivers and libraries # depending on the configuration options pver = meson.project_version().split('.')
Signature · 1 line
1.8.3.1
v4 cover enable use of the MSVC compiler
In reply to Tyler RetzlaffIntroduce minimum changes to the build system to allow use of the MSVC compiler.
This change is intended to enable a phased approach to allowing DPDK to built with MSVC. Building with MSVC removes barriers to enterprise customers use of DPDK who have constraints around security policy, compliance and functional requirements.
v4:
* Remove conditional if cc.get_id() != 'msvc' for assignment of objdump and binutils_avx512_check in anticipation of merge of patch from David Marchand
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]
Note:
I'm aware that none of the shell scripts here are usable on the windows build, it's a gap we hope to fill in the future for now we hap hazardly rely on the linux builds.
* Remove enabled_apps = [] apps when skipping apps/meson.build for is_ms_compiler in anticipation of merge of patch from David Marchand
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]
* Rebase series and include 'log' library as it is now required by kvargs and telemetry libs
* Move 2 comments into block scope ehre they apply
Note:
There are no requirements specifically for msvc compiler beyond those that would cause build to fail when the currently experimental options are used. when i know the final version of the compiler needed it will be documented in the windows quick start guide.
v3:
* enable compilation with C11 optional atomics
* enable compilation with C23 typeof operator
* disable microsoft secure crt checks (dpdk code fails)
* force use of intrinsics
v2:
* moved checks to skip drivers, apps, usertools directories in to <dir>/meson.build file and removed conditional check from root meson.build (patch 3/3)
Tyler Retzlaff (4):
build: unblock the use of the MSVC compiler
build: determine execution environment at config time
build: limit what is built when using MSVC compiler
build: enable MSVC specific compiler options
app/meson.build | 6 ++++-- config/meson.build | 39 +++++++++++++++++++++++++++++++-------- config/x86/meson.build | 10 ++++++---- drivers/meson.build | 4 ++++ lib/eal/meson.build | 8 -------- lib/meson.build | 21 ++++++++++++++++++--- usertools/meson.build | 4 ++++ 7 files changed, 67 insertions(+), 25 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v4 1/4 build: unblock the use of the MSVC compiler
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
--- config/meson.build | 23 +++++++++++++++-------- config/x86/meson.build | 10 ++++++---- lib/meson.build | 13 ++++++++++--- 3 files changed, 31 insertions(+), 15 deletions(-)
config/meson.build +15 -8
@@ -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
@@ -129,12 +130,14 @@ endif 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 + # 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 + endif endif toolchain = cc.get_id()
@@ -253,7 +256,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
config/x86/meson.build +6 -4
@@ -24,10 +24,12 @@ if cc.has_argument('-mavx512f') endif 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 + # 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' + endif endif base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
lib/meson.build +10 -3
@@ -230,9 +230,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
Signature · 1 line
1.8.3.1
Re: [PATCH v4 1/4] build: unblock the use of the MSVC compiler
Quoted 16 lines · Tyler Retzlaff
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
Signed-off-by Tyler Retzlaff <[email protected]>Acked-by Bruce Richardson <[email protected]>--- config/meson.build | 23 +++++++++++++++-------- config/x86/meson.build | 10 ++++++---- lib/meson.build | 13 ++++++++++--- 3 files changed, 31 insertions(+), 15 deletions(-)config/meson.build +0
-0
config/meson.build endforeach · line 20
Quoted 6 lines
config/meson.build +2
-1@@ -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)
Question out of interest, what other linker option do we have on windows? When is the second part of this conditional false?
/Bruce
Re: [PATCH v4 1/4] build: unblock the use of the MSVC compiler
2023-08-14 09:27 (UTC+0100), Bruce Richardson:
Quoted 18 lines · Tyler Retzlaff
Quoted 17 lines
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
Signed-off-by Tyler Retzlaff <[email protected]>Acked-by Bruce Richardson <[email protected]>--- config/meson.build | 23 +++++++++++++++-------- config/x86/meson.build | 10 ++++++---- lib/meson.build | 13 ++++++++++--- 3 files changed, 31 insertions(+), 15 deletions(-)config/meson.build +0
-0@@ -16,7 +16,8 @@ endforeach
Quoted 8 lines
config/meson.build endforeach · line 20
Quoted 5 lines
config/meson.build +2
-1# 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)Question out of interest, what other linker option do we have on windows? When is the second part of this conditional false?
MinGW: GCC + GNU ld (the second conditional is false) Clang: clang + link.exe MSVC: cl.exe + link.exe
Re: [PATCH v4 1/4] build: unblock the use of the MSVC compiler
Quoted 28 lines · Dmitry Kozlyuk
2023-08-14 09:27 (UTC+0100), Bruce Richardson:
Quoted 18 lines · Tyler Retzlaff
Quoted 17 lines
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
Signed-off-by Tyler Retzlaff <[email protected]>Acked-by Bruce Richardson <[email protected]>--- config/meson.build | 23 +++++++++++++++-------- config/x86/meson.build | 10 ++++++---- lib/meson.build | 13 ++++++++++--- 3 files changed, 31 insertions(+), 15 deletions(-)config/meson.build +0
-0@@ -16,7 +16,8 @@ endforeachQuoted 8 lines
config/meson.build endforeach · line 20
Quoted 5 lines
config/meson.build +2
-1# 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)Question out of interest, what other linker option do we have on windows? When is the second part of this conditional false?
Quoted 3 lines
MinGW: GCC + GNU ld (the second conditional is false) Clang: clang + link.exe MSVC: cl.exe + link.exe
Thanks. I'd forgottena bout mingw!
PATCH v4 2/4 build: determine execution environment at config time
In reply to Tyler RetzlaffMove 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.
--- config/meson.build | 8 ++++++++ lib/eal/meson.build | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
config/meson.build +8 -0
@@ -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')
lib/eal/meson.build +0 -8
@@ -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)
Signature · 1 line
1.8.3.1
PATCH v4 3/4 build: limit what is built when using MSVC compiler
In reply to Tyler RetzlaffBuild only kvargs and telemetry when is_ms_compiler.
--- app/meson.build | 6 ++++-- drivers/meson.build | 4 ++++ lib/meson.build | 8 ++++++++ usertools/meson.build | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-)
app/meson.build +4 -2
@@ -1,6 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation +if is_ms_compiler + subdir_done() +endif + disable_apps = ',' + get_option('disable_apps') disable_apps = run_command(list_dir_globs, disable_apps, check: true).stdout().split()
@@ -38,8 +42,6 @@ if get_option('default_library') == 'static' and not is_windows default_ldflags += ['-Wl,--export-dynamic'] endif -enabled_apps = [] # used to print summary at the end - foreach app:apps name = app build = true
drivers/meson.build +4 -0
@@ -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
lib/meson.build +8 -0
@@ -66,6 +66,14 @@ libraries = [ 'node', ] +if is_ms_compiler + libraries = [ + 'log', + 'kvargs', + 'telemetry', + ] +endif + optional_libs = [ 'bitratestats', 'cfgfile',
usertools/meson.build +4 -0
@@ -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',
Signature · 1 line
1.8.3.1
Re: [PATCH v4 3/4] build: limit what is built when using MSVC compiler
Quoted 27 lines · Tyler Retzlaff
Build only kvargs and telemetry when
is_ms_compiler.Signed-off-by Tyler Retzlaff <[email protected]>Acked-by Bruce Richardson <[email protected]>--- app/meson.build | 6 ++++-- drivers/meson.build | 4 ++++ lib/meson.build | 8 ++++++++ usertools/meson.build | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-)app/meson.build +4
-0@@ -1,6 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation +if is_ms_compiler + subdir_done() +endif + disable_apps = ',' + get_option('disable_apps') disable_apps = run_command(list_dir_globs, disable_apps, check: true).stdout().split()
app/meson.build if get_option('default_library') == 'static' and not is_windows · line 42
Quoted 5 lines
app/meson.build +0
-2@@ -38,8 +42,6 @@ if get_option('default_library') == 'static' and not is_windows default_ldflags += ['-Wl,--export-dynamic'] endif -enabled_apps = [] # used to print summary at the end -
oops, i shouldn't have removed this since David's patch removes it already. please ignore this removal when reviewing.
PATCH v4 4/4 build: enable MSVC specific compiler options
In reply to Tyler Retzlaff* Enable optional use of C11 atomics support.
* Enable use of C23 typeof operator.
* Explicitly force intrinsics when building with MSVC.
* Disable MSVC C runtime checks.
--- config/meson.build | 8 ++++++++ 1 file changed, 8 insertions(+)
config/meson.build +8 -0
@@ -27,6 +27,14 @@ dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) is_ms_compiler = is_windows and (cc.get_id() == 'msvc') is_ms_linker = is_windows and (cc.get_id() == 'clang' or is_ms_compiler) +# MS compiler (except x86) does not support inline assembly +if is_ms_compiler + dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1) + dpdk_conf.set('RTE_FORCE_INTRINSICS', 1) + add_project_arguments('/experimental:c11atomics', language: 'c') + add_project_arguments('/d1experimental:typeof', language: 'c') +endif + # set the major version, which might be used by drivers and libraries # depending on the configuration options pver = meson.project_version().split('.')
Signature · 1 line
1.8.3.1
Re: [PATCH v4 4/4] build: enable MSVC specific compiler options
Quoted 6 lines · Tyler Retzlaff
* Enable optional use of C11 atomics support.
* Enable use of C23 typeof operator.
* Explicitly force intrinsics when building with MSVC.
* Disable MSVC C runtime checks.Signed-off-by Tyler Retzlaff <[email protected]>
If there is going to be a lot of this type of special handling for MSVC, we could look to add a separate config/msvc (and config/gcc-like) directory with separate meson.build files for the different toolchains. Might help centralize all such definitions in one place rather than having conditionals everywhere.
/Bruce
Quoted 26 lines
--- config/meson.build | 8 ++++++++ 1 file changed, 8 insertions(+)config/meson.build +8
-0@@ -27,6 +27,14 @@ dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) is_ms_compiler = is_windows and (cc.get_id() == 'msvc') is_ms_linker = is_windows and (cc.get_id() == 'clang' or is_ms_compiler) +# MS compiler (except x86) does not support inline assembly +if is_ms_compiler + dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1) + dpdk_conf.set('RTE_FORCE_INTRINSICS', 1) + add_project_arguments('/experimental:c11atomics', language: 'c') + add_project_arguments('/d1experimental:typeof', language: 'c') +endif + # set the major version, which might be used by drivers and libraries # depending on the configuration options pver = meson.project_version().split('.')Signature · 1 line
1.8.3.1
Re: [PATCH v4 4/4] build: enable MSVC specific compiler options
Quoted 8 lines · Bruce Richardson
Quoted 6 lines · Tyler Retzlaff
* Enable optional use of C11 atomics support.
* Enable use of C23 typeof operator.
* Explicitly force intrinsics when building with MSVC.
* Disable MSVC C runtime checks.Signed-off-by Tyler Retzlaff <[email protected]>
Quoted 7 lines
Acked-by Bruce Richardson <[email protected]>If there is going to be a lot of this type of special handling for MSVC, we could look to add a separate config/msvc (and config/gcc-like) directory with separate meson.build files for the different toolchains. Might help centralize all such definitions in one place rather than having conditionals everywhere.
i think that would probably be a good idea. it would untangle the toolchain detail from the flow of the build files.
i don't propose introducing it in this series but when this is merged i would like to reach out and get your thoughts on how to properly set up a config/toolchain-xxx. in addition to the compiler flags and definitions below it would be good to suppress (for now) warnings until i have an opportunity to evaluate and address the code raising them.
Re: [PATCH v4 4/4] build: enable MSVC specific compiler options
Quoted 16 lines · Tyler Retzlaff
Quoted 7 lines · Bruce Richardson
Quoted 5 lines · Tyler Retzlaff
* Enable optional use of C11 atomics support. * Enable use of C23 typeof operator. * Explicitly force intrinsics when building with MSVC. * Disable MSVC C runtime checks.
Signed-off-by Tyler Retzlaff <[email protected]>Quoted 7 lines
Acked-by Bruce Richardson <[email protected]>If there is going to be a lot of this type of special handling for MSVC, we could look to add a separate config/msvc (and config/gcc-like) directory with separate meson.build files for the different toolchains. Might help centralize all such definitions in one place rather than having conditionals everywhere.
Quoted 9 lines
i think that would probably be a good idea. it would untangle the toolchain detail from the flow of the build files.
i don't propose introducing it in this series but when this is merged i would like to reach out and get your thoughts on how to properly set up a config/toolchain-xxx. in addition to the compiler flags and definitions below it would be good to suppress (for now) warnings until i have an opportunity to evaluate and address the code raising them.
Agree on not requiring it for this set. I'm not exactly sure how to split up the toolchain files, especially given that gcc and clang (and other llvm-based compilers like icx) are so very, very similar in what we have to do for them. It would be very wasteful to have individual toolchain files for each one, duplicating lots of settings. That's why my initial suggestion was for msvc and "gcc-like" compilers. Any suggestions for a better name for the latter, welcome! :-)
RE: [PATCH v4 4/4] build: enable MSVC specific compiler options
Quoted 12 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Monday, 14 August 2023 18.47Quoted 8 lines · Tyler Retzlaff
Quoted 7 lines · Bruce Richardson
Quoted 5 lines · Tyler Retzlaff
* Enable optional use of C11 atomics support. * Enable use of C23 typeof operator. * Explicitly force intrinsics when building with MSVC. * Disable MSVC C runtime checks.
Signed-off-by Tyler Retzlaff <[email protected]>
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Acked-by Bruce Richardson <[email protected]>If there is going to be a lot of this type of special handling for MSVC, we could look to add a separate config/msvc (and config/gcc-
like)
Quoted 1 line
Quoted 1 line
directory with separate meson.build files for the different
toolchains.
Quoted 2 lines
Quoted 2 lines
Might help centralize all such definitions in one place rather than having conditionals everywhere.
Please think twice before splitting into per-toolchain files! You must consider the ratio of differences vs. similarities.
<rant on>
For reference, consider the EAL, which has per-arch subdirectories basically containing the same files, whereof many contain nearly similar content for the different architectures.
And much of it is not even arch-specific at all, but plain C.
There is way too much copy-paste in this design pattern.
Although a "default fallback" implementation could alleviate some of this, minor arch-specific deviations in a function would still require a full copy-paste of the function's remaining code.
In my opinion, a lot of this would be better having in unified files with #ifdefs where required by one or more architectures. It would also allow arch A and arch B to share one implementation, while arch C and arch D share another, and arch E has its own. <rant off>
The EAL might be a really bad comparison here, but it's a good example of a differences/similarities ratio moving in an unfavorable direction for the design pattern. I also hope it serves as an example of how not to do it.
That being said, I admit that it could probably be done right. In this case, it's a mostly matter of taste if you prefer keeping the differences together in one file, or having the differences spread out at the locations where they have their actual effect.
Quoted 23 lines
Quoted 5 lines
i think that would probably be a good idea. it would untangle the toolchain detail from the flow of the build files.
i don't propose introducing it in this series but when this is merged
i
Quoted 1 line
would like to reach out and get your thoughts on how to properly set
up a
Quoted 1 line
config/toolchain-xxx. in addition to the compiler flags and
definitions
Quoted 3 lines
below it would be good to suppress (for now) warnings until i have an opportunity to evaluate and address the code raising them.
Agree on not requiring it for this set. I'm not exactly sure how to split
up the toolchain files, especially given that gcc and clang (and other llvm-based compilers like icx) are so very, very similar in what we have to
do for them. It would be very wasteful to have individual toolchain files
for each one, duplicating lots of settings. That's why my initial suggestion was for msvc and "gcc-like" compilers. Any suggestions for a better name for the latter, welcome! :-)
Re: [PATCH v4 4/4] build: enable MSVC specific compiler options
In reply to Tyler RetzlaffHello Tyler,
Quoted 16 lines · Tyler Retzlaff
* Enable optional use of C11 atomics support.
* Enable use of C23 typeof operator.
* Explicitly force intrinsics when building with MSVC.
* Disable MSVC C runtime checks.Signed-off-by Tyler Retzlaff <[email protected]>--- config/meson.build | 8 ++++++++ 1 file changed, 8 insertions(+)config/meson.build +0
-0
config/meson.build dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) · line 30
Quoted 4 lines
config/meson.build +1
-0@@ -27,6 +27,14 @@ dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) is_ms_compiler = is_windows and (cc.get_id() == 'msvc') is_ms_linker = is_windows and (cc.get_id() == 'clang' or is_ms_compiler) +# MS compiler (except x86) does not support inline assembly
One last (hopefully) small question, what does this comment apply to? Forced use of intrinsics?
Quoted 13 lines
config/meson.build +7
-1+if is_ms_compiler + dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1) + dpdk_conf.set('RTE_FORCE_INTRINSICS', 1) + add_project_arguments('/experimental:c11atomics', language: 'c') + add_project_arguments('/d1experimental:typeof', language: 'c') +endif + # set the major version, which might be used by drivers and libraries # depending on the configuration options pver = meson.project_version().split('.') --1.8.3.1
Signature · 1 line
David Marchand
v5 cover enable use of the MSVC compiler
In reply to Tyler RetzlaffIntroduce minimum changes to the build system to allow use of the MSVC compiler.
This change is intended to enable a phased approach to allowing DPDK to built with MSVC. Building with MSVC removes barriers to enterprise customers use of DPDK who have constraints around security policy, compliance and functional requirements.
v5:
* Clean up comments in config/meson.build for project arguments and dpdk_conf defines when is_ms_compiler
* Restore incorrectly removed enabled_apps = [] in v4
v4:
* Remove conditional if cc.get_id() != 'msvc' for assignment of objdump and binutils_avx512_check in anticipation of merge of patch from David Marchand
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]
Note:
I'm aware that none of the shell scripts here are usable on the windows build, it's a gap we hope to fill in the future for now we hap hazardly rely on the linux builds.
* Remove enabled_apps = [] apps when skipping apps/meson.build for is_ms_compiler in anticipation of merge of patch from David Marchand
https://patchwork.dpdk.org/project/dpdk/patch/[email protected]
* Rebase series and include 'log' library as it is now required by kvargs and telemetry libs
* Move 2 comments into block scope ehre they apply
Note:
There are no requirements specifically for msvc compiler beyond those that would cause build to fail when the currently experimental options are used. when i know the final version of the compiler needed it will be documented in the windows quick start guide.
v3:
* enable compilation with C11 optional atomics
* enable compilation with C23 typeof operator
* disable microsoft secure crt checks (dpdk code fails)
* force use of intrinsics
v2:
* moved checks to skip drivers, apps, usertools directories in to <dir>/meson.build file and removed conditional check from root meson.build (patch 3/3)
Tyler Retzlaff (4):
build: unblock the use of the MSVC compiler
build: determine execution environment at config time
build: limit what is built when using MSVC compiler
build: enable MSVC specific compiler options
app/meson.build | 4 ++++ config/meson.build | 47 +++++++++++++++++++++++++++++++++++++++-------- config/x86/meson.build | 10 ++++++---- drivers/meson.build | 4 ++++ lib/eal/meson.build | 8 -------- lib/meson.build | 21 ++++++++++++++++++--- usertools/meson.build | 4 ++++ 7 files changed, 75 insertions(+), 23 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v5 1/4 build: unblock the use of the MSVC compiler
Detect when MSVC toolset is available and tweak toolchain arguments where the meson build system offers no abstraction.
--- config/meson.build | 23 +++++++++++++++-------- config/x86/meson.build | 10 ++++++---- lib/meson.build | 13 ++++++++++--- 3 files changed, 31 insertions(+), 15 deletions(-)
config/meson.build +15 -8
@@ -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
@@ -129,12 +130,14 @@ endif 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 + # 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 + endif endif toolchain = cc.get_id()
@@ -253,7 +256,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
config/x86/meson.build +6 -4
@@ -24,10 +24,12 @@ if cc.has_argument('-mavx512f') endif 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 + # 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' + endif endif base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2']
lib/meson.build +10 -3
@@ -230,9 +230,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
Signature · 1 line
1.8.3.1
PATCH v5 2/4 build: determine execution environment at config time
In reply to Tyler RetzlaffMove 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.
--- config/meson.build | 8 ++++++++ lib/eal/meson.build | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
config/meson.build +8 -0
@@ -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')
lib/eal/meson.build +0 -8
@@ -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)
Signature · 1 line
1.8.3.1
PATCH v5 3/4 build: limit what is built when using MSVC compiler
In reply to Tyler RetzlaffBuild only kvargs and telemetry when is_ms_compiler.
--- app/meson.build | 4 ++++ drivers/meson.build | 4 ++++ lib/meson.build | 8 ++++++++ usertools/meson.build | 4 ++++ 4 files changed, 20 insertions(+)
app/meson.build +4 -0
@@ -1,6 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation +if is_ms_compiler + subdir_done() +endif + disable_apps = ',' + get_option('disable_apps') disable_apps = run_command(list_dir_globs, disable_apps, check: true).stdout().split()
drivers/meson.build +4 -0
@@ -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
lib/meson.build +8 -0
@@ -66,6 +66,14 @@ libraries = [ 'node', ] +if is_ms_compiler + libraries = [ + 'log', + 'kvargs', + 'telemetry', + ] +endif + optional_libs = [ 'bitratestats', 'cfgfile',
usertools/meson.build +4 -0
@@ -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',
Signature · 1 line
1.8.3.1
PATCH v5 4/4 build: enable MSVC specific compiler options
In reply to Tyler Retzlaff* Enable optional use of C11 atomics support.
* Enable use of C23 typeof operator.
* Explicitly force intrinsics when building with MSVC.
* Disable MSVC C runtime checks.
--- config/meson.build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
config/meson.build +16 -0
@@ -27,6 +27,22 @@ dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1) is_ms_compiler = is_windows and (cc.get_id() == 'msvc') is_ms_linker = is_windows and (cc.get_id() == 'clang' or is_ms_compiler) +if is_ms_compiler + # force the use of intrinsics the MSVC compiler (except x86) + # does not support inline assembly + dpdk_conf.set('RTE_FORCE_INTRINSICS', 1) + + # suppress warnings raised for using standard library functions + # the MSVC compiler regards as unsafe but are used by DPDK + dpdk_conf.set('_CRT_SECURE_NO_WARNINGS', 1) + + # enable non-locking atomic operations + add_project_arguments('/experimental:c11atomics', language: 'c') + + # enable typeof operator + add_project_arguments('/d1experimental:typeof', language: 'c') +endif + # set the major version, which might be used by drivers and libraries # depending on the configuration options pver = meson.project_version().split('.')
Signature · 1 line
1.8.3.1
Re: [PATCH v5 4/4] build: enable MSVC specific compiler options
Quoted 7 lines · Tyler Retzlaff
* Enable optional use of C11 atomics support.
* Enable use of C23 typeof operator.
* Explicitly force intrinsics when building with MSVC.
* Disable MSVC C runtime checks.Signed-off-by Tyler Retzlaff <[email protected]>---
Re: [PATCH v5 0/4] enable use of the MSVC compiler
In reply to Tyler RetzlaffQuoted 8 lines · Tyler Retzlaff
Introduce minimum changes to the build system to allow use of the MSVC compiler.
This change is intended to enable a phased approach to allowing DPDK to built with MSVC. Building with MSVC removes barriers to enterprise customers use of DPDK who have constraints around security policy, compliance and functional requirements.
Series applied, thanks Tyler.
Here we go with MSVC!
Signature · 1 line
David Marchand