• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 get_option('mesa-clc') != 'system' and (with_gallium_asahi or \
81                                           with_asahi_vk or \
82                                           with_intel_vk or \
83                                           with_gallium_iris or \
84                                           get_option('install-mesa-clc'))
85   prog_vtn_bindgen = executable(
86     'vtn_bindgen',
87     ['vtn_bindgen.c'],
88     include_directories : [inc_include, inc_src],
89     c_args : [c_msvc_compat_args, no_override_init_args],
90     dependencies : [idep_vtn, idep_mesautil],
91     # If we can run host binaries directly, just build vtn_bindgen for the host.
92     # Most commonly this happens when doing a cross compile from an x86_64 build
93     # machine to an x86 host
94     native : not meson.can_run_host_binaries(),
95     install : get_option('install-mesa-clc'),
96   )
97endif
98
99if with_tests
100  test(
101    'spirv_tests',
102    executable(
103      'spirv_tests',
104      files(
105        'tests/helpers.h',
106        'tests/avail_vis.cpp',
107        'tests/volatile.cpp',
108        'tests/control_flow_tests.cpp',
109      ),
110      c_args : [c_msvc_compat_args, no_override_init_args],
111      gnu_symbol_visibility : 'hidden',
112      include_directories : [inc_include, inc_src],
113      dependencies : [idep_vtn, dep_thread, idep_gtest, idep_nir, idep_mesautil],
114    ),
115    suite : ['compiler', 'spirv'],
116    protocol : 'gtest',
117  )
118endif
119