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