NNTRAINER_ROOT := $(LOCAL_PATH)/..
endif
+ifndef NDK_LIBS_OUT
+NDK_LIBS_OUT := $(NDK_PROJECT_PATH)
+endif
+
include $(CLEAR_VARS)
ifndef INIPARSER_ROOT
$(warning INIPARSER_ROOT is not defined!)
$(warning INIPARSER SRC is going to be downloaded!)
-INIPARSER_ROOT :=./iniparser
+INIPARSER_ROOT :=$(NDK_LIBS_OUT)/iniparser
+
+$(info $(shell ($(LOCAL_PATH)/prepare_iniparser.sh $(NDK_LIBS_OUT))))
endif
endif
-$(info $(shell ($(LOCAL_PATH)/prepare_iniparser.sh )))
include $(CLEAR_VARS)
$(warning TENSORFLOW_ROOT is not defined!)
$(warning TENSORFLOW SRC is going to be downloaded!)
-$(info $(shell ($(NNTRAINER_JNI_ROOT)/prepare_tflite.sh $(TENSORFLOW_VERSION) $(NNTRAINER_APPLICATION))))
+TENSORFLOW_ROOT := $(NDK_LIBS_OUT)/tensorflow-$(TENSORFLOW_VERSION)/tensorflow-lite
-TENSORFLOW_ROOT := $(NNTRAINER_JNI_ROOT)/tensorflow-$(TENSORFLOW_VERSION)/tensorflow-lite
+$(info $(shell ($(NNTRAINER_JNI_ROOT)/prepare_tflite.sh $(TENSORFLOW_VERSION) $(NDK_LIBS_OUT))))
endif #TENSORFLOW_ROOT
endif #MAKECMDGOALS
#!/usr/bin/env bash
+TARGET=$1
-# Get Iniparser
+if [ ! -d ${TARGET} ]; then
+ mkdir -p ${TARGET}
+fi
+
+pushd ${TARGET}
+# Get Iniparser
if [ ! -d "iniparer" ]; then
- git clone https://github.com/ndevilla/iniparser.git
+ echo "PREPARING ini parser at ${TARGET}"
+ git clone https://github.com/ndevilla/iniparser.git iniparser
fi
+
+popd
nnstreamer_dep = dependency('nnstreamer', required: true)
subdir('nnstreamer/tensor_filter')
endif
+
+if get_option('enable-android')
+
+ ndk_build = find_program('ndk-build', required : true)
+ jni_root = meson.current_source_dir() / 'jni'
+ jni_build_root = meson.build_root() / 'jni'
+
+ ndk_args = {
+ 'NDK_PROJECT_PATH': jni_root,
+ 'APP_BUILD_SCRIPT': jni_root / 'Android.mk',
+ 'NDK_APPLICATION_MK': jni_root / 'Application.mk',
+ 'NDK_LIBS_OUT': jni_build_root / 'libs',
+ 'NDK_OUT': jni_build_root / 'objs',
+ }
+
+ num_threads = run_command('grep', '-c', '^processor', '/proc/cpuinfo').stdout().strip()
+ message('num processor are: ' + num_threads)
+
+ thread_opt_flag = '-j' + num_threads
+
+ ndk_additional_flags = [thread_opt_flag]
+
+ ndk_build_command = [ndk_build]
+ foreach key, val : ndk_args
+ ndk_build_command += '@0@=@1@'.format(key, val)
+ endforeach
+ ndk_build_command += ndk_additional_flags
+
+ android_build_target = custom_target('android',
+ output: 'jni',
+ build_by_default: true,
+ command: ndk_build_command
+ )
+
+endif
option('enable-nnstreamer-tensor-filter', type: 'boolean', value: true)
option('enable-nnstreamer-backbone', type: 'boolean', value: true)
option('enable-tflite-backbone', type: 'boolean', value: true)
+option('enable-android', type: 'boolean', value: false)