19f464c52Smaya# Copyright © 2017-2019 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_glx = include_directories('.')
2201e04c3fSmrg
2301e04c3fSmrgsubdir('apple')
2401e04c3fSmrgif with_dri_platform == 'windows'
2501e04c3fSmrg  subdir('windows')
2601e04c3fSmrgendif
2701e04c3fSmrg
2801e04c3fSmrgfiles_libglx = files(
2901e04c3fSmrg  'clientattrib.c',
3001e04c3fSmrg  'clientinfo.c',
3101e04c3fSmrg  'compsize.c',
3201e04c3fSmrg  'create_context.c',
337ec681f3Smrg  'dri_common.c',
347ec681f3Smrg  'dri_common.h',
357ec681f3Smrg  'dri_common_query_renderer.c',
367ec681f3Smrg  'dri_common_interop.c',
377ec681f3Smrg  'drisw_glx.c',
387ec681f3Smrg  'drisw_priv.h',
3901e04c3fSmrg  'eval.c',
4001e04c3fSmrg  'glxclient.h',
4101e04c3fSmrg  'glxcmds.c',
4201e04c3fSmrg  'glxconfig.c',
4301e04c3fSmrg  'glxconfig.h',
4401e04c3fSmrg  'glxcurrent.c',
4501e04c3fSmrg  'glx_error.c',
4601e04c3fSmrg  'glx_error.h',
4701e04c3fSmrg  'glxext.c',
4801e04c3fSmrg  'glxextensions.c',
4901e04c3fSmrg  'glxextensions.h',
5001e04c3fSmrg  'glxhash.c',
5101e04c3fSmrg  'glxhash.h',
5201e04c3fSmrg  'glx_pbuffer.c',
5301e04c3fSmrg  'glx_query.c',
5401e04c3fSmrg  'indirect_glx.c',
5501e04c3fSmrg  'indirect_init.h',
5601e04c3fSmrg  'indirect_texture_compression.c',
5701e04c3fSmrg  'indirect_transpose_matrix.c',
5801e04c3fSmrg  'indirect_vertex_array.c',
5901e04c3fSmrg  'indirect_vertex_array.h',
6001e04c3fSmrg  'indirect_vertex_array_priv.h',
6101e04c3fSmrg  'indirect_vertex_program.c',
6201e04c3fSmrg  'indirect_window_pos.c',
6301e04c3fSmrg  'packrender.h',
6401e04c3fSmrg  'packsingle.h',
6501e04c3fSmrg  'pixel.c',
6601e04c3fSmrg  'pixelstore.c',
6701e04c3fSmrg  'query_renderer.c',
6801e04c3fSmrg  'render2.c',
6901e04c3fSmrg  'renderpix.c',
7001e04c3fSmrg  'single2.c',
7101e04c3fSmrg  'singlepix.c',
7201e04c3fSmrg  'vertarr.c',
737ec681f3Smrg  'xfont.c',
7401e04c3fSmrg)
7501e04c3fSmrg
7601e04c3fSmrgextra_libs_libglx = []
7701e04c3fSmrgextra_deps_libgl = []
7801e04c3fSmrgextra_ld_args_libgl = []
7901e04c3fSmrg
8001e04c3fSmrg# dri2
817ec681f3Smrgif with_dri_platform == 'drm' and dep_libdrm.found()
8201e04c3fSmrg  files_libglx += files(
8301e04c3fSmrg    'dri2.c',
8401e04c3fSmrg    'dri2_glx.c',
8501e04c3fSmrg    'dri2.h',
8601e04c3fSmrg    'dri2_priv.h',
8701e04c3fSmrg  )
8801e04c3fSmrgendif
8901e04c3fSmrg
9001e04c3fSmrgif with_dri3
9101e04c3fSmrg  files_libglx += files('dri3_glx.c', 'dri3_priv.h')
9201e04c3fSmrgendif
9301e04c3fSmrg
9401e04c3fSmrgif with_dri_platform == 'apple'
9501e04c3fSmrg  files_libglx += files('applegl_glx.c')
9601e04c3fSmrg  extra_libs_libglx += libappleglx
9701e04c3fSmrgelif with_dri_platform == 'windows'
9801e04c3fSmrg  files_libglx += files('driwindows_glx.c')
9901e04c3fSmrg  extra_libs_libglx += [
10001e04c3fSmrg    libwindowsdri,
10101e04c3fSmrg    libwindowsglx,
10201e04c3fSmrg  ]
10301e04c3fSmrg  extra_deps_libgl = [
10401e04c3fSmrg    meson.get_compiler('c').find_library('gdi32'),
10501e04c3fSmrg    meson.get_compiler('c').find_library('opengl32')
10601e04c3fSmrg  ]
10701e04c3fSmrg  extra_ld_args_libgl = '-Wl,--disable-stdcall-fixup'
10801e04c3fSmrgendif
10901e04c3fSmrg
11001e04c3fSmrgif not with_glvnd
11101e04c3fSmrg  gl_lib_name = 'GL'
11201e04c3fSmrg  gl_lib_version = '1.2.0'
11301e04c3fSmrgelse
1147ec681f3Smrg  gl_lib_name = 'GLX_@0@'.format(glvnd_vendor_name)
11501e04c3fSmrg  gl_lib_version = '0.0.0'
11601e04c3fSmrg  files_libglx += files(
11701e04c3fSmrg    'g_glxglvnddispatchfuncs.c',
11801e04c3fSmrg    'g_glxglvnddispatchindices.h',
11901e04c3fSmrg    'glxglvnd.c',
12001e04c3fSmrg    'glxglvnd.h',
12101e04c3fSmrg    'glxglvnddispatchfuncs.h',
12201e04c3fSmrg  )
12301e04c3fSmrgendif
12401e04c3fSmrg
12501e04c3fSmrglibglx = static_library(
12601e04c3fSmrg  'glx',
12701e04c3fSmrg  [files_libglx, glx_generated],
1287ec681f3Smrg  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_glapi, inc_loader],
12901e04c3fSmrg  c_args : [
13001e04c3fSmrg    '-DGL_LIB_NAME="lib@0@.so.@1@"'.format(gl_lib_name, gl_lib_version.split('.')[0]),
13101e04c3fSmrg  ],
1327ec681f3Smrg  gnu_symbol_visibility : 'hidden',
13301e04c3fSmrg  link_with : [
1347ec681f3Smrg    libloader, libloader_dri3_helper,
13501e04c3fSmrg    extra_libs_libglx,
13601e04c3fSmrg  ],
1377ec681f3Smrg  dependencies : [
1387ec681f3Smrg    idep_mesautil, idep_xmlconfig,
1397ec681f3Smrg    dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd,
1407ec681f3Smrg  ],
14101e04c3fSmrg)
14201e04c3fSmrg
14301e04c3fSmrglibgl = shared_library(
14401e04c3fSmrg  gl_lib_name,
14501e04c3fSmrg  [],
14601e04c3fSmrg  link_with : [libglapi_static, libglapi],
14701e04c3fSmrg  link_whole : libglx,
14801e04c3fSmrg  link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
14901e04c3fSmrg  dependencies : [
15001e04c3fSmrg    dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11, dep_xcb_glx, dep_xcb,
1517ec681f3Smrg    dep_x11_xcb, dep_xcb_dri2, dep_xext, dep_xfixes, dep_xxf86vm,
1527ec681f3Smrg    dep_xcb_shm, extra_deps_libgl,
15301e04c3fSmrg  ],
15401e04c3fSmrg  version : gl_lib_version,
1557ec681f3Smrg  darwin_versions : '4.0.0',
15601e04c3fSmrg  install : true,
15701e04c3fSmrg)
15801e04c3fSmrg
15901e04c3fSmrgif with_tests
16001e04c3fSmrg  subdir('tests')
16101e04c3fSmrgendif
162