mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
Android samples are included into the Android package
This commit is contained in:
parent
a70f354c0f
commit
20ec29f22e
@ -10,6 +10,7 @@ cd package
|
||||
PRG_DIR=`pwd`
|
||||
mkdir opencv
|
||||
|
||||
|
||||
# neon-enabled build
|
||||
cd $PRG_DIR
|
||||
mkdir build-neon
|
||||
@ -23,6 +24,7 @@ rm -rf doc include src .classpath .project AndroidManifest.xml default.propertie
|
||||
mv libs/armeabi-v7a libs/armeabi-v7a-neon
|
||||
mv share/OpenCV/3rdparty/libs/armeabi-v7a share/OpenCV/3rdparty/libs/armeabi-v7a-neon
|
||||
|
||||
|
||||
# armeabi-v7a build
|
||||
cd "$PRG_DIR"
|
||||
mkdir build
|
||||
@ -51,7 +53,42 @@ cp "$ANDROID_DIR/../README" opencv/
|
||||
|
||||
CV_VERSION=`grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+" opencv/share/OpenCV/OpenCVConfig-version.cmake`
|
||||
mv opencv opencv$CV_VERSION
|
||||
tar cjpf opencv$CV_VERSION.tar.bz2 opencv$CV_VERSION || exit -1
|
||||
|
||||
|
||||
#samples
|
||||
cp -r "$ANDROID_DIR/../samples/android" "$PRG_DIR/samples"
|
||||
cd "$PRG_DIR/samples"
|
||||
|
||||
#enable for loops over items with spaces in their name
|
||||
IFS="
|
||||
"
|
||||
for dir in `ls -1 | grep -v hello-android`
|
||||
do
|
||||
if [ -f "$dir/default.properties" ]
|
||||
then
|
||||
HAS_REFERENCE=`cat "$dir/default.properties" | grep -c android.library.reference.1`
|
||||
if [ $HAS_REFERENCE = 1 ]
|
||||
then
|
||||
echo -n > "$dir/default.properties"
|
||||
android update project --name "$dir" --target "android-8" --library "../../opencv$CV_VERSION" --path "$dir"
|
||||
echo 'android update project --name "$dir" --target "android-8" --library "../opencv$CV_VERSION" --path "$dir"'
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "OPENCV_MK_PATH:=../../opencv$CV_VERSION/share/OpenCV/OpenCV.mk" > includeOpenCV.mk
|
||||
|
||||
cd "$PRG_DIR/samples"
|
||||
#remove ignored files/folders
|
||||
svn status --no-ignore | grep ^I | cut -c9- | xargs -d \\n rm -rf
|
||||
#remove unversioned files/folders
|
||||
svn status | grep ^\? | cut -c9- | xargs -d \\n rm -rf
|
||||
#remove unneded CMakeLists.txt
|
||||
rm CMakeLists.txt
|
||||
|
||||
|
||||
# pack all files
|
||||
cd $PRG_DIR
|
||||
tar cjpf opencv$CV_VERSION.tar.bz2 --exclude-vcs opencv$CV_VERSION samples || exit -1
|
||||
echo
|
||||
echo "Package opencv$CV_VERSION.tar.bz2 is successfully created"
|
||||
|
@ -2,11 +2,12 @@ LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
OPENCV_MK_BUILD_PATH:=../../../../android/build/OpenCV.mk
|
||||
ifeq ("$(wildcard $(OPENCV_MK_BUILD_PATH))","")
|
||||
include ../includeOpenCV.mk
|
||||
ifeq ("$(wildcard $(OPENCV_MK_PATH))","")
|
||||
#try to load OpenCV.mk from default install location
|
||||
include $(TOOLCHAIN_PREBUILT_ROOT)/user/share/OpenCV/OpenCV.mk
|
||||
else
|
||||
include $(OPENCV_MK_BUILD_PATH)
|
||||
include $(OPENCV_MK_PATH)
|
||||
endif
|
||||
|
||||
LOCAL_MODULE := native_sample
|
||||
|
@ -3,11 +3,12 @@ LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
OPENCV_CAMERA_MODULES:=off
|
||||
OPENCV_MK_BUILD_PATH:=../../../../android/build/OpenCV.mk
|
||||
ifeq ("$(wildcard $(OPENCV_MK_BUILD_PATH))","")
|
||||
include ../includeOpenCV.mk
|
||||
ifeq ("$(wildcard $(OPENCV_MK_PATH))","")
|
||||
#try to load OpenCV.mk from default install location
|
||||
include $(TOOLCHAIN_PREBUILT_ROOT)/user/share/OpenCV/OpenCV.mk
|
||||
else
|
||||
include $(OPENCV_MK_BUILD_PATH)
|
||||
include $(OPENCV_MK_PATH)
|
||||
endif
|
||||
|
||||
LOCAL_MODULE := mixed_sample
|
||||
|
1
samples/android/includeOpenCV.mk
Normal file
1
samples/android/includeOpenCV.mk
Normal file
@ -0,0 +1 @@
|
||||
OPENCV_MK_PATH:=../../../android/build/OpenCV.mk
|
Loading…
Reference in New Issue
Block a user