ndk: Add a test to check that prebuilt libraries work as expected.
Change-Id: I7c0683ac1ee50bb62cc0f7ac22e839f749ec1cdf
This commit is contained in:
31
ndk/tests/prebuilt-library/jni/Android.mk
Normal file
31
ndk/tests/prebuilt-library/jni/Android.mk
Normal file
@@ -0,0 +1,31 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# Define BUILD_FOO=1 to rebuild libfoo.so from scratch, then
|
||||
# copy obj/local/armeabi/libfoo.so to jni/libfoo.so
|
||||
#
|
||||
ifneq ($(BUILD_FOO),)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := foo
|
||||
LOCAL_SRC_FILES := foo/foo.c
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/foo
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
else # not build libfoo.so, trying to use PREBUILT_SHARED_LIBRARY instead.
|
||||
|
||||
# Note: the module is named foo-prebuilt, but the library is libfool.so !
|
||||
#
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := foo-prebuilt
|
||||
LOCAL_SRC_FILES := $(LOCAL_PATH)/libfoo.so
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := foo-user
|
||||
LOCAL_SRC_FILES := foo-user.c
|
||||
LOCAL_PREBUILTS := foo-prebuilt
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
endif
|
||||
6
ndk/tests/prebuilt-library/jni/foo-user.c
Normal file
6
ndk/tests/prebuilt-library/jni/foo-user.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "foo.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return foo();
|
||||
}
|
||||
6
ndk/tests/prebuilt-library/jni/foo/foo.c
Normal file
6
ndk/tests/prebuilt-library/jni/foo/foo.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "foo.h"
|
||||
|
||||
int foo(void)
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
6
ndk/tests/prebuilt-library/jni/foo/foo.h
Normal file
6
ndk/tests/prebuilt-library/jni/foo/foo.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef FOO_FOO_H
|
||||
#define FOO_FOO_H
|
||||
|
||||
extern int foo(void);
|
||||
|
||||
#endif /* FOO_FOO_H */
|
||||
BIN
ndk/tests/prebuilt-library/jni/libfoo.so
Executable file
BIN
ndk/tests/prebuilt-library/jni/libfoo.so
Executable file
Binary file not shown.
Reference in New Issue
Block a user