17ec681f3Smrg# Copyright © 2018 Collabora Ltd
27ec681f3Smrg
37ec681f3Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy
47ec681f3Smrg# of this software and associated documentation files (the "Software"), to deal
57ec681f3Smrg# in the Software without restriction, including without limitation the rights
67ec681f3Smrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
77ec681f3Smrg# copies of the Software, and to permit persons to whom the Software is
87ec681f3Smrg# furnished to do so, subject to the following conditions:
97ec681f3Smrg
107ec681f3Smrg# The above copyright notice and this permission notice shall be included in
117ec681f3Smrg# all copies or substantial portions of the Software.
127ec681f3Smrg
137ec681f3Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
147ec681f3Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
157ec681f3Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
167ec681f3Smrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
177ec681f3Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
187ec681f3Smrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
197ec681f3Smrg# SOFTWARE.
207ec681f3Smrg
217ec681f3Smrgfiles_libzink = files(
227ec681f3Smrg  'nir_lower_dynamic_bo_access.c',
237ec681f3Smrg  'nir_to_spirv/nir_to_spirv.c',
247ec681f3Smrg  'nir_to_spirv/spirv_builder.c',
257ec681f3Smrg  'zink_batch.c',
267ec681f3Smrg  'zink_blit.c',
277ec681f3Smrg  'zink_bo.c',
287ec681f3Smrg  'zink_clear.c',
297ec681f3Smrg  'zink_compiler.c',
307ec681f3Smrg  'zink_context.c',
317ec681f3Smrg  'zink_descriptors.c',
327ec681f3Smrg  'zink_descriptors_lazy.c',
337ec681f3Smrg  'zink_draw.cpp',
347ec681f3Smrg  'zink_fence.c',
357ec681f3Smrg  'zink_format.c',
367ec681f3Smrg  'zink_framebuffer.c',
377ec681f3Smrg  'zink_pipeline.c',
387ec681f3Smrg  'zink_program.c',
397ec681f3Smrg  'zink_query.c',
407ec681f3Smrg  'zink_render_pass.c',
417ec681f3Smrg  'zink_resource.c',
427ec681f3Smrg  'zink_screen.c',
437ec681f3Smrg  'zink_state.c',
447ec681f3Smrg  'zink_surface.c',
457ec681f3Smrg)
467ec681f3Smrg
477ec681f3Smrgzink_device_info = custom_target(
487ec681f3Smrg  'zink_device_info.c',
497ec681f3Smrg  input : ['zink_device_info.py'],
507ec681f3Smrg  output : ['zink_device_info.h', 'zink_device_info.c'],
517ec681f3Smrg  command : [
527ec681f3Smrg    prog_python, '@INPUT@', '@OUTPUT@', join_paths(meson.source_root(), 'src/vulkan/registry/vk.xml')
537ec681f3Smrg  ]
547ec681f3Smrg)
557ec681f3Smrg
567ec681f3Smrgzink_instance = custom_target(
577ec681f3Smrg  'zink_instance.c',
587ec681f3Smrg  input : ['zink_instance.py'],
597ec681f3Smrg  output : ['zink_instance.h', 'zink_instance.c'],
607ec681f3Smrg  command : [
617ec681f3Smrg    prog_python, '@INPUT@', '@OUTPUT@', join_paths(meson.source_root(), 'src/vulkan/registry/vk.xml')
627ec681f3Smrg  ]
637ec681f3Smrg)
647ec681f3Smrg
657ec681f3Smrgzink_nir_algebraic_c = custom_target(
667ec681f3Smrg  'zink_nir_algebraic.c',
677ec681f3Smrg  input : 'nir_to_spirv/zink_nir_algebraic.py',
687ec681f3Smrg  output : 'zink_nir_algebraic.c',
697ec681f3Smrg  command : [
707ec681f3Smrg    prog_python, '@INPUT@',
717ec681f3Smrg    '-p', join_paths(meson.source_root(), 'src/compiler/nir/'),
727ec681f3Smrg  ],
737ec681f3Smrg  capture : true,
747ec681f3Smrg  depend_files : nir_algebraic_depends,
757ec681f3Smrg)
767ec681f3Smrg
777ec681f3Smrgzink_c_args = []
787ec681f3Smrginc_zink_vk = []
797ec681f3Smrg
807ec681f3Smrgif with_swrast_vk
817ec681f3Smrg  zink_c_args += '-DZINK_WITH_SWRAST_VK'
827ec681f3Smrgendif
837ec681f3Smrg
847ec681f3Smrg# MoltenVK options
857ec681f3Smrgif with_moltenvk_dir != ''
867ec681f3Smrg  inc_zink_vk  = [inc_zink_vk, include_directories( join_paths(with_moltenvk_dir, 'include') )]
877ec681f3Smrg  zink_c_args += ['-x','objective-c'] # Put compiler into objective-C mode to allow for MacOS types, like IOSurface and CAMetalLayer
887ec681f3Smrg  zink_c_args += ['-iframework' , 'Foundation']
897ec681f3Smrgendif
907ec681f3Smrg
917ec681f3Smrglibzink = static_library(
927ec681f3Smrg  'zink',
937ec681f3Smrg  [files_libzink, zink_device_info, zink_instance, zink_nir_algebraic_c, vk_dispatch_table],
947ec681f3Smrg  gnu_symbol_visibility : 'hidden',
957ec681f3Smrg  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_vulkan_util, inc_zink_vk],
967ec681f3Smrg  dependencies: [
977ec681f3Smrg    dep_vulkan, idep_nir_headers, idep_mesautil, idep_vulkan_util_headers,
987ec681f3Smrg    idep_vulkan_wsi_headers, dep_libdrm
997ec681f3Smrg  ],
1007ec681f3Smrg  c_args: zink_c_args,
1017ec681f3Smrg)
1027ec681f3Smrg
1037ec681f3Smrgdriver_zink = declare_dependency(
1047ec681f3Smrg  compile_args : '-DGALLIUM_ZINK',
1057ec681f3Smrg  link_with : [libzink],
1067ec681f3Smrg)
1077ec681f3Smrg
1087ec681f3Smrgif with_tests
1097ec681f3Smrg  test(
1107ec681f3Smrg    'zink_format_test',
1117ec681f3Smrg    executable(
1127ec681f3Smrg      'zink_format_test',
1137ec681f3Smrg      ['zink_format_test.c', 'zink_format.c'],
1147ec681f3Smrg      dependencies : [idep_mesautil, idep_vulkan_util],
1157ec681f3Smrg      include_directories : [inc_gallium, inc_gallium_aux, inc_include, inc_src],
1167ec681f3Smrg    ),
1177ec681f3Smrg    suite : ['zink'],
1187ec681f3Smrg  )
1197ec681f3Smrgendif
120