-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
An initial xcode setup for using xcode #539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this "looks" good to me, but I unfortunately don't have an iOS device to test on or iOS dev experience. I'd like at least one review from someone else with iOS dev experience and an iOS device to test with.
Yeah. I kind of like the way that the winit project has testers and maintainers for the different platforms. Maybe @francesca64 also has some interest in a review? |
@MichaelHills or @naithar, thoughts? |
28446bf
to
d2c2a7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building this now... will report back later after it runs.
FWIW I haven't been using cargo lipo
lately. A universal binary is a slower dev cycle, so I have my own script that I run like:
./build-ios.sh sim
./build-ios.sh ios
./build.sh # this is a universal binary
looks like this
$ cat build-ios.sh
#!/usr/bin/env bash
set -eo pipefail
if [ "$1" == "ios" ]; then
TARGET="aarch64-apple-ios"
cargo build --target $TARGET
elif [ "$1" == "sim" ]; then
TARGET="x86_64-apple-ios"
cargo build --target $TARGET
else
TARGET=universal
cargo lipo
fi
cp target/$TARGET/debug/libcallisto.a ../ios/Callisto/callisto-rs/libs/libcallisto.a
#cbindgen src/lib.rs -l c >../ios/Callisto/callisto-rs/include/callisto-rs.h
This improves the window size. If you start in portrait and then go to landscape it looks good. Once I land rust-windowing/winit#1703 then you can boot in landscape or lock to landscape and have it work properly.
|
Oh and thanks for chipping in @simlay ! |
Yeah, I definitely want something like that. I'll see if I can get an environment variable to pass through using xcode and using the make script. Xcode I think has a tendency to squash environment variables. Also, Unrelated to this example, I also see your commented |
deb4ec5
to
64cfa6d
Compare
Yeah I wasn't too sure about the overhead of lipo. My compile times are already kinda slow (MBP 2013) so just doing what I can to trim it down. I experimented a bit because I noticed release builds were faster than debug builds. I think I'm using debug=1 and opt=1 or something atm and the faster linker.
I actually don't really need this anymore, just the first time. :) It's really just a file with a forward declaration of my Just a couple more notes, not for this PR, but maybe in a follow up when we improve the example with touch or something. We should add some assets in because it took me a bit to realise the right way to do it. Originally I dropped files into my xcode project, and then xcode "optimized" the pngs breaking them to be not valid pngs and bevy failed to load them. After some time I finally figured out to turn off png optimization in the xcode project settings. On a later attempt, so that I didn't need to keep adding assets in, I added in the assets folder as a folder reference. That worked much better, and xcode doesn't try to optimize them, so it "just works". Anyway this change is looking pretty good now. I'll test it out again tomorrow night. |
Awesome work. I'm down to merge this once @MichaelHills' last comment is taken care of and merge conflicts are resolved. |
@MichaelHills I tried it with my Xcode and iPhone and it worked. Maybe something is up with your path? The build script does assume you use |
Somehow I had this in
I cleared out the garbage rust install I had in there, apparently from 6 years ago. I must've installed it back then to have a play.
WOW did you solve the This is amazing, now iOS builds straight out of the box. Awesome work @simlay ! Everything runs great. Let's land this! Just one last thing, if you feel like it :) this cleans up all of the Xcode project warnings
|
crates/bevy_render/Cargo.toml
Outdated
@@ -49,7 +49,7 @@ parking_lot = "0.11.0" | |||
bevy-glsl-to-spirv = "0.1.7" | |||
|
|||
[target.'cfg(target_os = "ios")'.dependencies] | |||
shaderc = "0.6.2" | |||
shaderc = { git = "https://github.com/google/shaderc-rs", branch = "master"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cart I remember reading that you didn't want git dependencies because it blocks crates.io releases, so does that mean we can't land this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has a crate anyways why not just switch it to the crate https://crates.io/crates/shaderc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simlay landed a commit on shaderc-rs
master a few days ago to fix the build for iOS. We would need a new release or a tmp_cart_shaderc
kinda thing until the next release comes out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I have no problem publishing tmp versions of crates if we need to, but we should ask the shaderc-rs folks if they're willing to cut a release first. If there isn't a new release by the time we drop bevy 0.3
, we can commit to using a tmp crate. I'm down to use a tmp crate in master in the short term as well, just so we can get this merged
Winit just released 0.23.0. I think that means we can have nice landscaped rendering now right? |
Relevant pr: #617 |
I tested the winit upgrade, landscape issues are sorted. So now you can lock your app to landscape and it works properly, or not lock it and start your app with your phone in a horizontal position. 👍 @cart @simlay what's the process for asking shaderc-rs to do a release? and/or what's the process for using a tmp crate? I'm new to both Rust and open source so not sure how things work around here. |
Brilliant. I do want to move forward on this / not let it stagnate, but before publishing a "temp crate" I want to ask shaderc-rs what their release plan is. Lets give them a day to respond and if they don't (or their next release will take too much time) then I'll publish a temp crate. @MichaelHills theres no hard and fast rule here / it will vary by project. The simple answer is to try being as respectful as possible and never make demands. In this case I would probably try to find the best way to directly contact one of the project's maintainers (ex: the project's discord) and if that line of communication can't be found, open an issue in the repo explaining our project / situation. I couldn't find a direct way to contact the maintainer using information in their project's readme or their github profile, so I think creating an issue is the right call. If you would prefer it if I opened the issue, let me know. |
@simlay looks like |
I think so! I have a macbook so I'll try to give this a test run in the simulator. I've never done that before so this will be an adventure :) |
Alrighty with the latest changes (and a fix to the Transform error) I can get all the way to the end of the process. Everything builds, but then the simulator fails with this:
|
Thats when using this device: iPhone 11 (E2FBD54D-D1A0-421F-99D8-07D29E2C0600) (Booted) |
Hmm. Weird, I'll play with it some more. |
Try |
Oh sorry, that was a different error. This not the metal thing. Yeah will check it out on the weekend. |
@cart I looked at the stack trace again, it is actually the metal thing, |
Once comments are addressed I think this is good to go. Great work! |
Hi, I notice there's quite a lot of recent traction with Bevy and wanted to help out with some of the annoying Xcode stuff for #87. I've made it a draft PR because some of this is dependent on google/shaderc-rs#83. I actually got a lot of this project layout originally is from @Gordon-F's gfx hal example and generated the xcode project using
xcodegen
.For the current ios example, I've just copied the source from 3d_scene. Ideally, there'd be multiple targets or something that one could choose from in the Xcode GUI to actually build and run/test but that sounds like a lot of work.
Here's what it looks like:
I've tested that this iOS CI actually runs/works here: https://github.com/bevyengine/bevy/runs/1152527269, the only difference between the workflow files is the removal of:
I don't think the cron CI will run when it's just a PR but I'm not sure.