diff --git a/meson.build b/meson.build index 497a6101..65655d81 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('opendht', 'c', 'cpp', +project('opendht', 'c', 'cpp', 'cython', version: '3.1.8', default_options: [ 'cpp_std=c++17', @@ -98,6 +98,20 @@ if get_option('c').enabled() endif endif +if get_option('python').require(get_option('indexation').enabled(), error_message: 'python requires indexation').allowed() + py = import('python').find_installation() + dep_py = py.dependency() + py.extension_module( + 'opendht', + 'python/opendht.pyx', + include_directories : opendht_interface_inc, + override_options : ['cython_language=cpp'], + link_with : [opendht], + dependencies : [msgpack, fmt, dep_py], + install : true + ) +endif + if get_option('tools').enabled() dhtnode = executable('dhtnode', 'tools/dhtnode.cpp', include_directories : opendht_interface_inc, diff --git a/meson.options b/meson.options index 7cb4082b..5af9d34a 100644 --- a/meson.options +++ b/meson.options @@ -4,3 +4,4 @@ option('peer_discovery', type : 'feature', value : 'enabled') option('tools', type : 'feature', value : 'enabled') option('c', type : 'feature', value : 'enabled') option('indexation', type : 'feature', value : 'enabled') +option('python', type : 'feature', value : 'enabled')