1# Copyright 2018 Rob Clark 2# Copyright 2019 Collabora, Ltd. 3# Copyright 2017 Intel Corporation 4# SPDX-License-Identifier: MIT 5 6dep_iokit = dependency('IOKit', required : false) 7 8libasahi_lib_files = files( 9 'agx_bo.c', 10 'agx_border.c', 11 'agx_device.c', 12 'agx_formats.c', 13 'agx_meta.c', 14 'agx_tilebuffer.c', 15 'agx_nir_lower_alpha.c', 16 'agx_nir_lower_gs.c', 17 'agx_nir_lower_ia.c', 18 'agx_nir_lower_msaa.c', 19 'agx_nir_lower_sample_intrinsics.c', 20 'agx_nir_lower_tess.c', 21 'agx_nir_lower_texture.c', 22 'agx_nir_lower_tilebuffer.c', 23 'agx_nir_lower_vbo.c', 24 'agx_nir_predicate_layer_id.c', 25 'agx_ppp.h', 26 'agx_scratch.c', 27 'pool.c', 28) 29 30libasahi_decode_files = files( 31 'decode.c', 32) 33 34libagx_shader_files = files( 35 'shaders/libagx.h', 36 'shaders/geometry.cl', 37 'shaders/geometry.h', 38 'shaders/tessellation.cl', 39 'shaders/tessellator.cl', 40 'shaders/texture.cl', 41 'shaders/helper.cl', 42) 43 44libasahi_decode = static_library( 45 'asahi_decode', 46 [libasahi_decode_files, agx_pack], 47 dependencies : [dep_valgrind, idep_mesautil], 48 c_args : [no_override_init_args], 49 gnu_symbol_visibility : 'hidden', 50 build_by_default : false, 51) 52 53libasahi_decode_shared = shared_library( 54 'asahi_decode', 55 [libasahi_decode_files, agx_pack], 56 dependencies : [dep_valgrind, idep_mesautil], 57 c_args : [no_override_init_args], 58 build_by_default : with_tools.contains('asahi'), 59) 60 61prepended_input_args = [] 62foreach input_arg : libagx_shader_files 63 prepended_input_args += ['--in', input_arg] 64endforeach 65libagx_shaders = custom_target( 66 'libagx_shaders.h', 67 input : libagx_shader_files, 68 output : 'libagx_shaders.h', 69 command : [ 70 prog_asahi_clc, '--prefix', 'libagx_shaders', 71 prepended_input_args, '-o', '@OUTPUT@', '--', 72 '-cl-std=cl2.0', '-D__OPENCL_VERSION__=200', 73 '-I' + join_paths(meson.current_source_dir(), '.'), 74 '-I' + join_paths(meson.current_source_dir(), '../../'), 75 '-I' + join_paths(meson.current_source_dir(), 'shaders'), 76 '-I' + join_paths(meson.current_build_dir(), '../genxml'), 77 ], 78 env: ['MESA_SHADER_CACHE_DISABLE=true'], 79 depends : [prog_asahi_clc, agx_pack], 80) 81 82libasahi_lib = static_library( 83 'asahi_lib', 84 [libasahi_lib_files, libagx_shaders, agx_pack], 85 include_directories : inc_asahi, 86 c_args : [no_override_init_args], 87 gnu_symbol_visibility : 'hidden', 88 link_with: [libasahi_decode], 89 dependencies: [dep_libdrm, dep_valgrind, idep_nir], 90 build_by_default : false, 91) 92 93if with_tests 94 test( 95 'libasahi_tests', 96 executable( 97 'libasahi_tests', 98 files( 99 'tests/test-packing.cpp', 100 'tests/test-tilebuffer.cpp', 101 ), 102 c_args : [c_msvc_compat_args, no_override_init_args], 103 gnu_symbol_visibility : 'hidden', 104 dependencies: [idep_gtest, idep_agx_pack, idep_mesautil], 105 link_with : [libasahi_lib], 106 ), 107 suite : ['asahi'], 108 protocol : 'gtest', 109 ) 110endif 111 112if dep_iokit.found() 113 libasahi_wrap = shared_library( 114 'wrap', 115 'wrap.c', 116 include_directories : [inc_src, inc_asahi], 117 dependencies : [idep_mesautil, dep_iokit], 118 c_args : [no_override_init_args, '-Wno-missing-prototypes'], 119 gnu_symbol_visibility : 'hidden', 120 build_by_default : with_tools.contains('asahi'), 121 link_with: libasahi_decode, 122 ) 123endif 124