Prefer pkg-config to sdl2-config.

pull/751/head
Jussi Pakkanen 8 years ago
parent 1ae45e3eb2
commit ba0456748e
  1. 22
      mesonbuild/dependencies.py

@ -1051,6 +1051,17 @@ class SDL2Dependency(Dependency):
self.is_found = False self.is_found = False
self.cargs = [] self.cargs = []
self.linkargs = [] self.linkargs = []
try:
pcdep = PkgConfigDependency('sdl2', environment, kwargs)
if pcdep.found():
self.is_found = True
self.cargs = pcdep.get_compile_args()
self.linkargs = pcdep.get_link_args()
self.version = pcdep.get_version()
return
except Exception as e:
mlog.debug('SDL 2 not found via pkgconfig. Trying next, error was:', str(e))
pass
sdlconf = shutil.which('sdl2-config') sdlconf = shutil.which('sdl2-config')
if sdlconf: if sdlconf:
pc = subprocess.Popen(['sdl2-config', '--cflags'], pc = subprocess.Popen(['sdl2-config', '--cflags'],
@ -1067,16 +1078,7 @@ class SDL2Dependency(Dependency):
mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.green('YES'), '(%s)' % sdlconf) mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.green('YES'), '(%s)' % sdlconf)
self.version = '2' # FIXME self.version = '2' # FIXME
return return
try: mlog.debug('Could not find sdl2-config binary, trying next.')
pcdep = PkgConfigDependency('sdl2', kwargs)
if pcdep.found():
self.is_found = True
self.cargs = pcdep.get_compile_args()
self.linkargs = pcdep.get_link_args()
self.version = pcdep.get_version()
return
except Exception:
pass
if mesonlib.is_osx(): if mesonlib.is_osx():
fwdep = ExtraFrameworkDependency('sdl2', kwargs.get('required', True)) fwdep = ExtraFrameworkDependency('sdl2', kwargs.get('required', True))
if fwdep.found(): if fwdep.found():

Loading…
Cancel
Save