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
24 incs_for_egl = [inc_include, inc_src, include_directories('main')]
42 'main/eglfallbacks.c',
53 'main/eglentrypoint.h',
57 g_egldispatchstubs_c = custom_target(
58 'g_egldispatchstubs.c',
60 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py',
61 'generate/egl.xml', 'generate/egl_other.xml'
63 output : 'g_egldispatchstubs.c',
65 prog_python2, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@', '@INPUT3@'
67 depend_files : files('generate/genCommon.py'),
71 g_egldispatchstubs_h = custom_target(
72 'g_egldispatchstubs.h',
74 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py',
75 'generate/egl.xml', 'generate/egl_other.xml'
77 output : 'g_egldispatchstubs.h',
79 prog_python2, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@', '@INPUT3@'
81 depend_files : files('generate/genCommon.py'),
87 'drivers/dri2/egl_dri2.c',
88 'drivers/dri2/egl_dri2.h',
89 'drivers/dri2/egl_dri2_fallbacks.h',
92 '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
93 '-D_EGL_BUILT_IN_DRIVER_DRI2',
98 files_egl += files('drivers/dri2/platform_x11.c')
100 files_egl += files('drivers/dri2/platform_x11_dri3.c')
101 link_for_egl += libloader_dri3_helper
103 deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xfixes]
106 files_egl += files('drivers/dri2/platform_drm.c')
107 link_for_egl += [libloader, libgbm, libxmlconfig]
108 incs_for_egl += [inc_loader, inc_gbm, include_directories('../gbm/main')]
109 deps_for_egl += dep_libdrm
111 if with_platform_surfaceless
112 files_egl += files('drivers/dri2/platform_surfaceless.c')
114 if with_platform_wayland
115 deps_for_egl += [dep_wayland_client, dep_wayland_server]
116 link_for_egl += libwayland_drm
117 files_egl += files('drivers/dri2/platform_wayland.c')
119 linux_dmabuf_unstable_v1_protocol_c,
120 linux_dmabuf_unstable_v1_client_protocol_h,
121 wayland_drm_client_protocol_h,
123 incs_for_egl += include_directories(
124 'wayland/wayland-egl', 'wayland/wayland-drm',
127 if with_platform_android
128 deps_for_egl += dep_android
129 files_egl += files('drivers/dri2/platform_android.c')
131 if with_platform_haiku
132 incs_for_egl += inc_haikugl
134 '-D_EGL_BUILT_IN_DRIVER_HAIKU',
136 files_egl += files('drivers/haiku/egl_haiku.cpp')
137 link_for_egl += libgl
138 deps_for_egl += cpp.find_library('be')
143 if cc.has_function('mincore')
144 c_args_for_egl += '-DHAVE_MINCORE'
149 egl_lib_version = '1.0.0'
151 egl_lib_name = 'EGL_mesa'
152 egl_lib_version = '0.0.0'
153 files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
154 files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
157 install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d')
161 libegl = shared_library(
167 '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()),
169 include_directories : incs_for_egl,
170 link_with : [link_for_egl, libloader, libxmlconfig, libglapi, libmesa_util],
171 link_args : [ld_args_bsymbolic, ld_args_gc_sections],
172 dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread],
174 version : egl_lib_version,
177 # If using glvnd the pkg-config header should not point to EGL_mesa, it should
178 # point to EGL. glvnd is only available on unix like platforms so adding -l
179 # should be safe here
180 # TODO: in the glvnd case glvnd itself should really be providing this.
182 _egl = '-L${libdir} -lEGL'
189 description : 'Mesa EGL Library',
190 version : meson.project_version(),
192 libraries_private: gl_priv_libs,
193 requires_private : gl_priv_reqs,
194 extra_cflags : gl_pkgconfig_c_flags,
197 if with_platform_wayland
198 subdir('wayland/wayland-egl')
203 # TODO: add glvnd symbol check
205 test('egl-symbols-check',
206 find_program('egl-symbols-check'),
210 test('egl-entrypoint-check',
211 find_program('egl-entrypoint-check'),
212 env : [ 'srcdir=' + meson.current_source_dir() ]