diff options
Diffstat (limited to 'mesonbuild/dependencies/ui.py')
-rw-r--r-- | mesonbuild/dependencies/ui.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index 5d7a6f6..1b8145e 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -373,9 +373,9 @@ class Qt5Dependency(QtBaseDependency): class SDL2Dependency(ExternalDependency): def __init__(self, environment, kwargs): super().__init__('sdl2', environment, None, kwargs) + kwargs['required'] = False if DependencyMethods.PKGCONFIG in self.methods: try: - kwargs['required'] = False pcdep = PkgConfigDependency('sdl2', environment, kwargs) if pcdep.found(): self.type_name = 'pkgconfig' @@ -386,20 +386,20 @@ class SDL2Dependency(ExternalDependency): return except Exception as e: mlog.debug('SDL 2 not found via pkgconfig. Trying next, error was:', str(e)) - if DependencyMethods.SDLCONFIG in self.methods: - sdlconf = shutil.which('sdl2-config') - if sdlconf: - stdo = Popen_safe(['sdl2-config', '--cflags'])[1] - self.compile_args = stdo.strip().split() - stdo = Popen_safe(['sdl2-config', '--libs'])[1] - self.link_args = stdo.strip().split() - stdo = Popen_safe(['sdl2-config', '--version'])[1] - self.version = stdo.strip() - self.is_found = True - mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.green('YES'), - self.version, '(%s)' % sdlconf) - return - mlog.debug('Could not find sdl2-config binary, trying next.') + if DependencyMethods.CONFIG_TOOL in self.methods: + try: + ctdep = ConfigToolDependency.factory( + 'sdl2', environment, None, kwargs, ['sdl2-config'], 'sdl2-config') + if ctdep.found(): + self.type_name = 'config-tool' + self.config = ctdep.config + self.version = ctdep.version + self.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args') + self.links_args = ctdep.get_config_value(['--libs'], 'link_args') + self.is_found = True + return + except Exception as e: + mlog.debug('SDL 2 not found via sdl2-config. Trying next, error was:', str(e)) if DependencyMethods.EXTRAFRAMEWORK in self.methods: if mesonlib.is_osx(): fwdep = ExtraFrameworkDependency('sdl2', False, None, self.env, @@ -414,9 +414,9 @@ class SDL2Dependency(ExternalDependency): def get_methods(self): if mesonlib.is_osx(): - return [DependencyMethods.PKGCONFIG, DependencyMethods.SDLCONFIG, DependencyMethods.EXTRAFRAMEWORK] + return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK] else: - return [DependencyMethods.PKGCONFIG, DependencyMethods.SDLCONFIG] + return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL] class WxDependency(ConfigToolDependency): |