1# Copyright © 2017 Intel Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20
21tu_entrypoints = custom_target(
22  'tu_entrypoints.[ch]',
23  input : ['tu_entrypoints_gen.py', vk_api_xml],
24  output : ['tu_entrypoints.h', 'tu_entrypoints.c'],
25  command : [
26    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--outdir',
27    meson.current_build_dir()
28  ],
29  depend_files : files('tu_extensions.py'),
30)
31
32tu_extensions_c = custom_target(
33  'tu_extensions.c',
34  input : ['tu_extensions.py', vk_api_xml],
35  output : ['tu_extensions.c', 'tu_extensions.h'],
36  command : [
37    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--out-c', '@OUTPUT0@',
38    '--out-h', '@OUTPUT1@'
39  ],
40)
41
42libtu_files = files(
43  'tu_clear_blit.c',
44  'tu_cmd_buffer.c',
45  'tu_cs.c',
46  'tu_cs.h',
47  'tu_device.c',
48  'tu_descriptor_set.c',
49  'tu_descriptor_set.h',
50  'tu_formats.c',
51  'tu_image.c',
52  'tu_legacy.c',
53  'tu_nir_lower_multiview.c',
54  'tu_pass.c',
55  'tu_pipeline.c',
56  'tu_pipeline_cache.c',
57  'tu_private.h',
58  'tu_query.c',
59  'tu_shader.c',
60  'tu_util.c',
61  'tu_util.h',
62  'vk_format.h',
63)
64
65tu_deps = []
66tu_flags = []
67tu_link_with = []
68
69tu_wsi = false
70
71if with_platform_x11
72  tu_deps += dep_xcb_dri3
73  tu_flags += [
74    '-DVK_USE_PLATFORM_XCB_KHR',
75    '-DVK_USE_PLATFORM_XLIB_KHR',
76  ]
77  libtu_files += files('tu_wsi_x11.c')
78  tu_wsi = true
79endif
80
81if with_platform_wayland
82  tu_deps += dep_wayland_client
83  tu_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
84  libtu_files += files('tu_wsi_wayland.c')
85  tu_wsi = true
86endif
87
88if system_has_kms_drm and not with_platform_android
89  tu_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
90  libtu_files += files('tu_wsi_display.c')
91  tu_wsi = true
92endif
93
94if tu_wsi
95  libtu_files += 'tu_wsi.c'
96  tu_link_with += libvulkan_wsi
97endif
98
99if with_platform_android
100  tu_flags += '-DVK_USE_PLATFORM_ANDROID_KHR'
101  libtu_files += files('tu_android.c')
102  tu_deps += [dep_android]
103endif
104
105if with_xlib_lease
106  tu_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
107  tu_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
108endif
109
110if with_freedreno_kgsl
111  libtu_files += files('tu_kgsl.c')
112else
113  libtu_files += files('tu_drm.c')
114  tu_deps += dep_libdrm
115endif
116
117libvulkan_freedreno = shared_library(
118  'vulkan_freedreno',
119  [libtu_files, tu_entrypoints, tu_extensions_c, freedreno_xml_header_files],
120  include_directories : [
121    inc_include,
122    inc_src,
123    inc_mapi,
124    inc_mesa,
125    inc_gallium,
126    inc_gallium_aux,
127    inc_compiler,
128    inc_vulkan_wsi,
129    inc_freedreno,
130  ],
131  link_with : [
132    tu_link_with,
133    libfreedreno_ir3,
134    libfreedreno_layout,
135  ],
136  dependencies : [
137    idep_libfreedreno_common,
138    dep_dl,
139    dep_elf,
140    dep_m,
141    dep_thread,
142    dep_valgrind,
143    idep_nir,
144    tu_deps,
145    idep_vulkan_util,
146    idep_mesautil,
147  ],
148  c_args : [no_override_init_args, tu_flags],
149  gnu_symbol_visibility : 'hidden',
150  link_args : [ld_args_bsymbolic, ld_args_gc_sections, ld_args_build_id],
151  install : true,
152)
153
154if with_symbols_check
155  test(
156    'tu symbols check',
157    symbols_check,
158    args : [
159      '--lib', libvulkan_freedreno,
160      '--symbols-file', vulkan_icd_symbols,
161      symbols_check_args,
162    ],
163    suite : ['freedreno'],
164  )
165endif
166
167freedreno_icd = custom_target(
168  'freedreno_icd',
169  input : 'tu_icd.py',
170  output : 'freedreno_icd.@0@.json'.format(host_machine.cpu()),
171  command : [
172    prog_python, '@INPUT@',
173    '--lib-path', join_paths(get_option('prefix'), get_option('libdir')),
174    '--out', '@OUTPUT@',
175  ],
176  depend_files : files('tu_extensions.py'),
177  build_by_default : true,
178  install_dir : with_vulkan_icd_dir,
179  install : true,
180)
181