meson: Fix freetype and icu dependency lookup

It is wrong to search for a different name depending on the compiler. If
anything, cmake name could be available on systems that uses GCC too.

This also fix regression in the usage of freetype subproject fallback as
its name is "freetype2" and was previously used even when the
"freetype" option was set to "auto".
This commit is contained in:
Xavier Claessens 2022-09-07 17:35:03 -04:00 committed by Behdad Esfahbod
parent 7c0791d61a
commit 53a194aa3f
1 changed files with 24 additions and 10 deletions

View File

@ -83,25 +83,39 @@ check_funcs = [
m_dep = cpp.find_library('m', required: false)
# https://github.com/harfbuzz/harfbuzz/pull/2498
freetype_dep = dependency(cpp.get_argument_syntax() == 'msvc' ? 'freetype' : 'freetype2',
# Try pkgconfig name
freetype_dep = dependency('freetype2', required: false)
if not freetype_dep.found()
# Try cmake name
freetype_dep = dependency('freetype', required: false)
endif
if not freetype_dep.found()
# Subproject fallback, `allow_fallback: true` means the fallback will be
# tried even if the freetype option is set to `auto`.
freetype_dep = dependency('freetype2',
required: get_option('freetype'),
default_options: ['harfbuzz=disabled'])
default_options: ['harfbuzz=disabled'],
allow_fallback: true)
endif
glib_dep = dependency('glib-2.0', required: get_option('glib'))
gobject_dep = dependency('gobject-2.0', required: get_option('gobject'))
graphite2_dep = dependency('graphite2', required: get_option('graphite2'))
graphite_dep = dependency('graphite2', required: get_option('graphite'))
if cpp.get_argument_syntax() == 'msvc'
# Try pkgconfig name
icu_dep = dependency('icu-uc', required: false)
if not icu_dep.found()
# Try cmake name
icu_dep = dependency('ICU',
required: get_option('icu'),
required: false,
components: 'uc',
method: 'cmake')
else
icu_dep = dependency('icu-uc',
required: get_option('icu'),
method: 'pkg-config')
endif
if not icu_dep.found()
# Subproject fallback if icu option is enabled
icu_dep = dependency('icu-uc', required: get_option('icu'))
endif
if icu_dep.found() and icu_dep.type_name() == 'pkgconfig'