Merge pull request #151 from nirbheek/fix-buildtype-usage

meson: Use the b_vscrt option for selecting the CRT
This commit is contained in:
Tim Rühsen 2020-04-03 15:22:51 +02:00 committed by GitHub
commit 8d9e490ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
project('libpsl', 'c', project('libpsl', 'c',
version : '0.21.0', version : '0.21.0',
meson_version : '>=0.47.0') meson_version : '>=0.49.0')
# Derived from LIBPSL_SO_VERSION in configure.ac # Derived from LIBPSL_SO_VERSION in configure.ac
lt_version = '5.3.2' lt_version = '5.3.2'
@ -10,9 +10,17 @@ 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 # We need to know the CRT being used to determine what .lib files we need on
# for dependencies that don't normally come with pkg-config files for Visual Studio builds # Visual Studio for dependencies that don't normally come with pkg-config files
buildtype = get_option('buildtype') vs_crt = 'release'
vs_crt_opt = get_option('b_vscrt')
if vs_crt_opt in ['mdd', 'mtd']
vs_crt = 'debug'
if vs_crt_opt == 'from_buildtype'
if get_option('buildtype') == 'debug'
vs_crt = 'debug'
endif
endif
notfound = dependency('', required : false) notfound = dependency('', required : false)
libidn2_dep = notfound libidn2_dep = notfound
@ -48,7 +56,7 @@ if ['libicu', 'auto'].contains(enable_runtime) or ['libicu', 'auto'].contains(en
# MSVC: the debug configuration of ICU generated the libraries with d suffix # 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 # 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 # build type. Note debugoptimized is just a release build with .pdb files enabled
if cc.get_id() == 'msvc' and buildtype == 'debug' if cc.get_id() in ['msvc', 'clang-cl'] and vs_crt == 'debug'
libicu_dep = cc.find_library('icuucd', required : false) libicu_dep = cc.find_library('icuucd', required : false)
else else
libicu_dep = cc.find_library('icuuc', required : false) libicu_dep = cc.find_library('icuuc', required : false)