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',
23  input : [vk_entrypoints_gen, vk_api_xml],
24  output : ['radv_entrypoints.h', 'radv_entrypoints.c'],
25  command : [
26    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
27    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'radv',
28    '--device-prefix', 'sqtt', '--device-prefix', 'metro_exodus',
29  ],
30  depend_files : vk_entrypoints_gen_depend_files,
31)
32
33libradv_files = files(
34  'layers/radv_metro_exodus.c',
35  'layers/radv_sqtt_layer.c',
36  'winsys/null/radv_null_bo.c',
37  'winsys/null/radv_null_bo.h',
38  'winsys/null/radv_null_cs.c',
39  'winsys/null/radv_null_cs.h',
40  'winsys/null/radv_null_winsys.c',
41  'winsys/null/radv_null_winsys_public.h',
42  'radv_acceleration_structure.c',
43  'radv_acceleration_structure.h',
44  'radv_android.c',
45  'radv_cmd_buffer.c',
46  'radv_cs.h',
47  'radv_debug.c',
48  'radv_debug.h',
49  'radv_device.c',
50  'radv_descriptor_set.c',
51  'radv_descriptor_set.h',
52  'radv_formats.c',
53  'radv_image.c',
54  'radv_meta.c',
55  'radv_meta.h',
56  'radv_meta_blit.c',
57  'radv_meta_blit2d.c',
58  'radv_meta_buffer.c',
59  'radv_meta_bufimage.c',
60  'radv_meta_clear.c',
61  'radv_meta_copy.c',
62  'radv_meta_copy_vrs_htile.c',
63  'radv_meta_dcc_retile.c',
64  'radv_meta_decompress.c',
65  'radv_meta_fast_clear.c',
66  'radv_meta_fmask_expand.c',
67  'radv_meta_resolve.c',
68  'radv_meta_resolve_cs.c',
69  'radv_meta_resolve_fs.c',
70  'radv_nir_lower_ycbcr_textures.c',
71  'radv_pass.c',
72  'radv_pipeline.c',
73  'radv_pipeline_cache.c',
74  'radv_pipeline_rt.c',
75  'radv_private.h',
76  'radv_radeon_winsys.h',
77  'radv_shader.c',
78  'radv_shader.h',
79  'radv_shader_args.c',
80  'radv_shader_args.h',
81  'radv_shader_info.c',
82  'radv_sqtt.c',
83  'radv_query.c',
84  'radv_util.c',
85  'radv_wsi.c',
86  'si_cmd_buffer.c',
87  'vk_format.h',
88)
89
90if not with_platform_windows
91  libradv_files += files(
92    'winsys/amdgpu/radv_amdgpu_bo.c',
93    'winsys/amdgpu/radv_amdgpu_bo.h',
94    'winsys/amdgpu/radv_amdgpu_cs.c',
95    'winsys/amdgpu/radv_amdgpu_cs.h',
96    'winsys/amdgpu/radv_amdgpu_surface.c',
97    'winsys/amdgpu/radv_amdgpu_surface.h',
98    'winsys/amdgpu/radv_amdgpu_winsys.c',
99    'winsys/amdgpu/radv_amdgpu_winsys.h',
100    'winsys/amdgpu/radv_amdgpu_winsys_public.h',
101  )
102endif
103
104if with_llvm
105  libradv_files += files(
106    'radv_llvm_helper.cpp',
107    'radv_llvm_helper.h',
108    'radv_nir_to_llvm.c',
109  )
110endif
111
112radv_deps = []
113radv_flags = cc.get_supported_arguments(['-Wimplicit-fallthrough', '-Wshadow'])
114
115if with_platform_x11
116  radv_deps += dep_xcb_dri3
117endif
118
119if with_platform_wayland
120  radv_deps += dep_wayland_client
121endif
122
123if system_has_kms_drm and not with_platform_android
124  libradv_files += files('radv_wsi_display.c')
125endif
126
127if with_xlib_lease
128  radv_deps += [dep_xlib_xrandr]
129endif
130
131if with_platform_android
132  radv_deps += dep_android
133endif
134
135# When static linking LLVM, all its symbols are public API.
136# That may cause symbol collision, so explicitly demote everything.
137libvulkan_radeon_ld_args = []
138libvulkan_radeon_link_depends = []
139
140if with_llvm and with_ld_version_script
141  libvulkan_radeon_ld_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'vulkan.sym')]
142  libvulkan_radeon_link_depends += files('vulkan.sym')
143endif
144
145vulkan_radv_def = 'vulkan_radv.def'
146
147libvulkan_radeon = shared_library(
148  'vulkan_radeon',
149  [libradv_files, radv_entrypoints, sha1_h],
150  vs_module_defs : vulkan_radv_def,
151  include_directories : [
152    inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_amd, inc_amd_common, inc_amd_common_llvm, inc_compiler, inc_util,
153  ],
154  link_with : [
155    libamd_common, libamd_common_llvm, libamdgpu_addrlib,
156  ],
157  dependencies : [
158    dep_llvm, dep_libdrm_amdgpu, dep_thread, dep_elf, dep_dl, dep_m,
159    dep_valgrind, radv_deps, idep_aco,
160    idep_mesautil, idep_nir, idep_vulkan_util, idep_vulkan_wsi,
161    idep_amdgfxregs_h, idep_xmlconfig,
162  ],
163  c_args : [no_override_init_args, radv_flags, c_msvc_compat_args],
164  cpp_args : [radv_flags, cpp_msvc_compat_args],
165  link_args : [
166    ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections, libvulkan_radeon_ld_args,
167  ],
168  link_depends : [libvulkan_radeon_link_depends,],
169  gnu_symbol_visibility : 'hidden',
170  install : true,
171)
172
173if with_symbols_check
174  test(
175    'radv symbols check',
176    symbols_check,
177    args : [
178      '--lib', libvulkan_radeon,
179      '--symbols-file', vulkan_icd_symbols,
180      '--ignore-symbol', 'ac_init_shared_llvm_once',
181      symbols_check_args,
182    ],
183    suite : ['amd'],
184  )
185endif
186
187icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
188icd_file_name = 'libvulkan_radeon.so'
189if with_platform_windows
190  icd_lib_path = '.'
191  icd_file_name = 'vulkan_radeon.dll'
192endif
193
194radeon_icd = custom_target(
195  'radeon_icd',
196  input : [vk_icd_gen, vk_api_xml],
197  output : 'radeon_icd.@0@.json'.format(host_machine.cpu()),
198  command : [
199    prog_python, '@INPUT0@',
200    '--api-version', '1.2', '--xml', '@INPUT1@',
201    '--lib-path', join_paths(icd_lib_path, icd_file_name),
202    '--out', '@OUTPUT@',
203  ],
204  build_by_default : true,
205  install_dir : with_vulkan_icd_dir,
206  install : true,
207)
208
209