Skip to content

Commit

Permalink
PATH_TO_IOS_REPO is environment variable (#52)
Browse files Browse the repository at this point in the history
* PATH_TO_IOS_REPO is environment variable

* [#37] Cleanup

* [#37] Code formatting
  • Loading branch information
duskoo authored Jun 6, 2020
1 parent 3fbc198 commit 95f90a1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions scripts/ios/create_ios_universal.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
#!/bin/bash

# Requirements:
# Requirements:
# 1. https://github.com/getditto/rust-bitcode
# 2. libtool
# See https://github.com/Co-Epi/app-backend-rust/wiki/Building-library-for-iOS

if test -z "$PATH_TO_IOS_REPO"; then
echo "Environment variable PATH_TO_IOS_REPO not set. Please set the variable using: 'export PATH_TO_IOS_REPO=<your_path_here>'"
exit 1
else
echo "\$PATH_TO_IOS_REPO is $PATH_TO_IOS_REPO"
if [ -d "$PATH_TO_IOS_REPO" ]; then
echo "Will copy files to ${PATH_TO_IOS_REPO}..."
else
echo "Error: ${PATH_TO_IOS_REPO} not found. Make sure that you have checked out the iOS project and that the path specified in PATH_TO_IOS_REPO environment variable is correct"
exit 1
fi
fi

RUSTFLAGS="-Z embed-bitcode" cargo +ios-arm64 build --target aarch64-apple-ios --release --lib
cargo build --target=x86_64-apple-ios --release

libtool -static -o ./target/CoEpiCore ./target/aarch64-apple-ios/release/libcoepi_core.a ./target/x86_64-apple-ios/release/libcoepi_core.a

# Overwrite library in iOS app (downloaded with Carthage) with local build.

PATH_TO_IOS_REPO="<insert path>"

PATH_TO_CARTHAGE_FRAMEWORK=$PATH_TO_IOS_REPO/Carthage/Build/iOS/CoEpiCore.framework
cp ./target/CoEpiCore $PATH_TO_CARTHAGE_FRAMEWORK/Versions/A/
cp ./src/ios/c_headers/coepicore.h $PATH_TO_CARTHAGE_FRAMEWORK/Versions/A/Headers/

0 comments on commit 95f90a1

Please sign in to comment.