meson: Only use HarfBuzz fallback when needed

The current Meson releases have broken CMake support, meaning that it is
likely that HarfBuzz could not be located for Visual Studio builds
unless one handcrafts pkg-config files for it, which is both tedious and
error-prone.

Instead, use the existing mechanism for looking for the HarfBuzz headers
and libraries on Visual Studio first when it could not be found via
dependency(), and then use the fallback if it still could not be found.
This commit is contained in:
Chun-wei Fan 2019-04-12 18:08:36 +08:00
parent 0842d084dd
commit 88086ea91a

View File

@ -376,8 +376,7 @@ pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
epoxy_dep = dependency('epoxy', version: epoxy_req, epoxy_dep = dependency('epoxy', version: epoxy_req,
fallback: ['libepoxy', 'libepoxy_dep']) fallback: ['libepoxy', 'libepoxy_dep'])
atk_dep = dependency('atk', version: atk_req) atk_dep = dependency('atk', version: atk_req)
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false, harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false)
fallback: ['harfbuzz', 'libharfbuzz_dep'])
xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled) xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req, graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req,
fallback: ['graphene', 'graphene_dep']) fallback: ['graphene', 'graphene_dep'])
@ -460,6 +459,11 @@ if cc.get_id() == 'msvc'
endif endif
endif endif
if not harfbuzz_dep.found()
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false,
fallback: ['harfbuzz', 'libharfbuzz_dep'])
endif
cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found()) cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found())
cdata.set('HAVE_PANGOFT', pangoft_dep.found()) cdata.set('HAVE_PANGOFT', pangoft_dep.found())