Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
option('system-uchardet', type: 'boolean', value: false,
description: 'Build against the system uchardet library (requires chardet from git)')
17 changes: 15 additions & 2 deletions src/cchardet/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,28 @@ uchardet_sources = files(

uchardet_inc = include_directories('../ext/uchardet/src')

if get_option('system-uchardet')
uchardet = dependency('uchardet')
# TODO: replace with a version constraint once new uchardet is released
cpp = meson.get_compiler('cpp')
if not cpp.has_function('uchardet_get_n_candidates', dependencies: [uchardet])
error('system-uchardet requires git version of uchardet from https://gitlab.freedesktop.org/uchardet/uchardet.git')
endif
else
uchardet = declare_dependency(
sources: uchardet_sources,
include_directories: uchardet_inc,
)
endif

py.extension_module(
'_cchardet',
'_cchardet.pyx',
uchardet_sources,
dependencies: [uchardet],
# Build the Cython output as C++ (the module wraps a C++ library). Meson then
# links the C++ runtime that matches the active compiler (libstdc++ or
# libc++), so no manual `-lstdc++` is needed.
override_options: ['cython_language=cpp'],
include_directories: uchardet_inc,
install: true,
subdir: 'cchardet',
)
Expand Down
Loading