Skip to content

Commit

Permalink
fix build native (Rust) library for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
lexfrl committed Oct 11, 2018
1 parent c8c7435 commit 90dbafe
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions rust/signer/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NDK_STANDALONE = $(shell pwd)/../../NDK
ARCHS_IOS = i386-apple-ios x86_64-apple-ios armv7-apple-ios armv7s-apple-ios aarch64-apple-ios
ARCHS_ANDROID = aarch64-linux-android armv7-linux-androideabi i686-linux-android
LIB=libsigner.a
Expand All @@ -13,9 +14,23 @@ android: $(ARCHS_ANDROID)
$(ARCHS_IOS): %:
cargo build --target $@ --release --no-default-features

.PHONY: $(ARCHS_ANDROID)
$(ARCHS_ANDROID): %:
aarch64-linux-android:
PATH=$(PATH):$(NDK_STANDALONE)/arm64/bin \
CC=$@-gcc \
CXX=$@-g++ \
cargo build --target $@ --release

armv7-linux-androideabi:
PATH=$(PATH):$(NDK_STANDALONE)/arm/bin \
CC=arm-linux-androideabi-gcc \
CXX=arm-linux-androideabi-g++ \
cargo build --target $@ --release

i686-linux-android:
PATH=$(PATH):$(NDK_STANDALONE)/x86/bin \
CC=i686-linux-android-gcc \
CXX=i686-linux-android-g++ \
cargo build --target $@ --release --lib

$(LIB): $(ARCHS_IOS)
lipo -create -output $@ $(foreach arch,$(ARCHS_IOS),$(wildcard target/$(arch)/release/$(LIB)))

0 comments on commit 90dbafe

Please sign in to comment.