ios build and clean up macos

This commit is contained in:
John Smith
2022-01-30 21:28:27 -05:00
parent b33b19358c
commit 4bdcbbdec9
14 changed files with 607 additions and 501 deletions

View File

@@ -1,15 +1,30 @@
#!/bin/bash
# Setup varaiables
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
FLUTTER_DIR=$(dirname `which flutter`)
HOMEBREW_DIR=$(dirname `which brew`)
CARGO_DIR=$(dirname `which cargo`)
CARGO_MANIFEST_PATH=$(python -c "import os; print(os.path.realpath(\"$SCRIPTDIR/Cargo.toml\"))")
# echo CARGO_MANIFEST_PATH: $CARGO_MANIFEST_PATH
TARGET_DIR=$(dirname `cargo locate-project --message-format plain`)/target
# Configure outputs
OUTPUT_FILENAME=libveilid_flutter.a
OUTPUT_DIR=$TARGET_DIR/ios_lib
# Get Rust configurations from xcode configurations
if [ "$CONFIGURATION" == "Debug" ]; then
EXTRA_CARGO_OPTIONS="$@"
RUST_CONFIGURATION="debug"
else
EXTRA_CARGO_OPTIONS="$@ --release"
RUST_CONFIGURATION="release"
fi
# Build all the matching architectures for the xcode configurations
ARCHS=${ARCHS:=arm64}
echo ARCHS: $ARCHS
LIPO_LIST=""
for arch in $ARCHS
do
if [ "$arch" == "arm64" ]; then
@@ -24,9 +39,14 @@ do
echo Unsupported ARCH: $arch
continue
fi
FLUTTER_DIR=$(dirname `which flutter`)
HOMEBREW_DIR=$(dirname `which brew`)
CARGO_DIR=$(dirname `which cargo`)
# Cargo build
env -i PATH=/usr/bin:/bin:/usr/local/bin:$HOMEBREW_DIR:$FLUTTER_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH
# Add output to lipo list
LIPO_LIST="$LIPO_LIST $TARGET_DIR/$CARGO_TARGET/$RUST_CONFIGURATION/$OUTPUT_FILENAME"
done
# Lipo the architectures together
mkdir -p $OUTPUT_DIR
lipo -output "$OUTPUT_DIR/$OUTPUT_FILENAME" -create $LIPO_LIST

View File

@@ -10,7 +10,7 @@ TARGET_DIR=$(dirname `cargo locate-project --message-format plain`)/target
# Configure outputs
OUTPUT_FILENAME=libveilid_flutter.dylib
OUTPUT_DIR=$SCRIPTDIR/../macos/lib
OUTPUT_DIR=$TARGET_DIR/macos_lib
# Get Rust configurations from xcode configurations
if [ "$CONFIGURATION" == "Debug" ]; then

File diff suppressed because one or more lines are too long