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_glx = include_directories('.')
22
23subdir('apple')
24if with_dri_platform == 'windows'
25  subdir('windows')
26endif
27
28files_libglx = files(
29  'clientattrib.c',
30  'clientinfo.c',
31  'compsize.c',
32  'create_context.c',
33  'dri_common.c',
34  'dri_common.h',
35  'dri_common_query_renderer.c',
36  'dri_common_interop.c',
37  'drisw_glx.c',
38  'drisw_priv.h',
39  'eval.c',
40  'glxclient.h',
41  'glxcmds.c',
42  'glxconfig.c',
43  'glxconfig.h',
44  'glxcurrent.c',
45  'glx_error.c',
46  'glx_error.h',
47  'glxext.c',
48  'glxextensions.c',
49  'glxextensions.h',
50  'glxhash.c',
51  'glxhash.h',
52  'glx_pbuffer.c',
53  'glx_query.c',
54  'indirect_glx.c',
55  'indirect_init.h',
56  'indirect_texture_compression.c',
57  'indirect_transpose_matrix.c',
58  'indirect_vertex_array.c',
59  'indirect_vertex_array.h',
60  'indirect_vertex_array_priv.h',
61  'indirect_vertex_program.c',
62  'indirect_window_pos.c',
63  'packrender.h',
64  'packsingle.h',
65  'pixel.c',
66  'pixelstore.c',
67  'query_renderer.c',
68  'render2.c',
69  'renderpix.c',
70  'single2.c',
71  'singlepix.c',
72  'vertarr.c',
73  'xfont.c',
74)
75
76extra_libs_libglx = []
77extra_deps_libgl = []
78extra_ld_args_libgl = []
79
80# dri2
81if with_dri_platform == 'drm' and dep_libdrm.found()
82  files_libglx += files(
83    'dri2.c',
84    'dri2_glx.c',
85    'dri2.h',
86    'dri2_priv.h',
87  )
88endif
89
90if with_dri3
91  files_libglx += files('dri3_glx.c', 'dri3_priv.h')
92endif
93
94if with_dri_platform == 'apple'
95  files_libglx += files('applegl_glx.c')
96  extra_libs_libglx += libappleglx
97elif with_dri_platform == 'windows'
98  files_libglx += files('driwindows_glx.c')
99  extra_libs_libglx += [
100    libwindowsdri,
101    libwindowsglx,
102  ]
103  extra_deps_libgl = [
104    meson.get_compiler('c').find_library('gdi32'),
105    meson.get_compiler('c').find_library('opengl32')
106  ]
107  extra_ld_args_libgl = '-Wl,--disable-stdcall-fixup'
108endif
109
110if not with_glvnd
111  gl_lib_name = 'GL'
112  gl_lib_version = '1.2.0'
113else
114  gl_lib_name = 'GLX_@0@'.format(glvnd_vendor_name)
115  gl_lib_version = '0.0.0'
116  files_libglx += files(
117    'g_glxglvnddispatchfuncs.c',
118    'g_glxglvnddispatchindices.h',
119    'glxglvnd.c',
120    'glxglvnd.h',
121    'glxglvnddispatchfuncs.h',
122  )
123endif
124
125libglx = static_library(
126  'glx',
127  [files_libglx, glx_generated],
128  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_glapi, inc_loader],
129  c_args : [
130    '-DGL_LIB_NAME="lib@0@.so.@1@"'.format(gl_lib_name, gl_lib_version.split('.')[0]),
131  ],
132  gnu_symbol_visibility : 'hidden',
133  link_with : [
134    libloader, libloader_dri3_helper,
135    extra_libs_libglx,
136  ],
137  dependencies : [
138    idep_mesautil, idep_xmlconfig,
139    dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd,
140  ],
141)
142
143libgl = shared_library(
144  gl_lib_name,
145  [],
146  link_with : [libglapi_static, libglapi],
147  link_whole : libglx,
148  link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
149  dependencies : [
150    dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11, dep_xcb_glx, dep_xcb,
151    dep_x11_xcb, dep_xcb_dri2, dep_xext, dep_xfixes, dep_xxf86vm,
152    dep_xcb_shm, extra_deps_libgl,
153  ],
154  version : gl_lib_version,
155  darwin_versions : '4.0.0',
156  install : true,
157)
158
159if with_tests
160  subdir('tests')
161endif
162