mirror of
https://github.com/bevyengine/bevy
synced 2024-11-27 07:00:18 +00:00
ccee658436
# Objective - iOS CI has linker issues https://github.com/bevyengine/bevy/runs/4388921574?check_suite_focus=true ## Solution - Building for iOS actually requires ~~both iOS SDK for target and~~ macOS SDK for build scripts. ~~I added them both when needed~~ I replaced the iOS SDK with the maOS. This was not an issue on m1 as they are compatible enough to make the build pass. - This completely confused `shader-sys` which fails to build in this configuration. Luckily as the example now uses the new renderer, I was able to remove the old renderer and depend no more on this lib. This is confirmed to work: - on intel mac with simulator - on m1 mac with simulator - on m1 mac with real iphone
55 lines
1.6 KiB
Bash
Executable file
55 lines
1.6 KiB
Bash
Executable file
#!/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 build --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
|
|
else
|
|
# M1 iOS simulator -- currently in Nightly only and requires to build `libstd`
|
|
cargo build --lib $RELFLAG --target aarch64-apple-ios-sim
|
|
fi
|
|
esac
|
|
done
|