From 8ed6ca89f51e4e5b4799da924ead9e717f7095f4 Mon Sep 17 00:00:00 2001 From: Mathieu Velten Date: Wed, 28 Aug 2024 13:05:54 +0200 Subject: [PATCH] Add Python bindings uniffi config --- bindings/matrix-sdk-crypto-ffi/Cargo.toml | 3 ++- bindings/matrix-sdk-crypto-ffi/pyproject.toml | 3 +++ bindings/matrix-sdk-crypto-ffi/uniffi.toml | 3 +++ bindings/matrix-sdk-ffi/Cargo.toml | 7 ++++++- bindings/matrix-sdk-ffi/pyproject.toml | 3 +++ bindings/matrix-sdk-ffi/uniffi-bindgen.rs | 3 +++ bindings/matrix-sdk-ffi/uniffi.toml | 5 ++++- 7 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 bindings/matrix-sdk-crypto-ffi/pyproject.toml create mode 100644 bindings/matrix-sdk-ffi/pyproject.toml create mode 100644 bindings/matrix-sdk-ffi/uniffi-bindgen.rs diff --git a/bindings/matrix-sdk-crypto-ffi/Cargo.toml b/bindings/matrix-sdk-crypto-ffi/Cargo.toml index 50dcaf137fe..efb716d5c6b 100644 --- a/bindings/matrix-sdk-crypto-ffi/Cargo.toml +++ b/bindings/matrix-sdk-crypto-ffi/Cargo.toml @@ -10,10 +10,11 @@ license = "Apache-2.0" publish = false [lib] +name = "matrix_sdk_crypto_ffi" crate-type = ["cdylib", "staticlib"] [[bin]] -name = "matrix_sdk_crypto_ffi" +name = "uniffi-bindgen" path = "uniffi-bindgen.rs" [features] diff --git a/bindings/matrix-sdk-crypto-ffi/pyproject.toml b/bindings/matrix-sdk-crypto-ffi/pyproject.toml new file mode 100644 index 00000000000..07dd28cde91 --- /dev/null +++ b/bindings/matrix-sdk-crypto-ffi/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" diff --git a/bindings/matrix-sdk-crypto-ffi/uniffi.toml b/bindings/matrix-sdk-crypto-ffi/uniffi.toml index ca1ce5b229d..99334534536 100644 --- a/bindings/matrix-sdk-crypto-ffi/uniffi.toml +++ b/bindings/matrix-sdk-crypto-ffi/uniffi.toml @@ -4,3 +4,6 @@ cdylib_name = "matrix_sdk_crypto_ffi" [bindings.swift] module_name = "MatrixSDKCrypto" + +[bindings.python] +cdylib_name = "matrix_sdk_crypto_ffi" diff --git a/bindings/matrix-sdk-ffi/Cargo.toml b/bindings/matrix-sdk-ffi/Cargo.toml index d954bfb302f..d2f96148435 100644 --- a/bindings/matrix-sdk-ffi/Cargo.toml +++ b/bindings/matrix-sdk-ffi/Cargo.toml @@ -10,8 +10,13 @@ rust-version = { workspace = true } repository = "https://github.com/matrix-org/matrix-rust-sdk" [lib] +name = "matrix_sdk_ffi" crate-type = ["cdylib", "staticlib"] +[[bin]] +name = "uniffi-bindgen" +path = "uniffi-bindgen.rs" + [features] default = ["bundled-sqlite"] bundled-sqlite = ["matrix-sdk/bundled-sqlite"] @@ -41,7 +46,7 @@ tracing-core = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } tracing-appender = { version = "0.2.2" } tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } -uniffi = { workspace = true, features = ["tokio"] } +uniffi = { workspace = true, features = ["cli", "tokio"] } url = { workspace = true } zeroize = { workspace = true } uuid = { version = "1.4.1", features = ["v4"] } diff --git a/bindings/matrix-sdk-ffi/pyproject.toml b/bindings/matrix-sdk-ffi/pyproject.toml new file mode 100644 index 00000000000..07dd28cde91 --- /dev/null +++ b/bindings/matrix-sdk-ffi/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" diff --git a/bindings/matrix-sdk-ffi/uniffi-bindgen.rs b/bindings/matrix-sdk-ffi/uniffi-bindgen.rs new file mode 100644 index 00000000000..f6cff6cf1d9 --- /dev/null +++ b/bindings/matrix-sdk-ffi/uniffi-bindgen.rs @@ -0,0 +1,3 @@ +fn main() { + uniffi::uniffi_bindgen_main() +} diff --git a/bindings/matrix-sdk-ffi/uniffi.toml b/bindings/matrix-sdk-ffi/uniffi.toml index 92ed4de9c63..29cf9de7326 100644 --- a/bindings/matrix-sdk-ffi/uniffi.toml +++ b/bindings/matrix-sdk-ffi/uniffi.toml @@ -1,4 +1,7 @@ [bindings.kotlin] package_name = "org.matrix.rustcomponents.sdk" cdylib_name = "matrix_sdk_ffi" -android_cleaner = true \ No newline at end of file +android_cleaner = true + +[bindings.python] +cdylib_name = "matrix_sdk_ffi"