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

added iced tour example template #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions templates/apps/iced/.gitignore.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Rust
target/
**/*.rs.bk

# cargo-mobile
.cargo/
/gen

# macOS
.DS_Store
28 changes: 28 additions & 0 deletions templates/apps/iced/Cargo.toml.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "{{app.name}}"
version = "0.1.0"
authors = ["{{author}}"]
edition = "2018"

[package.metadata.cargo-apple.ios]
frameworks = ["CoreText"]

[lib]
crate-type = ["staticlib", "cdylib", "rlib"]

[[bin]]
name = "{{app.name}}-desktop"
path = "gen/bin/desktop.rs"

[dependencies]
mobile-entry-point = "0.1.1"
iced = { git = "https://github.com/discordance/iced.git", branch = "ios_fixes", features = ["image", "debug"] }

[target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.9.0"
log = "0.4.11"
ndk-glue = "0.2.1"

[target.'cfg(not(target_os = "android"))'.dependencies]
simple_logger = "1.11.0"

18 changes: 18 additions & 0 deletions templates/apps/iced/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# iced

This is just the [`iced` tour example](https://github.com/hecrj/iced/tree/master/examples/tour) with very light modifications:

- The `#[mobile_entry_point]` annotation generates all the boilerplate `extern` functions for mobile.
- Logging on Android is done using `android_logger`.

there is an issue with metal validation
https://github.com/gfx-rs/wgpu/issues/185
which is a problem also referenced in
https://github.com/gfx-rs/wgpu/issues/185

Until this is fixed in either iced or wgpu, metal validation needs to be deactivated, otherwise app panics.

To do so in Xcode:
Product > Scheme > Edit scheme > Run > Metal validation => disabled

To run this on desktop, just do `cargo run` like normal! For mobile, use `cargo android run` and `cargo apple run` respectively (or use `cargo android open` and `cargo apple open` to open in Android Studio and Xcode respectively).
4 changes: 4 additions & 0 deletions templates/apps/iced/gen/bin/desktop.rs.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{{snake-case app.name}}::start_app();
}
Binary file added templates/apps/iced/images/ferris.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading