[v3,4/4] build: enable MSVC specific compiler options

Message ID 1682453329-20435-5-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Series enable use of the MSVC compiler |


Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Tyler Retzlaff April 25, 2023, 8:08 p.m. UTC
  * 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 <roretzla@linux.microsoft.com>
 config/meson.build | 8 ++++++++
 1 file changed, 8 insertions(+)


diff --git a/config/meson.build b/config/meson.build
index d2b12db..9484449 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -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')
 # set the major version, which might be used by drivers and libraries
 # depending on the configuration options
 pver = meson.project_version().split('.')