Issue
in ndk, I want to build library with the same MODULE name for different ABI from different source file.
I have two sources under dir: armeabi-v7a and arm64-v8a
Here is my Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := session
LOCAL_SRC_FILES := armeabi-v7a/libsession.so
TARGET_ARCH_ABI := armeabi-v7a
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := session
LOCAL_SRC_FILES := arm64-v8a/libsession.so
TARGET_ARCH_ABI := arm64-v8a
include $(PREBUILT_SHARED_LIBRARY)
Here is my Application.mk:
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a arm64-v8a
APP_PLATFORM := android-21
but failes:
Android NDK: Trying to define local module 'session' in jni/Android.mk.
Android NDK: But this module was already defined by jni/Android.mk.
How to achieve that?
Solution
The simplest way would be to use the fact that your .so file appear to be located in subdirectories named after the ABI:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := session
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libsession.so
include $(PREBUILT_SHARED_LIBRARY)
If that hadn't been the case you could've checked the value of TARGET_ARCH_ABI
and acted accordingly. For example:
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_SRC_FILES := foo/libfoo.so
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_SRC_FILES := bar/libbar.so
endif
There's no need to set TARGET_ARCH_ABI
yourself - it's set for you by the build system.
Answered By - Michael
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.