mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 14:36:16 +01:00
Build .xcframework
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -10,3 +10,9 @@ idevice.h
|
|||||||
/ffi/examples/.cache
|
/ffi/examples/.cache
|
||||||
.vscode
|
.vscode
|
||||||
build
|
build
|
||||||
|
*.xcframework
|
||||||
|
bundle.zip
|
||||||
|
/swift/libs
|
||||||
|
/swift/include/*.h
|
||||||
|
/swift/.build
|
||||||
|
/swift/.swiftpm
|
||||||
|
|||||||
636
Cargo.lock
generated
636
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
name = "idevice"
|
name = "idevice"
|
||||||
description = "A Rust library to interact with services on iOS devices."
|
description = "A Rust library to interact with services on iOS devices."
|
||||||
authors = ["Jackson Coxson"]
|
authors = ["Jackson Coxson"]
|
||||||
version = "0.1.33"
|
version = "0.1.34"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
documentation = "https://docs.rs/idevice"
|
documentation = "https://docs.rs/idevice"
|
||||||
|
|||||||
39
justfile
39
justfile
@@ -2,3 +2,42 @@ check-features:
|
|||||||
cd idevice
|
cd idevice
|
||||||
cargo hack check --feature-powerset --no-dev-deps
|
cargo hack check --feature-powerset --no-dev-deps
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
xcframework: # apple-build
|
||||||
|
rm -rf swift/IDevice.xcframework
|
||||||
|
rm -rf swift/libs
|
||||||
|
cp ffi/idevice.h swift/include/idevice.h
|
||||||
|
mkdir swift/libs
|
||||||
|
lipo -create -output swift/libs/idevice-ios-sim.a \
|
||||||
|
target/aarch64-apple-ios-sim/release/libidevice_ffi.a \
|
||||||
|
target/x86_64-apple-ios/release/libidevice_ffi.a
|
||||||
|
lipo -create -output swift/libs/idevice-macos.a \
|
||||||
|
target/aarch64-apple-darwin/release/libidevice_ffi.a \
|
||||||
|
target/x86_64-apple-darwin/release/libidevice_ffi.a
|
||||||
|
|
||||||
|
xcodebuild -create-xcframework \
|
||||||
|
-library target/aarch64-apple-ios/release/libidevice_ffi.a -headers swift/include \
|
||||||
|
-library swift/libs/idevice-ios-sim.a -headers swift/include \
|
||||||
|
-library swift/libs/idevice-macos.a -headers swift/include \
|
||||||
|
-output swift/IDevice.xcframework
|
||||||
|
|
||||||
|
zip -r bundle.zip IDevice.xcframework
|
||||||
|
openssl dgst -sha256 bundle.zip
|
||||||
|
|
||||||
|
[working-directory: 'ffi']
|
||||||
|
apple-build: # requires a Mac
|
||||||
|
# iOS device build
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS="--sysroot=$(xcrun --sdk iphoneos --show-sdk-path)" \
|
||||||
|
cargo build --release --target aarch64-apple-ios
|
||||||
|
|
||||||
|
# iOS Simulator (arm64)
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS="--sysroot=$(xcrun --sdk iphonesimulator --show-sdk-path)" \
|
||||||
|
cargo build --release --target aarch64-apple-ios-sim
|
||||||
|
|
||||||
|
# iOS Simulator (x86_64)
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS="--sysroot=$(xcrun --sdk iphonesimulator --show-sdk-path)" \
|
||||||
|
cargo build --release --target x86_64-apple-ios
|
||||||
|
|
||||||
|
# macOS (native) – no special env needed
|
||||||
|
cargo build --release --target aarch64-apple-darwin
|
||||||
|
cargo build --release --target x86_64-apple-darwin
|
||||||
|
|||||||
24
swift/Package.swift
Normal file
24
swift/Package.swift
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// Package.swift
|
||||||
|
|
||||||
|
// swift-tools-version: 6.1
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "IDevice",
|
||||||
|
platforms: [
|
||||||
|
.iOS(.v12),
|
||||||
|
.macOS(.v11),
|
||||||
|
],
|
||||||
|
products: [
|
||||||
|
.library(
|
||||||
|
name: "IDevice",
|
||||||
|
targets: ["IDevice"]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.binaryTarget(
|
||||||
|
name: "IDevice",
|
||||||
|
path: "IDevice.xcframework"
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
4
swift/include/module.modulemap
Normal file
4
swift/include/module.modulemap
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
module IDevice {
|
||||||
|
header "idevice.h"
|
||||||
|
export *
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user