x11: Only report supported DRI3/Present versions
[mesa.git] / src / glx / meson.build
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
21 inc_glx = include_directories('.')
22
23 subdir('apple')
24 if with_dri_platform == 'windows'
25 subdir('windows')
26 endif
27
28 files_libglx = files(
29 'clientattrib.c',
30 'clientinfo.c',
31 'compsize.c',
32 'create_context.c',
33 'eval.c',
34 'glxclient.h',
35 'glxcmds.c',
36 'glxconfig.c',
37 'glxconfig.h',
38 'glxcurrent.c',
39 'glx_error.c',
40 'glx_error.h',
41 'glxext.c',
42 'glxextensions.c',
43 'glxextensions.h',
44 'glxhash.c',
45 'glxhash.h',
46 'glx_pbuffer.c',
47 'glx_query.c',
48 'indirect_glx.c',
49 'indirect_init.h',
50 'indirect_texture_compression.c',
51 'indirect_transpose_matrix.c',
52 'indirect_vertex_array.c',
53 'indirect_vertex_array.h',
54 'indirect_vertex_array_priv.h',
55 'indirect_vertex_program.c',
56 'indirect_window_pos.c',
57 'packrender.h',
58 'packsingle.h',
59 'pixel.c',
60 'pixelstore.c',
61 'query_renderer.c',
62 'render2.c',
63 'renderpix.c',
64 'single2.c',
65 'singlepix.c',
66 'vertarr.c',
67 )
68
69 extra_libs_libglx = []
70 extra_deps_libgl = []
71 extra_ld_args_libgl = []
72
73 if with_dri
74 files_libglx += files(
75 'dri_common.c',
76 'dri_common.h',
77 'dri_common_query_renderer.c',
78 'dri_common_interop.c',
79 'xfont.c',
80 'drisw_glx.c',
81 'drisw_priv.h',
82 )
83 endif
84
85 # dri2
86 if with_dri and with_dri_platform == 'drm' and dep_libdrm.found()
87 files_libglx += files(
88 'dri2.c',
89 'dri2_glx.c',
90 'dri2.h',
91 'dri2_priv.h',
92 'dri_glx.c',
93 'dri_sarea.h',
94 'XF86dri.c',
95 'xf86dri.h',
96 'xf86dristr.h',
97 )
98 endif
99
100 if with_dri3
101 files_libglx += files('dri3_glx.c', 'dri3_priv.h')
102 endif
103
104 if with_dri_platform == 'apple'
105 files_libglx += files('applegl_glx.c')
106 extra_libs_libglx += libappleglx
107 elif with_dri_platform == 'windows'
108 files_libglx += files('driwindows_glx.c')
109 extra_libs_libglx += [
110 libwindowsdri,
111 libwindowsglx,
112 ]
113 extra_deps_libgl = [
114 meson.get_compiler('c').find_library('gdi32'),
115 meson.get_compiler('c').find_library('opengl32')
116 ]
117 extra_ld_args_libgl = '-Wl,--disable-stdcall-fixup'
118 endif
119
120 if not with_glvnd
121 gl_lib_name = 'GL'
122 gl_lib_version = '1.2.0'
123 else
124 gl_lib_name = 'GLX_mesa'
125 gl_lib_version = '0.0.0'
126 files_libglx += files(
127 'g_glxglvnddispatchfuncs.c',
128 'g_glxglvnddispatchindices.h',
129 'glxglvnd.c',
130 'glxglvnd.h',
131 'glxglvnddispatchfuncs.h',
132 )
133 endif
134
135 gl_lib_cargs = [
136 '-D_REENTRANT',
137 '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
138 ]
139
140 if dep_xxf86vm != [] and dep_xxf86vm.found()
141 gl_lib_cargs += '-DHAVE_XF86VIDMODE'
142 endif
143
144 libglx = static_library(
145 'glx',
146 [files_libglx, glx_generated],
147 include_directories : [inc_common, inc_glapi, inc_loader, inc_gl_internal],
148 c_args : [
149 c_vis_args, gl_lib_cargs,
150 '-DGL_LIB_NAME="lib@0@.so.@1@"'.format(gl_lib_name, gl_lib_version.split('.')[0]),
151 ],
152 link_with : [
153 libloader, libloader_dri3_helper, libmesa_util, libxmlconfig,
154 extra_libs_libglx,
155 ],
156 dependencies : [dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd],
157 build_by_default : false,
158 )
159
160 # workaround for bug #2180
161 dummy_c = custom_target(
162 'dummy_c',
163 output : 'dummy.c',
164 command : [prog_touch, '@OUTPUT@'],
165 )
166
167 if with_glx == 'dri'
168 libgl = shared_library(
169 gl_lib_name,
170 dummy_c, # workaround for bug #2180
171 include_directories : [inc_common, inc_glapi, inc_loader, inc_gl_internal],
172 link_with : [libglapi_static, libglapi],
173 link_whole : libglx,
174 link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
175 dependencies : [
176 dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11, dep_xcb_glx, dep_xcb,
177 dep_x11_xcb, dep_xcb_dri2, dep_xext, dep_xfixes, dep_xdamage,
178 extra_deps_libgl,
179 ],
180 version : gl_lib_version,
181 install : true,
182 )
183 endif
184
185 if with_tests
186 subdir('tests')
187 endif