• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_egl = include_directories('.', 'main')
22inc_egl_dri2 = include_directories('drivers/dri2')
23
24c_args_for_egl = [asan_c_args]
25cpp_args_for_egl = []
26link_for_egl = []
27deps_for_egl = []
28incs_for_egl = [inc_include, inc_src, inc_egl]
29
30if with_gallium_softpipe
31  c_args_for_egl += '-DGALLIUM_SOFTPIPE'
32endif
33
34files_egl = files(
35  'main/eglapi.c',
36  'main/eglarray.c',
37  'main/eglarray.h',
38  'main/eglconfigdebug.c',
39  'main/eglconfigdebug.h',
40  'main/eglconfig.c',
41  'main/eglconfig.h',
42  'main/eglcontext.c',
43  'main/eglcontext.h',
44  'main/eglcurrent.c',
45  'main/eglcurrent.h',
46  'main/egldefines.h',
47  'main/egldevice.c',
48  'main/egldevice.h',
49  'main/egldisplay.c',
50  'main/egldisplay.h',
51  'main/egldriver.h',
52  'main/eglglobals.c',
53  'main/eglglobals.h',
54  'main/eglimage.c',
55  'main/eglimage.h',
56  'main/egllog.c',
57  'main/egllog.h',
58  'main/eglsurface.c',
59  'main/eglsurface.h',
60  'main/eglsync.c',
61  'main/eglsync.h',
62  'main/eglentrypoint.h',
63  'main/egltypedefs.h',
64)
65
66g_egldispatchstubs_c = custom_target(
67  'g_egldispatchstubs.c',
68  input : [
69    'generate/gen_egl_dispatch.py',
70    'generate/egl.xml', 'generate/egl_other.xml'
71  ],
72  output : 'g_egldispatchstubs.c',
73  command : [
74    prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@',
75  ],
76  depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ],
77  capture : true,
78)
79
80g_egldispatchstubs_h = custom_target(
81  'g_egldispatchstubs.h',
82  input : [
83    'generate/gen_egl_dispatch.py',
84    'generate/egl.xml', 'generate/egl_other.xml'
85  ],
86  output : 'g_egldispatchstubs.h',
87  command : [
88    prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@',
89  ],
90  depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ],
91  capture : true,
92)
93
94if with_dri2
95  files_egl += files(
96    'drivers/dri2/egl_dri2.c',
97    'drivers/dri2/egl_dri2.h',
98  )
99  files_egl += sha1_h
100  deps_for_egl += idep_xmlconfig
101  link_for_egl += libloader
102  incs_for_egl += inc_loader
103  incs_for_egl += inc_gallium
104  incs_for_egl += inc_gallium_aux
105  incs_for_egl += inc_mesa
106  incs_for_egl += inc_st_dri
107
108  files_egl += files(
109    'drivers/dri2/platform_device.c',
110    'drivers/dri2/platform_surfaceless.c',
111  )
112
113  if with_platform_x11
114    files_egl += files('drivers/dri2/platform_x11.c')
115    if with_dri3
116      files_egl += files('drivers/dri2/platform_x11_dri3.c')
117      link_for_egl += libloader_dri3_helper
118    endif
119    deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xrandr, dep_xcb_xfixes]
120  endif
121  if with_gbm and not with_platform_android
122    files_egl += files('drivers/dri2/platform_drm.c')
123    link_for_egl += libgbm
124    incs_for_egl += [inc_gbm, include_directories('../gbm/main')]
125    deps_for_egl += dep_libdrm
126  endif
127  if with_platform_wayland
128    deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
129    link_for_egl += [libwayland_drm, libloader_wayland_helper]
130    files_egl += files('drivers/dri2/platform_wayland.c')
131    files_egl += wp_files['linux-dmabuf-unstable-v1']
132    files_egl += [wayland_drm_client_protocol_h]
133    incs_for_egl += include_directories('wayland/wayland-drm')
134  endif
135  if with_platform_android
136    deps_for_egl += [dep_android, idep_u_gralloc]
137    files_egl += files('drivers/dri2/platform_android.c')
138  endif
139elif with_platform_haiku
140  c_args_for_egl += [
141    '-D_EGL_BUILT_IN_DRIVER_HAIKU',
142  ]
143  files_egl += files('drivers/haiku/egl_haiku.cpp')
144
145  incs_for_egl += [inc_gallium, inc_gallium_aux, inc_gallium_drivers, inc_gallium_winsys, inc_gallium_winsys_sw]
146  incs_for_egl += [inc_mesa, inc_mapi]
147  incs_for_egl += [include_directories('../gallium/frontends/hgl')]
148
149  link_for_egl += [libmesa, libgallium, libswhgl, libsthgl]
150  deps_for_egl += [cpp.find_library('be'), driver_swrast]
151elif with_platform_windows
152  c_args_for_egl += [
153    '-DEGLAPI=', '-DPUBLIC='
154  ]
155  files_egl += files('drivers/wgl/egl_wgl.c')
156  incs_for_egl += [inc_wgl, inc_gallium, inc_gallium_aux, inc_mesa, inc_mapi]
157  link_for_egl += libgallium_wgl
158endif
159
160if cc.has_function('mincore')
161  c_args_for_egl += '-DHAVE_MINCORE'
162endif
163
164if not with_glvnd
165  egl_lib_name = 'EGL' + get_option('egl-lib-suffix')
166  egl_lib_version = '1.0.0'
167  egl_lib_soversion = host_machine.system() == 'windows' ? '' : '1'
168else
169  egl_lib_name = 'EGL_@0@'.format(glvnd_vendor_name)
170  egl_lib_version = '0.0.0'
171  egl_lib_soversion = '0'
172  deps_for_egl += dep_glvnd
173  files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
174  files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
175  glvnd_config = configuration_data()
176  glvnd_config.set('glvnd_vendor_name', get_option('glvnd-vendor-name'))
177  configure_file(
178    configuration: glvnd_config,
179    input : 'main/50_mesa.json',
180    output: '50_@0@.json'.format(glvnd_vendor_name),
181    install : true,
182    install_tag : 'runtime',
183    install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d')
184  )
185endif
186
187egl_def = custom_target(
188  'egl.def',
189  input: 'main/egl.def.in',
190  output : 'egl.def',
191  command : gen_vs_module_defs_normal_command,
192)
193
194libegl = shared_library(
195  egl_lib_name,
196  files_egl,
197  c_args : [
198    c_args_for_egl,
199    '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()),
200  ],
201  cpp_args : [cpp_args_for_egl],
202  gnu_symbol_visibility : 'hidden',
203  include_directories : incs_for_egl,
204  link_with : [link_for_egl, libglapi],
205  link_args : [ld_args_bsymbolic, ld_args_gc_sections],
206  dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread, idep_mesautil],
207  install : true,
208  version : egl_lib_version,
209  soversion : egl_lib_soversion,
210  name_prefix : host_machine.system() == 'windows' ? 'lib' : [],  # always use lib, but avoid warnings on !windows
211  vs_module_defs : egl_def
212)
213
214if not with_glvnd
215  pkg.generate(
216    name : 'egl',
217    description : 'Mesa EGL Library',
218    version : meson.project_version(),
219    libraries : libegl,
220    libraries_private: gl_priv_libs,
221    requires_private : gl_priv_reqs,
222    extra_cflags : gl_pkgconfig_c_flags,
223  )
224endif
225
226if with_symbols_check
227  if with_glvnd
228    egl_symbols = files('egl-glvnd-symbols.txt')
229  else
230    egl_symbols = files('egl-symbols.txt')
231  endif
232  test('egl-symbols-check',
233    symbols_check,
234    args : [
235      '--lib', libegl,
236      '--symbols-file', egl_symbols,
237      symbols_check_args,
238    ],
239    suite : ['egl'],
240  )
241  test('egl-entrypoint-check',
242    prog_python,
243    args : files('egl-entrypoint-check.py', 'main/eglentrypoint.h'),
244    suite : ['egl'],
245  )
246endif
247