1# Copyright © 2017 Intel Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20
21radv_entrypoints = custom_target(
22  'radv_entrypoints.[ch]',
23  input : ['radv_entrypoints_gen.py', vk_api_xml],
24  output : ['radv_entrypoints.h', 'radv_entrypoints.c'],
25  command : [
26    prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--outdir',
27    meson.current_build_dir()
28  ],
29  depend_files : files('radv_extensions.py'),
30)
31
32radv_extensions_c = custom_target(
33  'radv_extensions.c',
34  input : ['radv_extensions.py', vk_api_xml, vk_android_native_buffer_xml],
35  output : ['radv_extensions.c'],
36  command : [
37    prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@', '--out', '@OUTPUT@',
38  ],
39)
40
41vk_format_table_c = custom_target(
42  'vk_format_table.c',
43  input : ['vk_format_table.py', 'vk_format_layout.csv'],
44  output : 'vk_format_table.c',
45  command : [prog_python2, '@INPUT@'],
46  depend_files : files('vk_format_parse.py'),
47  capture : true,
48)
49
50libradv_files = files(
51  'winsys/amdgpu/radv_amdgpu_bo.c',
52  'winsys/amdgpu/radv_amdgpu_bo.h',
53  'winsys/amdgpu/radv_amdgpu_cs.c',
54  'winsys/amdgpu/radv_amdgpu_cs.h',
55  'winsys/amdgpu/radv_amdgpu_surface.c',
56  'winsys/amdgpu/radv_amdgpu_surface.h',
57  'winsys/amdgpu/radv_amdgpu_winsys.c',
58  'winsys/amdgpu/radv_amdgpu_winsys.h',
59  'winsys/amdgpu/radv_amdgpu_winsys_public.h',
60  'radv_cmd_buffer.c',
61  'radv_cs.h',
62  'radv_debug.c',
63  'radv_debug.h',
64  'radv_device.c',
65  'radv_descriptor_set.c',
66  'radv_descriptor_set.h',
67  'radv_formats.c',
68  'radv_image.c',
69  'radv_meta.c',
70  'radv_meta.h',
71  'radv_meta_blit.c',
72  'radv_meta_blit2d.c',
73  'radv_meta_buffer.c',
74  'radv_meta_bufimage.c',
75  'radv_meta_clear.c',
76  'radv_meta_copy.c',
77  'radv_meta_decompress.c',
78  'radv_meta_fast_clear.c',
79  'radv_meta_resolve.c',
80  'radv_meta_resolve_cs.c',
81  'radv_meta_resolve_fs.c',
82  'radv_pass.c',
83  'radv_pipeline.c',
84  'radv_pipeline_cache.c',
85  'radv_private.h',
86  'radv_radeon_winsys.h',
87  'radv_shader.c',
88  'radv_shader.h',
89  'radv_query.c',
90  'radv_util.c',
91  'radv_util.h',
92  'radv_wsi.c',
93  'si_cmd_buffer.c',
94  'vk_format.h',
95)
96
97radv_deps = []
98radv_flags = []
99
100if with_platform_x11
101  radv_deps += dep_xcb_dri3
102  radv_flags += [
103    '-DVK_USE_PLATFORM_XCB_KHR',
104    '-DVK_USE_PLATFORM_XLIB_KHR',
105  ]
106  libradv_files += files('radv_wsi_x11.c')
107endif
108
109if with_platform_wayland
110  radv_deps += dep_wayland_client
111  radv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
112  libradv_files += files('radv_wsi_wayland.c')
113endif
114
115libvulkan_radeon = shared_library(
116  'vulkan_radeon',
117  [libradv_files, radv_entrypoints, radv_extensions_c, vk_format_table_c],
118  include_directories : [
119    inc_common, inc_amd, inc_amd_common, inc_compiler, inc_vulkan_util,
120    inc_vulkan_wsi,
121  ],
122  link_with : [
123    libamd_common, libamdgpu_addrlib, libvulkan_util, libvulkan_wsi,
124    libmesa_util,
125  ],
126  dependencies : [
127    dep_llvm, dep_libdrm_amdgpu, dep_thread, dep_elf, dep_dl, dep_m,
128    dep_valgrind,
129    idep_nir,
130  ],
131  c_args : [c_vis_args, no_override_init_args, radv_flags],
132  link_args : [ld_args_bsymbolic, ld_args_gc_sections],
133  install : true,
134)
135
136radv_data = configuration_data()
137radv_data.set('install_libdir', join_paths(get_option('prefix'), get_option('libdir')))
138radv_data.set('libvulkan_radeon_path', libvulkan_radeon.full_path())
139
140configure_file(
141  configuration : radv_data,
142  input : 'radeon_icd.json.in',
143  output : 'radeon_icd.@0@.json'.format(host_machine.cpu()),
144  install_dir : with_vulkan_icd_dir,
145)
146configure_file(
147  configuration : radv_data,
148  input : 'dev_icd.json.in',
149  output : 'dev_icd.json'
150)
151