[JAVA-Api] Add and update MXNet related mk files
authormakesource <makesource@gmail.com>
Sun, 1 May 2022 03:50:02 +0000 (12:50 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Mon, 30 May 2022 02:26:19 +0000 (11:26 +0900)
Add mk files for prebuilt MXNet shared library files

Signed-off-by: makesource <makesource@gmail.com>
java/android/nnstreamer/src/main/jni/Android-mxnet-prebuilt.mk [new file with mode: 0644]
java/android/nnstreamer/src/main/jni/Android-mxnet.mk [new file with mode: 0644]
java/android/nnstreamer/src/main/jni/Android.mk
java/android/nnstreamer/src/main/jni/nnstreamer-native-api.c

diff --git a/java/android/nnstreamer/src/main/jni/Android-mxnet-prebuilt.mk b/java/android/nnstreamer/src/main/jni/Android-mxnet-prebuilt.mk
new file mode 100644 (file)
index 0000000..55a2f9f
--- /dev/null
@@ -0,0 +1,23 @@
+#------------------------------------------------------
+# MXNet Deep learning framework
+# https://github.com/apache/incubator-mxnet
+#
+# This mk file defines prebuilt libraries for mxnet module.
+# (mxnet core libraries, arm64-v8a only)
+#------------------------------------------------------
+LOCAL_PATH := $(call my-dir)
+
+ifndef MXNET_LIB_PATH
+$(error MXNET_LIB_PATH is not defined!)
+endif
+
+MXNET_PREBUILT_LIBS :=
+
+#------------------------------------------------------
+# mxnet prebuilt shared libraries
+#------------------------------------------------------
+include $(CLEAR_VARS)
+LOCAL_MODULE := mxnet
+LOCAL_SRC_FILES := $(MXNET_LIB_PATH)/libmxnet.so
+include $(PREBUILT_SHARED_LIBRARY)
+MXNET_PREBUILT_LIBS += mxnet
\ No newline at end of file
diff --git a/java/android/nnstreamer/src/main/jni/Android-mxnet.mk b/java/android/nnstreamer/src/main/jni/Android-mxnet.mk
new file mode 100644 (file)
index 0000000..93f5646
--- /dev/null
@@ -0,0 +1,26 @@
+LOCAL_PATH := $(call my-dir)
+
+MXNET_DIR := $(LOCAL_PATH)/mxnet
+MXNET_INCLUDES := $(MXNET_DIR)/include
+MXNET_LIB_PATH := $(MXNET_DIR)/lib
+
+$(info MXNET_DIR is $(MXNET_DIR))
+$(info MXNET_INCLUDES is $(MXNET_INCLUDES))
+
+#------------------------------------------------------
+# mxnet prebuilt shared libraries
+#------------------------------------------------------
+include $(LOCAL_PATH)/Android-mxnet-prebuilt.mk
+
+#------------------------------------------------------
+# tensor-filter sub-plugin for mxnet
+#------------------------------------------------------
+include $(CLEAR_VARS)
+LOCAL_MODULE := mxnet-subplugin
+LOCAL_SRC_FILES := $(NNSTREAMER_FILTER_MXNET_SRCS)
+LOCAL_CXXFLAGS := -O3 -fPIC -frtti -fexceptions $(NNS_API_FLAGS) $(PYTORCH_FLAGS)
+LOCAL_C_INCLUDES := $(MXNET_INCLUDES) $(NNSTREAMER_INCLUDES) $(GST_HEADERS_COMMON)
+LOCAL_STATIC_LIBRARIES := nnstreamer
+LOCAL_SHARED_LIBRARIES := $(MXNET_PREBUILT_LIBS)
+
+include $(BUILD_STATIC_LIBRARY)
index 5a76a59..81766d5 100644 (file)
@@ -79,6 +79,12 @@ include $(LOCAL_PATH)/Android-nnstreamer.mk
 #------------------------------------------------------
 # external libs and sub-plugins
 #------------------------------------------------------
+
+# MXNET
+NNS_SUBPLUGINS += mxnet-subplugin
+include $(LOCAL_PATH)/Android-mxnet.mk
+
+
 ifeq ($(ENABLE_TF_LITE),true)
 NNS_API_FLAGS += -DENABLE_TENSORFLOW_LITE=1
 NNS_SUBPLUGINS += tensorflow-lite-subplugin
index 9ec50d2..29d25d3 100644 (file)
@@ -54,6 +54,8 @@ extern void init_filter_snpe (JNIEnv * env, jobject context);
 extern void init_filter_torch (void);
 #endif
 
+extern void init_filter_mxnet (void);
+
 /**
  * @brief External function from GStreamer Android.
  */
@@ -810,6 +812,7 @@ nnstreamer_native_initialize (JNIEnv * env, jobject context)
 #if defined (ENABLE_PYTORCH)
     init_filter_torch ();
 #endif
+  init_filter_mxnet() ;
 #endif /* __ANDROID__ */
     nns_is_initilaized = TRUE;
   }