1 # Copyright © 2017 Intel Corporation
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:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
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
21 inc_egl = include_directories('.', 'main')
22 inc_egl_dri2 = include_directories('drivers/dri2')
27 incs_for_egl = [inc_include, inc_drm_uapi, inc_src, inc_egl]
45 'main/eglfallbacks.c',
56 'main/eglentrypoint.h',
60 g_egldispatchstubs_c = custom_target(
61 'g_egldispatchstubs.c',
63 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py',
64 'generate/egl.xml', 'generate/egl_other.xml'
66 output : 'g_egldispatchstubs.c',
68 prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@', '@INPUT3@'
70 depend_files : files('generate/genCommon.py'),
74 g_egldispatchstubs_h = custom_target(
75 'g_egldispatchstubs.h',
77 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py',
78 'generate/egl.xml', 'generate/egl_other.xml'
80 output : 'g_egldispatchstubs.h',
82 prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@', '@INPUT3@'
84 depend_files : files('generate/genCommon.py'),
90 'drivers/dri2/egl_dri2.c',
91 'drivers/dri2/egl_dri2.h',
92 'drivers/dri2/egl_dri2_fallbacks.h',
95 '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
100 files_egl += files('drivers/dri2/platform_x11.c')
101 incs_for_egl += inc_loader
103 files_egl += files('drivers/dri2/platform_x11_dri3.c')
104 link_for_egl += libloader_dri3_helper
106 deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xfixes]
109 files_egl += files('drivers/dri2/platform_drm.c')
110 link_for_egl += [libloader, libgbm, libxmlconfig]
111 incs_for_egl += [inc_loader, inc_gbm, include_directories('../gbm/main')]
112 deps_for_egl += dep_libdrm
114 if with_platform_surfaceless
115 files_egl += files('drivers/dri2/platform_surfaceless.c')
116 incs_for_egl += [inc_loader]
118 if with_platform_wayland
119 deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
120 link_for_egl += libwayland_drm
121 files_egl += files('drivers/dri2/platform_wayland.c')
123 linux_dmabuf_unstable_v1_protocol_c,
124 linux_dmabuf_unstable_v1_client_protocol_h,
125 wayland_drm_client_protocol_h,
127 incs_for_egl += include_directories('wayland/wayland-drm')
129 if with_platform_android
130 deps_for_egl += dep_android
131 files_egl += files('drivers/dri2/platform_android.c')
132 incs_for_egl += [inc_loader]
134 if with_platform_haiku
135 incs_for_egl += inc_haikugl
137 '-D_EGL_BUILT_IN_DRIVER_HAIKU',
139 files_egl += files('drivers/haiku/egl_haiku.cpp')
140 link_for_egl += libgl
141 deps_for_egl += cpp.find_library('be')
144 if cc.has_function('mincore')
145 c_args_for_egl += '-DHAVE_MINCORE'
150 egl_lib_version = '1.0.0'
152 egl_lib_name = 'EGL_mesa'
153 egl_lib_version = '0.0.0'
154 files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
155 files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
158 install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d')
162 libegl = shared_library(
168 '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()),
170 include_directories : incs_for_egl,
171 link_with : [link_for_egl, libloader, libxmlconfig, libglapi, libmesa_util],
172 link_args : [ld_args_bsymbolic, ld_args_gc_sections],
173 dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread],
175 version : egl_lib_version,
178 # If using glvnd the pkg-config header should not point to EGL_mesa, it should
179 # point to EGL. glvnd is only available on unix like platforms so adding -l
180 # should be safe here
181 # TODO: in the glvnd case glvnd itself should really be providing this.
183 _egl = '-L${libdir} -lEGL'
190 description : 'Mesa EGL Library',
191 version : meson.project_version(),
193 libraries_private: gl_priv_libs,
194 requires_private : gl_priv_reqs,
195 extra_cflags : gl_pkgconfig_c_flags,
200 # TODO: add glvnd symbol check
202 test('egl-symbols-check',
203 find_program('egl-symbols-check'),
208 test('egl-entrypoint-check',
209 find_program('egl-entrypoint-check'),
210 env : [ 'srcdir=' + meson.current_source_dir() ]