Skip to content

Commit

Permalink
iOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed Jan 26, 2023
1 parent 5acf87b commit 8e49a34
Show file tree
Hide file tree
Showing 12 changed files with 1,488 additions and 440 deletions.
175 changes: 174 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Tool
run: cargo run --features=bin --manifest-path=bindgen/Cargo.toml --verbose CoreFoundation --sdk macosx

sys:
sys-macos:
strategy:
matrix:
feature: [
Expand Down Expand Up @@ -224,3 +224,176 @@ jobs:
- uses: actions/checkout@v3
- name: Build
run: cargo build --manifest-path=sys/Cargo.toml --verbose --features ${{ matrix.feature }}
sys-ios:
strategy:
matrix:
feature: [
ARKit,
AVFAudio,
AVFoundation,
AVKit,
AVRouting,
Accelerate,
Accessibility,
Accounts,
ActivityKit,
AdServices,
AdSupport,
AddressBook,
AddressBookUI,
AppClip,
AppIntents,
AppTrackingTransparency,
AssetsLibrary,
AudioToolbox,
AudioUnit,
AuthenticationServices,
AutomaticAssessmentConfiguration,
BackgroundAssets,
BackgroundTasks,
BusinessChat,
CFNetwork,
CallKit,
CarPlay,
ClassKit,
ClockKit,
CloudKit,
ColorSync,
Contacts,
ContactsUI,
CoreAudio,
CoreAudioKit,
CoreBluetooth,
CoreData,
CoreFoundation,
CoreGraphics,
CoreHaptics,
CoreImage,
CoreLocation,
CoreLocationUI,
CoreMIDI,
CoreML,
CoreMedia,
CoreMotion,
CoreNFC,
CoreServices,
CoreSpotlight,
CoreTelephony,
CoreText,
CoreTransferable,
CoreVideo,
CryptoTokenKit,
DataDetection,
DeviceCheck,
DeviceDiscoveryExtension,
EventKit,
EventKitUI,
ExposureNotification,
ExtensionFoundation,
ExtensionKit,
ExternalAccessory,
FileProvider,
FileProviderUI,
Foundation,
GLKit,
GSS,
GameController,
GameKit,
GameplayKit,
HealthKit,
HealthKitUI,
HomeKit,
IOKit,
IOSurface,
IdentityLookup,
IdentityLookupUI,
ImageCaptureCore,
ImageIO,
Intents,
IntentsUI,
JavaScriptCore,
LinkPresentation,
LocalAuthentication,
LocalAuthenticationEmbeddedUI,
MLCompute,
MapKit,
Matter,
MatterSupport,
MediaAccessibility,
MediaPlayer,
MediaSetup,
MediaToolbox,
MessageUI,
Messages,
Metal,
MetalFX,
MetalKit,
# MetalPerformanceShaders,
# MetalPerformanceShadersGraph,
MetricKit,
MobileCoreServices,
ModelIO,
MultipeerConnectivity,
NaturalLanguage,
NearbyInteraction,
Network,
NetworkExtension,
NewsstandKit,
NotificationCenter,
OSLog,
OpenAL,
OpenGLES,
PDFKit,
PHASE,
PassKit,
PencilKit,
Photos,
PhotosUI,
ProximityReader,
PushKit,
PushToTalk,
QuartzCore,
QuickLook,
QuickLookThumbnailing,
ReplayKit,
RoomPlan,
SafariServices,
SafetyKit,
SceneKit,
ScreenTime,
Security,
SensorKit,
SharedWithYou,
SharedWithYouCore,
ShazamKit,
Social,
SoundAnalysis,
Speech,
SpriteKit,
StoreKit,
SwiftUI,
SystemConfiguration,
ThreadNetwork,
Twitter,
UIKit,
UniformTypeIdentifiers,
UserNotifications,
UserNotificationsUI,
VideoSubscriberAccount,
VideoToolbox,
Vision,
VisionKit,
WatchConnectivity,
# WebKit, -- exceed max arg
WidgetKit,
iAd
]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: prepare iOS build
uses: dtolnay/rust-toolchain@stable
with:
target: aarch64-apple-ios
- name: Build
run: cargo build --target=aarch64-apple-ios --manifest-path=sys/Cargo.toml --verbose --features ${{ matrix.feature }}
17 changes: 8 additions & 9 deletions bindgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ include = ["*.toml", "/src"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bindgen = "0.60.1"
serde = { version = "1.0.140", features = ["derive"] }
serde_derive = "1.0.140"
toml = "0.5.9"
derive_more = { version = "0.99.17" }
apple-sdk = "0.1.0"
thiserror = "1.0.31"
bindgen = "0.63"
serde = { version = "1.0", features = ["derive"] }
toml = "0.6"
derive_more = { version = "0.99" }
apple-sdk = "0.4"
thiserror = "1.0"
regex = "1.7"

clap = { version = "3.2.14", features = ["derive"], optional = true }
regex = "1.7.1"
clap = { version = "4.1", features = ["derive"], optional = true }

[features]
default = ["bin"] # required-featues for apple-bindgen binary
Expand Down
8 changes: 7 additions & 1 deletion bindgen/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ impl Builder {
clang_args.push(&target_arg);
}

clang_args.extend(&["-isysroot", self.sdk.path().to_str().unwrap()]);
clang_args.extend(&[
"-isysroot",
self.sdk
.path()
.to_str()
.expect("sdk path is not utf-8 representable"),
]);

builder = builder
.clang_args(&clang_args)
Expand Down
4 changes: 2 additions & 2 deletions bindgen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use apple_sdk::Platform;
use clap::Parser;
use std::{path::PathBuf, str::FromStr};

#[derive(Debug)]
#[derive(Debug, Clone)]
enum Sdk {
Name(Platform),
Path(SdkPath),
Expand Down Expand Up @@ -47,7 +47,7 @@ struct Args {
target: Option<String>,

/// Print build details
#[clap(short, long, takes_value = false)]
#[clap(short, long, num_args = 0)]
verbose: bool,
}

Expand Down
2 changes: 1 addition & 1 deletion bindgen/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum SdkPathError {
XcrunError(std::io::Error),
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct SdkPath(PathBuf);

impl SdkPath {
Expand Down
Loading

0 comments on commit 8e49a34

Please sign in to comment.