Created
September 18, 2014 21:52
-
-
Save julienr/6380a90ca6e95c1901e3 to your computer and use it in GitHub Desktop.
OpenCV Android custom build multiple ABI script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to build opencv for android for multiple architectures | |
# Must be run from a directory that contains an 'opencv' directory with the | |
# opencv sources (from git or a tarball) | |
# Final Build to opencv/build/install | |
export ANDROID_NDK=$NDK | |
CMAKE_ARGS="-DNATIVE_API_LEVEL=14 \ | |
-DBUILD_ANDROID_EXAMPLES=0 \ | |
-DBUILD_ANDROID_PACKAGE=0 \ | |
-DBUILD_DOCS=0 \ | |
-DBUILD_EXAMPLES=0 \ | |
-DBUILD_FAT_JAVA_LIB=0 \ | |
-DBUILD_JASPER=0 \ | |
-DBUILD_JPEG=0 \ | |
-DBUILD_OPENEXR=0 \ | |
-DBUILD_PACKAGE=0 \ | |
-DBUILD_PERF_TESTS=0 \ | |
-DBUILD_PNG=0 \ | |
-DBUILD_SHARED_LIBS=0 \ | |
-DBUILD_TBB=0 \ | |
-DBUILD_TESTS=0 \ | |
-DBUILD_TIFF=0 \ | |
-DBUILD_WITH_DEBUG_INFO=0 \ | |
-DBUILD_ZLIB=0 \ | |
-DBUILD_opencv_androidcamera=0 \ | |
-DBUILD_opencv_apps=0 \ | |
-DBUILD_opencv_calib3d=0 \ | |
-DBUILD_opencv_contrib=0 \ | |
-DBUILD_opencv_core=1 \ | |
-DBUILD_opencv_features2d=0 \ | |
-DBUILD_opencv_flann=0 \ | |
-DBUILD_opencv_gpu=0 \ | |
-DBUILD_opencv_highgui=0 \ | |
-DBUILD_opencv_imgproc=1 \ | |
-DBUILD_opencv_java=0 \ | |
-DBUILD_opencv_legacy=0 \ | |
-DBUILD_opencv_ml=0 \ | |
-DBUILD_opencv_nonfree=0 \ | |
-DBUILD_opencv_objdetect=0 \ | |
-DBUILD_opencv_ocl=0 \ | |
-DBUILD_opencv_photo=0 \ | |
-DBUILD_opencv_stitching=0 \ | |
-DBUILD_opencv_superres=0 \ | |
-DBUILD_opencv_ts=0 \ | |
-DBUILD_opencv_video=0 \ | |
-DBUILD_opencv_videostab=0 \ | |
-DBUILD_opencv_world=0 \ | |
-DWITH_CUBLAS=0 \ | |
-DWITH_CUDA=0 \ | |
-DWITH_CUFFT=0 \ | |
-DWITH_EIGEN=0 \ | |
-DWITH_IPP=0 \ | |
-DWITH_JASPER=0 \ | |
-DWITH_JPEG=0 \ | |
-DWITH_OPENCL=0 \ | |
-DWITH_OPENEXR=0 \ | |
-DWITH_OPENMP=0 \ | |
-DWITH_PNG=0 \ | |
-DWITH_TBB=0 \ | |
-DWITH_TIFF=0" | |
# First argument is abi type (armeabi-v7a, x86) | |
function build_opencv { | |
ABI=$1 | |
pushd opencv | |
echo "Building Opencv for $ABI" | |
mkdir build_$ABI | |
pushd build_$ABI | |
cmake -DANDROID_ABI=$ABI \ | |
-DCMAKE_TOOLCHAIN_FILE=../platforms/android/android.toolchain.cmake \ | |
$CMAKE_ARGS .. | |
make -j5 | |
make install | |
popd | |
popd | |
} | |
build_opencv x86 | |
build_opencv armeabi-v7a | |
# collect install directories to build/install | |
pushd opencv | |
mkdir build | |
pushd build | |
mkdir install | |
cp -r ../build_x86/install/* install/ | |
cp -r ../build_armeabi-v7a/install/* install/ | |
popd | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment