xref: /aosp_15_r20/external/mesa3d/src/compiler/spirv/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2017 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4vtn_gather_types_c = custom_target(
5  'vtn_gather_types.c',
6  input : files('vtn_gather_types_c.py', 'spirv.core.grammar.json'),
7  output : 'vtn_gather_types.c',
8  command : [prog_python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'],
9)
10
11spirv_info = custom_target(
12  'spirv_info',
13  input : files('spirv_info_gen.py', 'spirv.core.grammar.json'),
14  output : ['spirv_info.h', 'spirv_info.c'],
15  command : [prog_python, '@INPUT0@', '--json', '@INPUT1@',
16             '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@'],
17)
18spirv_info_h = spirv_info[0]
19
20vtn_generator_ids_h = custom_target(
21  'vtn_generator_ids.h',
22  input : files('vtn_generator_ids_h.py', 'spir-v.xml'),
23  output : 'vtn_generator_ids.h',
24  command : [prog_python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'],
25)
26
27files_libvtn = files(
28  'GLSL.ext.AMD.h',
29  'GLSL.std.450.h',
30  'OpenCL.std.h',
31  'gl_spirv.c',
32  'nir_spirv.h',
33  'spirv.h',
34  'spirv_to_nir.c',
35  'vtn_alu.c',
36  'vtn_amd.c',
37  'vtn_cfg.c',
38  'vtn_cmat.c',
39  'vtn_debug.c',
40  'vtn_glsl450.c',
41  'vtn_opencl.c',
42  'vtn_private.h',
43  'vtn_structured_cfg.c',
44  'vtn_subgroup.c',
45  'vtn_variables.c',
46)
47
48libvtn = static_library(
49  'vtn',
50  [files_libvtn,
51   spirv_info,
52   vtn_gather_types_c,
53   vtn_generator_ids_h,
54  ],
55  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa],
56  c_args : [c_msvc_compat_args, no_override_init_args],
57  gnu_symbol_visibility : 'hidden',
58  dependencies : [dep_spirv_tools, idep_nir, dep_valgrind],
59  build_by_default : false,
60)
61
62idep_vtn = declare_dependency(
63  dependencies : [dep_spirv_tools, idep_nir, idep_mesautil],
64  link_with : libvtn,
65)
66
67spirv2nir = executable(
68  'spirv2nir',
69  files('spirv2nir.c') + [
70   vtn_generator_ids_h,
71  ],
72  dependencies : [dep_m, idep_vtn, idep_mesautil],
73  include_directories : [inc_include, inc_src],
74  c_args : [c_msvc_compat_args, no_override_init_args],
75  gnu_symbol_visibility : 'hidden',
76  build_by_default : with_tools.contains('nir'),
77  install : with_tools.contains('nir'),
78)
79
80if with_tests
81  test(
82    'spirv_tests',
83    executable(
84      'spirv_tests',
85      files(
86        'tests/helpers.h',
87        'tests/avail_vis.cpp',
88        'tests/volatile.cpp',
89        'tests/control_flow_tests.cpp',
90      ),
91      c_args : [c_msvc_compat_args, no_override_init_args],
92      gnu_symbol_visibility : 'hidden',
93      include_directories : [inc_include, inc_src],
94      dependencies : [idep_vtn, dep_thread, idep_gtest, idep_nir, idep_mesautil],
95    ),
96    suite : ['compiler', 'spirv'],
97    protocol : 'gtest',
98  )
99endif
100