xref: /third_party/mesa3d/src/amd/vulkan/meson.build (revision bf215546)
1bf215546Sopenharmony_ci# Copyright © 2017 Intel Corporation
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy
4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal
5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights
6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is
8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions:
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in
11bf215546Sopenharmony_ci# all copies or substantial portions of the Software.
12bf215546Sopenharmony_ci
13bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19bf215546Sopenharmony_ci# SOFTWARE.
20bf215546Sopenharmony_ci
21bf215546Sopenharmony_ciradv_entrypoints = custom_target(
22bf215546Sopenharmony_ci  'radv_entrypoints',
23bf215546Sopenharmony_ci  input : [vk_entrypoints_gen, vk_api_xml],
24bf215546Sopenharmony_ci  output : ['radv_entrypoints.h', 'radv_entrypoints.c'],
25bf215546Sopenharmony_ci  command : [
26bf215546Sopenharmony_ci    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
27bf215546Sopenharmony_ci    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'radv',
28bf215546Sopenharmony_ci    '--device-prefix', 'sqtt', '--device-prefix', 'metro_exodus',
29bf215546Sopenharmony_ci  ],
30bf215546Sopenharmony_ci  depend_files : vk_entrypoints_gen_depend_files,
31bf215546Sopenharmony_ci)
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_cilibradv_files = files(
34bf215546Sopenharmony_ci  'layers/radv_metro_exodus.c',
35bf215546Sopenharmony_ci  'layers/radv_sqtt_layer.c',
36bf215546Sopenharmony_ci  'winsys/null/radv_null_bo.c',
37bf215546Sopenharmony_ci  'winsys/null/radv_null_bo.h',
38bf215546Sopenharmony_ci  'winsys/null/radv_null_cs.c',
39bf215546Sopenharmony_ci  'winsys/null/radv_null_cs.h',
40bf215546Sopenharmony_ci  'winsys/null/radv_null_winsys.c',
41bf215546Sopenharmony_ci  'winsys/null/radv_null_winsys_public.h',
42bf215546Sopenharmony_ci  'radv_acceleration_structure.c',
43bf215546Sopenharmony_ci  'radv_acceleration_structure.h',
44bf215546Sopenharmony_ci  'radv_android.c',
45bf215546Sopenharmony_ci  'radv_cmd_buffer.c',
46bf215546Sopenharmony_ci  'radv_cs.h',
47bf215546Sopenharmony_ci  'radv_debug.c',
48bf215546Sopenharmony_ci  'radv_debug.h',
49bf215546Sopenharmony_ci  'radv_device.c',
50bf215546Sopenharmony_ci  'radv_descriptor_set.c',
51bf215546Sopenharmony_ci  'radv_descriptor_set.h',
52bf215546Sopenharmony_ci  'radv_device_generated_commands.c',
53bf215546Sopenharmony_ci  'radv_formats.c',
54bf215546Sopenharmony_ci  'radv_image.c',
55bf215546Sopenharmony_ci  'radv_meta.c',
56bf215546Sopenharmony_ci  'radv_meta.h',
57bf215546Sopenharmony_ci  'radv_meta_blit.c',
58bf215546Sopenharmony_ci  'radv_meta_blit2d.c',
59bf215546Sopenharmony_ci  'radv_meta_buffer.c',
60bf215546Sopenharmony_ci  'radv_meta_bufimage.c',
61bf215546Sopenharmony_ci  'radv_meta_clear.c',
62bf215546Sopenharmony_ci  'radv_meta_copy.c',
63bf215546Sopenharmony_ci  'radv_meta_copy_vrs_htile.c',
64bf215546Sopenharmony_ci  'radv_meta_dcc_retile.c',
65bf215546Sopenharmony_ci  'radv_meta_decompress.c',
66bf215546Sopenharmony_ci  'radv_meta_etc_decode.c',
67bf215546Sopenharmony_ci  'radv_meta_fast_clear.c',
68bf215546Sopenharmony_ci  'radv_meta_fmask_copy.c',
69bf215546Sopenharmony_ci  'radv_meta_fmask_expand.c',
70bf215546Sopenharmony_ci  'radv_meta_resolve.c',
71bf215546Sopenharmony_ci  'radv_meta_resolve_cs.c',
72bf215546Sopenharmony_ci  'radv_meta_resolve_fs.c',
73bf215546Sopenharmony_ci  'radv_nir_apply_pipeline_layout.c',
74bf215546Sopenharmony_ci  'radv_nir_lower_abi.c',
75bf215546Sopenharmony_ci  'radv_nir_lower_ray_queries.c',
76bf215546Sopenharmony_ci  'radv_nir_lower_ycbcr_textures.c',
77bf215546Sopenharmony_ci  'radv_pass.c',
78bf215546Sopenharmony_ci  'radv_perfcounter.c',
79bf215546Sopenharmony_ci  'radv_pipeline.c',
80bf215546Sopenharmony_ci  'radv_pipeline_cache.c',
81bf215546Sopenharmony_ci  'radv_pipeline_rt.c',
82bf215546Sopenharmony_ci  'radv_private.h',
83bf215546Sopenharmony_ci  'radv_radeon_winsys.h',
84bf215546Sopenharmony_ci  'radv_rt_common.c',
85bf215546Sopenharmony_ci  'radv_sdma_copy_image.c',
86bf215546Sopenharmony_ci  'radv_shader.c',
87bf215546Sopenharmony_ci  'radv_shader.h',
88bf215546Sopenharmony_ci  'radv_shader_args.c',
89bf215546Sopenharmony_ci  'radv_shader_args.h',
90bf215546Sopenharmony_ci  'radv_shader_info.c',
91bf215546Sopenharmony_ci  'radv_spm.c',
92bf215546Sopenharmony_ci  'radv_sqtt.c',
93bf215546Sopenharmony_ci  'radv_query.c',
94bf215546Sopenharmony_ci  'radv_wsi.c',
95bf215546Sopenharmony_ci  'si_cmd_buffer.c',
96bf215546Sopenharmony_ci  'vk_format.h',
97bf215546Sopenharmony_ci)
98bf215546Sopenharmony_ci
99bf215546Sopenharmony_cifiles_drirc = files('00-radv-defaults.conf')
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ciinstall_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
102bf215546Sopenharmony_ci
103bf215546Sopenharmony_ciif not with_platform_windows
104bf215546Sopenharmony_ci  libradv_files += files(
105bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_bo.c',
106bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_bo.h',
107bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_cs.c',
108bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_cs.h',
109bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_surface.c',
110bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_surface.h',
111bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_winsys.c',
112bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_winsys.h',
113bf215546Sopenharmony_ci    'winsys/amdgpu/radv_amdgpu_winsys_public.h',
114bf215546Sopenharmony_ci  )
115bf215546Sopenharmony_ciendif
116bf215546Sopenharmony_ci
117bf215546Sopenharmony_ciif with_llvm
118bf215546Sopenharmony_ci  libradv_files += files(
119bf215546Sopenharmony_ci    'radv_llvm_helper.cpp',
120bf215546Sopenharmony_ci    'radv_llvm_helper.h',
121bf215546Sopenharmony_ci    'radv_nir_to_llvm.c',
122bf215546Sopenharmony_ci  )
123bf215546Sopenharmony_ciendif
124bf215546Sopenharmony_ci
125bf215546Sopenharmony_cisubdir('radix_sort')
126bf215546Sopenharmony_cilibradv_files += radix_sort_files
127bf215546Sopenharmony_ci
128bf215546Sopenharmony_ciradv_deps = []
129bf215546Sopenharmony_ciradv_flags = cc.get_supported_arguments(['-Wimplicit-fallthrough', '-Wshadow'])
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_ciif with_platform_x11
132bf215546Sopenharmony_ci  radv_deps += dep_xcb_dri3
133bf215546Sopenharmony_ciendif
134bf215546Sopenharmony_ci
135bf215546Sopenharmony_ciif with_platform_wayland
136bf215546Sopenharmony_ci  radv_deps += dep_wayland_client
137bf215546Sopenharmony_ciendif
138bf215546Sopenharmony_ci
139bf215546Sopenharmony_ciif with_xlib_lease
140bf215546Sopenharmony_ci  radv_deps += [dep_xlib_xrandr]
141bf215546Sopenharmony_ciendif
142bf215546Sopenharmony_ci
143bf215546Sopenharmony_ciif with_platform_android
144bf215546Sopenharmony_ci  radv_deps += dep_android
145bf215546Sopenharmony_ciendif
146bf215546Sopenharmony_ci
147bf215546Sopenharmony_ci# When static linking LLVM, all its symbols are public API.
148bf215546Sopenharmony_ci# That may cause symbol collision, so explicitly demote everything.
149bf215546Sopenharmony_cilibvulkan_radeon_ld_args = []
150bf215546Sopenharmony_cilibvulkan_radeon_link_depends = []
151bf215546Sopenharmony_ci
152bf215546Sopenharmony_ciif with_ld_version_script
153bf215546Sopenharmony_ci  libvulkan_radeon_ld_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'vulkan.sym')]
154bf215546Sopenharmony_ci  libvulkan_radeon_link_depends += files('vulkan.sym')
155bf215546Sopenharmony_ciendif
156bf215546Sopenharmony_ci
157bf215546Sopenharmony_ciradv_build_id = get_option('radv-build-id')
158bf215546Sopenharmony_ciif radv_build_id != ''
159bf215546Sopenharmony_ci  radv_flags += '-DRADV_BUILD_ID_OVERRIDE="' + radv_build_id + '"'
160bf215546Sopenharmony_ciendif
161bf215546Sopenharmony_ci
162bf215546Sopenharmony_cilibvulkan_radeon = shared_library(
163bf215546Sopenharmony_ci  'vulkan_radeon',
164bf215546Sopenharmony_ci  [libradv_files, radv_entrypoints, sha1_h, radix_sort_spv],
165bf215546Sopenharmony_ci  vs_module_defs : vulkan_api_def,
166bf215546Sopenharmony_ci  include_directories : [
167bf215546Sopenharmony_ci    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,
168bf215546Sopenharmony_ci  ],
169bf215546Sopenharmony_ci  link_with : [
170bf215546Sopenharmony_ci    libamd_common, libamd_common_llvm, libamdgpu_addrlib,
171bf215546Sopenharmony_ci  ],
172bf215546Sopenharmony_ci  dependencies : [
173bf215546Sopenharmony_ci    dep_llvm, dep_libdrm_amdgpu, dep_thread, dep_elf, dep_dl, dep_m,
174bf215546Sopenharmony_ci    dep_valgrind, radv_deps, idep_aco,
175bf215546Sopenharmony_ci    idep_mesautil, idep_nir, idep_vulkan_util, idep_vulkan_wsi,
176bf215546Sopenharmony_ci    idep_vulkan_runtime, idep_amdgfxregs_h, idep_xmlconfig,
177bf215546Sopenharmony_ci    idep_vulkan_common_entrypoints_h
178bf215546Sopenharmony_ci  ],
179bf215546Sopenharmony_ci  c_args : [no_override_init_args, radv_flags, c_msvc_compat_args],
180bf215546Sopenharmony_ci  cpp_args : [radv_flags, cpp_msvc_compat_args],
181bf215546Sopenharmony_ci  link_args : [
182bf215546Sopenharmony_ci    ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections, libvulkan_radeon_ld_args,
183bf215546Sopenharmony_ci  ],
184bf215546Sopenharmony_ci  link_depends : [libvulkan_radeon_link_depends,],
185bf215546Sopenharmony_ci  gnu_symbol_visibility : 'hidden',
186bf215546Sopenharmony_ci  install : true,
187bf215546Sopenharmony_ci)
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_ciif with_symbols_check
190bf215546Sopenharmony_ci  test(
191bf215546Sopenharmony_ci    'radv symbols check',
192bf215546Sopenharmony_ci    symbols_check,
193bf215546Sopenharmony_ci    args : [
194bf215546Sopenharmony_ci      '--lib', libvulkan_radeon,
195bf215546Sopenharmony_ci      '--symbols-file', vulkan_icd_symbols,
196bf215546Sopenharmony_ci      '--ignore-symbol', 'ac_init_shared_llvm_once',
197bf215546Sopenharmony_ci      symbols_check_args,
198bf215546Sopenharmony_ci    ],
199bf215546Sopenharmony_ci    suite : ['amd'],
200bf215546Sopenharmony_ci  )
201bf215546Sopenharmony_ciendif
202bf215546Sopenharmony_ci
203bf215546Sopenharmony_ciicd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
204bf215546Sopenharmony_ciicd_file_name = 'libvulkan_radeon.so'
205bf215546Sopenharmony_ciif with_platform_windows
206bf215546Sopenharmony_ci  icd_lib_path = '.'
207bf215546Sopenharmony_ci  icd_file_name = 'vulkan_radeon.dll'
208bf215546Sopenharmony_ciendif
209bf215546Sopenharmony_ci
210bf215546Sopenharmony_ciicd_command = [
211bf215546Sopenharmony_ci  prog_python, '@INPUT0@',
212bf215546Sopenharmony_ci  '--api-version', '1.3', '--xml', '@INPUT1@',
213bf215546Sopenharmony_ci  '--lib-path', join_paths(icd_lib_path, icd_file_name),
214bf215546Sopenharmony_ci  '--out', '@OUTPUT@',
215bf215546Sopenharmony_ci]
216bf215546Sopenharmony_ciif with_platform_windows
217bf215546Sopenharmony_ci  icd_command += '--use-backslash'
218bf215546Sopenharmony_ciendif
219bf215546Sopenharmony_ci
220bf215546Sopenharmony_ciradeon_icd = custom_target(
221bf215546Sopenharmony_ci  'radeon_icd',
222bf215546Sopenharmony_ci  input : [vk_icd_gen, vk_api_xml],
223bf215546Sopenharmony_ci  output : 'radeon_icd.@0@.json'.format(host_machine.cpu()),
224bf215546Sopenharmony_ci  command : icd_command,
225bf215546Sopenharmony_ci  build_by_default : true,
226bf215546Sopenharmony_ci  install_dir : with_vulkan_icd_dir,
227bf215546Sopenharmony_ci  install : true,
228bf215546Sopenharmony_ci)
229bf215546Sopenharmony_ci
230bf215546Sopenharmony_ciif meson.version().version_compare('>= 0.58')
231bf215546Sopenharmony_ci  _dev_icdname = 'radeon_devenv_icd.@0@.json'.format(host_machine.cpu())
232bf215546Sopenharmony_ci  custom_target(
233bf215546Sopenharmony_ci    'radeon_devenv_icd',
234bf215546Sopenharmony_ci    input : [vk_icd_gen, vk_api_xml],
235bf215546Sopenharmony_ci    output : _dev_icdname,
236bf215546Sopenharmony_ci    command : [
237bf215546Sopenharmony_ci      prog_python, '@INPUT0@',
238bf215546Sopenharmony_ci      '--api-version', '1.3', '--xml', '@INPUT1@',
239bf215546Sopenharmony_ci      '--lib-path', meson.current_build_dir() / icd_file_name,
240bf215546Sopenharmony_ci      '--out', '@OUTPUT@',
241bf215546Sopenharmony_ci    ],
242bf215546Sopenharmony_ci    build_by_default : true,
243bf215546Sopenharmony_ci  )
244bf215546Sopenharmony_ci
245bf215546Sopenharmony_ci  devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
246bf215546Sopenharmony_ciendif
247