meson.build revision 01e04c3f
101e04c3fSmrg# Copyright © 2017 Intel Corporation 201e04c3fSmrg 301e04c3fSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy 401e04c3fSmrg# of this software and associated documentation files (the "Software"), to deal 501e04c3fSmrg# in the Software without restriction, including without limitation the rights 601e04c3fSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 701e04c3fSmrg# copies of the Software, and to permit persons to whom the Software is 801e04c3fSmrg# furnished to do so, subject to the following conditions: 901e04c3fSmrg 1001e04c3fSmrg# The above copyright notice and this permission notice shall be included in 1101e04c3fSmrg# all copies or substantial portions of the Software. 1201e04c3fSmrg 1301e04c3fSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1401e04c3fSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1501e04c3fSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1601e04c3fSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1701e04c3fSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1801e04c3fSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 1901e04c3fSmrg# SOFTWARE. 2001e04c3fSmrg 2101e04c3fSmrginc_egl = include_directories('.', 'main') 2201e04c3fSmrginc_egl_dri2 = include_directories('drivers/dri2') 2301e04c3fSmrg 2401e04c3fSmrgc_args_for_egl = [] 2501e04c3fSmrglink_for_egl = [] 2601e04c3fSmrgdeps_for_egl = [] 2701e04c3fSmrgincs_for_egl = [inc_include, inc_drm_uapi, inc_src, inc_egl] 2801e04c3fSmrg 2901e04c3fSmrgfiles_egl = files( 3001e04c3fSmrg 'main/eglapi.c', 3101e04c3fSmrg 'main/eglapi.h', 3201e04c3fSmrg 'main/eglarray.c', 3301e04c3fSmrg 'main/eglarray.h', 3401e04c3fSmrg 'main/eglconfig.c', 3501e04c3fSmrg 'main/eglconfig.h', 3601e04c3fSmrg 'main/eglcontext.c', 3701e04c3fSmrg 'main/eglcontext.h', 3801e04c3fSmrg 'main/eglcurrent.c', 3901e04c3fSmrg 'main/eglcurrent.h', 4001e04c3fSmrg 'main/egldefines.h', 4101e04c3fSmrg 'main/egldevice.c', 4201e04c3fSmrg 'main/egldevice.h', 4301e04c3fSmrg 'main/egldisplay.c', 4401e04c3fSmrg 'main/egldisplay.h', 4501e04c3fSmrg 'main/egldriver.c', 4601e04c3fSmrg 'main/egldriver.h', 4701e04c3fSmrg 'main/eglfallbacks.c', 4801e04c3fSmrg 'main/eglglobals.c', 4901e04c3fSmrg 'main/eglglobals.h', 5001e04c3fSmrg 'main/eglimage.c', 5101e04c3fSmrg 'main/eglimage.h', 5201e04c3fSmrg 'main/egllog.c', 5301e04c3fSmrg 'main/egllog.h', 5401e04c3fSmrg 'main/eglsurface.c', 5501e04c3fSmrg 'main/eglsurface.h', 5601e04c3fSmrg 'main/eglsync.c', 5701e04c3fSmrg 'main/eglsync.h', 5801e04c3fSmrg 'main/eglentrypoint.h', 5901e04c3fSmrg 'main/egltypedefs.h', 6001e04c3fSmrg) 6101e04c3fSmrg 6201e04c3fSmrgg_egldispatchstubs_c = custom_target( 6301e04c3fSmrg 'g_egldispatchstubs.c', 6401e04c3fSmrg input : [ 6501e04c3fSmrg 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py', 6601e04c3fSmrg 'generate/egl.xml', 'generate/egl_other.xml' 6701e04c3fSmrg ], 6801e04c3fSmrg output : 'g_egldispatchstubs.c', 6901e04c3fSmrg command : [ 7001e04c3fSmrg prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@', '@INPUT3@' 7101e04c3fSmrg ], 7201e04c3fSmrg depend_files : files('generate/genCommon.py'), 7301e04c3fSmrg capture : true, 7401e04c3fSmrg) 7501e04c3fSmrg 7601e04c3fSmrgg_egldispatchstubs_h = custom_target( 7701e04c3fSmrg 'g_egldispatchstubs.h', 7801e04c3fSmrg input : [ 7901e04c3fSmrg 'generate/gen_egl_dispatch.py', 'generate/eglFunctionList.py', 8001e04c3fSmrg 'generate/egl.xml', 'generate/egl_other.xml' 8101e04c3fSmrg ], 8201e04c3fSmrg output : 'g_egldispatchstubs.h', 8301e04c3fSmrg command : [ 8401e04c3fSmrg prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@', '@INPUT3@' 8501e04c3fSmrg ], 8601e04c3fSmrg depend_files : files('generate/genCommon.py'), 8701e04c3fSmrg capture : true, 8801e04c3fSmrg) 8901e04c3fSmrg 9001e04c3fSmrgif with_dri2 9101e04c3fSmrg files_egl += files( 9201e04c3fSmrg 'drivers/dri2/egl_dri2.c', 9301e04c3fSmrg 'drivers/dri2/egl_dri2.h', 9401e04c3fSmrg 'drivers/dri2/egl_dri2_fallbacks.h', 9501e04c3fSmrg ) 9601e04c3fSmrg c_args_for_egl += [ 9701e04c3fSmrg '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path), 9801e04c3fSmrg ] 9901e04c3fSmrg 10001e04c3fSmrg if with_platform_x11 10101e04c3fSmrg files_egl += files('drivers/dri2/platform_x11.c') 10201e04c3fSmrg incs_for_egl += inc_loader 10301e04c3fSmrg if with_dri3 10401e04c3fSmrg files_egl += files('drivers/dri2/platform_x11_dri3.c') 10501e04c3fSmrg link_for_egl += libloader_dri3_helper 10601e04c3fSmrg endif 10701e04c3fSmrg deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xfixes] 10801e04c3fSmrg endif 10901e04c3fSmrg if with_platform_drm 11001e04c3fSmrg files_egl += files('drivers/dri2/platform_drm.c') 11101e04c3fSmrg link_for_egl += [libloader, libgbm, libxmlconfig] 11201e04c3fSmrg incs_for_egl += [inc_loader, inc_gbm, include_directories('../gbm/main')] 11301e04c3fSmrg deps_for_egl += dep_libdrm 11401e04c3fSmrg endif 11501e04c3fSmrg if with_platform_surfaceless 11601e04c3fSmrg files_egl += files('drivers/dri2/platform_surfaceless.c') 11701e04c3fSmrg incs_for_egl += [inc_loader] 11801e04c3fSmrg endif 11901e04c3fSmrg if with_platform_wayland 12001e04c3fSmrg deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers] 12101e04c3fSmrg link_for_egl += libwayland_drm 12201e04c3fSmrg files_egl += files('drivers/dri2/platform_wayland.c') 12301e04c3fSmrg files_egl += [ 12401e04c3fSmrg linux_dmabuf_unstable_v1_protocol_c, 12501e04c3fSmrg linux_dmabuf_unstable_v1_client_protocol_h, 12601e04c3fSmrg wayland_drm_client_protocol_h, 12701e04c3fSmrg ] 12801e04c3fSmrg incs_for_egl += include_directories('wayland/wayland-drm') 12901e04c3fSmrg endif 13001e04c3fSmrg if with_platform_android 13101e04c3fSmrg deps_for_egl += dep_android 13201e04c3fSmrg files_egl += files('drivers/dri2/platform_android.c') 13301e04c3fSmrg incs_for_egl += [inc_loader] 13401e04c3fSmrg endif 13501e04c3fSmrgelif with_platform_haiku 13601e04c3fSmrg incs_for_egl += inc_haikugl 13701e04c3fSmrg c_args_for_egl += [ 13801e04c3fSmrg '-D_EGL_BUILT_IN_DRIVER_HAIKU', 13901e04c3fSmrg ] 14001e04c3fSmrg files_egl += files('drivers/haiku/egl_haiku.cpp') 14101e04c3fSmrg link_for_egl += libgl 14201e04c3fSmrg deps_for_egl += cpp.find_library('be') 14301e04c3fSmrgendif 14401e04c3fSmrg 14501e04c3fSmrgif cc.has_function('mincore') 14601e04c3fSmrg c_args_for_egl += '-DHAVE_MINCORE' 14701e04c3fSmrgendif 14801e04c3fSmrg 14901e04c3fSmrgif not with_glvnd 15001e04c3fSmrg egl_lib_name = 'EGL' 15101e04c3fSmrg egl_lib_version = '1.0.0' 15201e04c3fSmrgelse 15301e04c3fSmrg egl_lib_name = 'EGL_mesa' 15401e04c3fSmrg egl_lib_version = '0.0.0' 15501e04c3fSmrg files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c] 15601e04c3fSmrg files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c') 15701e04c3fSmrg install_data( 15801e04c3fSmrg 'main/50_mesa.json', 15901e04c3fSmrg install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d') 16001e04c3fSmrg ) 16101e04c3fSmrgendif 16201e04c3fSmrg 16301e04c3fSmrglibegl = shared_library( 16401e04c3fSmrg egl_lib_name, 16501e04c3fSmrg files_egl, 16601e04c3fSmrg c_args : [ 16701e04c3fSmrg c_vis_args, 16801e04c3fSmrg c_args_for_egl, 16901e04c3fSmrg '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()), 17001e04c3fSmrg ], 17101e04c3fSmrg include_directories : incs_for_egl, 17201e04c3fSmrg link_with : [link_for_egl, libloader, libxmlconfig, libglapi, libmesa_util], 17301e04c3fSmrg link_args : [ld_args_bsymbolic, ld_args_gc_sections], 17401e04c3fSmrg dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread], 17501e04c3fSmrg install : true, 17601e04c3fSmrg version : egl_lib_version, 17701e04c3fSmrg) 17801e04c3fSmrg 17901e04c3fSmrg# If using glvnd the pkg-config header should not point to EGL_mesa, it should 18001e04c3fSmrg# point to EGL. glvnd is only available on unix like platforms so adding -l 18101e04c3fSmrg# should be safe here 18201e04c3fSmrg# TODO: in the glvnd case glvnd itself should really be providing this. 18301e04c3fSmrgif with_glvnd 18401e04c3fSmrg _egl = '-L${libdir} -lEGL' 18501e04c3fSmrgelse 18601e04c3fSmrg _egl = libegl 18701e04c3fSmrgendif 18801e04c3fSmrg 18901e04c3fSmrgpkg.generate( 19001e04c3fSmrg name : 'egl', 19101e04c3fSmrg description : 'Mesa EGL Library', 19201e04c3fSmrg version : meson.project_version(), 19301e04c3fSmrg libraries : _egl, 19401e04c3fSmrg libraries_private: gl_priv_libs, 19501e04c3fSmrg requires_private : gl_priv_reqs, 19601e04c3fSmrg extra_cflags : gl_pkgconfig_c_flags, 19701e04c3fSmrg) 19801e04c3fSmrg 19901e04c3fSmrgif with_tests 20001e04c3fSmrg if with_glvnd 20101e04c3fSmrg # TODO: add glvnd symbol check 20201e04c3fSmrg else 20301e04c3fSmrg test('egl-symbols-check', 20401e04c3fSmrg find_program('egl-symbols-check'), 20501e04c3fSmrg env : env_test, 20601e04c3fSmrg args : libegl 20701e04c3fSmrg ) 20801e04c3fSmrg endif 20901e04c3fSmrg test('egl-entrypoint-check', 21001e04c3fSmrg find_program('egl-entrypoint-check'), 21101e04c3fSmrg env : [ 'srcdir=' + meson.current_source_dir() ] 21201e04c3fSmrg ) 21301e04c3fSmrgendif 214