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

Ios support #61

Merged
merged 36 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4c8fe1d
ios setup
NiklasEi Jul 17, 2023
bd343ca
rename scheme
NiklasEi Jul 17, 2023
cd7f159
fix assets path
NiklasEi Jul 17, 2023
9d87e29
try correcting target path
NiklasEi Jul 17, 2023
443f9ae
Ignore more ios build files
NiklasEi Jul 17, 2023
842fc3c
Working xbuild manifest for android
NiklasEi Jul 21, 2023
15fd05d
Update README.md
NiklasEi Jul 21, 2023
8227473
Try pointing to correct so lib
NiklasEi Jul 21, 2023
1137ab8
Point to xcode project
NiklasEi Jul 22, 2023
05bfa3e
Fix nothing rendering on iOS
NiklasEi Jul 24, 2023
d76febb
Extend release workflow for android and iOS
NiklasEi Jul 24, 2023
5d0c9b9
Fix res path for android
NiklasEi Jul 24, 2023
fd4ce84
Build iOS in release configuration
NiklasEi Jul 24, 2023
4906524
Workflow to release to testflight
NiklasEi Jul 24, 2023
e70601e
Set CFBundleIconName
NiklasEi Jul 25, 2023
cf89f65
Add asset catalog for ios app icon
NiklasEi Jul 25, 2023
4c982c2
Add a launch screen storyboard which finally allows uploading to the …
NiklasEi Jul 25, 2023
2773946
Stop creating releases/tags using the branch name
NiklasEi Jul 25, 2023
f5592aa
Try ios upload without certificate and provisioning profile
NiklasEi Jul 25, 2023
d45f421
Add certificate and provisioning profile
NiklasEi Jul 25, 2023
a9440ad
Try to configure the correct provisioning profile
NiklasEi Jul 25, 2023
16533a5
Rename provisioning profile
NiklasEi Jul 26, 2023
bf6ac0b
Merge branch 'main' of github.com:NiklasEi/bevy_game_template into io…
NiklasEi Jul 26, 2023
4e1aa51
Use internal provisioning profile name
NiklasEi Jul 26, 2023
f0a41a8
Use internal provisioning profile name with PROVISIONING_PROFILE
NiklasEi Jul 26, 2023
11562f5
Rename profile
NiklasEi Jul 26, 2023
eaf154f
Show provisioning profile
NiklasEi Jul 26, 2023
5a34a5f
Use runner context for temp directory and create private_keys directory
NiklasEi Jul 26, 2023
4745c15
Fix ipa name
NiklasEi Jul 26, 2023
ad77da6
Upload ipa artifact after export
NiklasEi Jul 26, 2023
7a6bee4
Update versions to lib version
NiklasEi Jul 26, 2023
519d03a
Upload archive and release correct ipa
NiklasEi Jul 26, 2023
67afbff
Configure provisioning profile for archive and explicitly tell xcodeb…
NiklasEi Jul 26, 2023
e67243a
Get and use provisioning profile uuid
NiklasEi Jul 26, 2023
217f75b
Clean up working workflow
NiklasEi Jul 26, 2023
ce57fc4
Improve selection of device UUID
NiklasEi Jul 26, 2023
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: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ _Since Bevy is in heavy development, there regularly are unpublished new feature
4. Start coding :tada:
* Start the native app: `cargo run`
* Start the web build: `trunk serve`
* requires [trunk]: `cargo install --locked trunk`
* requires `wasm32-unknown-unknown` target: `rustup target add wasm32-unknown-unknown`
* this will serve your app on `8080` and automatically rebuild + reload it after code changes
* requires [trunk]: `cargo install --locked trunk`
* requires `wasm32-unknown-unknown` target: `rustup target add wasm32-unknown-unknown`
* this will serve your app on `8080` and automatically rebuild + reload it after code changes
* Start the android app: `cargo apk run -p mobile` (update the library name if you changed it)
* check the [bevy example readme for android setup instructions][android-instructions]
* check the [bevy example readme for android setup instructions][android-instructions]
* Start the iOS app: run `make run` inside the `/mobile` directory
* check the [bevy example readme for ios setup instructions][ios-instructions]
NiklasEi marked this conversation as resolved.
Show resolved Hide resolved

You should keep the `credits` directory up to date. The release workflow automatically includes the directory in every build.

Expand Down Expand Up @@ -74,3 +76,4 @@ This project is licensed under [CC0 1.0 Universal](LICENSE) except some content
[`wasm-server-runner`]: https://github.com/jakobhellermann/wasm-server-runner
[trunk]: https://trunkrs.dev/
[android-instructions]: https://github.com/bevyengine/bevy/blob/latest/examples/README.md#setup
[ios-instructions]: https://github.com/bevyengine/bevy/blob/latest/examples/README.md#setup-1
3 changes: 3 additions & 0 deletions mobile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mobile.xcodeproj/xcuserdata/
mobile.xcodeproj/project.xcworkspace/
build/
26 changes: 26 additions & 0 deletions mobile/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: xcodebuild run install boot-sim generate clean

DEVICE = ${DEVICE_ID}
ifndef DEVICE_ID
DEVICE=$(shell xcrun simctl list devices 'iOS' | grep -v 'unavailable' | grep -v '^--' | grep -v '==' | head -n 1 | cut -d ' ' -f 7 | sed 's/[()]//g')
NiklasEi marked this conversation as resolved.
Show resolved Hide resolved
endif

run: install
# Todo: change the bundle identifier (then remove this comment :P)
xcrun simctl launch --console $(DEVICE) me.nikl.bevygame

boot-sim:
xcrun simctl boot $(DEVICE) || true

install: xcodebuild-simulator boot-sim
xcrun simctl install $(DEVICE) build/Build/Products/Debug-iphonesimulator/mobile.app

xcodebuild-simulator:
IOS_TARGETS=x86_64-apple-ios xcodebuild -scheme mobile -configuration Debug -derivedDataPath build -destination "id=$(DEVICE)"

xcodebuild-iphone:
IOS_TARGETS=aarch64-apple-ios xcodebuild -scheme mobile -configuration Debug -derivedDataPath build -arch arm64

clean:
rm -r build
cargo clean
55 changes: 55 additions & 0 deletions mobile/build_rust_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

# based on https://github.com/mozilla/glean/blob/main/build-scripts/xc-universal-binary.sh

set -eux

PATH=$PATH:$HOME/.cargo/bin

RELFLAG=
if [[ "$CONFIGURATION" != "Debug" ]]; then
RELFLAG=--release
fi

set -euvx

if [[ -n "${DEVELOPER_SDK_DIR:-}" ]]; then
# Assume we're in Xcode, which means we're probably cross-compiling.
# In this case, we need to add an extra library search path for build scripts and proc-macros,
# which run on the host instead of the target.
# (macOS Big Sur does not have linkable libraries in /usr/lib/.)
export LIBRARY_PATH="${DEVELOPER_SDK_DIR}/MacOSX.sdk/usr/lib:${LIBRARY_PATH:-}"
fi

# add homebrew bin path, as it's the most commonly used package manager on macOS
# this is needed for cmake on apple arm processors as it's not available by default
export PATH="$PATH:/opt/homebrew/bin"

IS_SIMULATOR=0
if [ "${LLVM_TARGET_TRIPLE_SUFFIX-}" = "-simulator" ]; then
IS_SIMULATOR=1
fi

for arch in $ARCHS; do
case "$arch" in
x86_64)
if [ $IS_SIMULATOR -eq 0 ]; then
echo "Building for x86_64, but not a simulator build. What's going on?" >&2
exit 2
fi

# Intel iOS simulator
export CFLAGS_x86_64_apple_ios="-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 rustc --crate-type staticlib --lib $RELFLAG --target aarch64-apple-ios
else
# M1 iOS simulator -- currently in Nightly only and requires to build `libstd`
cargo rustc --crate-type staticlib --lib $RELFLAG --target aarch64-apple-ios-sim
fi
esac
done
33 changes: 33 additions & 0 deletions mobile/ios-src/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<false/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</dict>
</plist>
1 change: 1 addition & 0 deletions mobile/ios-src/bindings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
void main_rs(void);
6 changes: 6 additions & 0 deletions mobile/ios-src/main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import "bindings.h"

int main() {
main_rs();
return 0;
}
Loading