-
Notifications
You must be signed in to change notification settings - Fork 7
/
Android.mk
31 lines (29 loc) · 1.35 KB
/
Android.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
MY_COLDCLEAR_LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(MY_COLDCLEAR_LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := CCloader
LOCAL_MODULE_FILENAME := CCloader
CCNAME := cold_clear-$(TARGET_ARCH_ABI)
$(MY_COLDCLEAR_LOCAL_PATH)/$(CCNAME).c:
cargo install cargo-ndk
case $(TARGET_ARCH_ABI) in \
armeabi-v7a) rustup target add armv7-linux-androideabi;; \
arm64-v8a) rustup target add aarch64-linux-android;; \
x86_64) rustup target add x86_64-linux-android;; \
*) echo unsupported platform $(TARGET_ARCH_ABI); exit 1;; \
esac
cd $(@D)/cold-clear && ANDROID_NDK_HOME=$(ANDROID_NDK_ROOT) ANDROID_NDK_PATH=$(ANDROID_NDK_ROOT) NDK_HOME=$(ANDROID_NDK_ROOT) cargo ndk -t $(TARGET_ARCH_ABI) --platform `echo $(TARGET_PLATFORM) | sed s/android-//g` build -p c-api --release
cp $(@D)/cold-clear/target/*/release/libcold_clear.a $(@D)/lib$(CCNAME).a
cd $(@D)/cold-clear && cargo clean
touch $@
.PHONY: $(MY_COLDCLEAR_LOCAL_PATH)/$(CCNAME).c
LOCAL_SRC_FILES := cold_clear_wrapper.c $(CCNAME).c
LOCAL_LDFLAGS := $(MY_COLDCLEAR_LOCAL_PATH)/lib$(CCNAME).a -Wl,--hash-style=both
LOCAL_C_INCLUDES := $(MY_COLDCLEAR_LOCAL_PATH)/cold-clear/c-api
ifneq ($(MY_COLDCLEAR_STANDALONE),yes)
LOCAL_SHARED_LIBRARIES := liblove
else
LOCAL_LDFLAGS += -L$(LOVE_HOME)/lib/$(TARGET_ARCH_ABI) -llove
LOCAL_C_INCLUDES += $(MY_COLDCLEAR_LOCAL_PATH)/include
endif
include $(BUILD_SHARED_LIBRARY)