This repository has been archived by the owner on Jun 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (32 loc) · 1.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
projpath = ./swift
proto_path = $(projpath)/Proto
ffi_path = $(projpath)/Rust
cargo = ~/.cargo/bin/cargo
framework_name = Boring
xcframework_root = $(ffi_path)/$(framework_name).xcframework
common = $(xcframework_root)/common/$(framework_name).framework
libname = libboring_core
all: protoc ios_lib
protoc:
protoc --proto_path=proto --swift_out=$(proto_path) proto/types.proto
ios_lib:
cd rust; $(cargo) build --target x86_64-apple-ios --release
cd rust; $(cargo) build --target aarch64-apple-ios --release
cd rust; $(cargo) build --target aarch64-apple-ios-sim --release
rm -rf $(xcframework_root)
mkdir -p $(common)/Modules
cp rust/module.modulemap $(common)/Modules
mkdir -p $(common)/Headers
cp rust/include/ffi.h $(common)/Headers
cp rust/Boring.h $(common)/Headers
mkdir -p $(xcframework_root)/ios-arm64
cp -r $(common) $(xcframework_root)/ios-arm64/$(framework_name).framework
cp rust/target/aarch64-apple-ios/release/$(libname).a $(xcframework_root)/ios-arm64/$(framework_name).framework/$(framework_name)
mkdir -p $(xcframework_root)/ios-arm64_x86_64-simulator
cp -r $(common) $(xcframework_root)/ios-arm64_x86_64-simulator/$(framework_name).framework
lipo -create \
-output $(xcframework_root)/ios-arm64_x86_64-simulator/$(framework_name).framework/$(framework_name) \
rust/target/aarch64-apple-ios-sim/release/$(libname).a \
rust/target/x86_64-apple-ios/release/$(libname).a
cp rust/Info.plist $(xcframework_root)/Info.plist
rm -rf $(xcframework_root)/common