From: Jaeyun Date: Thu, 11 Apr 2019 06:10:48 +0000 (+0900) Subject: [Build/Android] add common definition X-Git-Tag: accepted/tizen/unified/20190425.014439~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=953d12cf3cf4d2b42eaf08c79fbaa3da619132d7;p=platform%2Fupstream%2Fnnstreamer.git [Build/Android] add common definition define common features to build nnstreamer library for android TODO: update mk files in nnstreamer-example later Signed-off-by: Jaeyun Jung --- diff --git a/jni/Android-app.mk b/jni/Android-app.mk index 3e44fbd..cc8354c 100644 --- a/jni/Android-app.mk +++ b/jni/Android-app.mk @@ -16,10 +16,13 @@ LOCAL_PATH := $(call my-dir) # target#> cd /data/nnstreamer/ # target#> ./{your-test-app} -NNSTREAMER_VERSION := 0.1.3 -CUSTOM_LINKER64 := -fPIE -pie -Wl,-dynamic-linker,/data/nnstreamer/libandroid/linker64 +ifndef NNSTREAMER_ROOT +NNSTREAMER_ROOT := $(LOCAL_PATH)/.. +endif -NO_AUDIO := false +include $(LOCAL_PATH)/nnstreamer.mk + +CUSTOM_LINKER64 := -fPIE -pie -Wl,-dynamic-linker,/data/nnstreamer/libandroid/linker64 # Do not specify "TARGET_ARCH_ABI" in this file. If you want to append additional architecture, # Please append an architecture name behind "APP_ABI" in Application.mk file. @@ -97,14 +100,12 @@ endif # This application is dependent on 'multifilesrc' and 'png' element that are provided by Gstreamer. include $(CLEAR_VARS) LOCAL_MODULE := tensor_repo_dynamic_test -LOCAL_CFLAGS += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\" LOCAL_SRC_FILES += ../tests/nnstreamer_repo_dynamicity/tensor_repo_dynamic_test.c -LOCAL_CXXFLAGS += -std=c++11 +LOCAL_CFLAGS += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\" +LOCAL_CXXFLAGS += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\" LOCAL_LDFLAGS := $(CUSTOM_LINKER64) -NNSTREAMER_GST_HOME := ../gst/nnstreamer - -LOCAL_C_INCLUDES := $(NNSTREAMER_GST_HOME) +LOCAL_C_INCLUDES := $(NNSTREAMER_INCLUDES) LOCAL_SHARED_LIBRARIES := $(BUILDING_BLOCK_LIST) LOCAL_C_INCLUDES += $(GSTREAMER_ROOT)/include/gstreamer-1.0 \ diff --git a/jni/Android-nnstreamer.mk b/jni/Android-nnstreamer.mk index b1c145b..538ee8f 100644 --- a/jni/Android-nnstreamer.mk +++ b/jni/Android-nnstreamer.mk @@ -27,8 +27,11 @@ LOCAL_PATH := $(call my-dir) # cp ./libs/arm64-v8a/libnnstreamer.so $GSTREAMER_ROOT_ANDROID/arm64/lib/gstreamer-1.0/ # -NNSTREAMER_VERSION := 0.1.3 -NO_AUDIO := false +ifndef NNSTREAMER_ROOT +NNSTREAMER_ROOT := $(LOCAL_PATH)/.. +endif + +include $(LOCAL_PATH)/nnstreamer.mk # Do not specify "TARGET_ARCH_ABI" in this file. If you want to append additional architecture, # Please append an architecture name behind "APP_ABI" in Application.mk file. @@ -94,7 +97,7 @@ include $(CLEAR_VARS) # Please keep the pthread and openmp library for checking a compatibility LOCAL_ARM_NEON := true LOCAL_CFLAGS += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\" -LOCAL_CXXFLAGS += -std=c++11 +LOCAL_CXXFLAGS += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\" LOCAL_CFLAGS += -pthread -fopenmp ifeq ($(NO_AUDIO), true) @@ -105,43 +108,9 @@ endif LOCAL_LDFLAGS += -fuse-ld=bfd LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := nnstreamer -NNSTREAMER_GST_HOME := ../gst/nnstreamer -NNSTREAMER_GST_TEST := ../nnstreamer_example/ -LOCAL_SRC_FILES := $(NNSTREAMER_GST_HOME)/nnstreamer.c \ - $(NNSTREAMER_GST_HOME)/nnstreamer_conf.c \ - $(NNSTREAMER_GST_HOME)/nnstreamer_subplugin.c \ - $(NNSTREAMER_GST_HOME)/tensor_common.c \ - $(NNSTREAMER_GST_HOME)/tensor_repo.c \ - $(NNSTREAMER_GST_HOME)/tensor_converter/tensor_converter.c \ - $(NNSTREAMER_GST_HOME)/tensor_aggregator/tensor_aggregator.c \ - $(NNSTREAMER_GST_HOME)/tensor_decoder/tensordec.c \ - $(NNSTREAMER_GST_HOME)/tensor_demux/gsttensordemux.c \ - $(NNSTREAMER_GST_HOME)/tensor_filter/tensor_filter.c \ - $(NNSTREAMER_GST_HOME)/tensor_filter/tensor_filter_custom.c \ - $(NNSTREAMER_GST_HOME)/tensor_merge/gsttensormerge.c \ - $(NNSTREAMER_GST_HOME)/tensor_mux/gsttensormux.c \ - $(NNSTREAMER_GST_HOME)/tensor_reposink/tensor_reposink.c \ - $(NNSTREAMER_GST_HOME)/tensor_reposrc/tensor_reposrc.c \ - $(NNSTREAMER_GST_HOME)/tensor_sink/tensor_sink.c \ - $(NNSTREAMER_GST_HOME)/tensor_source/tensor_src_iio.c \ - $(NNSTREAMER_GST_HOME)/tensor_split/gsttensorsplit.c \ - $(NNSTREAMER_GST_HOME)/tensor_transform/tensor_transform.c - -LOCAL_C_INCLUDES := $(NNSTREAMER_GST_HOME)/ \ - $(NNSTREAMER_GST_HOME)/tensor_converter/ \ - $(NNSTREAMER_GST_HOME)/tensor_aggregator/ \ - $(NNSTREAMER_GST_HOME)/tensor_decoder/ \ - $(NNSTREAMER_GST_HOME)/tensor_demux/ \ - $(NNSTREAMER_GST_HOME)/tensor_filter/ \ - $(NNSTREAMER_GST_HOME)/tensor_merge/ \ - $(NNSTREAMER_GST_HOME)/tensor_mux/ \ - $(NNSTREAMER_GST_HOME)/tensor_reposink/ \ - $(NNSTREAMER_GST_HOME)/tensor_reposrc/ \ - $(NNSTREAMER_GST_HOME)/tensor_sink/ \ - $(NNSTREAMER_GST_HOME)/tensor_source/ \ - $(NNSTREAMER_GST_HOME)/tensor_split/ \ - $(NNSTREAMER_GST_HOME)/tensor_transform/ +LOCAL_MODULE := nnstreamer +LOCAL_SRC_FILES := $(NNSTREAMER_COMMON_SRCS) $(NNSTREAMER_PLUGINS_SRCS) +LOCAL_C_INCLUDES := $(NNSTREAMER_INCLUDES) BUILDING_BLOCK_LIST := gstreamer-1.0 glib-2.0 gobject-2.0 intl gstcoreelements \ gstapp pixman-1 fontconfig expat freetype \ diff --git a/jni/nnstreamer.mk b/jni/nnstreamer.mk new file mode 100644 index 0000000..9225333 --- /dev/null +++ b/jni/nnstreamer.mk @@ -0,0 +1,65 @@ +# This mk file defines common features to build NNStreamer library for Android. + +ifndef NNSTREAMER_ROOT +$(error NNSTREAMER_ROOT is not defined!) +endif + +NNSTREAMER_VERSION := 0.1.3 + +NNSTREAMER_GST_HOME := $(NNSTREAMER_ROOT)/gst/nnstreamer +NNSTREAMER_EXT_HOME := $(NNSTREAMER_ROOT)/ext/nnstreamer + +# nnstreamer common headers +NNSTREAMER_INCLUDES := \ + $(NNSTREAMER_GST_HOME) + +# nnstreamer common sources +NNSTREAMER_COMMON_SRCS := \ + $(NNSTREAMER_GST_HOME)/nnstreamer.c \ + $(NNSTREAMER_GST_HOME)/nnstreamer_conf.c \ + $(NNSTREAMER_GST_HOME)/nnstreamer_subplugin.c \ + $(NNSTREAMER_GST_HOME)/tensor_common.c \ + $(NNSTREAMER_GST_HOME)/tensor_repo.c + +# nnstreamer plugins +NNSTREAMER_PLUGINS_SRCS := \ + $(NNSTREAMER_GST_HOME)/tensor_converter/tensor_converter.c \ + $(NNSTREAMER_GST_HOME)/tensor_aggregator/tensor_aggregator.c \ + $(NNSTREAMER_GST_HOME)/tensor_decoder/tensordec.c \ + $(NNSTREAMER_GST_HOME)/tensor_demux/gsttensordemux.c \ + $(NNSTREAMER_GST_HOME)/tensor_filter/tensor_filter.c \ + $(NNSTREAMER_GST_HOME)/tensor_filter/tensor_filter_custom.c \ + $(NNSTREAMER_GST_HOME)/tensor_merge/gsttensormerge.c \ + $(NNSTREAMER_GST_HOME)/tensor_mux/gsttensormux.c \ + $(NNSTREAMER_GST_HOME)/tensor_reposink/tensor_reposink.c \ + $(NNSTREAMER_GST_HOME)/tensor_reposrc/tensor_reposrc.c \ + $(NNSTREAMER_GST_HOME)/tensor_sink/tensor_sink.c \ + $(NNSTREAMER_GST_HOME)/tensor_source/tensor_src_iio.c \ + $(NNSTREAMER_GST_HOME)/tensor_split/gsttensorsplit.c \ + $(NNSTREAMER_GST_HOME)/tensor_transform/tensor_transform.c + +# filter tensorflow +NNSTREAMER_FILTER_TF_SRCS := \ + $(NNSTREAMER_EXT_HOME)/tensor_filter/tensor_filter_tensorflow.c \ + $(NNSTREAMER_EXT_HOME)/tensor_filter/tensor_filter_tensorflow_core.cc + +# filter tensorflow-lite +NNSTREAMER_FILTER_TFLITE_SRCS := \ + $(NNSTREAMER_EXT_HOME)/tensor_filter/tensor_filter_tensorflow_lite.c \ + $(NNSTREAMER_EXT_HOME)/tensor_filter/tensor_filter_tensorflow_lite_core.cc + +# decoder boundingbox +NNSTREAMER_DECODER_BB_SRCS := \ + $(NNSTREAMER_EXT_HOME)/tensor_decoder/tensordec-boundingbox.c + +# decoder directvideo +NNSTREAMER_DECODER_DV_SRCS := \ + $(NNSTREAMER_EXT_HOME)/tensor_decoder/tensordec-directvideo.c + +# decoder imagelabel +NNSTREAMER_DECODER_IL_SRCS := \ + $(NNSTREAMER_EXT_HOME)/tensor_decoder/tensordec-imagelabel.c + +# common features +NO_AUDIO := false + diff --git a/packaging/nnstreamer.spec b/packaging/nnstreamer.spec index 661646e..75c78d9 100644 --- a/packaging/nnstreamer.spec +++ b/packaging/nnstreamer.spec @@ -11,7 +11,7 @@ Summary: gstremaer plugins for neural networks # Synchronize the version information among Ubuntu, Tizen, Android, and Meson. # 1. Ubuntu : ./debian/changelog # 2. Tizen : ./packaging/nnstreamer.spec -# 3. Android: ./jni/Android*.mk +# 3. Android: ./jni/nnstreamer.mk # 4. Meson : ./meson.build Version: 0.1.3 Release: 0