Made samples build independent from nonfree module.

(cherry picked from commit bba8c0beac)
This commit is contained in:
Alexander Smorkalov
2015-10-14 12:52:32 +03:00
parent 42447a7610
commit 966d35a9fb
18 changed files with 301 additions and 110 deletions

View File

@@ -1,7 +1,6 @@
SET(OPENCV_OCL_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_highgui
opencv_ml opencv_video opencv_objdetect opencv_features2d
opencv_calib3d opencv_legacy opencv_contrib opencv_ocl
opencv_nonfree)
opencv_calib3d opencv_legacy opencv_contrib opencv_ocl)
ocv_check_dependencies(${OPENCV_OCL_SAMPLES_REQUIRED_DEPS})
@@ -52,7 +51,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
endif()
if (OCV_DEPENDENCIES_FOUND AND INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd *.txt)
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* *.txt)
install(FILES ${install_list}
DESTINATION "${OPENCV_SAMPLES_SRC_INSTALL_PATH}/ocl"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT samples)

View File

@@ -1,11 +1,22 @@
#include "opencv2/opencv_modules.hpp"
#include <iostream>
#include <stdio.h>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/ocl/ocl.hpp"
#include "opencv2/nonfree/ocl.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
return -1;
}
#else
# include "opencv2/core/core.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/ocl/ocl.hpp"
# include "opencv2/nonfree/ocl.hpp"
# include "opencv2/calib3d/calib3d.hpp"
# include "opencv2/nonfree/nonfree.hpp"
using namespace cv;
using namespace cv::ocl;
@@ -326,3 +337,5 @@ int main(int argc, char* argv[])
waitKey(0);
return EXIT_SUCCESS;
}
#endif