1 LOCAL_PATH := $(call my-dir)
3 # Geunsik Lim <geunsik.lim@samsung.com>
4 # This configuration file is to compile a test application
5 # using Gstreamer + NNstreamer library.
7 # Step1: Build a test appliation based on nnstreamer for Android platform
8 # ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android-app.mk NDK_APPLICATION_MK=./Application.mk -j$(nproc)
10 # Step2: Install a test application into Android target device
11 # readelf -d ./libs/arm64-v8a/{your-test-app}
12 # adb push ./libs/arm64-v8a/{your-test-app} /data/nnstreamer/
14 # Step3: Run the test application
16 # target#> cd /data/nnstreamer/
17 # target#> ./{your-test-app}
19 ifndef NNSTREAMER_ROOT
20 NNSTREAMER_ROOT := $(LOCAL_PATH)/..
23 CUSTOM_LINKER64 := -fPIE -pie -Wl,-dynamic-linker,/data/nnstreamer/libandroid/linker64
25 # Do not specify "TARGET_ARCH_ABI" in this file. If you want to append additional architecture,
26 # Please append an architecture name behind "APP_ABI" in Application.mk file.
28 ifeq ($(TARGET_ARCH_ABI),armeabi)
29 GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/arm
30 else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
31 GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/armv7
32 else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
33 GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/arm64
34 else ifeq ($(TARGET_ARCH_ABI),x86)
35 GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/x86
36 else ifeq ($(TARGET_ARCH_ABI),x86_64)
37 GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/x86_64
39 $(error Target arch ABI not supported: $(TARGET_ARCH_ABI))
42 # Common definition for NNStreamer
43 include $(LOCAL_PATH)/nnstreamer.mk
45 # Define shared libraries that are required by a gstreamer plug-in.
46 define shared_lib_common
49 LOCAL_SRC_FILES := $(GSTREAMER_ROOT)/lib/lib$(1).so
50 include $(PREBUILT_SHARED_LIBRARY)
53 # Define shared libraries that are used as a gstreamer plug-in.
57 LOCAL_SRC_FILES := $(GSTREAMER_ROOT)/lib/gstreamer-1.0/lib$(1).so
58 include $(PREBUILT_SHARED_LIBRARY)
61 # Describe shared libraries that are needed to run this application.
62 so_names_common := gstreamer-1.0 gstbase-1.0 gstvideo-1.0 glib-2.0 \
63 gobject-2.0 intl z bz2 orc-0.4 gmodule-2.0 ffi gsttag-1.0 iconv \
64 gstapp-1.0 png16 gstbadbase-1.0 gio-2.0 pangocairo-1.0 \
65 pangoft2-1.0 pango-1.0 gthread-2.0 cairo pixman-1 fontconfig expat freetype \
66 gstbadvideo-1.0 gstcontroller-1.0 jpeg graphene-1.0 gstpbutils-1.0 gstgl-1.0 \
67 gstallocators-1.0 gstbadallocators-1.0 harfbuzz
69 ifeq ($(NO_AUDIO), false)
70 so_names_common += gstaudio-1.0 gstbadaudio-1.0
73 $(foreach item,$(so_names_common),$(eval $(call shared_lib_common,$(item))))
75 so_names_gst := gstcoreelements gstcoretracers gstadder gstapp \
76 gstpango gstrawparse gsttypefindfunctions gstvideoconvert gstvideorate \
77 gstvideoscale gstvideotestsrc gstvolume gstautodetect gstvideofilter gstopengl \
78 gstopensles gstcompositor gstpng gstmultifile nnstreamer
80 ifeq ($(NO_AUDIO), false)
81 so_names_gst += gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
84 $(foreach item,$(so_names_gst),$(eval $(call shared_lib_gst,$(item))))
86 BUILDING_BLOCK_LIST := gstreamer-1.0 glib-2.0 gobject-2.0 intl gstcoreelements \
87 gstapp pixman-1 fontconfig expat freetype \
88 gstvideoconvert gstvideorate gstvideoscale \
89 gmodule-2.0 iconv png16 gstpng gstmultifile gio-2.0 \
90 gstbase-1.0 gstvideo-1.0 tag-1.0 orc app-1.0 badbase-1.0 gthread \
91 cairo pixman gstbadvideo gstcontroller jpeg gstpbutils gstallocators \
92 bz2 harfbuzz z nnstreamer
95 ifeq ($(NO_AUDIO), false)
96 BUILDING_BLOCK_LIST += gstaudio-1.0 gstbadaudio-1.0 gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
99 # In case of Android ARM 64bit environment, the default path of linker is "/data/nnstreamer/".
100 # We use the "tests/nnstreamer_repo_dynamicity/tensor_repo_dynamic_test.c" file as a test application.
101 # This application is dependent on 'multifilesrc' and 'png' element that are provided by Gstreamer.
102 include $(CLEAR_VARS)
103 LOCAL_MODULE := tensor_repo_dynamic_test
104 LOCAL_SRC_FILES += ../tests/nnstreamer_repo_dynamicity/tensor_repo_dynamic_test.c
105 LOCAL_CFLAGS += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\"
106 LOCAL_CXXFLAGS += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\"
107 LOCAL_LDLIBS += -llog
108 #LOCAL_LDFLAGS += $(CUSTOM_LINKER64)
109 LOCAL_LDFLAGS += -fuse-ld=bfd
111 LOCAL_C_INCLUDES := $(NNSTREAMER_INCLUDES)
112 LOCAL_SHARED_LIBRARIES := $(BUILDING_BLOCK_LIST)
114 LOCAL_C_INCLUDES += $(GST_HEADERS_COMMON)
116 GSTREAMER_ANDROID_INCLUDE := $(GSTREAMER_ROOT)/include
118 include $(BUILD_EXECUTABLE)