From 5dc162a4ec726df96cc61781dfbb3fcd315f3ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <> Date: Sun, 24 Mar 2024 23:25:31 -0400 Subject: [PATCH] meson: support building python --- meson.build | 16 +++++++++++++++- meson.options | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) 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')