meson: on msvc icu installs the libraries with a "d" suffix

This commit is contained in:
Ignacio Casal Quinteiro 2019-01-21 12:20:53 +01:00
parent c6fdf56b20
commit 0bd3ae2a0c
1 changed files with 12 additions and 1 deletions

View File

@ -7,6 +7,10 @@ cc = meson.get_compiler('c')
enable_runtime = get_option('runtime') enable_runtime = get_option('runtime')
enable_builtin = get_option('builtin') enable_builtin = get_option('builtin')
# We need to know the build type to determine what .lib files we need on Visual Studio
# for dependencies that don't normally come with pkg-config files for Visual Studio builds
buildtype = get_option('buildtype')
notfound = dependency('', required : false) notfound = dependency('', required : false)
libidn2_dep = notfound libidn2_dep = notfound
libicu_dep = notfound libicu_dep = notfound
@ -38,8 +42,15 @@ endif
if ['libicu', 'auto'].contains(enable_runtime) or ['libicu', 'auto'].contains(enable_builtin) if ['libicu', 'auto'].contains(enable_runtime) or ['libicu', 'auto'].contains(enable_builtin)
libicu_dep = dependency('icu-uc', required : false) libicu_dep = dependency('icu-uc', required : false)
if not libicu_dep.found() and cc.has_header('unicode/ustring.h') if not libicu_dep.found() and cc.has_header('unicode/ustring.h')
# MSVC: the debug configuration of ICU generated the libraries with d suffix
# we must handle this and search for the right library depending on the
# build type. Note debugoptimized is just a release build with .pdb files enabled
if cc.get_id() == 'msvc' and buildtype == 'debug'
libicu_dep = cc.find_library('icuucd', required : false)
else
libicu_dep = cc.find_library('icuuc', required : false) libicu_dep = cc.find_library('icuuc', required : false)
endif endif
endif
if libicu_dep.found() if libicu_dep.found()
if enable_runtime == 'auto' if enable_runtime == 'auto'
enable_runtime = 'libicu' enable_runtime = 'libicu'