Commit 3756faf9 authored by George Nash's avatar George Nash

For Android copy libs into samples

Change-Id: I42ed63b176216571bb0a23a7f6b701e91e3f3734
Signed-off-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
parent c0463c18
......@@ -92,12 +92,12 @@ or
make NDK_HOME=~/android-arm-23 ANDROID_API=23 IPV4=1 DEBUG=1
Copy the libiotivity-lite-jni.so to the appropriate jniLibs sub-directories for each project:
The Make file will build and copy the library files (*.so and *.jar) into the
provided samples.
cp libiotivity-lite-jni.so ../../swig/apps/android_simple_client/SimpleClient/app/src/main/jniLibs/armeabi/
cp libiotivity-lite-jni.so ../../swig/apps/android_simple_server/SimpleServer/app/src/main/jniLibs/armeabi/
The Makefile also contains a version of these same build instructions.
If developing your own project you may need to manually copy the libraries from
`<iotivity-lite-root>/swig/iotivity-lite-java/libs` to the location expected
by your project.
Building and Running Samples
=================================================
......
......@@ -62,6 +62,8 @@ EXTRA_FLAG = -std=gnu99 -Wall -DOC_CLIENT -DOC_SERVER -DOC_IPV4 -DOC_DYNAMIC_ALL
DTLSFLAGS=-I../deps/mbedtls/include -D__OC_RANDOM
LDFLAG += -lm
INSTALL_ANDROID_LIBS =
ifeq ($(DEBUG),1)
EXTRA_FLAG += -DOC_DEBUG -g -O0
endif
......@@ -87,6 +89,7 @@ ifeq ($(OS),android)
SWIG_CFLAG += -D__linux__
HEADER_FILE += -I../port/android
LDFLAG += -llog
INSTALL_ANDROID_LIBS = install_android_libs
ifeq ($(ANDROID_API),)
EXTRA_FLAG += -D__ANDROID_API__=23
else
......@@ -96,7 +99,7 @@ endif
JAVA_LANG_OBJ_DIR += $(PORT_OBJ_DIR)swig/
all: clean build_swig build_jar build_jni_so
all: clean build_swig build_jar build_jni_so $(INSTALL_ANDROID_LIBS)
.PHONY: clean
......@@ -111,7 +114,7 @@ copy_java:
mkdir -p $(IOTIVITY_LITE_JAVA_SRC_DIR)$(PACKAGE_DIR)oc/
cp $(OC_JAVA_DIR)oc/*.java $(IOTIVITY_LITE_JAVA_SRC_DIR)$(PACKAGE_DIR)oc/
build_jar:
build_jar: copy_java
mkdir -p $(IOTIVITY_LITE_JAVA_BIN_DIR)
$(JAVAC) -source 1.7 -target 1.7 -sourcepath $(IOTIVITY_LITE_JAVA_SRC_DIR) -d $(IOTIVITY_LITE_JAVA_BIN_DIR) $(IOTIVITY_LITE_JAVA_SRC_DIR)$(PACKAGE_DIR)*.java $(IOTIVITY_LITE_JAVA_SRC_DIR)$(PACKAGE_DIR)oc/*.java
$(JAR) -cfv $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JAR_NAME) -C $(IOTIVITY_LITE_JAVA_BIN_DIR) .
......@@ -119,6 +122,21 @@ build_jar:
build_jni_so: $(JNI_SRC)
$(CC) -shared $(JAVA_LANG_OBJ_DIR)*.o $(PORT_OBJ_DIR)*.o $(CLIENT_SERVER_OBJ_DIR)*.o $(LDFLAG) -o $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JNI_SO_NAME)
install_android_libs: build_swig build_jar build_jni_so
# copy so and jar files to samples
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JNI_SO_NAME) apps/android_simple_client/SimpleClient/app/src/main/jniLibs/armeabi/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JAR_NAME) apps/android_simple_client/SimpleClient/app/libs/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JNI_SO_NAME) apps/android_simple_server/SimpleServer/app/src/main/jniLibs/armeabi/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JAR_NAME) apps/android_simple_server/SimpleServer/app/libs/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JNI_SO_NAME) apps/android_on_boarding_tool/OnBoardingTool/app/src/main/jniLibs/armeabi/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JAR_NAME) apps/android_on_boarding_tool/OnBoardingTool/app/libs/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JNI_SO_NAME) apps/oc/android_simple_client/SimpleClient/app/src/main/jniLibs/armeabi/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JAR_NAME) apps/oc/android_simple_client/SimpleClient/app/libs/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JNI_SO_NAME) apps/oc/android_simple_server/SimpleServer/app/src/main/jniLibs/armeabi/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JAR_NAME) apps/oc/android_simple_server/SimpleServer/app/libs/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JNI_SO_NAME) apps/oc/android_on_boarding_tool/OnBoardingTool/app/src/main/jniLibs/armeabi/
cp $(IOTIVITY_LITE_JAVA_LIBS_DIR)$(JAR_NAME) apps/oc/android_on_boarding_tool/OnBoardingTool/app/libs/
%_wrap.c:
mkdir -p $(JAVA_LANG_OBJ_DIR)
$(CC) -c -o $(JAVA_LANG_OBJ_DIR)$(addsuffix .o, $(basename $@)) $(IOTIVITY_LITE_JAVA_JNI_DIR)$@ $(JNIFLAG) $(EXTRA_HEADER_FILE) $(HEADER_FILE) $(EXTRA_FLAG) $(DTLSFLAGS)
......@@ -131,4 +149,17 @@ clean:
rm -f $(addsuffix *.java, $(IOTIVITY_LITE_JAVA_SRC_DIR)$(PACKAGE_DIR))
rm -rf $(IOTIVITY_LITE_JAVA_SRC_DIR)$(PACKAGE_DIR)oc
rm -rf $(IOTIVITY_LITE_JAVA_BIN_DIR)
rm -rf $(JAVA_LANG_OBJ_DIR)
\ No newline at end of file
rm -rf $(JAVA_LANG_OBJ_DIR)
# delete so and jar files copied to samples
rm -f apps/android_simple_client/SimpleClient/app/src/main/jniLibs/armeabi/$(JNI_SO_NAME)
rm -f apps/android_simple_client/SimpleClient/app/libs/$(JAR_NAME)
rm -f apps/android_simple_server/SimpleServer/app/src/main/jniLibs/armeabi/$(JNI_SO_NAME)
rm -f apps/android_simple_server/SimpleServer/app/libs/$(JAR_NAME)
rm -f apps/android_on_boarding_tool/OnBoardingTool/app/src/main/jniLibs/armeabi/$(JNI_SO_NAME)
rm -f apps/android_on_boarding_tool/OnBoardingTool/app/libs/$(JAR_NAME)
rm -f apps/oc/android_simple_client/SimpleClient/app/src/main/jniLibs/armeabi/$(JNI_SO_NAME)
rm -f apps/oc/android_simple_client/SimpleClient/app/libs/$(JAR_NAME)
rm -f apps/oc/android_simple_server/SimpleServer/app/src/main/jniLibs/armeabi/$(JNI_SO_NAME)
rm -f apps/oc/android_simple_server/SimpleServer/app/libs/$(JAR_NAME)
rm -f apps/oc/android_on_boarding_tool/OnBoardingTool/app/src/main/jniLibs/armeabi/$(JNI_SO_NAME)
rm -f apps/oc/android_on_boarding_tool/OnBoardingTool/app/libs/$(JAR_NAME)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment