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