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@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13141>
This commit is contained in:
Mike Blumenkrantz
2021-10-01 09:43:00 -04:00
committed by Marge Bot
parent 1d574d4860
commit 7cc85dba71
10 changed files with 28 additions and 61 deletions

View File

@@ -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'

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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')

View File

@@ -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

View File

@@ -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(

View File

@@ -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(

View File

@@ -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