meson: Add dep_glvnd to egl deps when building with glvnd
[mesa.git] / src / egl / meson.build
1 # Copyright © 2017-2019 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
21 inc_egl = include_directories('.', 'main')
22 inc_egl_dri2 = include_directories('drivers/dri2')
23
24 c_args_for_egl = []
25 link_for_egl = []
26 deps_for_egl = []
27 incs_for_egl = [inc_include, inc_src, inc_egl]
28
29 files_egl = files(
30 'main/eglapi.c',
31 'main/eglapi.h',
32 'main/eglarray.c',
33 'main/eglarray.h',
34 'main/eglconfig.c',
35 'main/eglconfig.h',
36 'main/eglcontext.c',
37 'main/eglcontext.h',
38 'main/eglcurrent.c',
39 'main/eglcurrent.h',
40 'main/egldefines.h',
41 'main/egldevice.c',
42 'main/egldevice.h',
43 'main/egldisplay.c',
44 'main/egldisplay.h',
45 'main/egldriver.c',
46 'main/egldriver.h',
47 'main/eglglobals.c',
48 'main/eglglobals.h',
49 'main/eglimage.c',
50 'main/eglimage.h',
51 'main/egllog.c',
52 'main/egllog.h',
53 'main/eglsurface.c',
54 'main/eglsurface.h',
55 'main/eglsync.c',
56 'main/eglsync.h',
57 'main/eglentrypoint.h',
58 'main/egltypedefs.h',
59 )
60
61 g_egldispatchstubs_c = custom_target(
62 'g_egldispatchstubs.c',
63 input : [
64 'generate/gen_egl_dispatch.py',
65 'generate/egl.xml', 'generate/egl_other.xml'
66 ],
67 output : 'g_egldispatchstubs.c',
68 command : [
69 prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@',
70 ],
71 depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ],
72 capture : true,
73 )
74
75 g_egldispatchstubs_h = custom_target(
76 'g_egldispatchstubs.h',
77 input : [
78 'generate/gen_egl_dispatch.py',
79 'generate/egl.xml', 'generate/egl_other.xml'
80 ],
81 output : 'g_egldispatchstubs.h',
82 command : [
83 prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@',
84 ],
85 depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ],
86 capture : true,
87 )
88
89 if with_dri2
90 files_egl += files(
91 'drivers/dri2/egl_dri2.c',
92 'drivers/dri2/egl_dri2.h',
93 'drivers/dri2/egl_dri2_fallbacks.h',
94 )
95 deps_for_egl += idep_xmlconfig
96 link_for_egl += libloader
97 incs_for_egl += inc_loader
98
99 files_egl += files('drivers/dri2/platform_device.c')
100 if with_platform_x11
101 files_egl += files('drivers/dri2/platform_x11.c')
102 if with_dri3
103 files_egl += files('drivers/dri2/platform_x11_dri3.c')
104 link_for_egl += libloader_dri3_helper
105 endif
106 deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xfixes]
107 endif
108 if with_platform_drm
109 files_egl += files('drivers/dri2/platform_drm.c')
110 link_for_egl += libgbm
111 incs_for_egl += [inc_gbm, include_directories('../gbm/main')]
112 deps_for_egl += dep_libdrm
113 endif
114 if with_platform_surfaceless
115 files_egl += files('drivers/dri2/platform_surfaceless.c')
116 endif
117 if with_platform_wayland
118 deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
119 link_for_egl += libwayland_drm
120 files_egl += files('drivers/dri2/platform_wayland.c')
121 files_egl += [
122 linux_dmabuf_unstable_v1_protocol_c,
123 linux_dmabuf_unstable_v1_client_protocol_h,
124 wayland_drm_client_protocol_h,
125 ]
126 incs_for_egl += include_directories('wayland/wayland-drm')
127 endif
128 if with_platform_android
129 deps_for_egl += dep_android
130 files_egl += files('drivers/dri2/platform_android.c')
131 endif
132 elif with_platform_haiku
133 incs_for_egl += inc_haikugl
134 c_args_for_egl += [
135 '-D_EGL_BUILT_IN_DRIVER_HAIKU',
136 ]
137 files_egl += files('drivers/haiku/egl_haiku.cpp')
138 link_for_egl += libgl
139 deps_for_egl += cpp.find_library('be')
140 endif
141
142 if cc.has_function('mincore')
143 c_args_for_egl += '-DHAVE_MINCORE'
144 endif
145
146 if not with_glvnd
147 egl_lib_name = 'EGL' + get_option('egl-lib-suffix')
148 egl_lib_version = '1.0.0'
149 else
150 egl_lib_name = 'EGL_mesa'
151 egl_lib_version = '0.0.0'
152 deps_for_egl += dep_glvnd
153 files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
154 files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
155 install_data(
156 'main/50_mesa.json',
157 install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d')
158 )
159 endif
160
161 libegl = shared_library(
162 egl_lib_name,
163 files_egl,
164 c_args : [
165 c_vis_args,
166 c_args_for_egl,
167 '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()),
168 ],
169 include_directories : incs_for_egl,
170 link_with : [link_for_egl, libglapi],
171 link_args : [ld_args_bsymbolic, ld_args_gc_sections],
172 dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread, idep_mesautil],
173 install : true,
174 version : egl_lib_version,
175 )
176
177 if not with_glvnd
178 pkg.generate(
179 name : 'egl',
180 description : 'Mesa EGL Library',
181 version : meson.project_version(),
182 libraries : libegl,
183 libraries_private: gl_priv_libs,
184 requires_private : gl_priv_reqs,
185 extra_cflags : gl_pkgconfig_c_flags,
186 )
187 endif
188
189 if with_tests and prog_nm.found()
190 if with_glvnd
191 egl_symbols = files('egl-glvnd-symbols.txt')
192 else
193 egl_symbols = files('egl-symbols.txt')
194 endif
195 test('egl-symbols-check',
196 symbols_check,
197 args : [
198 '--lib', libegl,
199 '--symbols-file', egl_symbols,
200 '--nm', prog_nm.path(),
201 ],
202 suite : ['egl'],
203 )
204 test('egl-entrypoint-check',
205 prog_python,
206 args : files('egl-entrypoint-check.py', 'main/eglentrypoint.h'),
207 suite : ['egl'],
208 )
209 endif