Reputation: 804
I'd like to install OpenCV on iOS, but not all the modules, just a few.
How can I achieve this? Is there an argument I could pass to the build_framework.py script that allows me do so?
I followed OpenCV tutorial but it doesn't say anything about this.
Upvotes: 4
Views: 821
Reputation: 984
As of v2.4.6 OpenCV has a custom python script to ease the work (plateforms > ios > build_framework.py)
You just need to add flags on the cmake line to make a custom compile.
For instance : I only need the lib imgproc and to include all the headers into the archive, my cmake now ressembles this :
cmakeargs = ("-GXcode " +
"-D BUILD_SHARED_LIBS=OFF "+
"-D BUILD_opencv_core=ON "+
"-D BUILD_opencv_imgproc=ON "+
"-D BUILD_opencv_world=ON "+
"-D BUILD_opencv_gpu=OFF "+
"-D BUILD_opencv_calib3d=OFF "+
"-D BUILD_opencv_contrib=OFF "+
"-D BUILD_opencv_features2D=OFF "+
"-D BUILD_opencv_flann=OFF "+
"-D BUILD_opencv_highgui=OFF "+
"-D BUILD_opencv_legacy=OFF "+
"-D BUILD_opencv_ml=OFF "+
"-D BUILD_opencv_nonfree=OFF "+
"-D BUILD_opencv_objdetect=OFF "+
"-D BUILD_opencv_photo=OFF "+
"-D BUILD_opencv_stitching=OFF "+
"-D BUILD_opencv_video=OFF "+
"-D BUILD_opencv_videostab=OFF "+
"-DCMAKE_BUILD_TYPE=Release " +
"-DCMAKE_TOOLCHAIN_FILE=%s/platforms/ios/cmake/Toolchains/Toolchain-%s_Xcode.cmake " +
"-DCMAKE_INSTALL_PREFIX=install") % (srcroot, target)
Don't forget to add the core and world lib as they are obligatory. Execute the python script > profite.
After that add the lib manually to your project and remove the pesky import headers left in the headers > opencv.hpp and you should be good to go !
Upvotes: 4