Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #112 from c4dt/add_arm
Browse files Browse the repository at this point in the history
Support ARM macs
  • Loading branch information
ineiti authored Nov 9, 2022
2 parents e925f0d + 22e7a21 commit 301f167
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ios-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ jobs:
toolchain: stable
target: aarch64-apple-ios

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: aarch64-apple-ios-sim

- name: Build XCFramework
run: |
make build-ios
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Ignore IDE files.
.idea/

# Generated by Cargo
# will have compiled files and executables
debug/
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.4.5 - 2022/11/09
* Support ARM Macs

0.4.4 - 2022/08/26
* Moving back version-# in Cargo.toml to 0.4.4

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lightarti-rest"
version = "0.4.4"
version = "0.4.5"
authors = [
"Linus Gasser <linus.gasser@epfl.ch>",
"Laurent Girod <laurent.girod@epfl.ch>",
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ The code is licensed under the MIT license.
- Christian Grigis, C4DT
- Laurent Girod, SPRING Lab, EPFL

External contributors:
- Benjamin Erhart, https://github.com/tladesignz

Analysis and design by:

- Wouter Lueks, SPRING Lab, EPFL
Expand Down
49 changes: 41 additions & 8 deletions ios/build_xcf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,55 @@ if [ "$MODE" = "release" ]; then
fi

XCFRAMEWORK_ARGS=""
ARCHS="x86_64-apple-ios aarch64-apple-ios"
if [ "$1" = dev ]; then
ARCHS=x86_64-apple-ios
fi

for arch in $ARCHS; do
cargo build --target $arch $MODEFLAG
tdir=../target/$arch/$MODE
function build {
cargo build --target $1 $MODEFLAG
}

function create_universal {
tdir=../target/universal/$MODE

rm -rf $tdir
mkdir -p $tdir

lipo -create \
-arch x86_64 ../target/$1/$MODE/liblightarti_rest.a \
-arch arm64 ../target/$2/$MODE/liblightarti_rest.a \
-output $tdir/liblightarti_rest.a
}

function prepare_target {
tdir=../target/$1/$MODE
hdir=$tdir/lightarti-rest

rm -rf $hdir
mkdir -p $hdir

cp lightarti-rest.h module.modulemap $hdir

XCFRAMEWORK_ARGS="${XCFRAMEWORK_ARGS} -library $tdir/liblightarti_rest.a"
XCFRAMEWORK_ARGS="${XCFRAMEWORK_ARGS} -headers $hdir"
done
}

# Build x86 simulator target (for Intel Macs).
build x86_64-apple-ios

# Build ARM simulator target (for ARM Macs).
build aarch64-apple-ios-sim

# Create universal binary library for simulators.
create_universal x86_64-apple-ios aarch64-apple-ios-sim

# Copy headers and configure xcodebuild.
prepare_target universal

# Build iOS target.
build aarch64-apple-ios

# Copy headers and configure xcodebuild.
prepare_target aarch64-apple-ios

# Build xcframework package.
XCFFILE=lightarti-rest.xcframework
rm -rf $XCFFILE
xcodebuild -create-xcframework $XCFRAMEWORK_ARGS -output $XCFFILE

0 comments on commit 301f167

Please sign in to comment.