1 SET(OPENCV_GPU_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc opencv_highgui
\r
2 opencv_ml opencv_video opencv_objdetect opencv_features2d
\r
3 opencv_calib3d opencv_legacy opencv_contrib opencv_gpu
\r
6 ocv_check_dependencies(${OPENCV_GPU_SAMPLES_REQUIRED_DEPS})
\r
8 if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
\r
10 string(TOUPPER "${project}" project_upper)
\r
12 project("${project}_samples")
\r
14 ocv_include_modules(${OPENCV_GPU_SAMPLES_REQUIRED_DEPS})
\r
15 ocv_include_directories(
\r
16 "${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia"
\r
17 "${OpenCV_SOURCE_DIR}/modules/gpu/src/nvidia/core"
\r
21 ocv_include_directories(${CUDA_INCLUDE_DIRS})
\r
24 if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
\r
25 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
\r
28 # ---------------------------------------------
\r
29 # Define executable targets
\r
30 # ---------------------------------------------
\r
31 MACRO(OPENCV_DEFINE_GPU_EXAMPLE name srcs)
\r
32 set(the_target "example_${project}_${name}")
\r
33 add_executable(${the_target} ${srcs})
\r
35 target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_GPU_SAMPLES_REQUIRED_DEPS})
\r
37 set_target_properties(${the_target} PROPERTIES
\r
38 OUTPUT_NAME "${name}_${project}"
\r
39 PROJECT_LABEL "(EXAMPLE_${project_upper}) ${name}")
\r
41 if(ENABLE_SOLUTION_FOLDERS)
\r
42 set_target_properties(${the_target} PROPERTIES FOLDER "samples//${project}")
\r
46 if(MSVC AND NOT BUILD_SHARED_LIBS)
\r
47 set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")
\r
49 install(TARGETS ${the_target} RUNTIME DESTINATION "samples/${project}" COMPONENT main)
\r
53 file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
\r
55 foreach(sample_filename ${all_samples})
\r
56 get_filename_component(sample ${sample_filename} NAME_WE)
\r
57 file(GLOB sample_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${sample}.*)
\r
58 OPENCV_DEFINE_GPU_EXAMPLE(${sample} ${sample_srcs})
\r
61 include("performance/CMakeLists.txt")
\r
64 if (INSTALL_C_EXAMPLES AND NOT WIN32)
\r
65 file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
\r
66 install(FILES ${install_list}
\r
67 DESTINATION share/OpenCV/samples/${project}
\r
68 PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
\r