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 '--beta', with_vulkan_beta.to_string() 30 ], 31 depend_files : vk_entrypoints_gen_depend_files, 32) 33 34libdzn_files = files( 35 'dzn_cmd_buffer.c', 36 'dzn_descriptor_set.c', 37 'dzn_device.c', 38 'dzn_dxcore.cpp', 39 'dzn_image.c', 40 'dzn_meta.c', 41 'dzn_nir.c', 42 'dzn_pipeline.c', 43 'dzn_query.c', 44 'dzn_sync.c', 45 'dzn_util.c', 46 'dzn_wsi.c', 47) 48 49dzn_deps = [ 50 idep_libdxil_compiler, 51 idep_libspirv_to_dxil, 52 idep_nir, 53 idep_nir_headers, 54 idep_vulkan_util, 55 idep_vulkan_runtime, 56 idep_vulkan_wsi, 57 dep_dxheaders, 58] 59 60dzn_flags = [ ] 61dzn_cpp_flags = [ ] 62 63if with_platform_windows 64 dzn_flags += '-DVK_USE_PLATFORM_WIN32_KHR' 65 libdzn_files += files('dzn_dxgi.c') 66endif 67 68if cc.get_argument_syntax() != 'msvc' 69 dzn_flags_to_try = [ 70 '-Werror=unused-variable', 71 '-Werror=unused-but-set-variable', 72 '-Werror=unused-value', 73 '-Werror=format', 74 '-Werror=switch', 75 ] 76 dzn_flags += cc.get_supported_arguments(dzn_flags_to_try) 77 dzn_cpp_flags = cpp.get_supported_arguments(['-Wno-error=unused-value']) 78endif 79 80libvulkan_dzn = shared_library( 81 'vulkan_dzn', 82 [libdzn_files, dzn_entrypoints, sha1_h], 83 vs_module_defs : vulkan_api_def, 84 include_directories : [inc_include, inc_src, inc_util], 85 dependencies : [dzn_deps, idep_vulkan_wsi, idep_xmlconfig], 86 c_args : dzn_flags, 87 cpp_args : dzn_cpp_flags, 88 gnu_symbol_visibility : 'hidden', 89 link_args : [ld_args_bsymbolic, ld_args_gc_sections], 90 name_prefix : host_machine.system() == 'windows' ? '' : [], 91 install : true, 92) 93 94icd_file_name = 'libvulkan_dzn.so' 95icd_lib_path = join_paths(get_option('prefix'), get_option('libdir')) 96if with_platform_windows 97 icd_lib_path = join_paths(get_option('prefix'), get_option('bindir')) 98 icd_file_name = 'vulkan_dzn.dll' 99endif 100 101 102icd_command = [ 103 prog_python, '@INPUT0@', 104 '--api-version', '1.1', '--xml', '@INPUT1@', 105 '--lib-path', join_paths(icd_lib_path, icd_file_name), 106 '--out', '@OUTPUT@', 107] 108 109icd_dev_command = [ 110 prog_python, '@INPUT0@', 111 '--api-version', '1.1', '--xml', '@INPUT1@', 112 '--lib-path', join_paths(meson.current_build_dir(), icd_file_name), 113 '--out', '@OUTPUT@', 114] 115 116if with_platform_windows 117 icd_command += '--use-backslash' 118 icd_dev_command += '--use-backslash' 119endif 120 121dzn_icd = custom_target( 122 'dzn_icd', 123 input : [vk_icd_gen, vk_api_xml], 124 output : 'dzn_icd.@0@.json'.format(host_machine.cpu()), 125 command : icd_command, 126 build_by_default : true, 127 install_dir : with_vulkan_icd_dir, 128 install_tag : 'runtime', 129 install : true, 130) 131 132_dev_icdname = 'dzn_devenv_icd.@0@.json'.format(host_machine.cpu()) 133_dev_icd = custom_target( 134 'dzn_devenv_icd', 135 input : [vk_icd_gen, vk_api_xml], 136 output : _dev_icdname, 137 command : icd_dev_command, 138 build_by_default : true, 139) 140 141devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path()) 142