build: link against single EGL provider

when building with rpi EGL is provided by librcmegl library and libEGL
should not be linked then
This commit is contained in:
Jan Palus 2020-04-18 20:38:52 +02:00 committed by wm4
parent 65fd6c8ae9
commit 727b1bff57
2 changed files with 37 additions and 11 deletions

View File

@ -5,7 +5,8 @@ from distutils.version import StrictVersion
import os
__all__ = ["check_pthreads", "check_iconv", "check_lua",
"check_cocoa", "check_wl_protocols", "check_swift"]
"check_cocoa", "check_wl_protocols", "check_swift",
"check_egl_provider"]
pthreads_program = load_fragment('pthreads.c')
@ -124,3 +125,29 @@ def check_swift(ctx, dependency_identifier):
"'swift >= " + str(minVer) + "' not found, found " +
str(ctx.env.SWIFT_VERSION or None))
return False
def check_egl_provider(minVersion=None, name='egl', check=None):
def fn(ctx, dependency_identifier, **kw):
if not hasattr(ctx, 'egl_provider'):
egl_provider_check = check or check_pkg_config(name)
if egl_provider_check(ctx, dependency_identifier):
ctx.egl_provider = name
for ver in ['1.5', '1.4', '1.3', '1.2', '1.1', '1.0']:
stmt = 'int x[EGL_VERSION_{0}]'.format(ver.replace('.','_'))
check_stmt = check_statement(['EGL/egl.h'], stmt)
if check_stmt(ctx, dependency_identifier):
ctx.egl_provider_version = StrictVersion(ver)
break
return True
else:
return False
else:
minVersionSV = minVersion and StrictVersion(minVersion)
if not minVersionSV or ctx.egl_provider_version and \
ctx.egl_provider_version >= minVersionSV:
defkey = inflector.define_key(dependency_identifier)
ctx.define(defkey, 1)
return True
else:
return False
return fn

19
wscript
View File

@ -548,14 +548,19 @@ video_output_features = [
'func': check_libs(['GL', 'GL Xdamage'],
check_cc(fragment=load_fragment('gl_x11.c'),
use=['x11', 'libdl', 'pthreads']))
}, {
'name': '--rpi',
'desc': 'Raspberry Pi support',
'func': check_egl_provider(name='brcmegl', check=any_check(
check_pkg_config('brcmegl'),
check_pkg_config('/opt/vc/lib/pkgconfig/brcmegl.pc')
)),
'default': 'disable',
} , {
'name': '--egl',
'desc': 'EGL 1.4',
'groups': [ 'gl' ],
'func': compose_checks(
check_pkg_config('egl'),
check_statement(['EGL/egl.h'], 'int x[EGL_VERSION_1_4]')
),
'func': check_egl_provider('1.4')
} , {
'name': '--egl-x11',
'desc': 'OpenGL X11 EGL Backend',
@ -708,12 +713,6 @@ video_output_features = [
'desc': 'Direct3D 11 video output',
'deps': 'win32-desktop && shaderc && spirv-cross',
'func': check_cc(header_name=['d3d11_1.h', 'dxgi1_6.h']),
}, {
'name': '--rpi',
'desc': 'Raspberry Pi support',
'func': any_check(check_pkg_config('brcmegl'),
check_pkg_config('/opt/vc/lib/pkgconfig/brcmegl.pc')),
'default': 'disable',
} , {
'name': '--ios-gl',
'desc': 'iOS OpenGL ES hardware decoding interop support',