[Android] Add building of C-API
authorParichay Kapoor <pk.kapoor@samsung.com>
Tue, 15 Sep 2020 10:04:13 +0000 (19:04 +0900)
committerjijoong.moon <jijoong.moon@samsung.com>
Wed, 23 Sep 2020 08:22:34 +0000 (17:22 +0900)
Add building of C-API for android
Also add corresponding error fix for inclusion

**Self evaluation:**
1. Build test: [x]Passed [ ]Failed [ ]Skipped
2. Run test: [x]Passed [ ]Failed [ ]Skipped

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
api/capi/src/nntrainer.cpp
jni/Android.mk

index 7e583ad..07c00f2 100644 (file)
@@ -29,6 +29,7 @@
 #include <nntrainer_internal.h>
 #include <nntrainer_log.h>
 #include <parse_util.h>
+#include <sstream>
 #include <stdarg.h>
 #include <string.h>
 
index 01be5d0..0134d33 100644 (file)
@@ -65,3 +65,29 @@ LOCAL_SRC_FILES     := $(NNTRAINER_SRCS) $(INIPARSER_SRCS)
 LOCAL_C_INCLUDES    += $(NNTRAINER_INCLUDES) $(INIPARSER_INCLUDES)
 
 include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+CAPI_NNTRAINER_SRCS := $(NNTRAINER_ROOT)/api/capi/src/nntrainer.cpp \
+                  $(NNTRAINER_ROOT)/api/capi/src/nntrainer_util.cpp
+
+CAPI_NNTRAINER_INCLUDES := $(NNTRAINER_ROOT)/nntrainer/include \
+                      $(NNTRAINER_ROOT)/api \
+                      $(NNTRAINER_ROOT)/api/capi/include \
+                      $(NNTRAINER_ROOT)/api/capi/include/platform
+
+LOCAL_SHARED_LIBRARIES := nntrainer
+
+LOCAL_ARM_NEON      := true
+LOCAL_CFLAGS        += -pthread -fopenmp -fexceptions
+LOCAL_CXXFLAGS      += -std=c++14 -frtti -fexceptions
+LOCAL_LDFLAGS       += -fuse-ld=bfd -fopenmp
+LOCAL_MODULE_TAGS   := optional
+
+LOCAL_LDLIBS        := -llog
+
+LOCAL_MODULE        := capi-nntrainer
+LOCAL_SRC_FILES     := $(CAPI_NNTRAINER_SRCS)
+LOCAL_C_INCLUDES    += $(CAPI_NNTRAINER_INCLUDES)
+
+include $(BUILD_SHARED_LIBRARY)