Mesa (main): build: unify vulkan cpp platform args

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 6 15:03:16 UTC 2021


Module: Mesa
Branch: main
Commit: 7cc85dba71cdf6a75ee6625ac5ae5a6798273f18
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7cc85dba71cdf6a75ee6625ac5ae5a6798273f18

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Oct  1 09:43:00 2021 -0400

build: unify vulkan cpp platform args

these were duplicated all over the place, and it's annoying to have to keep
duplicating them any time a new component includes the vulkan header

Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13141>

---

 meson.build                                | 28 ++++++++++++++++++++++++++++
 src/amd/vulkan/meson.build                 | 16 ----------------
 src/broadcom/vulkan/meson.build            |  6 ------
 src/freedreno/vulkan/meson.build           |  8 --------
 src/gallium/frontends/lavapipe/meson.build |  6 ------
 src/intel/vulkan/meson.build               |  8 --------
 src/panfrost/vulkan/meson.build            |  2 --
 src/virtio/vulkan/meson.build              |  6 ------
 src/vulkan/device-select-layer/meson.build |  2 --
 src/vulkan/meson.build                     |  7 -------
 10 files changed, 28 insertions(+), 61 deletions(-)

diff --git a/meson.build b/meson.build
index 13b63f8ff09..c390dd8e83c 100644
--- a/meson.build
+++ b/meson.build
@@ -414,6 +414,34 @@ else
   with_xlib_lease = _xlib_lease == 'enabled'
 endif
 
+if with_platform_wayland
+  c_args += '-DVK_USE_PLATFORM_WAYLAND_KHR'
+  cpp_args += '-DVK_USE_PLATFORM_WAYLAND_KHR'
+endif
+if with_platform_x11
+  c_args += ['-DVK_USE_PLATFORM_XCB_KHR', '-DVK_USE_PLATFORM_XLIB_KHR']
+  #add this once aco and other places can build with it
+  #cpp_args += ['-DVK_USE_PLATFORM_XCB_KHR', '-DVK_USE_PLATFORM_XLIB_KHR']
+endif
+if with_platform_windows
+  c_args += '-DVK_USE_PLATFORM_WIN32_KHR'
+  #add this once aco and other places can build with it
+  #cpp_args += '-DVK_USE_PLATFORM_WIN32_KHR'
+endif
+if with_platform_android
+  c_args += '-DVK_USE_PLATFORM_ANDROID_KHR'
+  cpp_args += '-DVK_USE_PLATFORM_ANDROID_KHR'
+endif
+if with_xlib_lease
+  c_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
+  #add this once aco and other places can build with it
+  #cpp_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
+endif
+if system_has_kms_drm and not with_platform_android
+  c_args += '-DVK_USE_PLATFORM_DISPLAY_KHR'
+  cpp_args += '-DVK_USE_PLATFORM_DISPLAY_KHR'
+endif
+
 _egl = get_option('egl')
 if _egl == 'true'
   _egl = 'enabled'
diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
index 5e0840e7f5f..a99f00fd2e7 100644
--- a/src/amd/vulkan/meson.build
+++ b/src/amd/vulkan/meson.build
@@ -113,40 +113,24 @@ radv_flags = cc.get_supported_arguments(['-Wimplicit-fallthrough', '-Wshadow'])
 
 if with_platform_x11
   radv_deps += dep_xcb_dri3
-  radv_flags += [
-    '-DVK_USE_PLATFORM_XCB_KHR',
-    '-DVK_USE_PLATFORM_XLIB_KHR',
-  ]
   libradv_files += files('radv_wsi_x11.c')
 endif
 
 if with_platform_wayland
   radv_deps += dep_wayland_client
-  radv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
   libradv_files += files('radv_wsi_wayland.c')
 endif
 
 if system_has_kms_drm and not with_platform_android
-  radv_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
   libradv_files += files('radv_wsi_display.c')
 endif
 
 if with_xlib_lease
   radv_deps += [dep_xlib_xrandr]
-  radv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
 endif
 
 if with_platform_android
   radv_deps += dep_android
-  radv_flags += [
-    '-DVK_USE_PLATFORM_ANDROID_KHR'
-  ]
-endif
-
-if with_platform_windows
-  radv_flags += [
-    '-DVK_USE_PLATFORM_WIN32_KHR',
-  ]
 endif
 
 # When static linking LLVM, all its symbols are public API.
diff --git a/src/broadcom/vulkan/meson.build b/src/broadcom/vulkan/meson.build
index 9d2593cf6d2..eb826a6af0b 100644
--- a/src/broadcom/vulkan/meson.build
+++ b/src/broadcom/vulkan/meson.build
@@ -90,22 +90,16 @@ v3dv_deps = [
 
 if with_platform_x11
   v3dv_deps += dep_xcb_dri3
-  v3dv_flags += [
-    '-DVK_USE_PLATFORM_XCB_KHR',
-    '-DVK_USE_PLATFORM_XLIB_KHR',
-  ]
   libv3dv_files += files('v3dv_wsi_x11.c')
 endif
 
 if with_platform_wayland
   v3dv_deps += [dep_wayland_client, dep_wl_protocols]
-  v3dv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
   libv3dv_files += files('v3dv_wsi_wayland.c')
   libv3dv_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c]
 endif
 
 if system_has_kms_drm and not with_platform_android
- v3dv_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
  libv3dv_files += files('v3dv_wsi_display.c')
 endif
 
diff --git a/src/freedreno/vulkan/meson.build b/src/freedreno/vulkan/meson.build
index a35af5664fb..e1365eb828a 100644
--- a/src/freedreno/vulkan/meson.build
+++ b/src/freedreno/vulkan/meson.build
@@ -62,23 +62,17 @@ tu_wsi = false
 
 if with_platform_x11
   tu_deps += dep_xcb_dri3
-  tu_flags += [
-    '-DVK_USE_PLATFORM_XCB_KHR',
-    '-DVK_USE_PLATFORM_XLIB_KHR',
-  ]
   libtu_files += files('tu_wsi_x11.c')
   tu_wsi = true
 endif
 
 if with_platform_wayland
   tu_deps += dep_wayland_client
-  tu_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
   libtu_files += files('tu_wsi_wayland.c')
   tu_wsi = true
 endif
 
 if system_has_kms_drm and not with_platform_android
-  tu_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
   libtu_files += files('tu_wsi_display.c')
   tu_wsi = true
 endif
@@ -89,14 +83,12 @@ if tu_wsi
 endif
 
 if with_platform_android
-  tu_flags += '-DVK_USE_PLATFORM_ANDROID_KHR'
   libtu_files += files('tu_android.c')
   tu_deps += [dep_android]
 endif
 
 if with_xlib_lease
   tu_deps += [dep_xlib_xrandr]
-  tu_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
 endif
 
 if with_freedreno_kgsl
diff --git a/src/gallium/frontends/lavapipe/meson.build b/src/gallium/frontends/lavapipe/meson.build
index 83d8857e825..7bb9fe8df12 100644
--- a/src/gallium/frontends/lavapipe/meson.build
+++ b/src/gallium/frontends/lavapipe/meson.build
@@ -43,21 +43,15 @@ lvp_flags = []
 
 if with_platform_x11
   lvp_deps += dep_xcb_dri3
-  lvp_flags += [
-    '-DVK_USE_PLATFORM_XCB_KHR',
-    '-DVK_USE_PLATFORM_XLIB_KHR',
-  ]
   liblvp_files += files('lvp_wsi_x11.c')
 endif
 
 if with_platform_wayland
   lvp_deps += dep_wayland_client
-  lvp_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
   liblvp_files += files('lvp_wsi_wayland.c')
 endif
 
 if with_platform_windows
-  lvp_flags += '-DVK_USE_PLATFORM_WIN32_KHR'
   liblvp_files += files('lvp_wsi_win32.c')
 endif
 
diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build
index 97423f0b025..90ff0a02329 100644
--- a/src/intel/vulkan/meson.build
+++ b/src/intel/vulkan/meson.build
@@ -125,31 +125,23 @@ anv_flags = [
 
 if with_platform_x11
   anv_deps += dep_xcb_dri3
-  anv_flags += [
-    '-DVK_USE_PLATFORM_XCB_KHR',
-    '-DVK_USE_PLATFORM_XLIB_KHR',
-  ]
   libanv_files += files('anv_wsi_x11.c')
 endif
 
 if with_platform_wayland
   anv_deps += dep_wayland_client
-  anv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
   libanv_files += files('anv_wsi_wayland.c')
 endif
 
 if system_has_kms_drm and not with_platform_android
-  anv_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
   libanv_files += files('anv_wsi_display.c')
 endif
 
 if with_xlib_lease
   anv_deps += [dep_xlib_xrandr]
-  anv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
 endif
 
 if with_platform_android
-  anv_flags += '-DVK_USE_PLATFORM_ANDROID_KHR'
   libanv_files += files('anv_android.c')
 else
   libanv_files += files('anv_android_stubs.c')
diff --git a/src/panfrost/vulkan/meson.build b/src/panfrost/vulkan/meson.build
index 9401dde3d4d..07f2fca25fb 100644
--- a/src/panfrost/vulkan/meson.build
+++ b/src/panfrost/vulkan/meson.build
@@ -95,13 +95,11 @@ foreach arch : ['5', '6', '7']
 endforeach
 
 if system_has_kms_drm
-  panvk_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
   libpanvk_files += files('panvk_wsi_display.c')
 endif
 
 if with_platform_wayland
   panvk_deps += [dep_wayland_client, dep_wl_protocols]
-  panvk_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
   libpanvk_files += files('panvk_wsi_wayland.c')
   libpanvk_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c]
 endif
diff --git a/src/virtio/vulkan/meson.build b/src/virtio/vulkan/meson.build
index 15734dfddbd..9ce40dfd883 100644
--- a/src/virtio/vulkan/meson.build
+++ b/src/virtio/vulkan/meson.build
@@ -74,22 +74,16 @@ endif
 if with_platform_wayland
   libvn_files += files('vn_wsi_wayland.c')
   vn_deps += dep_wayland_client
-  vn_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
 endif
 
 if with_platform_x11
   libvn_files += files('vn_wsi_x11.c')
   vn_deps += dep_xcb_dri3
-  vn_flags += [
-    '-DVK_USE_PLATFORM_XCB_KHR',
-    '-DVK_USE_PLATFORM_XLIB_KHR',
-  ]
 endif
 
 if with_platform_android
   libvn_files += files('vn_android.c')
   vn_deps += dep_android
-  vn_flags += '-DVK_USE_PLATFORM_ANDROID_KHR'
 endif
 
 libvulkan_virtio = shared_library(
diff --git a/src/vulkan/device-select-layer/meson.build b/src/vulkan/device-select-layer/meson.build
index c1336b27c3f..9b6747bf090 100644
--- a/src/vulkan/device-select-layer/meson.build
+++ b/src/vulkan/device-select-layer/meson.build
@@ -28,14 +28,12 @@ vklayer_flags = []
 if with_platform_x11
    vklayer_files += files('device_select_x11.c')
    vklayer_deps += dep_xcb_dri3
-   vklayer_flags += [ '-DVK_USE_PLATFORM_XCB_KHR' ]
 endif
 
 if with_platform_wayland
    vklayer_files += files('device_select_wayland.c')
    vklayer_files += [ wayland_drm_client_protocol_h, wayland_drm_protocol_c ]
    vklayer_deps += [dep_wayland_client, dep_wl_protocols]
-   vklayer_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
 endif
 
 vklayer_mesa_device_select = shared_library(
diff --git a/src/vulkan/meson.build b/src/vulkan/meson.build
index 4590cfe4070..f087804ffbe 100644
--- a/src/vulkan/meson.build
+++ b/src/vulkan/meson.build
@@ -29,7 +29,6 @@ vulkan_wsi_deps = []
 vulkan_wsi_list = []
 
 if with_platform_x11
-  vulkan_wsi_args += ['-DVK_USE_PLATFORM_XCB_KHR', '-DVK_USE_PLATFORM_XLIB_KHR']
   vulkan_wsi_deps += [
     dep_xcb,
     dep_x11_xcb,
@@ -43,20 +42,14 @@ if with_platform_x11
   vulkan_wsi_list += ['xcb', 'x11']
 endif
 if with_platform_wayland
-  vulkan_wsi_args += ['-DVK_USE_PLATFORM_WAYLAND_KHR']
   vulkan_wsi_deps += dep_wayland_client
   vulkan_wsi_list += ['wayland']
 endif
-if with_platform_windows
-  vulkan_wsi_args += ['-DVK_USE_PLATFORM_WIN32_KHR']
-endif
 if system_has_kms_drm and not with_platform_android
-  vulkan_wsi_args += '-DVK_USE_PLATFORM_DISPLAY_KHR'
   vulkan_wsi_deps += [dep_libdrm]
   vulkan_wsi_list += ['drm']
 endif
 if with_xlib_lease
-  vulkan_wsi_args += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
   vulkan_wsi_deps += [dep_xlib_xrandr]
   vulkan_wsi_list += ['xlib_xrandr']
 endif



More information about the mesa-commit mailing list