Skip to content

Commit 75bcfb0

Browse files
committed
Merge #32: Make uniffi an optional feature
6ccaea6 Make `uniffi` an optional feature (Praveen Perera) Pull request description: ACKs for top commit: notmandatory: ACK 6ccaea6 Tree-SHA512: f09db2fb3d147051ee9045bbc25dd6386066bd69ba4445b9ccfbc884767bb48f4ed034661fc34590c92c85759b4cf69bdac912d2636ed8a9bc9886813b680134
2 parents b6b7172 + 6ccaea6 commit 75bcfb0

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

cktap-swift/build-xcframework.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ cargo build --package rust-cktap --profile release-smaller --target aarch64-appl
4040

4141
# Then run uniffi-bindgen
4242
cargo run --bin uniffi-bindgen generate \
43+
--features uniffi \
4344
--library target/aarch64-apple-ios/release-smaller/librust_cktap.dylib \
4445
--language swift \
4546
--out-dir cktap-swift/Sources/CKTap \

lib/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ edition = "2021"
88
crate-type = ["lib", "staticlib", "cdylib"]
99
name = "rust_cktap"
1010

11+
1112
[dependencies]
1213
ciborium = "0.2.0"
1314
serde = "1"
@@ -25,15 +26,16 @@ bitcoin = { version = "0.32", features = ["rand-std"] }
2526
# logging
2627
log = "0.4"
2728

28-
# uniffi todo: make this optional
29-
uniffi = { version = "0.29.1", features = ["cli"] }
29+
# uniffi
30+
uniffi = { version = "0.29", features = ["cli"], optional = true }
3031

3132
pcsc = { version = "2", optional = true }
3233

3334
[build-dependencies]
3435
uniffi = { version = "0.29.1", features = ["build"] }
3536

3637
[features]
38+
uniffi = ["dep:uniffi"]
3739
default = []
3840
emulator = []
3941

lib/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[cfg(feature = "uniffi")]
12
uniffi::setup_scaffolding!();
23

34
extern crate core;
@@ -13,7 +14,10 @@ pub use bitcoin::secp256k1::{self, rand};
1314

1415
#[cfg(feature = "emulator")]
1516
pub mod emulator;
17+
18+
#[cfg(feature = "uniffi")]
1619
mod ffi;
20+
1721
#[cfg(feature = "pcsc")]
1822
pub mod pcsc;
1923
pub mod sats_card;

lib/src/uniffi-bindgen.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
fn main() {
2+
#[cfg(feature = "uniffi")]
23
uniffi::uniffi_bindgen_main()
34
}

0 commit comments

Comments
 (0)