xref: /aosp_15_r20/external/mesa3d/src/vulkan/wsi/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2017 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4files_vulkan_wsi = files('wsi_common.c')
5links_vulkan_wsi = []
6platform_deps = []
7
8if dep_libdrm.found()
9  files_vulkan_wsi += files('wsi_common_drm.c')
10endif
11
12if with_platform_x11
13  files_vulkan_wsi += files('wsi_common_x11.c')
14endif
15
16if with_platform_wayland
17  files_vulkan_wsi += files('wsi_common_wayland.c')
18  files_vulkan_wsi += wp_files['linux-dmabuf-unstable-v1']
19  files_vulkan_wsi += wp_files['presentation-time']
20  files_vulkan_wsi += wp_files['tearing-control-v1']
21  links_vulkan_wsi += libloader_wayland_helper
22  files_vulkan_wsi += wp_files['linux-drm-syncobj-v1']
23endif
24
25if with_platform_windows
26  files_vulkan_wsi += files('wsi_common_win32.cpp')
27  platform_deps += dep_dxheaders
28else
29  files_vulkan_wsi += files('wsi_common_headless.c')
30endif
31
32if with_platform_macos
33  files_vulkan_wsi += files('wsi_common_metal.c', 'wsi_common_metal_layer.m')
34endif
35
36if system_has_kms_drm and not with_platform_android
37  files_vulkan_wsi += files('wsi_common_display.c')
38endif
39
40wsi_entrypoints = custom_target(
41  'wsi_entrypoints',
42  input : [vk_entrypoints_gen, vk_api_xml],
43  output : ['wsi_common_entrypoints.h', 'wsi_common_entrypoints.c'],
44  command : [
45    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
46    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'wsi',
47    '--beta', with_vulkan_beta.to_string()
48  ],
49  depend_files : vk_entrypoints_gen_depend_files,
50)
51
52libvulkan_wsi = static_library(
53  'vulkan_wsi',
54  [files_vulkan_wsi, wsi_entrypoints],
55  include_directories : [inc_include, inc_src],
56  dependencies : [
57    vulkan_wsi_deps, dep_libdrm, dep_libudev, idep_vulkan_util_headers,
58    idep_vulkan_runtime_headers, idep_xmlconfig, idep_mesautil, platform_deps,
59    idep_blake3
60  ],
61  link_with: links_vulkan_wsi,
62  gnu_symbol_visibility : 'hidden',
63  build_by_default : false,
64)
65
66idep_vulkan_wsi_headers = declare_dependency(
67  sources : wsi_entrypoints[0],
68  dependencies : idep_vulkan_wsi_defines,
69  include_directories : include_directories('.')
70)
71
72# This is likely a bug in the Meson VS backend, as MSVC with ninja works fine.
73# See this discussion here:
74# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10506
75if get_option('backend').startswith('vs')
76  idep_vulkan_wsi = declare_dependency(
77    link_with : libvulkan_wsi,
78    dependencies : idep_vulkan_wsi_headers
79  )
80else
81  idep_vulkan_wsi = declare_dependency(
82    # Instruct users of this library to link with --whole-archive.  Otherwise,
83    # our weak function overloads may not resolve properly.
84    link_whole : libvulkan_wsi,
85    dependencies : [
86      idep_vulkan_wsi_headers, dep_libudev
87    ]
88  )
89endif
90