From c60a1ff0c94258d49dfb823d8e8edfee9c34e933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Mon, 6 Feb 2023 18:07:38 +0000 Subject: [PATCH] IOS, Android... same thing (#7493) # Objective - Merge the examples on iOS and Android - Make sure they both work from the same code ## Solution - don't create window when not in an active state (from #6830) - exit on suspend on Android (from #6830) - automatically enable dependency feature of bevy_audio on android so that it works out of the box - don't inverse y position of touch events - reuse the same example for both Android and iOS Fixes #4616 Fixes #4103 Fixes #3648 Fixes #3458 Fixes #3249 Fixes #86 --- .github/workflows/post-release.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/validation-jobs.yml | 4 +- Cargo.toml | 7 ++- crates/bevy_audio/Cargo.toml | 5 ++ crates/bevy_internal/Cargo.toml | 3 ++ crates/bevy_winit/src/lib.rs | 20 +++---- examples/README.md | 10 ++-- examples/README.md.tpl | 10 ++-- examples/android/src/lib.rs | 54 ------------------- examples/ios/Cargo.toml | 14 ----- examples/{ios => mobile}/.gitignore | 0 examples/{android => mobile}/Cargo.toml | 8 +-- examples/{ios => mobile}/Makefile | 8 +-- .../bevy_mobile_example.xcodeproj}/.gitignore | 0 .../project.pbxproj | 30 +++++------ .../xcschemes/bevy_mobile_example.xcscheme} | 18 +++---- examples/{ios => mobile}/build_rust_deps.sh | 6 +-- examples/{ios => mobile}/ios-src/Info.plist | 0 examples/{ios => mobile}/ios-src/bindings.h | 0 examples/{ios => mobile}/ios-src/main.m | 0 examples/{ios => mobile}/src/lib.rs | 2 +- 22 files changed, 73 insertions(+), 130 deletions(-) delete mode 100644 examples/android/src/lib.rs delete mode 100644 examples/ios/Cargo.toml rename examples/{ios => mobile}/.gitignore (100%) rename examples/{android => mobile}/Cargo.toml (75%) rename examples/{ios => mobile}/Makefile (57%) rename examples/{ios/bevy_ios_example.xcodeproj => mobile/bevy_mobile_example.xcodeproj}/.gitignore (100%) rename examples/{ios/bevy_ios_example.xcodeproj => mobile/bevy_mobile_example.xcodeproj}/project.pbxproj (94%) rename examples/{ios/bevy_ios_example.xcodeproj/xcshareddata/xcschemes/bevy_ios_example.xcscheme => mobile/bevy_mobile_example.xcodeproj/xcshareddata/xcschemes/bevy_mobile_example.xcscheme} (81%) rename examples/{ios => mobile}/build_rust_deps.sh (85%) rename examples/{ios => mobile}/ios-src/Info.plist (100%) rename examples/{ios => mobile}/ios-src/bindings.h (100%) rename examples/{ios => mobile}/ios-src/main.m (100%) rename examples/{ios => mobile}/src/lib.rs (98%) diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index 698e6dd0554e2..a74e50d1da2a1 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -44,7 +44,7 @@ jobs: --no-push \ --exclude ci \ --exclude errors \ - --exclude bevy-ios-example \ + --exclude bevy_mobile_example \ --exclude build-wasm-example - name: Create PR diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6ac6375b3c4ba..5bf527fcf2321 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: --dependent-version upgrade \ --exclude ci \ --exclude errors \ - --exclude bevy-ios-example \ + --exclude bevy_mobile_example \ --exclude build-wasm-example - name: Create PR diff --git a/.github/workflows/validation-jobs.yml b/.github/workflows/validation-jobs.yml index ea98a13261fab..4d306320dae00 100644 --- a/.github/workflows/validation-jobs.yml +++ b/.github/workflows/validation-jobs.yml @@ -29,7 +29,7 @@ jobs: run: rustup target add aarch64-apple-ios x86_64-apple-ios - name: Build and install iOS app in iOS Simulator. - run: cd examples/ios && make install + run: cd examples/mobile && make install build-android: runs-on: ubuntu-latest @@ -56,7 +56,7 @@ jobs: run: cargo install --force cargo-apk - name: Build APK - run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --package bevy-android-example + run: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME cargo apk build --package bevy_mobile_example run-examples-on-windows-dx12: runs-on: windows-latest diff --git a/Cargo.toml b/Cargo.toml index a95e4d531c1d5..217c71c6ee048 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,7 @@ rust-version = "1.67.0" exclude = ["benches", "crates/bevy_ecs_compile_fail_tests", "crates/bevy_reflect_compile_fail_tests"] members = [ "crates/*", - "examples/android", - "examples/ios", + "examples/mobile", "tools/ci", "tools/build-example-pages", "tools/build-wasm-example", @@ -44,6 +43,7 @@ default = [ "vorbis", "x11", "filesystem_watcher", + "android_shared_stdcxx" ] # Force dynamic linking, which improves iterative compile times @@ -118,6 +118,9 @@ debug_asset_server = ["bevy_internal/debug_asset_server"] # Enable animation support, and glTF animation loading animation = ["bevy_internal/animation"] +# Enable using a shared stdlib for cxx on Android. +android_shared_stdcxx = ["bevy_internal/android_shared_stdcxx"] + [dependencies] bevy_dylib = { path = "crates/bevy_dylib", version = "0.9.0", default-features = false, optional = true } bevy_internal = { path = "crates/bevy_internal", version = "0.9.0", default-features = false } diff --git a/crates/bevy_audio/Cargo.toml b/crates/bevy_audio/Cargo.toml index eca14a2c34ba1..8ea7dee8d63b9 100644 --- a/crates/bevy_audio/Cargo.toml +++ b/crates/bevy_audio/Cargo.toml @@ -21,6 +21,9 @@ anyhow = "1.0.4" rodio = { version = "0.16", default-features = false } parking_lot = "0.12.1" +[target.'cfg(target_os = "android")'.dependencies] +oboe = { version = "0.4", optional = true } + [target.'cfg(target_arch = "wasm32")'.dependencies] rodio = { version = "0.16", default-features = false, features = ["wasm-bindgen"] } @@ -37,3 +40,5 @@ symphonia-isomp4 = ["rodio/symphonia-isomp4"] symphonia-mp3 = ["rodio/symphonia-mp3"] symphonia-vorbis = ["rodio/symphonia-vorbis"] symphonia-wav = ["rodio/symphonia-wav"] +# Enable using a shared stdlib for cxx on Android. +android_shared_stdcxx = ["oboe/shared-stdcxx"] diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml index 522c67b4a8832..238956006f11d 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -74,6 +74,9 @@ animation = ["bevy_animation", "bevy_gltf?/bevy_animation"] # Used to disable code that is unsupported when Bevy is dynamically linked dynamic_linking = ["bevy_diagnostic/dynamic_linking"] +# Enable using a shared stdlib for cxx on Android. +android_shared_stdcxx = ["bevy_audio/android_shared_stdcxx"] + [dependencies] # bevy bevy_app = { path = "../bevy_app", version = "0.9.0" } diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 2035898a4f810..63b66c1ac3ec3 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -231,7 +231,7 @@ struct WinitPersistentState { impl Default for WinitPersistentState { fn default() -> Self { Self { - active: true, + active: false, low_power_event: false, redraw_request_sent: false, timeout_reached: false, @@ -290,7 +290,7 @@ pub fn winit_runner(mut app: App) { } } - { + if winit_state.active { #[cfg(not(target_arch = "wasm32"))] let (commands, mut new_windows, created_window_writer, winit_windows) = create_window_system_state.get_mut(&mut app.world); @@ -475,14 +475,7 @@ pub fn winit_runner(mut app: App) { } }, WindowEvent::Touch(touch) => { - let mut location = - touch.location.to_logical(window.resolution.scale_factor()); - - // On a mobile window, the start is from the top while on PC/Linux/OSX from - // bottom - if cfg!(target_os = "android") || cfg!(target_os = "ios") { - location.y = window.height() as f64 - location.y; - } + let location = touch.location.to_logical(window.resolution.scale_factor()); // Event input_events @@ -616,6 +609,13 @@ pub fn winit_runner(mut app: App) { } event::Event::Suspended => { winit_state.active = false; + #[cfg(target_os = "android")] + { + // Bevy doesn't support suspend/resume so we just exit + // and Android will restart the application on resume + // TODO: Save save some state and load on resume + *control_flow = ControlFlow::Exit; + } } event::Event::Resumed => { winit_state.active = true; diff --git a/examples/README.md b/examples/README.md index a6090ff0966e4..cfa05e8b44756 100644 --- a/examples/README.md +++ b/examples/README.md @@ -367,7 +367,7 @@ When using `NDK (Side by side)`, the environment variable `ANDROID_NDK_ROOT` mus To run on a device setup for Android development, run: ```sh -cargo apk run --example android_example +cargo apk run -p bevy_mobile_example ``` When using Bevy as a library, the following fields must be added to `Cargo.toml`: @@ -414,7 +414,7 @@ min_sdk_version = >>API or less<< Example | File | Description --- | --- | --- -`android` | [`android/android.rs`](./android/android.rs) | The `3d/3d_scene.rs` example for Android +`android` | [`mobile/src/lib.rs`](./mobile/src/lib.rs) | A 3d Scene with a button and playing sound ## iOS @@ -435,7 +435,7 @@ rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim Using bash: ```sh -cd examples/ios +cd examples/mobile make run ``` @@ -450,7 +450,7 @@ DEVICE_ID=${YOUR_DEVICE_ID} make run If you'd like to see xcode do stuff, you can run ```sh -open bevy_ios_example.xcodeproj/ +open bevy_mobile_example.xcodeproj/ ``` which will open xcode. You then must push the zoom zoom play button and wait @@ -458,7 +458,7 @@ for the magic. Example | File | Description --- | --- | --- -`ios` | [`ios/src/lib.rs`](./ios/src/lib.rs) | The `3d/3d_scene.rs` example for iOS +`ios` | [`mobile/src/lib.rs`](./mobile/src/lib.rs) | A 3d Scene with a button and playing sound ## WASM diff --git a/examples/README.md.tpl b/examples/README.md.tpl index 21e894198a7d9..19e0007274884 100644 --- a/examples/README.md.tpl +++ b/examples/README.md.tpl @@ -98,7 +98,7 @@ When using `NDK (Side by side)`, the environment variable `ANDROID_NDK_ROOT` mus To run on a device setup for Android development, run: ```sh -cargo apk run --example android_example +cargo apk run -p bevy_mobile_example ``` When using Bevy as a library, the following fields must be added to `Cargo.toml`: @@ -145,7 +145,7 @@ min_sdk_version = >>API or less<< Example | File | Description --- | --- | --- -`android` | [`android/android.rs`](./android/android.rs) | The `3d/3d_scene.rs` example for Android +`android` | [`mobile/src/lib.rs`](./mobile/src/lib.rs) | A 3d Scene with a button and playing sound ## iOS @@ -166,7 +166,7 @@ rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim Using bash: ```sh -cd examples/ios +cd examples/mobile make run ``` @@ -181,7 +181,7 @@ DEVICE_ID=${YOUR_DEVICE_ID} make run If you'd like to see xcode do stuff, you can run ```sh -open bevy_ios_example.xcodeproj/ +open bevy_mobile_example.xcodeproj/ ``` which will open xcode. You then must push the zoom zoom play button and wait @@ -189,7 +189,7 @@ for the magic. Example | File | Description --- | --- | --- -`ios` | [`ios/src/lib.rs`](./ios/src/lib.rs) | The `3d/3d_scene.rs` example for iOS +`ios` | [`mobile/src/lib.rs`](./mobile/src/lib.rs) | A 3d Scene with a button and playing sound ## WASM diff --git a/examples/android/src/lib.rs b/examples/android/src/lib.rs deleted file mode 100644 index 244027265a2cf..0000000000000 --- a/examples/android/src/lib.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::{ - prelude::*, - render::{ - settings::{WgpuSettings, WgpuSettingsPriority}, - RenderPlugin, - }, -}; - -// the `bevy_main` proc_macro generates the required android boilerplate -#[bevy_main] -fn main() { - App::new() - .add_plugins(DefaultPlugins.set(RenderPlugin { - // This configures the app to use the most compatible rendering settings. - // They help with compatibility with as many devices as possible. - wgpu_settings: WgpuSettings { - priority: WgpuSettingsPriority::Compatibility, - ..default() - }, - })) - .add_startup_system(setup) - .run(); -} - -/// set up a simple 3D scene -fn setup( - mut commands: Commands, - mut meshes: ResMut>, - mut materials: ResMut>, -) { - // plane - commands.spawn(PbrBundle { - mesh: meshes.add(Mesh::from(shape::Plane { size: 5.0 })), - material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), - ..default() - }); - // cube - commands.spawn(PbrBundle { - mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), - material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), - transform: Transform::from_xyz(0.0, 0.5, 0.0), - ..default() - }); - // light - commands.spawn(PointLightBundle { - transform: Transform::from_xyz(4.0, 8.0, 4.0), - ..default() - }); - // camera - commands.spawn(Camera3dBundle { - transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), - ..default() - }); -} diff --git a/examples/ios/Cargo.toml b/examples/ios/Cargo.toml deleted file mode 100644 index 2e2d425dd287c..0000000000000 --- a/examples/ios/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "bevy-ios-example" -version = "0.1.0" -edition = "2021" -description = "Example for building an iOS app with Bevy" -publish = false -license = "MIT OR Apache-2.0" - -[lib] -name = "bevy_ios_example" -crate-type = ["staticlib"] - -[dependencies] -bevy = { path = "../../" } diff --git a/examples/ios/.gitignore b/examples/mobile/.gitignore similarity index 100% rename from examples/ios/.gitignore rename to examples/mobile/.gitignore diff --git a/examples/android/Cargo.toml b/examples/mobile/Cargo.toml similarity index 75% rename from examples/android/Cargo.toml rename to examples/mobile/Cargo.toml index 6f8cd0074a7bf..8101ca0da6b4f 100644 --- a/examples/android/Cargo.toml +++ b/examples/mobile/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "bevy-android-example" +name = "bevy_mobile_example" version = "0.1.0" edition = "2021" -description = "Example for building an Android app with Bevy" +description = "Example for building an iOS or Android app with Bevy" publish = false license = "MIT OR Apache-2.0" [lib] -name = "bevy_android_example" -crate-type = ["cdylib"] +name = "bevy_mobile_example" +crate-type = ["staticlib", "cdylib"] [dependencies] bevy = { path = "../../" } diff --git a/examples/ios/Makefile b/examples/mobile/Makefile similarity index 57% rename from examples/ios/Makefile rename to examples/mobile/Makefile index bb5444093245f..1b12ab1d815ac 100644 --- a/examples/ios/Makefile +++ b/examples/mobile/Makefile @@ -6,19 +6,19 @@ ifndef DEVICE_ID endif run: install - xcrun simctl launch --console $(DEVICE) com.rust.bevy-ios-example + xcrun simctl launch --console $(DEVICE) com.rust.bevy_mobile_example boot-sim: xcrun simctl boot $(DEVICE) || true install: xcodebuild-simulator boot-sim - xcrun simctl install $(DEVICE) build/Build/Products/Debug-iphonesimulator/bevy_ios_example.app + xcrun simctl install $(DEVICE) build/Build/Products/Debug-iphonesimulator/bevy_mobile_example.app xcodebuild-simulator: - IOS_TARGETS=x86_64-apple-ios xcodebuild -scheme bevy_ios_example -configuration Debug -derivedDataPath build -destination "id=$(DEVICE)" + IOS_TARGETS=x86_64-apple-ios xcodebuild -scheme bevy_mobile_example -configuration Debug -derivedDataPath build -destination "id=$(DEVICE)" xcodebuild-iphone: - IOS_TARGETS=aarch64-apple-ios xcodebuild -scheme bevy_ios_example -configuration Debug -derivedDataPath build -arch arm64 + IOS_TARGETS=aarch64-apple-ios xcodebuild -scheme bevy_mobile_example -configuration Debug -derivedDataPath build -arch arm64 clean: rm -r build diff --git a/examples/ios/bevy_ios_example.xcodeproj/.gitignore b/examples/mobile/bevy_mobile_example.xcodeproj/.gitignore similarity index 100% rename from examples/ios/bevy_ios_example.xcodeproj/.gitignore rename to examples/mobile/bevy_mobile_example.xcodeproj/.gitignore diff --git a/examples/ios/bevy_ios_example.xcodeproj/project.pbxproj b/examples/mobile/bevy_mobile_example.xcodeproj/project.pbxproj similarity index 94% rename from examples/ios/bevy_ios_example.xcodeproj/project.pbxproj rename to examples/mobile/bevy_mobile_example.xcodeproj/project.pbxproj index 790312c38e20a..4ac87d8415e26 100644 --- a/examples/ios/bevy_ios_example.xcodeproj/project.pbxproj +++ b/examples/mobile/bevy_mobile_example.xcodeproj/project.pbxproj @@ -28,7 +28,7 @@ /* Begin PBXFileReference section */ 160DB77300A3F1806F024D47 /* bindings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bindings.h; sourceTree = ""; }; - 55EAC02897847195D2F44C15 /* bevy_ios_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = bevy_ios_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 55EAC02897847195D2F44C15 /* bevy_mobile_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = bevy_mobile_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 57CD6305253C7A940098CD4A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 57CD630A253C7F5F0098CD4A /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = assets; path = ../../../assets; sourceTree = ""; }; 8EE7F1E3B0303533925D7E33 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; @@ -58,7 +58,7 @@ 321F7D6A765B38E746C35105 /* Products */ = { isa = PBXGroup; children = ( - 55EAC02897847195D2F44C15 /* bevy_ios_example.app */, + 55EAC02897847195D2F44C15 /* bevy_mobile_example.app */, ); name = Products; sourceTree = ""; @@ -116,9 +116,9 @@ /* End PBXLegacyTarget section */ /* Begin PBXNativeTarget section */ - 3BDB8152E4962373181B4FE5 /* bevy_ios_example */ = { + 3BDB8152E4962373181B4FE5 /* bevy_mobile_example */ = { isa = PBXNativeTarget; - buildConfigurationList = E714A1AEAAE517C348B5BD27 /* Build configuration list for PBXNativeTarget "bevy_ios_example" */; + buildConfigurationList = E714A1AEAAE517C348B5BD27 /* Build configuration list for PBXNativeTarget "bevy_mobile_example" */; buildPhases = ( 9F13800790AD9DBC2BC0F116 /* Sources */, D5A822CB2D6847BA8800BE4C /* Frameworks */, @@ -129,9 +129,9 @@ dependencies = ( 19D4B9C22ADC6705B5132B4C /* PBXTargetDependency */, ); - name = bevy_ios_example; - productName = bevy_ios_example; - productReference = 55EAC02897847195D2F44C15 /* bevy_ios_example.app */; + name = bevy_mobile_example; + productName = bevy_mobile_example; + productReference = 55EAC02897847195D2F44C15 /* bevy_mobile_example.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ @@ -142,7 +142,7 @@ attributes = { LastUpgradeCheck = 1240; }; - buildConfigurationList = 9D43D41707A5C30B227B83F9 /* Build configuration list for PBXProject "bevy_ios_example" */; + buildConfigurationList = 9D43D41707A5C30B227B83F9 /* Build configuration list for PBXProject "bevy_mobile_example" */; compatibilityVersion = "Xcode 10.0"; developmentRegion = en; hasScannedForEncodings = 0; @@ -153,7 +153,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 3BDB8152E4962373181B4FE5 /* bevy_ios_example */, + 3BDB8152E4962373181B4FE5 /* bevy_mobile_example */, D08AEBE0B1A9C9A7B8C7B33F /* cargo_ios */, ); }; @@ -290,10 +290,10 @@ ); OTHER_LDFLAGS = ( "$(inherited)", - "-lbevy_ios_example", + "-lbevy_mobile_example", "-lc++abi", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.rust.bevy-ios-example"; + PRODUCT_BUNDLE_IDENTIFIER = "com.rust.bevy_mobile_example"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -397,10 +397,10 @@ ); OTHER_LDFLAGS = ( "$(inherited)", - "-lbevy_ios_example", + "-lbevy_mobile_example", "-lc++abi", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.rust.bevy-ios-example"; + PRODUCT_BUNDLE_IDENTIFIER = "com.rust.bevy_mobile_example"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -422,7 +422,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 9D43D41707A5C30B227B83F9 /* Build configuration list for PBXProject "bevy_ios_example" */ = { + 9D43D41707A5C30B227B83F9 /* Build configuration list for PBXProject "bevy_mobile_example" */ = { isa = XCConfigurationList; buildConfigurations = ( 4AD7BC6FDD56FF18FA6DA7D7 /* Debug */, @@ -440,7 +440,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; - E714A1AEAAE517C348B5BD27 /* Build configuration list for PBXNativeTarget "bevy_ios_example" */ = { + E714A1AEAAE517C348B5BD27 /* Build configuration list for PBXNativeTarget "bevy_mobile_example" */ = { isa = XCConfigurationList; buildConfigurations = ( A2D5B73DD30D562B6F366526 /* Debug */, diff --git a/examples/ios/bevy_ios_example.xcodeproj/xcshareddata/xcschemes/bevy_ios_example.xcscheme b/examples/mobile/bevy_mobile_example.xcodeproj/xcshareddata/xcschemes/bevy_mobile_example.xcscheme similarity index 81% rename from examples/ios/bevy_ios_example.xcodeproj/xcshareddata/xcschemes/bevy_ios_example.xcscheme rename to examples/mobile/bevy_mobile_example.xcodeproj/xcshareddata/xcschemes/bevy_mobile_example.xcscheme index e9da20104f702..21da7f3077f8e 100644 --- a/examples/ios/bevy_ios_example.xcodeproj/xcshareddata/xcschemes/bevy_ios_example.xcscheme +++ b/examples/mobile/bevy_mobile_example.xcodeproj/xcshareddata/xcschemes/bevy_mobile_example.xcscheme @@ -15,9 +15,9 @@ + BuildableName = "bevy_mobile_example.app" + BlueprintName = "bevy_mobile_example" + ReferencedContainer = "container:bevy_mobile_example.xcodeproj"> @@ -45,9 +45,9 @@ + BuildableName = "bevy_mobile_example.app" + BlueprintName = "bevy_mobile_example" + ReferencedContainer = "container:bevy_mobile_example.xcodeproj"> @@ -62,9 +62,9 @@ + BuildableName = "bevy_mobile_example.app" + BlueprintName = "bevy_mobile_example" + ReferencedContainer = "container:bevy_mobile_example.xcodeproj"> diff --git a/examples/ios/build_rust_deps.sh b/examples/mobile/build_rust_deps.sh similarity index 85% rename from examples/ios/build_rust_deps.sh rename to examples/mobile/build_rust_deps.sh index 7714d6c6f851c..2914faad5c0d0 100755 --- a/examples/ios/build_rust_deps.sh +++ b/examples/mobile/build_rust_deps.sh @@ -40,16 +40,16 @@ for arch in $ARCHS; do # Intel iOS simulator export CFLAGS_x86_64_apple_ios="-target x86_64-apple-ios" - cargo build --lib $RELFLAG --target x86_64-apple-ios + cargo rustc --crate-type staticlib --lib $RELFLAG --target x86_64-apple-ios ;; arm64) if [ $IS_SIMULATOR -eq 0 ]; then # Hardware iOS targets - cargo build --lib $RELFLAG --target aarch64-apple-ios + cargo rustc --crate-type staticlib --lib $RELFLAG --target aarch64-apple-ios else # M1 iOS simulator -- currently in Nightly only and requires to build `libstd` - cargo build --lib $RELFLAG --target aarch64-apple-ios-sim + cargo rustc --crate-type staticlib --lib $RELFLAG --target aarch64-apple-ios-sim fi esac done diff --git a/examples/ios/ios-src/Info.plist b/examples/mobile/ios-src/Info.plist similarity index 100% rename from examples/ios/ios-src/Info.plist rename to examples/mobile/ios-src/Info.plist diff --git a/examples/ios/ios-src/bindings.h b/examples/mobile/ios-src/bindings.h similarity index 100% rename from examples/ios/ios-src/bindings.h rename to examples/mobile/ios-src/bindings.h diff --git a/examples/ios/ios-src/main.m b/examples/mobile/ios-src/main.m similarity index 100% rename from examples/ios/ios-src/main.m rename to examples/mobile/ios-src/main.m diff --git a/examples/ios/src/lib.rs b/examples/mobile/src/lib.rs similarity index 98% rename from examples/ios/src/lib.rs rename to examples/mobile/src/lib.rs index f7474b37433a5..76651e24e1767 100644 --- a/examples/ios/src/lib.rs +++ b/examples/mobile/src/lib.rs @@ -1,6 +1,6 @@ use bevy::{input::touch::TouchPhase, prelude::*, window::WindowMode}; -// the `bevy_main` proc_macro generates the required ios boilerplate +// the `bevy_main` proc_macro generates the required boilerplate for iOS and Android #[bevy_main] fn main() { App::new()