From 5efce600ab3a8e4e7f429f5d683595c33d6cbe45 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 13 Mar 2020 16:40:20 +0800 Subject: [PATCH] Meson: Try harder to look for ICU on Visual Studio ICU's Visual Studio build files do not generate pkg-config files for us, unless it is built with Cygwin instead of the project files. If pkg-config files for ICU cannot be found, look for its headers and .lib manually. --- meson.build | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 8e192d7ab..27353f337 100644 --- a/meson.build +++ b/meson.build @@ -95,9 +95,28 @@ cairo_dep = dependency('cairo', required: get_option('cairo'), fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig'), fallback: ['fontconfig', 'fontconfig_dep']) graphite2_dep = dependency('graphite2', required: get_option('graphite')) -icu_dep = dependency('icu-uc', required: get_option('icu')) +icu_dep = dependency('icu-uc', required: get_option('icu').enabled() and cpp.get_id() != 'msvc') m_dep = cpp.find_library('m', required: false) +if not icu_dep.found() and cpp.get_id() == 'msvc' + if cpp.has_header('unicode/uchar.h') and \ + cpp.has_header('unicode/unorm2.h') and \ + cpp.has_header('unicode/ustring.h') and \ + cpp.has_header('unicode/utf16.h') and \ + cpp.has_header('unicode/uversion.h') and \ + cpp.has_header('unicode/uscript.h') + if get_option('buildtype') == 'debug' + icu_dep = cpp.find_library('icuucd', required: get_option('icu')) + else + icu_dep = cpp.find_library('icuuc', required: get_option('icu')) + endif + else + if get_option('icu').enabled() + error('ICU headers and libraries must be present to build ICU support') + endif + endif +endif + # Ensure that cairo-ft is fetched from the same library as cairo itself if cairo_dep.found() if cairo_dep.type_name() == 'pkgconfig'