meson.build 4.73 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright © 2019 Raspberry Pi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

v3dv_entrypoints = custom_target(
22
23
  'v3dv_entrypoints',
  input : [vk_entrypoints_gen, vk_api_xml],
24
25
  output : ['v3dv_entrypoints.h', 'v3dv_entrypoints.c'],
  command : [
26
27
    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'v3dv',
28
  ],
29
  depend_files : vk_entrypoints_gen_depend_files,
30
31
32
33
34
35
36
37
38
39
)

v3dv_extensions_c = custom_target(
  'v3dv_extensions.c',
  input : ['v3dv_extensions_gen.py', vk_api_xml],
  output : 'v3dv_extensions.c',
  command : [
    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
    '--out-c', '@OUTPUT@',
  ],
40
  depend_files : [files('v3dv_extensions.py'), vk_extensions_gen],
41
42
43
44
45
46
47
48
49
50
)

v3dv_extensions_h = custom_target(
  'v3dv_extensions.h',
  input : ['v3dv_extensions_gen.py', vk_api_xml],
  output : 'v3dv_extensions.h',
  command : [
    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
    '--out-h', '@OUTPUT@',
  ],
51
  depend_files : [files('v3dv_extensions.py'), vk_extensions_gen],
52
53
54
)

libv3dv_files = files(
55
  'v3dv_bo.c',
56
  'v3dv_cl.c',
57
  'v3dv_cmd_buffer.c',
58
59
  'v3dv_debug.c',
  'v3dv_debug.h',
60
  'v3dv_descriptor_set.c',
61
  'v3dv_device.c',
62
  'v3dv_formats.c',
Iago Toral's avatar
Iago Toral committed
63
  'v3dv_image.c',
64
  'v3dv_limits.h',
65
  'v3dv_meta_clear.c',
Iago Toral's avatar
Iago Toral committed
66
  'v3dv_meta_copy.c',
67
  'v3dv_pass.c',
68
  'v3dv_pipeline.c',
69
  'v3dv_pipeline_cache.c',
70
  'v3dv_private.h',
Iago Toral's avatar
Iago Toral committed
71
  'v3dv_query.c',
Iago Toral's avatar
Iago Toral committed
72
  'v3dv_queue.c',
73
  'v3dv_uniforms.c',
74
  'v3dv_util.c',
Iago Toral's avatar
Iago Toral committed
75
  'v3dv_wsi.c',
Iago Toral's avatar
Iago Toral committed
76
  'v3d_tiling.c',
77
78
79
80
81
82
83
)

# The vulkan driver only supports version >= 42, which is the version present in
# Rpi4. We need to explicitly set it as we are reusing pieces from the GL v3d
# driver.
v3dv_flags = ['-DV3D_VERSION=42']

84
85
86
87
88
dep_v3dv3 = dependency('v3dv3', required : false)
if dep_v3dv3.found()
  v3dv_flags += '-DUSE_V3D_SIMULATOR'
endif

89
v3dv_deps = [
90
  dep_dl,
91
  dep_libdrm,
92
  dep_valgrind,
93
  dep_v3dv3,
94
95
  idep_nir,
  idep_nir_headers,
96
97
98
  idep_vulkan_util,
]

Iago Toral's avatar
Iago Toral committed
99
100
101
102
103
104
105
106
107
if with_platform_x11
  v3dv_deps += dep_xcb_dri3
  v3dv_flags += [
    '-DVK_USE_PLATFORM_XCB_KHR',
    '-DVK_USE_PLATFORM_XLIB_KHR',
  ]
  libv3dv_files += files('v3dv_wsi_x11.c')
endif

Ella-0's avatar
Ella-0 committed
108
109
110
111
112
113
114
if with_platform_wayland
  v3dv_deps += [dep_wayland_client, dep_wl_protocols]
  v3dv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
  libv3dv_files += files('v3dv_wsi_wayland.c')
  libv3dv_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c]
endif

115
116
117
118
119
if system_has_kms_drm and not with_platform_android
 v3dv_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
 libv3dv_files += files('v3dv_wsi_display.c')
endif

120
121
122
123
libvulkan_broadcom = shared_library(
  'vulkan_broadcom',
  [libv3dv_files, v3dv_entrypoints, v3dv_extensions_c, v3dv_extensions_h, sha1_h],
  include_directories : [
Iago Toral's avatar
Iago Toral committed
124
    inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_broadcom, inc_compiler, inc_util, inc_vulkan_wsi,
125
126
  ],
  link_with : [
127
    libbroadcom_cle,
128
    libbroadcom_v3d,
Iago Toral's avatar
Iago Toral committed
129
    libvulkan_wsi,
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
  ],
  dependencies : v3dv_deps,
  c_args : v3dv_flags,
  link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections],
  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',
153
  input : [vk_icd_gen, vk_api_xml],
154
155
  output : 'broadcom_icd.@0@.json'.format(host_machine.cpu()),
  command : [
156
157
158
159
    prog_python, '@INPUT0@',
    '--api-version', '1.0', '--xml', '@INPUT1@',
    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
    		  	     'libvulkan_broadcom.so'),
160
161
162
163
164
165
    '--out', '@OUTPUT@',
  ],
  build_by_default : true,
  install_dir : with_vulkan_icd_dir,
  install : true,
)