Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make updater build on iOS #22

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions BUILDING_ENGINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,14 @@ When testing on my machine, I use something like:
$PATH_TO_ENGINE_SRC="$HOME/Documents/GitHub/engine/src"
shorebird --local-engine-src-path=$PATH_TO_ENGINE_SRC --local-engine=android_release_arm64 run
```


# For iOS

```
rustup target add aarch64-apple-ios x86_64-apple-ios
```

```
cargo build --target aarch64-apple-ios --target x86_64-apple-ios --release
```
5 changes: 5 additions & 0 deletions library/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ android_logger = "0.13.0"
# Send panics to log (instead of stderr), thus logcat on Android.
log-panics = { version = "2", features = ["with-backtrace"]}

[target.'cfg(target_os = "ios")'.dependencies]
# Use stderr for logging on iOS.
simple-logging = "2.0.2"
# Send panics to syslog (instead of stderr).
log-panics = { version = "2", features = ["with-backtrace"]}

[dev-dependencies]
tempdir = "0.3.7"
Expand Down
2 changes: 2 additions & 0 deletions library/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,7 @@ pub fn current_platform() -> &'static str {
static PLATFORM: &str = "windows";
#[cfg(target_os = "android")]
static PLATFORM: &str = "android";
#[cfg(target_os = "ios")]
static PLATFORM: &str = "ios";
return PLATFORM;
}
15 changes: 12 additions & 3 deletions library/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ pub fn init_logging() {
debug!("Logging initialized");
}

#[cfg(not(target_os = "android"))]
#[cfg(target_os = "ios")]
pub fn init_logging() {
// Nothing to do on non-Android platforms.
// Eventually iOS/MacOS may need something here.
// I could not figure out how to get fancier logging set up on iOS
// but logging to stderr seems to work.
use log::LevelFilter;
use std::io;
simple_logging::log_to(io::stderr(), LevelFilter::Info);
debug!("Logging initialized");
}

#[cfg(all(not(target_os = "android"), not(target_os = "ios")))]
pub fn init_logging() {
// Nothing to do on non-Android, non-iOS platforms.
}