GPU samples with NVIDIA specific API excluded from build if CUDA disabled.
This commit is contained in:
parent
b0c5f49170
commit
3425c90b66
@ -69,11 +69,27 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
|
||||
endif()
|
||||
ENDMACRO()
|
||||
|
||||
# remove all matching elements from the list
|
||||
MACRO(list_filterout lst regex)
|
||||
foreach(item ${${lst}})
|
||||
if(item MATCHES "${regex}")
|
||||
list(REMOVE_ITEM ${lst} "${item}")
|
||||
endif()
|
||||
endforeach()
|
||||
ENDMACRO()
|
||||
|
||||
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
||||
|
||||
if(NOT WITH_OPENGL)
|
||||
if(NOT HAVE_OPENGL)
|
||||
list(REMOVE_ITEM all_samples "opengl.cpp")
|
||||
endif(NOT WITH_OPENGL)
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_CUDA)
|
||||
list(REMOVE_ITEM all_samples "opticalflow_nvidia_api.cpp")
|
||||
list(REMOVE_ITEM all_samples "cascadeclassifier_nvidia_api.cpp")
|
||||
list(REMOVE_ITEM all_samples "driver_api_multi.cpp")
|
||||
list(REMOVE_ITEM all_samples "driver_api_stereo_multi.cpp")
|
||||
endif()
|
||||
|
||||
foreach(sample_filename ${all_samples})
|
||||
get_filename_component(sample ${sample_filename} NAME_WE)
|
||||
@ -86,9 +102,16 @@ 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 )
|
||||
if(NOT WITH_OPENGL)
|
||||
list(REMOVE_ITEM all_samples "opengl.cpp")
|
||||
endif(NOT WITH_OPENGL)
|
||||
message(" install_list: ${install_list}")
|
||||
if(NOT HAVE_OPENGL)
|
||||
list_filterout(install_list ".*opengl.cpp")
|
||||
endif()
|
||||
if(NOT HAVE_CUDA)
|
||||
list_filterout(install_list ".*opticalflow_nvidia_api.cpp")
|
||||
list_filterout(install_list ".*cascadeclassifier_nvidia_api.cpp")
|
||||
list_filterout(install_list ".*driver_api_multi.cpp")
|
||||
list_filterout(install_list ".*driver_api_stereo_multi.cpp")
|
||||
endif()
|
||||
install(FILES ${install_list}
|
||||
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
|
||||
|
@ -2,39 +2,24 @@
|
||||
#pragma warning( disable : 4201 4408 4127 4100)
|
||||
#endif
|
||||
|
||||
#include "cvconfig.h"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <cstdio>
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
#include "NCVHaarObjectDetection.hpp"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
|
||||
#if !defined(HAVE_CUDA) || defined(__arm__)
|
||||
|
||||
int main( int, const char** )
|
||||
{
|
||||
#if !defined(HAVE_CUDA)
|
||||
std::cout << "CUDA support is required (CMake key 'WITH_CUDA' must be true)." << std::endl;
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
int main()
|
||||
{
|
||||
std::cout << "Unsupported for ARM CUDA library." << std::endl;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
const Size2i preferredVideoFrameSize(640, 480);
|
||||
const string wndTitle = "NVIDIA Computer Vision :: Haar Classifiers Cascade";
|
||||
|
||||
@ -386,4 +371,4 @@ int main(int argc, const char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //!defined(HAVE_CUDA)
|
||||
#endif
|
||||
|
@ -9,26 +9,14 @@
|
||||
#include <ctime>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "cvconfig.h"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include "opencv2/gpu/gpu.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
|
||||
#ifdef HAVE_CUDA
|
||||
#include "NPP_staging/NPP_staging.hpp"
|
||||
#include "NCVBroxOpticalFlow.hpp"
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_CUDA)
|
||||
int main( int, const char** )
|
||||
{
|
||||
std::cout << "Please compile the library with CUDA support" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
|
||||
//using std::tr1::shared_ptr;
|
||||
using cv::Ptr;
|
||||
|
||||
#define PARAM_LEFT "--left"
|
||||
@ -649,5 +637,3 @@ int main(int argc, char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user