@@ -20,18 +20,32 @@ rustup target add aarch64-apple-darwin x86_64-apple-darwin --toolchain stable
2020cargo build --profile release-smaller --features uniffi || exit 1
2121cargo build --profile release-smaller --features uniffi --target x86_64-apple-darwin || exit 1
2222cargo build --profile release-smaller --features uniffi --target aarch64-apple-darwin || exit 1
23- cargo build --profile release-smaller --features uniffi --target x86_64-apple-ios || exit 1
23+
24+ # Build iOS device targets
25+ export SDKROOT=$( xcrun --sdk iphoneos --show-sdk-path)
2426cargo build --profile release-smaller --features uniffi --target aarch64-apple-ios || exit 1
25- cargo +stable build --release --features uniffi --target aarch64-apple-ios-sim || exit 1
27+
28+ # Build iOS simulator targets
29+ export SDKROOT=$( xcrun --sdk iphonesimulator --show-sdk-path)
30+ cargo build --profile release-smaller --features uniffi --target x86_64-apple-ios || exit 1
31+
32+ # For aarch64 simulator, set the additional environment variable
33+ export SDKROOT=$( xcrun --sdk iphonesimulator --show-sdk-path)
34+ export BINDGEN_EXTRA_CLANG_ARGS=" --target=arm64-apple-ios-simulator"
35+ cargo +stable build --profile release-smaller --features uniffi --target aarch64-apple-ios-sim || exit 1
2636
2737# Combine ios-sim and apple-darwin (macos) libs for x86_64 and aarch64 (m1)
2838mkdir -p target/lipo-ios-sim/release-smaller || exit 1
29- lipo target/aarch64-apple-ios-sim/release/libldk_node.a target/x86_64-apple-ios/release-smaller/libldk_node.a -create -output target/lipo-ios-sim/release-smaller/libldk_node.a || exit 1
39+ lipo target/aarch64-apple-ios-sim/release-smaller /libldk_node.a target/x86_64-apple-ios/release-smaller/libldk_node.a -create -output target/lipo-ios-sim/release-smaller/libldk_node.a || exit 1
3040mkdir -p target/lipo-macos/release-smaller || exit 1
3141lipo target/aarch64-apple-darwin/release-smaller/libldk_node.a target/x86_64-apple-darwin/release-smaller/libldk_node.a -create -output target/lipo-macos/release-smaller/libldk_node.a || exit 1
3242
3343$UNIFFI_BINDGEN_BIN generate bindings/ldk_node.udl --language swift -o " $BINDINGS_DIR " || exit 1
3444
45+ # Reset SDKROOT for macOS compilation
46+ unset SDKROOT
47+ unset BINDGEN_EXTRA_CLANG_ARGS
48+
3549swiftc -module-name LDKNode -emit-library -o " $BINDINGS_DIR " /libldk_node.dylib -emit-module -emit-module-path " $BINDINGS_DIR " -parse-as-library -L ./target/release-smaller -lldk_node -Xcc -fmodule-map-file=" $BINDINGS_DIR " /LDKNodeFFI.modulemap " $BINDINGS_DIR " /LDKNode.swift -v || exit 1
3650
3751# Create xcframework from bindings Swift file and libs
0 commit comments