[meson] use if blocks to separate different dependencies

This commit is contained in:
Ebrahim Byagowi 2020-06-11 18:32:13 +04:30
parent 8571b3551c
commit b8454c3d61
1 changed files with 58 additions and 52 deletions

View File

@ -74,19 +74,23 @@ check_funcs = [
['roundf'],
]
m_dep = cpp.find_library('m', required: false)
if not get_option('freetype').disabled()
freetype_dep = dependency('freetype2', required: false)
else
freetype_dep = dependency('', required: false)
endif
if not get_option('freetype').disabled() and not freetype_dep.found() and cpp.get_id() == 'msvc'
if not freetype_dep.found() and cpp.get_id() == 'msvc'
if cpp.has_header('ft2build.h')
freetype_dep = cpp.find_library('freetype', required: false)
endif
endif
if not freetype_dep.found() and get_option('freetype').enabled()
freetype_dep = dependency('freetype2', fallback: ['freetype2', 'freetype_dep'])
endif
else
freetype_dep = dependency('', required: false)
endif
glib_dep = dependency('glib-2.0', required: get_option('glib'),
fallback: ['glib', 'libglib_dep'])
@ -95,17 +99,15 @@ gobject_dep = dependency('gobject-2.0', required: get_option('gobject'),
fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig'),
fallback: ['fontconfig', 'fontconfig_dep'])
graphite2_dep = dependency('graphite2', required: get_option('graphite'))
m_dep = cpp.find_library('m', required: false)
if not get_option('icu').disabled()
icu_dep = dependency('icu-uc', required: false)
else
icu_dep = dependency('', required: false)
endif
if not icu_dep.found() and get_option('icu').enabled()
icu_dep = dependency('icu-uc', required: cpp.get_id() != 'msvc')
endif
if not get_option('icu').disabled() and not icu_dep.found() and cpp.get_id() == 'msvc'
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 \
@ -123,17 +125,19 @@ if not get_option('icu').disabled() and not icu_dep.found() and cpp.get_id() ==
endif
endif
endif
else
icu_dep = dependency('', required: false)
endif
if not get_option('cairo').disabled()
cairo_dep = dependency('cairo', required: false)
else
cairo_dep = dependency('', required: false)
endif
if not get_option('cairo').disabled() and not cairo_dep.found() and cpp.get_id() == 'msvc'
if not cairo_dep.found() and cpp.get_id() == 'msvc'
if cpp.has_header('cairo.h')
cairo_dep = cpp.find_library('cairo')
endif
endif
if not cairo_dep.found() and get_option('cairo').enabled()
cairo_dep = dependency('cairo', fallback: ['cairo', 'libcairo_dep'])
endif
@ -147,12 +151,14 @@ if cairo_dep.found()
cpp.has_function('cairo_ft_font_face_create_for_ft_face', dependencies: cairo_dep)
cairo_ft_dep = cairo_dep
else
# Not-found dependency
cairo_ft_dep = dependency('', required: false)
endif
endif
else
# Not-found dependency
cairo_ft_dep = dependency('', required: false)
endif
else
cairo_dep = dependency('', required: false)
cairo_ft_dep = dependency('', required: false)
endif