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('gallium')
25
26virgl_sources = [
27   'iov.c',
28   'virgl_context.c',
29   'virgl_context.h',
30   'virgl_hw.h',
31   'virgl_protocol.h',
32   'virgl_resource.c',
33   'virgl_resource.h',
34   'virgl_util.c',
35   'virgl_util.h',
36]
37
38vrend_sources = [
39   'vrend_blitter.c',
40   'vrend_blitter.h',
41   'vrend_debug.c',
42   'vrend_debug.h',
43   'vrend_decode.c',
44   'vrend_formats.c',
45   'vrend_iov.h',
46   'vrend_object.c',
47   'vrend_object.h',
48   'vrend_renderer.c',
49   'vrend_renderer.h',
50   'vrend_shader.c',
51   'vrend_shader.h',
52   'vrend_strbuf.h',
53   'vrend_tweaks.c',
54   'vrend_tweaks.h',
55   'vrend_winsys.c',
56   'vrend_winsys.h',
57]
58
59virglrenderer_sources = [
60   'virglrenderer.c',
61   'virglrenderer.h',
62   'virglrenderer_hw.h',
63]
64
65vrend_winsys_egl_sources = [
66   'vrend_winsys_gbm.c',
67   'vrend_winsys_gbm.h',
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
77virgl_depends = [
78   gallium_dep,
79   epoxy_dep,
80   libdrm_dep,
81   thread_dep,
82   m_dep,
83]
84
85if with_tracing == 'perfetto'
86   virgl_depends += [vperfetto_min_dep]
87endif
88
89if with_tracing == 'percetto'
90   virgl_depends += [percetto_dep]
91endif
92
93virgl_sources += vrend_sources
94
95if have_egl
96   virgl_sources += vrend_winsys_egl_sources
97   virgl_depends += [gbm_dep]
98endif
99
100if have_glx
101   virgl_sources += vrend_winsys_glx_sources
102   virgl_depends += [glx_dep]
103endif
104
105libvirgl = static_library(
106   'virgl',
107   virgl_sources,
108   include_directories: [inc_gallium, inc_configuration],
109   dependencies : virgl_depends,
110)
111
112libvirgl_inc = [
113   inc_gallium,
114   inc_configuration,
115   include_directories('.')
116]
117
118libvirgl_dep = declare_dependency(
119   link_with: libvirgl,
120   include_directories: libvirgl_inc
121)
122
123libvirglrenderer = shared_library(
124   'virglrenderer',
125   virglrenderer_sources,
126   include_directories: [inc_gallium, inc_configuration],
127   dependencies : [virgl_depends, libvirgl_dep],
128   version : binary_age.to_string() + '.'
129             + interface_age.to_string() + '.'
130             + revision.to_string(),
131   install : true
132)
133
134libvirglrenderer_dep = declare_dependency(
135   link_with: libvirglrenderer,
136   include_directories: libvirgl_inc,
137   dependencies : [libvirgl_dep, gallium_dep]
138)
139
140install_headers('virglrenderer.h', subdir : 'virgl')
141