Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace cargo-swift with equivalent script #15

Merged
merged 7 commits into from
Jan 30, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Cleanup
bisgardo committed Jan 29, 2024
commit f01d1290e47584a3090624619a4266ca52eb7a03
10 changes: 5 additions & 5 deletions lib/crypto/ConcordiumWalletCrypto/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.6

import PackageDescription

@@ -14,11 +14,11 @@ let package = Package(
targets: ["ConcordiumWalletCrypto"]
),
],
dependencies: [],
targets: [
// TODO: Generate using build plugin.
.binaryTarget(name: "RustFramework", path: "./RustFramework.xcframework"),
// TODO: Generate using build plugin.
.binaryTarget(
name: "RustFramework",
path: "./RustFramework.xcframework"
),
.target(
name: "ConcordiumWalletCrypto",
dependencies: [
9 changes: 5 additions & 4 deletions lib/crypto/build.sh
Original file line number Diff line number Diff line change
@@ -9,11 +9,9 @@ cp ./generated/crypto.swift ./ConcordiumWalletCrypto/Sources/ConcordiumWalletCry
mv ./generated/cryptoFFI.modulemap ./generated/module.modulemap

# Compile for iOS.
mkdir -p ./ConcordiumWalletCrypto/ios-arm64/Headers
cargo build --target aarch64-apple-ios --release

# Compile for iOS Simulator.
mkdir -p ./ConcordiumWalletCrypto/ios-arm64_x86_64-simulator/Headers
cargo build --target x86_64-apple-ios --release
cargo build --target aarch64-apple-ios-sim --release
lipo \
@@ -22,16 +20,19 @@ lipo \
-create -output ./target/universal-ios/release/libcrypto.a

# Compile for macOS.
mkdir -p ./ConcordiumWalletCrypto/macos-arm64_x86_64/Headers
cargo build --target x86_64-apple-darwin --release
cargo build --target aarch64-apple-darwin --release
lipo \
./target/x86_64-apple-darwin/release/libcrypto.a \
./target/aarch64-apple-darwin/release/libcrypto.a \
-create -output ./target/universal-macos/release/libcrypto.a

# Build binary framework.
xcodebuild -create-xcframework \
-library ./target/aarch64-apple-ios/release/libcrypto.a -headers ./generated \
-library ./target/universal-ios/release/libcrypto.a -headers ./generated \
-library ./target/universal-macos/release/libcrypto.a -headers ./generated \
-output ./ConcordiumWalletCrypto/RustFramework.xcframework
-output ./ConcordiumWalletCrypto/RustFramework.xcframework

# Clean up.
rm -rf ./generated
2 changes: 1 addition & 1 deletion lib/crypto/uniffi-bindgen.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() {
uniffi::uniffi_bindgen_main()
}
}