WEBP - add fallback pkg-config check if WEBP_INCLUDES and/or WEBP_LIBS aren't set.

This commit is contained in:
Artem Pavlenko 2024-03-28 15:55:30 +00:00
parent 6479059c7e
commit 1e4c17256a

View file

@ -1582,11 +1582,25 @@ if not preconfigured:
env['SKIPPED_DEPS'].append('png') env['SKIPPED_DEPS'].append('png')
if env['WEBP']: if env['WEBP']:
OPTIONAL_LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C','-DHAVE_WEBP']) if env.get('WEBP_LIBS') or env.get('WEBP_INCLUDES'):
inc_path = env['%s_INCLUDES' % 'WEBP'] OPTIONAL_LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C','-DHAVE_WEBP'])
lib_path = env['%s_LIBS' % 'WEBP'] inc_path = env['WEBP_INCLUDES']
env.AppendUnique(CPPPATH = fix_path(inc_path)) lib_path = env['WEBP_LIBS']
env.AppendUnique(LIBPATH = fix_path(lib_path)) env.AppendUnique(CPPPATH = fix_path(inc_path))
env.AppendUnique(LIBPATH = fix_path(lib_path))
else:
cmd = 'pkg-config libwebp --libs --cflags'
if env['RUNTIME_LINK'] == 'static':
cmd += ' --static'
temp_env = Environment(ENV=os.environ)
try:
temp_env.ParseConfig(cmd)
for lib in temp_env['LIBS']:
env.AppendUnique(LIBPATH = fix_path(lib))
for inc in temp_env['CPPPATH']:
env.AppendUnique(CPPPATH = fix_path(inc))
except OSError as e:
pass
else: else:
env['SKIPPED_DEPS'].append('webp') env['SKIPPED_DEPS'].append('webp')