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