[meson] Avoid using has_headers as that has added in 0.50.0

This commit is contained in:
Ebrahim Byagowi 2020-08-13 09:06:39 +04:30 committed by ebraminio
parent 411b426c69
commit 24b4200243
1 changed files with 30 additions and 27 deletions

View File

@ -77,9 +77,10 @@ freetype_dep = null_dep
if not get_option('freetype').disabled() if not get_option('freetype').disabled()
freetype_dep = dependency('freetype2', required: false) freetype_dep = dependency('freetype2', required: false)
if not freetype_dep.found() and cpp.get_id() == 'msvc' if (not freetype_dep.found() and
freetype_dep = cpp.find_library('freetype', required: false, cpp.get_id() == 'msvc' and
has_headers: ['ft2build.h']) cpp.has_header('ft2build.h'))
freetype_dep = cpp.find_library('freetype', required: false)
endif endif
if not freetype_dep.found() if not freetype_dep.found()
@ -102,24 +103,23 @@ icu_dep = null_dep
if not get_option('icu').disabled() if not get_option('icu').disabled()
icu_dep = dependency('icu-uc', required: false) icu_dep = dependency('icu-uc', required: false)
if not icu_dep.found() and get_option('icu').enabled() if (not icu_dep.found() and
icu_dep = dependency('icu-uc', required: cpp.get_id() != 'msvc') cpp.get_id() == 'msvc' and
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: false)
else
icu_dep = cpp.find_library('icuuc', required: false)
endif
endif endif
if not icu_dep.found() and cpp.get_id() == 'msvc' if not icu_dep.found()
if get_option('buildtype') == 'debug' icu_dep = dependency('icu-uc', required: get_option('icu'))
icu_dep_name = 'icuucd'
else
icu_dep_name = 'icuuc'
endif
icu_dep = cpp.find_library(icu_dep_name,
required: get_option('icu'),
has_headers: ['unicode/uchar.h',
'unicode/unorm2.h',
'unicode/ustring.h',
'unicode/utf16.h',
'unicode/uversion.h',
'unicode/uscript.h'])
endif endif
endif endif
@ -128,9 +128,10 @@ cairo_ft_dep = null_dep
if not get_option('cairo').disabled() if not get_option('cairo').disabled()
cairo_dep = dependency('cairo', required: false) cairo_dep = dependency('cairo', required: false)
if not cairo_dep.found() and cpp.get_id() == 'msvc' if (not cairo_dep.found() and
cairo_dep = cpp.find_library('cairo', required: false, cpp.get_id() == 'msvc' and
has_headers: ['cairo.h']) cpp.has_header('cairo.h'))
cairo_dep = cpp.find_library('cairo', required: false)
endif endif
if not cairo_dep.found() if not cairo_dep.found()
@ -226,11 +227,10 @@ endif
gdi_uniscribe_deps = [] gdi_uniscribe_deps = []
# GDI (Uniscribe) (Windows) # GDI (Uniscribe) (Windows)
if host_machine.system() == 'windows' and not get_option('gdi').disabled() if host_machine.system() == 'windows' and not get_option('gdi').disabled()
gdi_deps_found = true gdi_deps_found = cpp.has_header('usp10.h') and cpp.has_header('windows.h')
foreach usplib : ['usp10', 'gdi32', 'rpcrt4'] foreach usplib : ['usp10', 'gdi32', 'rpcrt4']
dep = cpp.find_library(usplib, required: get_option('gdi'), dep = cpp.find_library(usplib, required: get_option('gdi'))
has_headers: ['usp10.h', 'windows.h'])
gdi_deps_found = gdi_deps_found and dep.found() gdi_deps_found = gdi_deps_found and dep.found()
gdi_uniscribe_deps += dep gdi_uniscribe_deps += dep
endforeach endforeach
@ -244,8 +244,11 @@ endif
# DirectWrite (Windows) # DirectWrite (Windows)
directwrite_dep = null_dep directwrite_dep = null_dep
if host_machine.system() == 'windows' and not get_option('directwrite').disabled() if host_machine.system() == 'windows' and not get_option('directwrite').disabled()
directwrite_dep = cpp.find_library('dwrite', required: get_option('directwrite'), if get_option('directwrite').enabled() and not cpp.has_header('dwrite_1.h')
has_headers: ['dwrite_1.h']) error('DirectWrite was enabled explicitly, but required header is missing.')
endif
directwrite_dep = cpp.find_library('dwrite', required: get_option('directwrite'))
if directwrite_dep.found() if directwrite_dep.found()
conf.set('HAVE_DIRECTWRITE', 1) conf.set('HAVE_DIRECTWRITE', 1)