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_device_generated_commands.c', 53 'radv_formats.c', 54 'radv_image.c', 55 'radv_meta.c', 56 'radv_meta.h', 57 'radv_meta_blit.c', 58 'radv_meta_blit2d.c', 59 'radv_meta_buffer.c', 60 'radv_meta_bufimage.c', 61 'radv_meta_clear.c', 62 'radv_meta_copy.c', 63 'radv_meta_copy_vrs_htile.c', 64 'radv_meta_dcc_retile.c', 65 'radv_meta_decompress.c', 66 'radv_meta_etc_decode.c', 67 'radv_meta_fast_clear.c', 68 'radv_meta_fmask_copy.c', 69 'radv_meta_fmask_expand.c', 70 'radv_meta_resolve.c', 71 'radv_meta_resolve_cs.c', 72 'radv_meta_resolve_fs.c', 73 'radv_nir_apply_pipeline_layout.c', 74 'radv_nir_lower_abi.c', 75 'radv_nir_lower_ray_queries.c', 76 'radv_nir_lower_ycbcr_textures.c', 77 'radv_pass.c', 78 'radv_perfcounter.c', 79 'radv_pipeline.c', 80 'radv_pipeline_cache.c', 81 'radv_pipeline_rt.c', 82 'radv_private.h', 83 'radv_radeon_winsys.h', 84 'radv_rt_common.c', 85 'radv_sdma_copy_image.c', 86 'radv_shader.c', 87 'radv_shader.h', 88 'radv_shader_args.c', 89 'radv_shader_args.h', 90 'radv_shader_info.c', 91 'radv_spm.c', 92 'radv_sqtt.c', 93 'radv_query.c', 94 'radv_wsi.c', 95 'si_cmd_buffer.c', 96 'vk_format.h', 97) 98 99files_drirc = files('00-radv-defaults.conf') 100 101install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d')) 102 103if not with_platform_windows 104 libradv_files += files( 105 'winsys/amdgpu/radv_amdgpu_bo.c', 106 'winsys/amdgpu/radv_amdgpu_bo.h', 107 'winsys/amdgpu/radv_amdgpu_cs.c', 108 'winsys/amdgpu/radv_amdgpu_cs.h', 109 'winsys/amdgpu/radv_amdgpu_surface.c', 110 'winsys/amdgpu/radv_amdgpu_surface.h', 111 'winsys/amdgpu/radv_amdgpu_winsys.c', 112 'winsys/amdgpu/radv_amdgpu_winsys.h', 113 'winsys/amdgpu/radv_amdgpu_winsys_public.h', 114 ) 115endif 116 117if with_llvm 118 libradv_files += files( 119 'radv_llvm_helper.cpp', 120 'radv_llvm_helper.h', 121 'radv_nir_to_llvm.c', 122 ) 123endif 124 125subdir('radix_sort') 126libradv_files += radix_sort_files 127 128radv_deps = [] 129radv_flags = cc.get_supported_arguments(['-Wimplicit-fallthrough', '-Wshadow']) 130 131if with_platform_x11 132 radv_deps += dep_xcb_dri3 133endif 134 135if with_platform_wayland 136 radv_deps += dep_wayland_client 137endif 138 139if with_xlib_lease 140 radv_deps += [dep_xlib_xrandr] 141endif 142 143if with_platform_android 144 radv_deps += dep_android 145endif 146 147# When static linking LLVM, all its symbols are public API. 148# That may cause symbol collision, so explicitly demote everything. 149libvulkan_radeon_ld_args = [] 150libvulkan_radeon_link_depends = [] 151 152if with_ld_version_script 153 libvulkan_radeon_ld_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'vulkan.sym')] 154 libvulkan_radeon_link_depends += files('vulkan.sym') 155endif 156 157radv_build_id = get_option('radv-build-id') 158if radv_build_id != '' 159 radv_flags += '-DRADV_BUILD_ID_OVERRIDE="' + radv_build_id + '"' 160endif 161 162libvulkan_radeon = shared_library( 163 'vulkan_radeon', 164 [libradv_files, radv_entrypoints, sha1_h, radix_sort_spv], 165 vs_module_defs : vulkan_api_def, 166 include_directories : [ 167 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, 168 ], 169 link_with : [ 170 libamd_common, libamd_common_llvm, libamdgpu_addrlib, 171 ], 172 dependencies : [ 173 dep_llvm, dep_libdrm_amdgpu, dep_thread, dep_elf, dep_dl, dep_m, 174 dep_valgrind, radv_deps, idep_aco, 175 idep_mesautil, idep_nir, idep_vulkan_util, idep_vulkan_wsi, 176 idep_vulkan_runtime, idep_amdgfxregs_h, idep_xmlconfig, 177 idep_vulkan_common_entrypoints_h 178 ], 179 c_args : [no_override_init_args, radv_flags, c_msvc_compat_args], 180 cpp_args : [radv_flags, cpp_msvc_compat_args], 181 link_args : [ 182 ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections, libvulkan_radeon_ld_args, 183 ], 184 link_depends : [libvulkan_radeon_link_depends,], 185 gnu_symbol_visibility : 'hidden', 186 install : true, 187) 188 189if with_symbols_check 190 test( 191 'radv symbols check', 192 symbols_check, 193 args : [ 194 '--lib', libvulkan_radeon, 195 '--symbols-file', vulkan_icd_symbols, 196 '--ignore-symbol', 'ac_init_shared_llvm_once', 197 symbols_check_args, 198 ], 199 suite : ['amd'], 200 ) 201endif 202 203icd_lib_path = join_paths(get_option('prefix'), get_option('libdir')) 204icd_file_name = 'libvulkan_radeon.so' 205if with_platform_windows 206 icd_lib_path = '.' 207 icd_file_name = 'vulkan_radeon.dll' 208endif 209 210icd_command = [ 211 prog_python, '@INPUT0@', 212 '--api-version', '1.3', '--xml', '@INPUT1@', 213 '--lib-path', join_paths(icd_lib_path, icd_file_name), 214 '--out', '@OUTPUT@', 215] 216if with_platform_windows 217 icd_command += '--use-backslash' 218endif 219 220radeon_icd = custom_target( 221 'radeon_icd', 222 input : [vk_icd_gen, vk_api_xml], 223 output : 'radeon_icd.@0@.json'.format(host_machine.cpu()), 224 command : icd_command, 225 build_by_default : true, 226 install_dir : with_vulkan_icd_dir, 227 install : true, 228) 229 230if meson.version().version_compare('>= 0.58') 231 _dev_icdname = 'radeon_devenv_icd.@0@.json'.format(host_machine.cpu()) 232 custom_target( 233 'radeon_devenv_icd', 234 input : [vk_icd_gen, vk_api_xml], 235 output : _dev_icdname, 236 command : [ 237 prog_python, '@INPUT0@', 238 '--api-version', '1.3', '--xml', '@INPUT1@', 239 '--lib-path', meson.current_build_dir() / icd_file_name, 240 '--out', '@OUTPUT@', 241 ], 242 build_by_default : true, 243 ) 244 245 devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname) 246endif 247