Skip to content

Commit 87abe73

Browse files
committed
Add shell script to build frameworks
1 parent 058186b commit 87abe73

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ ci/LDKSwift/.swiftpm
2020
xcode/LDK/*.h
2121
xcode/LDK/*.c
2222
xcuserdata/
23+
/xcode/LDK/build

xcode/LDK/build-frameworks.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env sh
2+
set -e # abort if any command fails
3+
4+
BIN_OUTPUT_DIRECTORY="`pwd`/build"
5+
6+
rm -rf $BIN_OUTPUT_DIRECTORY
7+
8+
xcodebuild archive -scheme LDKFramework \
9+
-destination "generic/platform=iOS Simulator" \
10+
-archivePath ${BIN_OUTPUT_DIRECTORY}/LDKFramework-Sim \
11+
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
12+
13+
xcodebuild archive -scheme LDKFramework \
14+
-destination "generic/platform=iOS" \
15+
-archivePath ${BIN_OUTPUT_DIRECTORY}/LDKFramework-iOS \
16+
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
17+
18+
xcodebuild -create-xcframework \
19+
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-iOS.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
20+
-framework ${BIN_OUTPUT_DIRECTORY}/LDKFramework-Sim.xcarchive/Products/Library/Frameworks/LDKFramework.framework \
21+
-output ${BIN_OUTPUT_DIRECTORY}/LDKFramework.xcframework

xcode/LDK/build-libldk.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ if [[ ${ACTION:-build} = "build" || $ACTION = "install" ]]; then
2828

2929
if [[ $PLATFORM_NAME = "macosx" ]]; then
3030
RUST_TARGET_OS="darwin"
31-
elif [[ $PLATFORM_NAME = "iphonesimulator" ]]; then
32-
RUST_TARGET_OS="ios-sim"
3331
else
3432
RUST_TARGET_OS="ios"
3533
fi
@@ -62,6 +60,12 @@ if [[ ${ACTION:-build} = "build" || $ACTION = "install" ]]; then
6260
RUST_ARCH=$ARCH
6361
if [[ $RUST_ARCH = "arm64" ]]; then
6462
RUST_ARCH="aarch64"
63+
# This is because iOS Simulator builds for x86_64 is `x86_64-apple-ios`, while arm64 is `aarch64-apple-ios-sim`
64+
if [[ $PLATFORM_NAME = "iphonesimulator" ]]; then
65+
RUST_TARGET_OS="ios-sim"
66+
fi
67+
else
68+
RUST_TARGET_OS="ios"
6569
fi
6670

6771
cargo build -Z build-std=panic_abort,std --features "std" --target "${RUST_ARCH}-apple-${RUST_TARGET_OS}" $RUST_CONFIGURATION_FLAG

0 commit comments

Comments
 (0)