Meson: Look harder for Cairo on Visual Studio

Since Cairo's build system for Visual Studio does not generate pkg-config files
for us, look for cairo.h and cairo.lib manually if the pkg-config files cannot
be found.

Also look for cairo-ft more carefully: ensure that we have cairo-ft.h, and one
of its symbols can be found in the same cairo.lib that we previously found.
This commit is contained in:
Chun-wei Fan 2020-03-13 16:56:55 +08:00 committed by Ebrahim Byagowi
parent 5efce600ab
commit 9d0e6aef8a
1 changed files with 15 additions and 3 deletions

View File

@ -90,8 +90,7 @@ glib_dep = dependency('glib-2.0', required: get_option('glib'),
fallback: ['glib', 'libglib_dep']) fallback: ['glib', 'libglib_dep'])
gobject_dep = dependency('gobject-2.0', required: get_option('gobject'), gobject_dep = dependency('gobject-2.0', required: get_option('gobject'),
fallback: ['glib', 'libgobject_dep']) fallback: ['glib', 'libgobject_dep'])
cairo_dep = dependency('cairo', required: get_option('cairo'), cairo_dep = dependency('cairo', required: false)
fallback: ['cairo', 'libcairo_dep'])
fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig'), fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig'),
fallback: ['fontconfig', 'fontconfig_dep']) fallback: ['fontconfig', 'fontconfig_dep'])
graphite2_dep = dependency('graphite2', required: get_option('graphite')) graphite2_dep = dependency('graphite2', required: get_option('graphite'))
@ -117,13 +116,26 @@ if not icu_dep.found() and cpp.get_id() == 'msvc'
endif endif
endif endif
if not cairo_dep.found() and cpp.get_id() == 'msvc'
if cpp.has_header('cairo.h')
cairo_dep = cpp.find_library('cairo')
endif
endif
if not cairo_dep.found() and get_option('cairo').enabled()
cairo_dep = dependency('cairo', fallback: ['cairo', 'libcairo_dep'])
endif
# Ensure that cairo-ft is fetched from the same library as cairo itself # Ensure that cairo-ft is fetched from the same library as cairo itself
if cairo_dep.found() if cairo_dep.found()
if cairo_dep.type_name() == 'pkgconfig' if cairo_dep.type_name() == 'pkgconfig'
cairo_ft_dep = dependency('cairo-ft', required: get_option('cairo')) cairo_ft_dep = dependency('cairo-ft', required: get_option('cairo'))
else else
if cpp.has_header('cairo-ft.h') and \
cpp.has_function('cairo_ft_font_face_create_for_ft_face', dependencies: cairo_dep)
cairo_ft_dep = cairo_dep cairo_ft_dep = cairo_dep
endif endif
endif
else else
# Not-found dependency # Not-found dependency
cairo_ft_dep = dependency('', required: false) cairo_ft_dep = dependency('', required: false)