YrXtals/scripts/ios/xcodeproj.sh

37 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
cd "$ROOT"
if ! command -v xcodegen >/dev/null 2>&1; then
echo "xcodegen not found. install with:" >&2
echo " brew install xcodegen" >&2
exit 1
fi
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export IPHONEOS_DEPLOYMENT_TARGET=17.0
echo "Building Rust staticlibs for both iOS targets (release)..."
cargo build --release --target aarch64-apple-ios --lib
cargo build --release --target aarch64-apple-ios-sim --lib
mkdir -p "$ROOT/target"
[ -L "$ROOT/target/iphoneos" ] || ln -sf "/tmp/yr_crystals-target/aarch64-apple-ios" "$ROOT/target/iphoneos"
[ -L "$ROOT/target/iphonesimulator" ] || ln -sf "/tmp/yr_crystals-target/aarch64-apple-ios-sim" "$ROOT/target/iphonesimulator"
bash "$ROOT/scripts/ios/generate-icons.sh"
cd "$ROOT/ios"
echo "Generating YrXtals.xcodeproj..."
xcodegen generate
echo
echo "Generated: $ROOT/ios/YrXtals.xcodeproj"
echo "Open with: open $ROOT/ios/YrXtals.xcodeproj"
echo
echo "Build/run from xcode: pick a destination (an iPad or a sim) and hit Cmd+R."
echo "After changing Rust code, re-run this command to rebuild the staticlibs."