1# Copyright © 2017-2019 Intel Corporation 2# SPDX-License-Identifier: MIT 3 4inc_egl = include_directories('.', 'main') 5 6c_args_for_egl = [asan_c_args] 7cpp_args_for_egl = [] 8link_args_for_egl = [] 9link_deps_for_egl = [] 10link_for_egl = [libpipe_loader_dynamic] 11if with_dri 12 link_for_egl += libgallium_dri 13endif 14if with_platform_windows 15 link_for_egl += libgallium_wgl 16endif 17deps_for_egl = [] 18incs_for_egl = [inc_include, inc_src, inc_egl] 19 20files_egl = files( 21 'main/eglapi.c', 22 'main/eglarray.c', 23 'main/eglarray.h', 24 'main/eglconfigdebug.c', 25 'main/eglconfigdebug.h', 26 'main/eglconfig.c', 27 'main/eglconfig.h', 28 'main/eglcontext.c', 29 'main/eglcontext.h', 30 'main/eglcurrent.c', 31 'main/eglcurrent.h', 32 'main/egldefines.h', 33 'main/egldevice.c', 34 'main/egldevice.h', 35 'main/egldisplay.c', 36 'main/egldisplay.h', 37 'main/egldriver.h', 38 'main/eglglobals.c', 39 'main/eglglobals.h', 40 'main/eglimage.c', 41 'main/eglimage.h', 42 'main/egllog.c', 43 'main/egllog.h', 44 'main/eglsurface.c', 45 'main/eglsurface.h', 46 'main/eglsync.c', 47 'main/eglsync.h', 48 'main/eglentrypoint.h', 49 'main/egltypedefs.h', 50) 51 52g_egldispatchstubs_c = custom_target( 53 'g_egldispatchstubs.c', 54 input : [ 55 'generate/gen_egl_dispatch.py', 56 'generate/egl.xml', 'generate/egl_other.xml' 57 ], 58 output : 'g_egldispatchstubs.c', 59 command : [ 60 prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@', 61 ], 62 depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ], 63 capture : true, 64) 65 66g_egldispatchstubs_h = custom_target( 67 'g_egldispatchstubs.h', 68 input : [ 69 'generate/gen_egl_dispatch.py', 70 'generate/egl.xml', 'generate/egl_other.xml' 71 ], 72 output : 'g_egldispatchstubs.h', 73 command : [ 74 prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@', 75 ], 76 depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ], 77 capture : true, 78) 79 80if with_dri 81 files_egl += files( 82 'drivers/dri2/egl_dri2.c', 83 'drivers/dri2/egl_dri2.h', 84 ) 85 files_egl += sha1_h 86 deps_for_egl += idep_xmlconfig 87 link_for_egl += libloader 88 incs_for_egl += inc_loader 89 incs_for_egl += inc_loader_x11 90 incs_for_egl += inc_gallium 91 incs_for_egl += inc_gallium_aux 92 incs_for_egl += inc_mesa 93 incs_for_egl += inc_st_dri 94 95 files_egl += files( 96 'drivers/dri2/platform_device.c', 97 'drivers/dri2/platform_surfaceless.c', 98 ) 99 100 if with_platform_x11 101 files_egl += files('drivers/dri2/platform_x11.c') 102 if with_dri_platform == 'drm' 103 files_egl += files('drivers/dri2/platform_x11_dri3.c') 104 link_for_egl += [libloader_x11] 105 endif 106 deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xrandr, dep_xcb_xfixes, dep_xcb_shm] 107 endif 108 if with_gbm and not with_platform_android 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, libloader_wayland_helper] 117 files_egl += files('drivers/dri2/platform_wayland.c') 118 files_egl += wp_files['linux-dmabuf-unstable-v1'] 119 files_egl += [wayland_drm_client_protocol_h] 120 incs_for_egl += include_directories('wayland/wayland-drm') 121 endif 122 if with_platform_android 123 deps_for_egl += [dep_android, idep_u_gralloc] 124 files_egl += files('drivers/dri2/platform_android.c') 125 endif 126elif with_platform_haiku 127 c_args_for_egl += [ 128 '-D_EGL_BUILT_IN_DRIVER_HAIKU', 129 ] 130 files_egl += files('drivers/haiku/egl_haiku.cpp') 131 132 incs_for_egl += [inc_gallium, inc_gallium_aux, inc_gallium_drivers, inc_gallium_winsys, inc_gallium_winsys_sw] 133 incs_for_egl += [inc_mesa, inc_mapi] 134 incs_for_egl += [include_directories('../gallium/frontends/hgl')] 135 136 link_for_egl += [libmesa, libgallium, libswhgl, libsthgl] 137 deps_for_egl += [cpp.find_library('be'), driver_swrast] 138elif with_platform_windows 139 c_args_for_egl += [ 140 '-DEGLAPI=', '-DPUBLIC=' 141 ] 142 files_egl += files('drivers/wgl/egl_wgl.c') 143 incs_for_egl += [inc_wgl, inc_gallium, inc_gallium_aux, inc_mesa, inc_mapi] 144 link_for_egl += libgallium_wgl 145 146else 147 error('No EGL driver available.') 148endif 149 150if cc.has_function('mincore') 151 c_args_for_egl += '-DHAVE_MINCORE' 152endif 153 154if not with_glvnd 155 egl_lib_name = 'EGL' + get_option('egl-lib-suffix') 156 egl_lib_version = '1.0.0' 157 egl_lib_soversion = host_machine.system() == 'windows' ? '' : '1' 158else 159 egl_lib_name = 'EGL_@0@'.format(glvnd_vendor_name) 160 egl_lib_version = '0.0.0' 161 egl_lib_soversion = '0' 162 deps_for_egl += dep_glvnd 163 files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c] 164 files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c') 165 glvnd_config = configuration_data() 166 glvnd_config.set('glvnd_vendor_name', get_option('glvnd-vendor-name')) 167 configure_file( 168 configuration: glvnd_config, 169 input : 'main/50_mesa.json', 170 output: '50_@0@.json'.format(glvnd_vendor_name), 171 install : true, 172 install_tag : 'runtime', 173 install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d') 174 ) 175endif 176 177if with_ld_version_script 178 if with_glvnd 179 link_args_for_egl += [ 180 '-Wl,--version-script', join_paths(meson.current_source_dir(), 'egl-glvnd.sym') 181 ] 182 link_deps_for_egl += files('egl-glvnd.sym') 183 else 184 link_args_for_egl += [ 185 '-Wl,--version-script', join_paths(meson.current_source_dir(), 'egl.sym') 186 ] 187 link_deps_for_egl += files('egl.sym') 188 endif 189endif 190 191egl_def = custom_target( 192 'egl.def', 193 input: 'main/egl.def.in', 194 output : 'egl.def', 195 command : gen_vs_module_defs_normal_command, 196) 197 198libegl = shared_library( 199 egl_lib_name, 200 files_egl, 201 c_args : [ 202 c_args_for_egl, 203 '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()), 204 ], 205 cpp_args : [cpp_args_for_egl], 206 gnu_symbol_visibility : 'hidden', 207 include_directories : incs_for_egl, 208 link_with : [link_for_egl, libglapi], 209 link_args : [ld_args_bsymbolic, ld_args_gc_sections, link_args_for_egl], 210 link_depends : [link_deps_for_egl], 211 dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread, idep_mesautil], 212 install : true, 213 version : egl_lib_version, 214 soversion : egl_lib_soversion, 215 name_prefix : host_machine.system() == 'windows' ? 'lib' : [], # always use lib, but avoid warnings on !windows 216 vs_module_defs : egl_def 217) 218 219if not with_glvnd 220 pkg.generate( 221 name : 'egl', 222 description : 'Mesa EGL Library', 223 version : meson.project_version(), 224 libraries : libegl, 225 libraries_private: gl_priv_libs, 226 requires_private : gl_priv_reqs, 227 extra_cflags : gl_pkgconfig_c_flags, 228 ) 229endif 230 231if with_symbols_check 232 if with_glvnd 233 egl_symbols = files('egl-glvnd-symbols.txt') 234 else 235 egl_symbols = files('egl-symbols.txt') 236 endif 237 test('egl-symbols-check', 238 symbols_check, 239 args : [ 240 '--lib', libegl, 241 '--symbols-file', egl_symbols, 242 symbols_check_args, 243 ], 244 suite : ['egl'], 245 ) 246 test('egl-entrypoint-check', 247 prog_python, 248 args : files('egl-entrypoint-check.py', 'main/eglentrypoint.h'), 249 suite : ['egl'], 250 ) 251endif 252