首页 > 代码库 > linux下如何不编译opencv的某些模块

linux下如何不编译opencv的某些模块

opencv非常庞大,有很多模块,但大部分情况我们可能只会用到三四个模块,此时如果还是直接cmake . & make,将会非常费时,尤其是部署时很麻烦。

所以需要去除掉一些不需要的模块,可参考如下编译脚本,build_opencv.sh :

#!/bin/shcmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_opencv_gpu=OFF  -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D BUILD_WITH_DEBUG_INFO=OFF -D BUILD_opencv_apps=OFF -D BUILD_opencv_calib3d=OFF -D BUILD_opencv_contrib=OFF -D BUILD_opencv_features2d=OFF -D BUILD_opencv_flann=OFF -D BUILD_opencv_gpu=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_superres=OFF -D BUILD_opencv_ts=OFF -D BUILD_opencv_video=OFF -D BUILD_opencv_videostab=OFF .makesudo make install

  

linux下如何不编译opencv的某些模块