• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © Microsoft Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a
4# copy of this software and associated documentation files (the "Software"),
5# to deal in the Software without restriction, including without limitation
6# the rights to use, copy, modify, merge, publish, distribute, sublicense,
7# and/or sell copies of the Software, and to permit persons to whom the
8# Software is furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice (including the next
11# paragraph) shall be included in all copies or substantial portions of the
12# Software.
13
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20# IN THE SOFTWARE.
21
22dzn_entrypoints = custom_target(
23  'dzn_entrypoints',
24  input : [vk_entrypoints_gen, vk_api_xml],
25  output : ['dzn_entrypoints.h', 'dzn_entrypoints.c'],
26  command : [
27    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
28    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'dzn'
29  ],
30  depend_files : vk_entrypoints_gen_depend_files,
31)
32
33libdzn_files = files(
34  'dzn_cmd_buffer.c',
35  'dzn_descriptor_set.c',
36  'dzn_device.c',
37  'dzn_dxcore.cpp',
38  'dzn_image.c',
39  'dzn_meta.c',
40  'dzn_nir.c',
41  'dzn_pipeline.c',
42  'dzn_query.c',
43  'dzn_sync.c',
44  'dzn_util.c',
45  'dzn_wsi.c',
46)
47
48dzn_deps = [
49  idep_libdxil_compiler,
50  idep_libspirv_to_dxil,
51  idep_nir,
52  idep_nir_headers,
53  idep_vulkan_util,
54  idep_vulkan_runtime,
55  idep_vulkan_wsi,
56  dep_dxheaders,
57]
58
59dzn_flags = [ ]
60dzn_cpp_flags = [ ]
61
62if with_platform_windows
63  dzn_flags += '-DVK_USE_PLATFORM_WIN32_KHR'
64  libdzn_files += files('dzn_dxgi.c')
65endif
66
67if cc.get_argument_syntax() != 'msvc'
68  dzn_flags_to_try = [
69    '-Werror=unused-variable',
70    '-Werror=unused-but-set-variable',
71    '-Werror=unused-value',
72    '-Werror=format',
73    '-Werror=switch',
74  ]
75  dzn_flags += cc.get_supported_arguments(dzn_flags_to_try)
76  dzn_cpp_flags = cpp.get_supported_arguments(['-Wno-error=unused-value'])
77endif
78
79libvulkan_dzn = shared_library(
80  'vulkan_dzn',
81  [libdzn_files, dzn_entrypoints, sha1_h],
82  vs_module_defs : vulkan_api_def,
83  include_directories : [
84    inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux,
85    inc_compiler, inc_util
86  ],
87  dependencies : [dzn_deps, idep_vulkan_wsi],
88  c_args : dzn_flags,
89  cpp_args : dzn_cpp_flags,
90  gnu_symbol_visibility : 'hidden',
91  link_args : [ld_args_bsymbolic, ld_args_gc_sections],
92  name_prefix : host_machine.system() == 'windows' ? '' : 'lib',
93  install : true,
94)
95
96icd_file_name = 'libvulkan_dzn.so'
97module_dir = join_paths(get_option('prefix'), get_option('libdir'))
98if with_platform_windows
99  module_dir = join_paths(get_option('prefix'), get_option('bindir'))
100  icd_file_name = 'vulkan_dzn.dll'
101endif
102
103
104icd_command = [
105   prog_python, '@INPUT0@',
106   '--api-version', '1.1', '--xml', '@INPUT1@',
107   '--lib-path', join_paths(module_dir, icd_file_name),
108   '--out', '@OUTPUT@',
109]
110
111icd_dev_command = [
112   prog_python, '@INPUT0@',
113   '--api-version', '1.1', '--xml', '@INPUT1@',
114   '--lib-path', join_paths(meson.current_build_dir(), icd_file_name),
115   '--out', '@OUTPUT@',
116]
117
118if with_platform_windows
119  icd_command += '--use-backslash'
120  icd_dev_command += '--use-backslash'
121endif
122
123dzn_icd = custom_target(
124  'dzn_icd',
125  input : [vk_icd_gen, vk_api_xml],
126  output : 'dzn_icd.@0@.json'.format(host_machine.cpu()),
127  command : icd_command,
128  build_by_default : true,
129  install_dir : with_vulkan_icd_dir,
130  install : true,
131)
132
133if meson.version().version_compare('>= 0.58')
134  _dev_icdname = 'dzn_devenv_icd.@0@.json'.format(host_machine.cpu())
135  custom_target(
136    'dzn_devenv_icd',
137    input : [vk_icd_gen, vk_api_xml],
138    output : _dev_icdname,
139    command : icd_dev_command,
140    build_by_default : true,
141  )
142
143  devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
144endif
145