[Android] Use c++17 for ndk-build
authorYelin Jeong <yelini.jeong@samsung.com>
Mon, 24 Jun 2024 04:57:29 +0000 (13:57 +0900)
committerSangjung Woo <again4you@gmail.com>
Thu, 11 Jul 2024 09:30:38 +0000 (18:30 +0900)
This patch changes the c++ version to 17 in the jni files.

Signed-off-by: Yelin Jeong <yelini.jeong@samsung.com>
jni/Android-app.mk
jni/Android-gst-plugins.mk [new file with mode: 0644]
jni/Android-nnstreamer.mk
jni/Android.mk
jni/Application.mk

index 5c7a54e..3078304 100644 (file)
@@ -20,8 +20,6 @@ ifndef NNSTREAMER_ROOT
 NNSTREAMER_ROOT := $(LOCAL_PATH)/..
 endif
 
-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.
 
@@ -39,62 +37,31 @@ else
 $(error Target arch ABI not supported: $(TARGET_ARCH_ABI))
 endif
 
-# Common definition for NNStreamer
-include $(LOCAL_PATH)/nnstreamer.mk
-
-# Define shared libraries that are required by a gstreamer plug-in.
-define shared_lib_common
-    include $(CLEAR_VARS)
-    LOCAL_MODULE := $(1)
-    LOCAL_SRC_FILES := $(GSTREAMER_ROOT)/lib/lib$(1).so
-    include $(PREBUILT_SHARED_LIBRARY)
-endef
-
-# Define shared libraries that are used as a gstreamer plug-in.
-define shared_lib_gst
-    include $(CLEAR_VARS)
-    LOCAL_MODULE := $(1)
-    LOCAL_SRC_FILES := $(GSTREAMER_ROOT)/lib/gstreamer-1.0/lib$(1).so
-    include $(PREBUILT_SHARED_LIBRARY)
-endef
-
-# Describe shared libraries that are needed to run this application.
-so_names_common := gstreamer-1.0 gstbase-1.0 gstvideo-1.0 glib-2.0 \
-                   gobject-2.0 intl z bz2 orc-0.4 gmodule-2.0 ffi gsttag-1.0 iconv \
-                   gstapp-1.0 png16 gstbadbase-1.0 gio-2.0 pangocairo-1.0 \
-                   pangoft2-1.0 pango-1.0 gthread-2.0 cairo pixman-1 fontconfig expat freetype \
-                   gstbadvideo-1.0 gstcontroller-1.0 jpeg graphene-1.0 gstpbutils-1.0 gstgl-1.0 \
-                   gstallocators-1.0 gstbadallocators-1.0 harfbuzz
+GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build
+include $(LOCAL_PATH)/Android-gst-plugins.mk
 
-ifeq ($(NO_AUDIO), false)
-so_names_common += gstaudio-1.0 gstbadaudio-1.0
-endif
-
-$(foreach item,$(so_names_common),$(eval $(call shared_lib_common,$(item))))
+GST_BLOCKED_PLUGINS      := \
+        fallbackswitch livesync rsinter rstracers \
+        threadshare togglerecord cdg claxon dav1d rsclosedcaption \
+        ffv1 fmp4 mp4 gif hsv lewton rav1e json rspng regex textwrap textahead \
+        aws hlssink3 ndi rsonvif raptorq reqwest rsrtp rsrtsp webrtchttp rswebrtc uriplaylistbin \
+        rsaudiofx rsvideofx
 
-so_names_gst := gstcoreelements gstcoretracers gstadder gstapp \
-                gstpango gstrawparse gsttypefindfunctions gstvideoconvert gstvideorate \
-                gstvideoscale gstvideotestsrc gstvolume gstautodetect gstvideofilter gstopengl \
-                gstopensles gstcompositor gstpng gstmultifile nnstreamer
+GSTREAMER_PLUGINS        := $(filter-out $(GST_BLOCKED_PLUGINS), $(GST_REQUIRED_PLUGINS))
+GSTREAMER_EXTRA_DEPS     := $(GST_REQUIRED_DEPS) glib-2.0 gio-2.0 gmodule-2.0
+GSTREAMER_EXTRA_LIBS     := $(GST_REQUIRED_LIBS) -liconv
 
-ifeq ($(NO_AUDIO), false)
-so_names_gst += gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
+ifeq ($(NNSTREAMER_API_OPTION),all)
+GSTREAMER_EXTRA_LIBS += -lcairo
 endif
 
-$(foreach item,$(so_names_gst),$(eval $(call shared_lib_gst,$(item))))
-
-BUILDING_BLOCK_LIST := gstreamer-1.0 glib-2.0 gobject-2.0 intl gstcoreelements \
-gstapp pixman-1 fontconfig expat freetype \
-gstvideoconvert gstvideorate gstvideoscale \
-gmodule-2.0 iconv png16 gstpng gstmultifile gio-2.0 \
-gstbase-1.0 gstvideo-1.0 tag-1.0 orc app-1.0 badbase-1.0 gthread \
-cairo pixman gstbadvideo gstcontroller jpeg gstpbutils gstallocators \
-bz2 harfbuzz z nnstreamer
+GSTREAMER_INCLUDE_FONTS := no
+GSTREAMER_INCLUDE_CA_CERTIFICATES := no
 
+include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
 
-ifeq ($(NO_AUDIO), false)
-BUILDING_BLOCK_LIST += gstaudio-1.0 gstbadaudio-1.0 gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
-endif
+# Common definition for NNStreamer
+include $(LOCAL_PATH)/nnstreamer.mk
 
 # In case of Android ARM 64bit environment, the default path of linker is "/data/nnstreamer/".
 # We use the "tests/nnstreamer_repo_dynamicity/tensor_repo_dynamic_test.c" file as a test application.
@@ -103,13 +70,11 @@ include $(CLEAR_VARS)
 LOCAL_MODULE    := tensor_repo_dynamic_test
 LOCAL_SRC_FILES += ../tests/nnstreamer_repo_dynamicity/tensor_repo_dynamic_test.c
 LOCAL_CFLAGS    += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\"
-LOCAL_CXXFLAGS  += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\"
+LOCAL_CXXFLAGS  += -DVERSION=\"$(NNSTREAMER_VERSION)\"
 LOCAL_LDLIBS    += -llog
-#LOCAL_LDFLAGS  += $(CUSTOM_LINKER64)
-LOCAL_LDFLAGS   += -fuse-ld=bfd
 
 LOCAL_C_INCLUDES       := $(NNSTREAMER_INCLUDES)
-LOCAL_SHARED_LIBRARIES := $(BUILDING_BLOCK_LIST)
+LOCAL_SHARED_LIBRARIES := gstreamer_android
 
 LOCAL_C_INCLUDES += $(GST_HEADERS_COMMON)
 
diff --git a/jni/Android-gst-plugins.mk b/jni/Android-gst-plugins.mk
new file mode 100644 (file)
index 0000000..bbe0335
--- /dev/null
@@ -0,0 +1,29 @@
+#------------------------------------------------------
+# Define GStreamer plugins and extra dependencies
+#------------------------------------------------------
+
+ifndef GSTREAMER_NDK_BUILD_PATH
+GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build
+endif
+
+include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
+
+GST_REQUIRED_PLUGINS := $(GSTREAMER_PLUGINS_CORE) \
+    $(GSTREAMER_PLUGINS_CODECS) \
+    $(GSTREAMER_PLUGINS_ENCODING) \
+    $(GSTREAMER_PLUGINS_NET) \
+    $(GSTREAMER_PLUGINS_PLAYBACK) \
+    $(GSTREAMER_PLUGINS_VIS) \
+    $(GSTREAMER_PLUGINS_SYS) \
+    $(GSTREAMER_PLUGINS_EFFECTS) \
+    $(GSTREAMER_PLUGINS_CAPTURE) \
+    $(GSTREAMER_PLUGINS_CODECS_GPL) \
+    $(GSTREAMER_PLUGINS_CODECS_RESTRICTED) \
+    $(GSTREAMER_PLUGINS_NET_RESTRICTED) \
+    $(GSTREAMER_PLUGINS_GES)
+GST_REQUIRED_DEPS := gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-app-1.0
+GSTREAMER_EXTRA_LIBS     := $(GST_REQUIRED_LIBS) -liconv
+
+ifeq ($(NO_AUDIO), false)
+GST_REQUIRED_DEPS += gstaudio-1.0 gstbadaudio-1.0
+endif
index 9d4f7dc..eba8036 100644 (file)
@@ -5,15 +5,15 @@ LOCAL_PATH := $(call my-dir)
 #
 # Step1: Required packages
 # - Software Platform: Android 7.0 (Nougat) + ARM 64bit
-#   - NDK version: r12b
-#   - API Level: 24
-# - Gstreamer 1.12
+#   - NDK version: r25c
+#   - API Level: 33
+# - Gstreamer 1.24
 #
 # Step2: Append a path of Android Gstreamer and Android NDK as following:
 # vi ~/.bashrc
 # # gst-root-android, Android NDK/SDK
 # export GSTREAMER_ROOT_ANDROID=/work/taos/gst-android/gst_root_android
-# export ANDROID_NDK=/work/taos/gst-android/android-ndk-r12b
+# export ANDROID_NDK=/work/taos/gst-android/android-ndk-r25c
 # export PATH=$ANDROID_NDK:$PATH
 #
 # Step3: Build NNStreamer for Android platform
@@ -48,57 +48,38 @@ else
 $(error Target arch ABI not supported: $(TARGET_ARCH_ABI))
 endif
 
-# Common definition for NNStreamer
-include $(LOCAL_PATH)/nnstreamer.mk
-
-# Define shared libraries that are required by a gstreamer plug-in.
-define shared_lib_common
-    include $(CLEAR_VARS)
-    LOCAL_MODULE := $(1)
-    LOCAL_SRC_FILES := $(GSTREAMER_ROOT)/lib/lib$(1).so
-    include $(PREBUILT_SHARED_LIBRARY)
-endef
-
-# Define shared libraries that are used as a gstreamer plug-in.
-define shared_lib_gst
-    include $(CLEAR_VARS)
-    LOCAL_MODULE := $(1)
-    LOCAL_SRC_FILES := $(GSTREAMER_ROOT)/lib/gstreamer-1.0/lib$(1).so
-    include $(PREBUILT_SHARED_LIBRARY)
-endef
-
-# Describe shared libraries that are needed to run this application.
-
-so_names_common := gstreamer-1.0 gstbase-1.0 gstvideo-1.0 glib-2.0 \
-                   gobject-2.0 intl z bz2 orc-0.4 gmodule-2.0 ffi gsttag-1.0 iconv \
-                   gstapp-1.0 png16 gstbadbase-1.0 gio-2.0 pangocairo-1.0 \
-                   pangoft2-1.0 pango-1.0 gthread-2.0 cairo pixman-1 fontconfig expat freetype \
-                   gstbadvideo-1.0 gstcontroller-1.0 jpeg graphene-1.0 gstpbutils-1.0 gstgl-1.0 \
-                   gstallocators-1.0 gstbadallocators-1.0 harfbuzz
-
-ifeq ($(NO_AUDIO), false)
-so_names_common += gstaudio-1.0 gstbadaudio-1.0
-endif
+GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build
+include $(LOCAL_PATH)/Android-gst-plugins.mk
 
-$(foreach item,$(so_names_common),$(eval $(call shared_lib_common,$(item))))
+GST_BLOCKED_PLUGINS      := \
+        fallbackswitch livesync rsinter rstracers \
+        threadshare togglerecord cdg claxon dav1d rsclosedcaption \
+        ffv1 fmp4 mp4 gif hsv lewton rav1e json rspng regex textwrap textahead \
+        aws hlssink3 ndi rsonvif raptorq reqwest rsrtp rsrtsp webrtchttp rswebrtc uriplaylistbin \
+        rsaudiofx rsvideofx
 
-so_names_gst := gstcoreelements gstcoretracers gstadder gstapp \
-                gstpango gstrawparse gsttypefindfunctions gstvideoconvert gstvideorate \
-                gstvideoscale gstvideotestsrc gstvolume gstautodetect gstvideofilter gstopengl \
-                gstopensles gstcompositor gstpng gstmultifile
+GSTREAMER_PLUGINS        := $(filter-out $(GST_BLOCKED_PLUGINS), $(GST_REQUIRED_PLUGINS))
+GSTREAMER_EXTRA_DEPS     := $(GST_REQUIRED_DEPS) glib-2.0 gio-2.0 gmodule-2.0
+GSTREAMER_EXTRA_LIBS     := $(GST_REQUIRED_LIBS) -liconv
 
-ifeq ($(NO_AUDIO), false)
-so_names_gst += gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
+ifeq ($(NNSTREAMER_API_OPTION),all)
+GSTREAMER_EXTRA_LIBS += -lcairo
 endif
 
-$(foreach item,$(so_names_gst),$(eval $(call shared_lib_gst,$(item))))
+GSTREAMER_INCLUDE_FONTS := no
+GSTREAMER_INCLUDE_CA_CERTIFICATES := no
+
+include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
+
+# Common definition for NNStreamer
+include $(LOCAL_PATH)/nnstreamer.mk
 
 include $(CLEAR_VARS)
 
 # Please keep the pthread and openmp library for checking a compatibility
 LOCAL_ARM_NEON      := true
 LOCAL_CFLAGS        += -O0 -fPIC -DVERSION=\"$(NNSTREAMER_VERSION)\"
-LOCAL_CXXFLAGS      += -std=c++11 -fPIC -frtti -fexceptions -DVERSION=\"$(NNSTREAMER_VERSION)\"
+LOCAL_CXXFLAGS      += -fPIC -frtti -fexceptions -DVERSION=\"$(NNSTREAMER_VERSION)\"
 LOCAL_CFLAGS        += -pthread -fopenmp
 
 ifeq ($(NO_AUDIO), true)
@@ -106,28 +87,15 @@ LOCAL_CFLAGS += -DNO_AUDIO
 LOCAL_CXXFLAGS += -DNO_AUDIO
 endif
 
-LOCAL_LDLIBS        := -llog
-LOCAL_LDFLAGS       += -fuse-ld=bfd
+LOCAL_LDLIBS        := -llog -landroid
 LOCAL_MODULE_TAGS   := optional
 
 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 \
-gstvideoconvert gstvideorate gstvideoscale \
-gmodule-2.0 iconv png16 gstpng gstmultifile gio-2.0 \
-gstbase-1.0 gstvideo-1.0 tag-1.0 orc app-1.0 badbase-1.0 gthread \
-cairo pixman gstbadvideo gstcontroller jpeg gstpbutils gstallocators \
-bz2 harfbuzz z
-
-ifeq ($(NO_AUDIO), false)
-BUILDING_BLOCK_LIST += gstaudio-1.0 gstbadaudio-1.0 gstaudioconvert gstaudiomixer gstaudiorate gstaudioresample gstaudiotestsrc
-endif
-
 LOCAL_C_INCLUDES += $(GST_HEADERS_COMMON)
 
-LOCAL_SHARED_LIBRARIES := $(BUILDING_BLOCK_LIST)
+LOCAL_SHARED_LIBRARIES := gstreamer_android
 
 include $(BUILD_SHARED_LIBRARY)
index 34a83f4..1ce22af 100644 (file)
@@ -53,7 +53,7 @@ include $(CLEAR_VARS)
 # Please keep the pthread and openmp library for checking a compatibility
 LOCAL_ARM_NEON      := true
 LOCAL_CFLAGS        += -O0 -fPIC -DVERSION=\"$(NNSTREAMER_VERSION)\"
-LOCAL_CXXFLAGS      += -std=c++11 -fPIC -frtti -fexceptions -DVERSION=\"$(NNSTREAMER_VERSION)\"
+LOCAL_CXXFLAGS      += -fPIC -frtti -fexceptions -DVERSION=\"$(NNSTREAMER_VERSION)\"
 LOCAL_CFLAGS        += -pthread -fopenmp
 
 ifeq ($(NO_AUDIO), true)
@@ -133,7 +133,7 @@ LOCAL_SRC_FILES := $(TFLITE_SRCS)
 LOCAL_C_INCLUDES := $(TFLITE_INCLUDES)
 
 LOCAL_CFLAGS += -O3 -DNDEBUG
-LOCAL_CXXFLAGS += -std=c++11 -frtti -fexceptions -O3 -DNDEBUG
+LOCAL_CXXFLAGS += -frtti -fexceptions -O3 -DNDEBUG
 
 include $(BUILD_STATIC_LIBRARY)
 
@@ -163,7 +163,7 @@ LOCAL_SHARED_LIBRARIES := $(GST_BUILDING_BLOCK_LIST) nnstreamer
 
 LOCAL_ARM_NEON      := true
 LOCAL_CFLAGS        += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\"
-LOCAL_CXXFLAGS      += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\"
+LOCAL_CXXFLAGS      += -DVERSION=\"$(NNSTREAMER_VERSION)\"
 LOCAL_CFLAGS        += -pthread -fopenmp
 
 LOCAL_C_INCLUDES += $(GST_HEADERS_COMMON)
@@ -179,7 +179,7 @@ LOCAL_SHARED_LIBRARIES := $(GST_BUILDING_BLOCK_LIST) nnstreamer
 
 LOCAL_ARM_NEON      := true
 LOCAL_CFLAGS        += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\"
-LOCAL_CXXFLAGS      += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\"
+LOCAL_CXXFLAGS      += -DVERSION=\"$(NNSTREAMER_VERSION)\"
 LOCAL_CFLAGS        += -pthread -fopenmp
 
 LOCAL_C_INCLUDES += $(GST_HEADERS_COMMON)
@@ -195,7 +195,7 @@ LOCAL_SHARED_LIBRARIES := $(GST_BUILDING_BLOCK_LIST) nnstreamer
 
 LOCAL_ARM_NEON      := true
 LOCAL_CFLAGS        += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\"
-LOCAL_CXXFLAGS      += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\"
+LOCAL_CXXFLAGS      += -DVERSION=\"$(NNSTREAMER_VERSION)\"
 LOCAL_CFLAGS        += -pthread -fopenmp
 
 LOCAL_C_INCLUDES += $(GST_HEADERS_COMMON)
@@ -211,7 +211,7 @@ LOCAL_SHARED_LIBRARIES := $(GST_BUILDING_BLOCK_LIST) nnstreamer
 
 LOCAL_ARM_NEON      := true
 LOCAL_CFLAGS        += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\"
-LOCAL_CXXFLAGS      += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\"
+LOCAL_CXXFLAGS      += -DVERSION=\"$(NNSTREAMER_VERSION)\"
 LOCAL_CFLAGS        += -pthread -fopenmp
 
 LOCAL_C_INCLUDES += $(GST_HEADERS_COMMON)
@@ -227,7 +227,7 @@ LOCAL_SHARED_LIBRARIES := $(GST_BUILDING_BLOCK_LIST) nnstreamer
 
 LOCAL_ARM_NEON      := true
 LOCAL_CFLAGS        += -O0 -DVERSION=\"$(NNSTREAMER_VERSION)\"
-LOCAL_CXXFLAGS      += -std=c++11 -DVERSION=\"$(NNSTREAMER_VERSION)\"
+LOCAL_CXXFLAGS      += -DVERSION=\"$(NNSTREAMER_VERSION)\"
 LOCAL_CFLAGS        += -pthread -fopenmp
 
 LOCAL_C_INCLUDES += $(GST_HEADERS_COMMON)
index 7a630a3..3fe6a2a 100644 (file)
@@ -12,3 +12,4 @@ APP_ABI           := arm64-v8a
 LIBCXX_USE_GABIXX := true
 APP_STL           := c++_shared
 APP_PLATFORM      := android-24
+APP_CPPFLAGS      := -std=c++17