xref: /aosp_15_r20/external/virglrenderer/src/meson.build (revision bbecb9d118dfdb95f99bd754f8fa9be01f189df3)
1#############################################################################
2#
3# Copyright (C) 2019 Collabora Ltd
4#
5# Permission is hereby granted, free of charge, to any person obtaining a
6# copy of this software and associated documentation files (the "Software"),
7# to deal in the Software without restriction, including without limitation
8# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9# and/or sell copies of the Software, and to permit persons to whom the
10# Software is furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included
13# in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21# OTHER DEALINGS IN THE SOFTWARE.
22#
23
24subdir('mesa')
25subdir('gallium')
26
27virgl_sources = [
28   'iov.c',
29   'virgl_context.c',
30   'virgl_context.h',
31   'virgl_hw.h',
32   'virgl_protocol.h',
33   'virgl_resource.c',
34   'virgl_resource.h',
35   'virgl_util.c',
36   'virgl_util.h',
37]
38
39vrend_sources = [
40   'vrend_blitter.c',
41   'vrend_blitter.h',
42   'vrend_debug.c',
43   'vrend_debug.h',
44   'vrend_decode.c',
45   'vrend_formats.c',
46   'vrend_iov.h',
47   'vrend_object.c',
48   'vrend_object.h',
49   'vrend_renderer.c',
50   'vrend_renderer.h',
51   'vrend_shader.c',
52   'vrend_shader.h',
53   'vrend_strbuf.h',
54   'vrend_tweaks.c',
55   'vrend_tweaks.h',
56   'vrend_winsys.c',
57   'vrend_winsys.h',
58]
59
60virglrenderer_sources = [
61   'virglrenderer.c',
62   'virglrenderer.h',
63   'virglrenderer_hw.h',
64]
65
66vrend_winsys_egl_sources = [
67   'vrend_winsys_gbm_stubs.c',
68   'vrend_winsys_egl.c',
69   'vrend_winsys_egl.h',
70]
71
72vrend_winsys_glx_sources = [
73   'vrend_winsys_glx.c',
74   'vrend_winsys_glx.h',
75]
76
77venus_sources = [
78   'venus_hw.h',
79   'venus/venus-protocol/vn_protocol_renderer.h',
80   'venus/vkr_allocator.c',
81   'venus/vkr_allocator.h',
82   'venus/vkr_buffer.c',
83   'venus/vkr_buffer.h',
84   'venus/vkr_command_buffer.c',
85   'venus/vkr_command_buffer.h',
86   'venus/vkr_common.c',
87   'venus/vkr_common.h',
88   'venus/vkr_context.c',
89   'venus/vkr_context.h',
90   'venus/vkr_cs.c',
91   'venus/vkr_cs.h',
92   'venus/vkr_descriptor_set.c',
93   'venus/vkr_descriptor_set.h',
94   'venus/vkr_device.c',
95   'venus/vkr_device.h',
96   'venus/vkr_device_memory.c',
97   'venus/vkr_device_memory.h',
98   'venus/vkr_image.c',
99   'venus/vkr_image.h',
100   'venus/vkr_instance.c',
101   'venus/vkr_instance.h',
102   'venus/vkr_physical_device.c',
103   'venus/vkr_physical_device.h',
104   'venus/vkr_pipeline.c',
105   'venus/vkr_pipeline.h',
106   'venus/vkr_query_pool.c',
107   'venus/vkr_query_pool.h',
108   'venus/vkr_queue.c',
109   'venus/vkr_queue.h',
110   'venus/vkr_render_pass.c',
111   'venus/vkr_render_pass.h',
112   'venus/vkr_renderer.c',
113   'venus/vkr_renderer.h',
114   'venus/vkr_ring.c',
115   'venus/vkr_ring.h',
116   'venus/vkr_transport.c',
117   'venus/vkr_transport.h',
118]
119
120venus_codegen = custom_target(
121   'venus_codegen',
122   input : ['venus/vkr_device_object.py', 'venus/vkr_device_object.json'],
123   output : [
124      'vkr_buffer_gen.h',
125      'vkr_command_buffer_gen.h',
126      'vkr_descriptor_set_gen.h',
127      'vkr_device_memory_gen.h',
128      'vkr_image_gen.h',
129      'vkr_pipeline_gen.h',
130      'vkr_query_pool_gen.h',
131      'vkr_queue_gen.h',
132      'vkr_render_pass_gen.h',
133   ],
134   command : [prog_python, '@INPUT0@', '-o', '@OUTDIR@', '@INPUT1@'],
135)
136
137drm_sources = [
138   'drm/drm_fence.c',
139   'drm/drm_fence.h',
140   'drm/drm_renderer.c',
141   'drm/drm_renderer.h',
142   'drm/drm_util.c',
143   'drm/drm_util.h',
144]
145
146drm_msm_sources = [
147   'drm/drm-uapi/msm_drm.h',
148   'drm/msm/msm_proto.h',
149   'drm/msm/msm_renderer.c',
150   'drm/msm/msm_renderer.h',
151]
152
153proxy_sources = [
154   'proxy/proxy_client.c',
155   'proxy/proxy_common.c',
156   'proxy/proxy_context.c',
157   'proxy/proxy_renderer.c',
158   'proxy/proxy_server.c',
159   'proxy/proxy_socket.c',
160]
161
162video_sources = [
163   'virgl_video_hw.h',
164   'virgl_video.c',
165   'virgl_video.h',
166   'vrend_video.c',
167   'vrend_video.h',
168]
169
170virgl_depends = [
171   gallium_dep,
172   epoxy_dep,
173   libdrm_dep,
174   thread_dep,
175   m_dep,
176]
177
178if with_tracing == 'perfetto'
179   virgl_depends += [vperfetto_min_dep]
180endif
181
182if with_tracing == 'percetto'
183   virgl_depends += [percetto_dep]
184endif
185
186virgl_sources += vrend_sources
187
188if have_egl
189   virgl_sources += vrend_winsys_egl_sources
190endif
191
192if have_glx
193   virgl_sources += vrend_winsys_glx_sources
194   virgl_depends += [glx_dep]
195endif
196
197if with_venus
198   virgl_sources += venus_sources
199   virgl_sources += venus_codegen
200   virgl_depends += [venus_dep]
201endif
202
203if with_drm
204   virgl_sources += drm_sources
205endif
206
207if with_drm_msm
208   virgl_sources += drm_msm_sources
209endif
210
211if with_render_server
212   virgl_sources += proxy_sources
213endif
214
215if with_video
216  virgl_sources += video_sources
217  virgl_depends += [libva_dep, libvadrm_dep]
218endif
219
220libvirgl = static_library(
221   'virgl',
222   virgl_sources,
223   include_directories: [inc_gallium, inc_configuration, 'venus', 'drm', 'drm/drm-uapi'],
224   dependencies : virgl_depends,
225)
226
227libvirgl_inc = [
228   inc_gallium,
229   inc_configuration,
230   include_directories(['.', 'venus', 'drm'])
231]
232
233libvirgl_dep = declare_dependency(
234   link_with: libvirgl,
235   include_directories: libvirgl_inc
236)
237
238libvirglrenderer = library(
239   'virglrenderer',
240   virglrenderer_sources,
241   include_directories: [inc_gallium, inc_configuration],
242   dependencies : [virgl_depends, libvirgl_dep],
243   version : binary_age.to_string() + '.'
244             + interface_age.to_string() + '.'
245             + revision.to_string(),
246   install : true
247)
248
249pkg = import('pkgconfig')
250pkg.generate(libvirglrenderer,
251   description: 'virgl GL renderer',
252   subdirs: 'virgl'
253)
254
255libvirglrenderer_dep = declare_dependency(
256   link_with: libvirglrenderer,
257   include_directories: libvirgl_inc,
258   dependencies : [libvirgl_dep, gallium_dep]
259)
260
261install_headers('virglrenderer.h', subdir : 'virgl')
262