xref: /aosp_15_r20/external/mesa3d/src/microsoft/vulkan/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © Microsoft Corporation
2# SPDX-License-Identifier: MIT
3
4dzn_entrypoints = custom_target(
5  'dzn_entrypoints',
6  input : [vk_entrypoints_gen, vk_api_xml],
7  output : ['dzn_entrypoints.h', 'dzn_entrypoints.c'],
8  command : [
9    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
10    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'dzn',
11    '--beta', with_vulkan_beta.to_string()
12  ],
13  depend_files : vk_entrypoints_gen_depend_files,
14)
15
16libdzn_files = files(
17  'dzn_cmd_buffer.c',
18  'dzn_descriptor_set.c',
19  'dzn_device.c',
20  'dzn_dxcore.cpp',
21  'dzn_image.c',
22  'dzn_meta.c',
23  'dzn_nir.c',
24  'dzn_pipeline.c',
25  'dzn_query.c',
26  'dzn_sync.c',
27  'dzn_util.c',
28  'dzn_wsi.c',
29)
30
31dzn_deps = [
32  idep_libdxil_compiler,
33  idep_libspirv_to_dxil,
34  idep_nir,
35  idep_nir_headers,
36  idep_vulkan_util,
37  idep_vulkan_runtime,
38  idep_vulkan_wsi,
39  idep_mesautil,
40  dep_dxheaders,
41]
42
43dzn_flags = [ ]
44dzn_cpp_flags = [ ]
45
46if with_platform_windows
47  dzn_flags += '-DVK_USE_PLATFORM_WIN32_KHR'
48  libdzn_files += files('dzn_dxgi.c')
49endif
50
51if cc.get_argument_syntax() != 'msvc'
52  dzn_flags_to_try = [
53    '-Werror=unused-variable',
54    '-Werror=unused-but-set-variable',
55    '-Werror=unused-value',
56    '-Werror=format',
57    '-Werror=switch',
58  ]
59  dzn_flags += cc.get_supported_arguments(dzn_flags_to_try)
60  dzn_cpp_flags = cpp.get_supported_arguments(['-Wno-error=unused-value'])
61endif
62
63libvulkan_dzn = shared_library(
64  'vulkan_dzn',
65  [libdzn_files, dzn_entrypoints, sha1_h],
66  vs_module_defs : vulkan_api_def,
67  include_directories : [inc_include, inc_src, inc_util],
68  dependencies : [dzn_deps, idep_vulkan_wsi, idep_xmlconfig],
69  c_args : dzn_flags,
70  cpp_args : dzn_cpp_flags,
71  gnu_symbol_visibility : 'hidden',
72  link_args : [ld_args_bsymbolic, ld_args_gc_sections],
73  name_prefix : host_machine.system() == 'windows' ? '' : [],
74  install : true,
75)
76
77icd_file_name = 'libvulkan_dzn.so'
78icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
79if with_platform_windows
80  icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
81  icd_file_name = 'vulkan_dzn.dll'
82endif
83
84
85icd_command = [
86   prog_python, '@INPUT0@',
87   '--api-version', '1.1', '--xml', '@INPUT1@',
88   '--lib-path', join_paths(icd_lib_path, icd_file_name),
89   '--out', '@OUTPUT@',
90]
91
92icd_dev_command = [
93   prog_python, '@INPUT0@',
94   '--api-version', '1.1', '--xml', '@INPUT1@',
95   '--lib-path', join_paths(meson.current_build_dir(), icd_file_name),
96   '--out', '@OUTPUT@',
97]
98
99if with_platform_windows
100  icd_command += '--use-backslash'
101  icd_dev_command += '--use-backslash'
102endif
103
104dzn_icd = custom_target(
105  'dzn_icd',
106  input : [vk_icd_gen, vk_api_xml],
107  output : 'dzn_icd.@[email protected]'.format(host_machine.cpu()),
108  command : icd_command,
109  build_by_default : true,
110  install_dir : with_vulkan_icd_dir,
111  install_tag : 'runtime',
112  install : true,
113)
114
115_dev_icdname = 'dzn_devenv_icd.@[email protected]'.format(host_machine.cpu())
116_dev_icd = custom_target(
117  'dzn_devenv_icd',
118  input : [vk_icd_gen, vk_api_xml],
119  output : _dev_icdname,
120  command : icd_dev_command,
121  build_by_default : true,
122)
123
124devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
125# Deprecated: replaced by VK_DRIVER_FILES above
126devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())
127