dozen: require c++20 for designated initializers
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 1 Apr 2022 07:07:40 +0000 (09:07 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 5 Apr 2022 16:58:56 +0000 (16:58 +0000)
We do require C++20 still, because designated initializers is part of
that standard. This is almost a revert, but conditionally selecting
between c++latest or c++20 when available, as that's what we really want.

Fixes: 55ca1c8db37 ("vulkan/microsoft: Remove `override_options: ['cpp_std=c++latest']` option for visual studio")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15706>

src/microsoft/vulkan/meson.build

index f2989bc..2d8ce7a 100644 (file)
@@ -64,6 +64,14 @@ if with_platform_windows
   dzn_flags += '-DVK_USE_PLATFORM_WIN32_KHR'
 endif
 
+if meson.version().version_compare('>= 0.60')
+  cpp_std = 'cpp_std=c++20'
+elif cpp.get_id() == 'msvc'
+  cpp_std = 'cpp_std=c++latest'
+else
+  cpp_std = 'cpp_std=c++2a'
+endif
+
 libvulkan_dzn = shared_library(
   'vulkan_dzn',
   [libdzn_files, dzn_entrypoints, sha1_h],
@@ -78,7 +86,8 @@ libvulkan_dzn = shared_library(
   gnu_symbol_visibility : 'hidden',
   link_args : [ld_args_bsymbolic, ld_args_gc_sections],
   name_prefix : host_machine.system() == 'windows' ? '' : 'lib',
-  install : true
+  install : true,
+  override_options: [cpp_std]
 )
 
 icd_file_name = 'libvulkan_dzn.so'