summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2022-02-21 18:58:25 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2022-02-21 19:03:01 +0800
commitafdf144ae84fd67ad773799a93407214e5cc2261 (patch)
tree9fb8bada2460ca17e01295cac64eb79e4ec60d9e
parentf1e78584b7858889c72c904bf6e2fa3e5a785226 (diff)
downloadpango-afdf144ae84fd67ad773799a93407214e5cc2261.tar.gz
meson: Clean up FreeType search
Use CMake's built-in support to look for FreeType2 on Visual Studio-like builds, by using the 'freetype' package name, since it is what CMake expects. This cleans the Meson build files a bit and CMake would do more comprehensive work to help us find FreeType.
-rw-r--r--meson.build30
1 files changed, 9 insertions, 21 deletions
diff --git a/meson.build b/meson.build
index 88a13733..35464c2a 100644
--- a/meson.build
+++ b/meson.build
@@ -336,29 +336,17 @@ if not freetype_option.disabled() or freetype_required
freetype_option = false
endif
-# The first version of freetype with a pkg-config file is 2.1.5
-freetype_dep = dependency('freetype2', required: freetype_option)
+# The first version of freetype with a pkg-config file is 2.1.5,
+# CMake uses 'freetype' rather than 'freetype2' for the package name
+freetype_package_name = cc.get_argument_syntax() == 'msvc' ? \
+ 'freetype' : 'freetype2'
-if freetype_dep.found()
- freetype2_pc = 'freetype2'
-else
- if cc.get_id() == 'msvc' and cc.has_header('ft2build.h')
- foreach ft2_lib: ['freetype', 'freetypemt']
- if not freetype_dep.found()
- freetype_dep = cc.find_library(ft2_lib, required: freetype_option)
- if freetype_dep.found()
- freetype2_lib = '-l@0@'.format(ft2_lib)
- endif
- endif
- endforeach
- endif
-endif
+freetype_dep = dependency(freetype_package_name,
+ required: freetype_option,
+ fallback: ['freetype2', 'freetype_dep'])
-# Do the fallback now if freetype2 has not been found on the system.
-freetype_option = freetype_required ? true : get_option('freetype')
-if not freetype_dep.found()
- freetype_dep = dependency('freetype2', required: freetype_option,
- fallback: ['freetype2', 'freetype_dep'])
+if freetype_dep.found() and freetype_dep.type_name() == 'pkgconfig'
+ freetype2_pc = 'freetype2'
endif
# To build pangoft2, we need HarfBuzz, FontConfig and FreeType