meson.build 5.95 KB
Newer Older
1
# Copyright © 2017-2019 Intel Corporation
Dylan Baker's avatar
Dylan Baker committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

21
22
23
inc_egl = include_directories('.', 'main')
inc_egl_dri2 = include_directories('drivers/dri2')

Dylan Baker's avatar
Dylan Baker committed
24
25
26
c_args_for_egl = []
link_for_egl = []
deps_for_egl = []
27
incs_for_egl = [inc_include, inc_src, inc_egl]
28

Dylan Baker's avatar
Dylan Baker committed
29
30
31
32
33
34
35
36
37
38
39
40
files_egl = files(
  'main/eglapi.c',
  'main/eglapi.h',
  'main/eglarray.c',
  'main/eglarray.h',
  'main/eglconfig.c',
  'main/eglconfig.h',
  'main/eglcontext.c',
  'main/eglcontext.h',
  'main/eglcurrent.c',
  'main/eglcurrent.h',
  'main/egldefines.h',
41
42
  'main/egldevice.c',
  'main/egldevice.h',
Dylan Baker's avatar
Dylan Baker committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  'main/egldisplay.c',
  'main/egldisplay.h',
  'main/egldriver.c',
  'main/egldriver.h',
  'main/eglglobals.c',
  'main/eglglobals.h',
  'main/eglimage.c',
  'main/eglimage.h',
  'main/egllog.c',
  'main/egllog.h',
  'main/eglsurface.c',
  'main/eglsurface.h',
  'main/eglsync.c',
  'main/eglsync.h',
  'main/eglentrypoint.h',
  'main/egltypedefs.h',
)

Dylan Baker's avatar
Dylan Baker committed
61
62
63
g_egldispatchstubs_c = custom_target(
  'g_egldispatchstubs.c',
  input : [
64
    'generate/gen_egl_dispatch.py',
Dylan Baker's avatar
Dylan Baker committed
65
66
67
68
    'generate/egl.xml', 'generate/egl_other.xml'
  ],
  output : 'g_egldispatchstubs.c',
  command : [
69
    prog_python, '@INPUT0@', 'source', '@INPUT1@', '@INPUT2@',
Dylan Baker's avatar
Dylan Baker committed
70
  ],
71
  depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ],
Dylan Baker's avatar
Dylan Baker committed
72
73
74
75
76
77
  capture : true,
)

g_egldispatchstubs_h = custom_target(
  'g_egldispatchstubs.h',
  input : [
78
    'generate/gen_egl_dispatch.py',
Dylan Baker's avatar
Dylan Baker committed
79
80
81
82
    'generate/egl.xml', 'generate/egl_other.xml'
  ],
  output : 'g_egldispatchstubs.h',
  command : [
83
    prog_python, '@INPUT0@', 'header', '@INPUT1@', '@INPUT2@',
Dylan Baker's avatar
Dylan Baker committed
84
  ],
85
  depend_files : [ files('generate/eglFunctionList.py'), genCommon_py, ],
Dylan Baker's avatar
Dylan Baker committed
86
87
88
  capture : true,
)

89
90
91
92
93
94
if with_dri2
  files_egl += files(
    'drivers/dri2/egl_dri2.c',
    'drivers/dri2/egl_dri2.h',
    'drivers/dri2/egl_dri2_fallbacks.h',
  )
95
96
  deps_for_egl += idep_xmlconfig
  link_for_egl += libloader
97
  incs_for_egl += inc_loader
98

99
100
101
102
  files_egl += files(
    'drivers/dri2/platform_device.c',
    'drivers/dri2/platform_surfaceless.c',
  )
103
104
105
106
107
108
109
  if with_platform_x11
    files_egl += files('drivers/dri2/platform_x11.c')
    if with_dri3
      files_egl += files('drivers/dri2/platform_x11_dri3.c')
      link_for_egl += libloader_dri3_helper
    endif
    deps_for_egl += [dep_x11_xcb, dep_xcb_dri2, dep_xcb_xfixes]
Dylan Baker's avatar
Dylan Baker committed
110
  endif
111
  if with_gbm
112
    files_egl += files('drivers/dri2/platform_drm.c')
113
114
    link_for_egl += libgbm
    incs_for_egl += [inc_gbm, include_directories('../gbm/main')]
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
    deps_for_egl += dep_libdrm
  endif
  if with_platform_wayland
    deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
    link_for_egl += libwayland_drm
    files_egl += files('drivers/dri2/platform_wayland.c')
    files_egl += [
      linux_dmabuf_unstable_v1_protocol_c,
      linux_dmabuf_unstable_v1_client_protocol_h,
      wayland_drm_client_protocol_h,
    ]
    incs_for_egl += include_directories('wayland/wayland-drm')
  endif
  if with_platform_android
    deps_for_egl += dep_android
    files_egl += files('drivers/dri2/platform_android.c')
  endif
elif with_platform_haiku
133
134
135
136
137
138
139
140
  incs_for_egl += inc_haikugl
  c_args_for_egl += [
    '-D_EGL_BUILT_IN_DRIVER_HAIKU',
  ]
  files_egl += files('drivers/haiku/egl_haiku.cpp')
  link_for_egl += libgl
  deps_for_egl += cpp.find_library('be')
endif
Dylan Baker's avatar
Dylan Baker committed
141
142
143
144
145

if cc.has_function('mincore')
  c_args_for_egl += '-DHAVE_MINCORE'
endif

Dylan Baker's avatar
Dylan Baker committed
146
if not with_glvnd
147
  egl_lib_name = 'EGL' + get_option('egl-lib-suffix')
Dylan Baker's avatar
Dylan Baker committed
148
149
150
  egl_lib_version = '1.0.0'
else
  egl_lib_name = 'EGL_mesa'
151
  egl_lib_version = '0.0.0'
152
  deps_for_egl += dep_glvnd
Dylan Baker's avatar
Dylan Baker committed
153
154
  files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
  files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
155
156
  install_data(
    'main/50_mesa.json',
Dylan Baker's avatar
Dylan Baker committed
157
158
159
160
    install_dir : join_paths(get_option('datadir'), 'glvnd', 'egl_vendor.d')
  )
endif

Dylan Baker's avatar
Dylan Baker committed
161
libegl = shared_library(
Dylan Baker's avatar
Dylan Baker committed
162
  egl_lib_name,
Dylan Baker's avatar
Dylan Baker committed
163
164
165
166
167
  files_egl,
  c_args : [
    c_args_for_egl,
    '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()),
  ],
168
  gnu_symbol_visibility : 'hidden',
169
  include_directories : incs_for_egl,
170
  link_with : [link_for_egl, libglapi],
Dylan Baker's avatar
Dylan Baker committed
171
  link_args : [ld_args_bsymbolic, ld_args_gc_sections],
172
  dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread, idep_mesautil],
Dylan Baker's avatar
Dylan Baker committed
173
  install : true,
Dylan Baker's avatar
Dylan Baker committed
174
  version : egl_lib_version,
Dylan Baker's avatar
Dylan Baker committed
175
176
)

177
if not with_glvnd
178
179
180
181
  pkg.generate(
    name : 'egl',
    description : 'Mesa EGL Library',
    version : meson.project_version(),
182
    libraries : libegl,
183
184
185
186
187
    libraries_private: gl_priv_libs,
    requires_private : gl_priv_reqs,
    extra_cflags : gl_pkgconfig_c_flags,
  )
endif
188

189
if with_symbols_check
190
  if with_glvnd
Eric Engestrom's avatar
Eric Engestrom committed
191
    egl_symbols = files('egl-glvnd-symbols.txt')
192
  else
193
    egl_symbols = files('egl-symbols.txt')
194
  endif
195
196
197
198
199
  test('egl-symbols-check',
    symbols_check,
    args : [
      '--lib', libegl,
      '--symbols-file', egl_symbols,
200
      symbols_check_args,
201
202
203
    ],
    suite : ['egl'],
  )
204
  test('egl-entrypoint-check',
205
206
    prog_python,
    args : files('egl-entrypoint-check.py', 'main/eglentrypoint.h'),
Dylan Baker's avatar
Dylan Baker committed
207
    suite : ['egl'],
208
  )
Dylan Baker's avatar
Dylan Baker committed
209
endif