meson: Clean up FreeType2 dependency search

Since we are using Meson 0.60.x now, make use of CMake's support for finding
FreeType in addition to pkg-config, which actually looks for FreeType2 via
looking at the headers and .lib's internally, so we don't have to reinvent
the wheel.

Sadly, we don't have similar support for Cairo and HarfBuzz in CMake, so we
have to stick with what we have now, since we still need to support older
HarfBuzz and Cairo versions as we are in a stable release series.
This commit is contained in:
Chun-wei Fan 2022-12-09 12:41:10 +08:00
parent f2bbaf4f32
commit d819af3dbd

View File

@ -416,25 +416,9 @@ if pangoft_dep.found()
# We get the dependency itself from pango, but pango doesn't care
# about ft2 version, so an extra check is needed.
# Update once Meson can have deps declared in a declarative manner
ft2_dep = dependency('freetype2', version: '>= 2.7.1', required: false)
if not ft2_dep.found() and cc.get_id() == 'msvc'
if cc.has_header('ft2build.h') and cc.has_header('freetype/ftmm.h')
ft_lib = cc.find_library('freetype', required: false)
if ft_lib.found()
if cc.has_function('FT_Get_Var_Design_Coordinates', dependencies: ft_lib,
prefix: '''#include <ft2build.h>
#include FT_MULTIPLE_MASTERS_H''')
ft2_dep = ft_lib
endif
endif
endif
endif
if not ft2_dep.found()
ft2_dep = dependency('freetype2', version: '>= 2.7.1', fallback : ['freetype2', 'freetype_dep'])
endif
ft2_dep = dependency(['freetype2','FreeType'],
version: '>= 2.7.1',
fallback : ['freetype2', 'freetype_dep'])
endif
if win32_enabled