summaryrefslogtreecommitdiff
path: root/src/broadcom/vulkan/meson.build
blob: fd3627737172ce560f5621ed671cf239f932496d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Copyright © 2019 Raspberry Pi Ltd
# SPDX-License-Identifier: MIT

v3dv_entrypoints = custom_target(
  'v3dv_entrypoints',
  input : [vk_entrypoints_gen, vk_api_xml],
  output : ['v3dv_entrypoints.h', 'v3dv_entrypoints.c'],
  command : [
    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'v3dv',
    '--beta', with_vulkan_beta.to_string(),
    '--device-prefix', 'ver42',
    '--device-prefix', 'ver71',
  ],
  depend_files : vk_entrypoints_gen_depend_files,
)

libv3dv_files = files(
  'v3dv_bo.c',
  'v3dv_cl.c',
  'v3dv_cmd_buffer.c',
  'v3dv_debug.c',
  'v3dv_debug.h',
  'v3dv_descriptor_set.c',
  'v3dv_device.c',
  'v3dv_event.c',
  'v3dv_formats.c',
  'v3dv_image.c',
  'v3dv_limits.h',
  'v3dv_meta_clear.c',
  'v3dv_meta_copy.c',
  'v3dv_pass.c',
  'v3dv_pipeline.c',
  'v3dv_pipeline_cache.c',
  'v3dv_private.h',
  'v3dv_query.c',
  'v3dv_queue.c',
  'v3dv_uniforms.c',
  'v3dv_wsi.c',
) + [v3d_xml_pack]

files_per_version = files(
  'v3dvx_cmd_buffer.c',
  'v3dvx_descriptor_set.c',
  'v3dvx_device.c',
  'v3dvx_formats.c',
  'v3dvx_image.c',
  'v3dvx_pipeline.c',
  'v3dvx_meta_common.c',
  'v3dvx_pipeline.c',
  'v3dvx_query.c',
  'v3dvx_queue.c',
)

v3d_versions = ['42', '71']

v3dv_flags = []

dep_v3d_hw = dependency('v3d_hw', required : false)
if dep_v3d_hw.found()
  v3dv_flags += '-DUSE_V3D_SIMULATOR'
endif

v3dv_deps = [
  dep_dl,
  dep_libdrm,
  dep_valgrind,
  dep_v3d_hw,
  idep_nir,
  idep_nir_headers,
  idep_vulkan_util,
  idep_vulkan_runtime,
  idep_vulkan_wsi,
]

if with_platform_x11
  v3dv_deps += dep_xcb_dri3
endif

if with_platform_wayland
  v3dv_deps += dep_wayland_client
  libv3dv_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c]
endif

if with_platform_android
  v3dv_deps += [dep_android, idep_u_gralloc]
  v3dv_flags += '-DVK_USE_PLATFORM_ANDROID_KHR'
  libv3dv_files += files('v3dv_android.c')
endif

per_version_libs = []
foreach ver : v3d_versions
  per_version_libs += static_library(
    'v3dv-v' + ver,
    [files_per_version, v3d_xml_pack, v3dv_entrypoints[0]],
    include_directories : [
      inc_src, inc_include, inc_broadcom,
      inc_util,
    ],
    c_args : [v3dv_flags, '-DV3D_VERSION=' + ver],
    gnu_symbol_visibility : 'hidden',
    dependencies : [v3dv_deps],
)
endforeach

libvulkan_broadcom = shared_library(
  'vulkan_broadcom',
  [libv3dv_files, v3dv_entrypoints, sha1_h],
  include_directories : [
    inc_include, inc_src, inc_broadcom, inc_util,
  ],
  link_with : [
    libbroadcom_cle,
    libbroadcom_v3d,
    per_version_libs,
  ],
  dependencies : v3dv_deps,
  c_args : v3dv_flags,
  link_args : [vulkan_icd_link_args, '-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections],
  link_depends : vulkan_icd_link_depends,
  gnu_symbol_visibility : 'hidden',
  install : true,
)

if with_symbols_check
  test(
    'v3dv symbols check',
    symbols_check,
    args : [
      '--lib', libvulkan_broadcom,
      '--symbols-file', vulkan_icd_symbols,
      symbols_check_args,
    ],
    suite : ['broadcom'],
  )
endif

broadcom_icd = custom_target(
  'broadcom_icd',
  input : [vk_icd_gen, vk_api_xml],
  output : 'broadcom_icd.@0@.json'.format(host_machine.cpu()),
  command : [
    prog_python, '@INPUT0@',
    '--api-version', '1.2', '--xml', '@INPUT1@',
    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
    		  	     'libvulkan_broadcom.so'),
    '--out', '@OUTPUT@',
  ],
  build_by_default : true,
  install_dir : with_vulkan_icd_dir,
  install_tag : 'runtime',
  install : true,
)

_dev_icdname = 'broadcom_devenv_icd.@0@.json'.format(host_machine.cpu())
_dev_icd = custom_target(
  'broadcom_devenv_icd',
  input : [vk_icd_gen, vk_api_xml],
  output : _dev_icdname,
  command : [
    prog_python, '@INPUT0@',
    '--api-version', '1.3', '--xml', '@INPUT1@',
    '--lib-path', meson.current_build_dir() / 'libvulkan_broadcom.so',
    '--out', '@OUTPUT@',
  ],
  build_by_default : true,
)

devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
# Deprecated: replaced by VK_DRIVER_FILES above
devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())