clean up mac build
This commit is contained in:
parent
ccfde9977f
commit
b33b19358c
@ -1,10 +1,18 @@
|
||||
#!/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\"))")
|
||||
TARGET_DIR=$(dirname `cargo locate-project --message-format plain`)/target
|
||||
# echo CARGO_MANIFEST_PATH: $CARGO_MANIFEST_PATH
|
||||
|
||||
# Configure outputs
|
||||
OUTPUT_FILENAME=libveilid_flutter.dylib
|
||||
OUTPUT_DIR=$SCRIPTDIR/../macos/lib
|
||||
|
||||
# Get Rust configurations from xcode configurations
|
||||
if [ "$CONFIGURATION" == "Debug" ]; then
|
||||
EXTRA_CARGO_OPTIONS="$@"
|
||||
RUST_CONFIGURATION="debug"
|
||||
@ -12,8 +20,11 @@ else
|
||||
EXTRA_CARGO_OPTIONS="$@ --release"
|
||||
RUST_CONFIGURATION="release"
|
||||
fi
|
||||
|
||||
# Build all the matching architectures for the xcode configurations
|
||||
ARCHS=${ARCHS:=x86_64}
|
||||
echo ARCHS: $ARCHS
|
||||
LIPO_LIST=""
|
||||
for arch in $ARCHS
|
||||
do
|
||||
if [ "$arch" == "arm64" ]; then
|
||||
@ -28,15 +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
|
||||
# xxx add to lipo list?
|
||||
|
||||
# Add output to lipo list
|
||||
LIPO_LIST="$LIPO_LIST $TARGET_DIR/$CARGO_TARGET/$RUST_CONFIGURATION/$OUTPUT_FILENAME"
|
||||
done
|
||||
|
||||
OUTPUT_DIR=$SCRIPTDIR/../macos/lib
|
||||
# Lipo the architectures together
|
||||
mkdir -p $OUTPUT_DIR
|
||||
# xxx use lipo library?
|
||||
cp $TARGET_DIR/x86_64-apple-darwin/$RUST_CONFIGURATION/libveilid_flutter.dylib $OUTPUT_DIR
|
||||
|
||||
lipo -output "$OUTPUT_DIR/$OUTPUT_FILENAME" -create $LIPO_LIST
|
||||
|
Loading…
Reference in New Issue
Block a user