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