meson.build revision 01e04c3f
1# Copyright © 2017 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_drm_uapi, inc_src, inc_egl] 28 29files_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/eglfallbacks.c', 48 'main/eglglobals.c', 49 'main/eglglobals.h', 50 'main/eglimage.c', 51 'main/eglimage.h', 52 'main/egllog.c', 53 'main/egllog.h', 54 'main/eglsurface.c', 55 'main/eglsurface.h', 56 'main/eglsync.c', 57 'main/eglsync.h', 58 'main/eglentrypoint.h', 59 'main/egltypedefs.h', 60) 61 62g_egldispatchstubs_c = custom_target( 63 'g_egldispatchstubs.c', 64 input : [ 65 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py', 66 'generate/egl.xml', 'generate/egl_other.xml' 67 ], 68 output : 'g_egldispatchstubs.c', 69 command : [ 70 prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@', '@INPUT3@' 71 ], 72 depend_files : files('generate/genCommon.py'), 73 capture : true, 74) 75 76g_egldispatchstubs_h = custom_target( 77 'g_egldispatchstubs.h', 78 input : [ 79 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py', 80 'generate/egl.xml', 'generate/egl_other.xml' 81 ], 82 output : 'g_egldispatchstubs.h', 83 command : [ 84 prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@', '@INPUT3@' 85 ], 86 depend_files : files('generate/genCommon.py'), 87 capture : true, 88) 89 90if with_dri2 91 files_egl += files( 92 'drivers/dri2/egl_dri2.c', 93 'drivers/dri2/egl_dri2.h', 94 'drivers/dri2/egl_dri2_fallbacks.h', 95 ) 96 c_args_for_egl += [ 97 '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path), 98 ] 99 100 if with_platform_x11 101 files_egl += files('drivers/dri2/platform_x11.c') 102 incs_for_egl += inc_loader 103 if with_dri3 104 files_egl += files('drivers/dri2/platform_x11_dri3.c') 105 link_for_egl += libloader_dri3_helper 106 endif 107 deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xfixes] 108 endif 109 if with_platform_drm 110 files_egl += files('drivers/dri2/platform_drm.c') 111 link_for_egl += [libloader, libgbm, libxmlconfig] 112 incs_for_egl += [inc_loader, inc_gbm, include_directories('../gbm/main')] 113 deps_for_egl += dep_libdrm 114 endif 115 if with_platform_surfaceless 116 files_egl += files('drivers/dri2/platform_surfaceless.c') 117 incs_for_egl += [inc_loader] 118 endif 119 if with_platform_wayland 120 deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers] 121 link_for_egl += libwayland_drm 122 files_egl += files('drivers/dri2/platform_wayland.c') 123 files_egl += [ 124 linux_dmabuf_unstable_v1_protocol_c, 125 linux_dmabuf_unstable_v1_client_protocol_h, 126 wayland_drm_client_protocol_h, 127 ] 128 incs_for_egl += include_directories('wayland/wayland-drm') 129 endif 130 if with_platform_android 131 deps_for_egl += dep_android 132 files_egl += files('drivers/dri2/platform_android.c') 133 incs_for_egl += [inc_loader] 134 endif 135elif with_platform_haiku 136 incs_for_egl += inc_haikugl 137 c_args_for_egl += [ 138 '-D_EGL_BUILT_IN_DRIVER_HAIKU', 139 ] 140 files_egl += files('drivers/haiku/egl_haiku.cpp') 141 link_for_egl += libgl 142 deps_for_egl += cpp.find_library('be') 143endif 144 145if cc.has_function('mincore') 146 c_args_for_egl += '-DHAVE_MINCORE' 147endif 148 149if not with_glvnd 150 egl_lib_name = 'EGL' 151 egl_lib_version = '1.0.0' 152else 153 egl_lib_name = 'EGL_mesa' 154 egl_lib_version = '0.0.0' 155 files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c] 156 files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c') 157 install_data( 158 'main/50_mesa.json', 159 install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d') 160 ) 161endif 162 163libegl = shared_library( 164 egl_lib_name, 165 files_egl, 166 c_args : [ 167 c_vis_args, 168 c_args_for_egl, 169 '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()), 170 ], 171 include_directories : incs_for_egl, 172 link_with : [link_for_egl, libloader, libxmlconfig, libglapi, libmesa_util], 173 link_args : [ld_args_bsymbolic, ld_args_gc_sections], 174 dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread], 175 install : true, 176 version : egl_lib_version, 177) 178 179# If using glvnd the pkg-config header should not point to EGL_mesa, it should 180# point to EGL. glvnd is only available on unix like platforms so adding -l 181# should be safe here 182# TODO: in the glvnd case glvnd itself should really be providing this. 183if with_glvnd 184 _egl = '-L${libdir} -lEGL' 185else 186 _egl = libegl 187endif 188 189pkg.generate( 190 name : 'egl', 191 description : 'Mesa EGL Library', 192 version : meson.project_version(), 193 libraries : _egl, 194 libraries_private: gl_priv_libs, 195 requires_private : gl_priv_reqs, 196 extra_cflags : gl_pkgconfig_c_flags, 197) 198 199if with_tests 200 if with_glvnd 201 # TODO: add glvnd symbol check 202 else 203 test('egl-symbols-check', 204 find_program('egl-symbols-check'), 205 env : env_test, 206 args : libegl 207 ) 208 endif 209 test('egl-entrypoint-check', 210 find_program('egl-entrypoint-check'), 211 env : [ 'srcdir=' + meson.current_source_dir() ] 212 ) 213endif 214