2017-12-29 17:12:55 +01:00
|
|
|
icu_dep = dependency('icu-i18n', version: '>= 50', required: get_option('icu'))
|
|
|
|
conf.set('HAVE_ICU', icu_dep.found())
|
|
|
|
|
|
|
|
icu_sources = [
|
|
|
|
'CaseFold.cxx',
|
|
|
|
'Compare.cxx',
|
|
|
|
'Collate.cxx',
|
|
|
|
'Converter.cxx',
|
|
|
|
]
|
|
|
|
|
|
|
|
if is_windows
|
|
|
|
icu_sources += 'Win32.cxx'
|
|
|
|
endif
|
|
|
|
|
2022-04-20 16:10:39 +02:00
|
|
|
iconv_dep = []
|
2017-12-29 17:12:55 +01:00
|
|
|
if icu_dep.found()
|
|
|
|
icu_sources += [
|
|
|
|
'Util.cxx',
|
|
|
|
'Init.cxx',
|
|
|
|
]
|
|
|
|
elif not get_option('iconv').disabled()
|
2022-04-24 06:14:17 +02:00
|
|
|
# an installed iconv library will make the builtin iconv() unavailable,
|
2022-04-20 16:10:39 +02:00
|
|
|
# so search for the library first and pass it as (possible) dependency
|
|
|
|
iconv_dep = compiler.find_library('libiconv', required: false)
|
|
|
|
have_iconv = compiler.has_function('iconv',
|
|
|
|
dependencies: iconv_dep,
|
|
|
|
prefix : '#include <iconv.h>')
|
2019-09-29 20:57:04 +02:00
|
|
|
if not have_iconv and get_option('iconv').enabled()
|
2017-12-29 17:12:55 +01:00
|
|
|
error('iconv() not available')
|
|
|
|
endif
|
2022-04-20 16:10:39 +02:00
|
|
|
conf.set('HAVE_ICONV', have_iconv)
|
2017-12-29 17:12:55 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
icu = static_library(
|
|
|
|
'icu',
|
|
|
|
icu_sources,
|
|
|
|
include_directories: inc,
|
|
|
|
dependencies: [
|
|
|
|
icu_dep,
|
2022-04-20 16:10:39 +02:00
|
|
|
iconv_dep,
|
2021-05-27 16:06:11 +02:00
|
|
|
fmt_dep,
|
2017-12-29 17:12:55 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
icu_dep = declare_dependency(
|
|
|
|
link_with: icu,
|
|
|
|
dependencies: [
|
|
|
|
util_dep,
|
|
|
|
],
|
|
|
|
)
|