How to create OpenCV for Android using Clang and latest NDK r15b

How can I build OpenCV for Android using Clang and the latest NDK r15b? The latest NDK r15b tools folder does not have any special Clang subfolders, except for llvm and android.toolchain.cmake script ignores the llvm subfolder. So I can't figure out how to get things to work?

+3


source to share


1 answer


You can compile it like this:

cd $OPENCV_SRC_DIR
mkdir build
export ANDROID_NDK=$YOUR_NDK_PATH
cmake -DCMAKE_TOOLCHAIN_FILE=$YOUR_NDK_PATH/build/cmake/android.toolchain.cmake  ..
make -j7
make install
cd install

      

Note:



Tested with latest ndk16 + opencv-2.4.11.

(Clang is the default compiler in the new ndk)

+1


source







All Articles