~paparazzi-uav/paparazzi/v5.0-manual

« back to all changes in this revision

Viewing changes to sw/ext/opencv_bebop/opencv/samples/cpp/CMakeLists.txt

  • Committer: Paparazzi buildbot
  • Date: 2016-05-18 15:00:29 UTC
  • Revision ID: felix.ruess+docbot@gmail.com-20160518150029-e8lgzi5kvb4p7un9
Manual import commit 4b8bbb730080dac23cf816b98908dacfabe2a8ec from v5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ----------------------------------------------------------------------------
 
2
#  CMake file for C samples. See root CMakeLists.txt
 
3
#
 
4
# ----------------------------------------------------------------------------
 
5
 
 
6
SET(OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_flann
 
7
    opencv_imgcodecs opencv_videoio opencv_highgui opencv_ml opencv_video
 
8
    opencv_objdetect opencv_photo opencv_features2d opencv_calib3d
 
9
    opencv_stitching opencv_videostab opencv_shape ${OPENCV_MODULES_PUBLIC} ${OpenCV_LIB_COMPONENTS})
 
10
 
 
11
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
 
12
 
 
13
 
 
14
if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
 
15
  project(cpp_samples)
 
16
 
 
17
  ocv_include_directories("${OpenCV_SOURCE_DIR}/include")#for opencv.hpp
 
18
  ocv_include_modules_recurse(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
 
19
 
 
20
  if(HAVE_opencv_cudaoptflow)
 
21
    ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/cudaoptflow/include")
 
22
  endif()
 
23
  if(HAVE_opencv_cudaimgproc)
 
24
    ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/cudaimgproc/include")
 
25
  endif()
 
26
  if(HAVE_opencv_cudaarithm)
 
27
    ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/cudaarithm/include")
 
28
  endif()
 
29
  if(HAVE_opencv_cudafilters)
 
30
    ocv_include_directories("${OpenCV_SOURCE_DIR}/modules/cudafilters/include")
 
31
  endif()
 
32
 
 
33
  if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS)
 
34
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
 
35
  endif()
 
36
 
 
37
  # ---------------------------------------------
 
38
  #      Define executable targets
 
39
  # ---------------------------------------------
 
40
  MACRO(OPENCV_DEFINE_CPP_EXAMPLE name srcs)
 
41
 
 
42
    if("${srcs}" MATCHES "tutorial_code")
 
43
      set(sample_kind tutorial)
 
44
      set(sample_KIND TUTORIAL)
 
45
      set(sample_subfolder "tutorials")
 
46
    else()
 
47
      set(sample_kind example)
 
48
      set(sample_KIND EXAMPLE)
 
49
      set(sample_subfolder "cpp")
 
50
    endif()
 
51
 
 
52
    set(the_target "${sample_kind}_${name}")
 
53
    add_executable(${the_target} ${srcs})
 
54
    ocv_target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
 
55
 
 
56
    if("${srcs}" MATCHES "gpu/")
 
57
      ocv_target_link_libraries(${the_target} opencv_cudaarithm opencv_cudafilters)
 
58
    endif()
 
59
 
 
60
    if(HAVE_opencv_ocl)
 
61
      ocv_target_link_libraries(${the_target} opencv_ocl)
 
62
    endif()
 
63
 
 
64
    set_target_properties(${the_target} PROPERTIES
 
65
      OUTPUT_NAME "cpp-${sample_kind}-${name}"
 
66
      PROJECT_LABEL "(${sample_KIND}) ${name}")
 
67
 
 
68
    if(ENABLE_SOLUTION_FOLDERS)
 
69
      set_target_properties(${the_target} PROPERTIES FOLDER "samples/${sample_subfolder}")
 
70
    endif()
 
71
 
 
72
    if(WIN32)
 
73
      if (MSVC AND NOT BUILD_SHARED_LIBS)
 
74
        set_target_properties(${the_target} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /DEBUG")
 
75
      endif()
 
76
      install(TARGETS ${the_target}
 
77
              RUNTIME DESTINATION "${OPENCV_SAMPLES_BIN_INSTALL_PATH}/${sample_subfolder}" COMPONENT samples)
 
78
    endif()
 
79
  ENDMACRO()
 
80
 
 
81
  file(GLOB_RECURSE cpp_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
 
82
 
 
83
  if(NOT HAVE_OPENGL)
 
84
    ocv_list_filterout(cpp_samples Qt_sample)
 
85
  endif()
 
86
 
 
87
  if(NOT HAVE_opencv_cudaarithm OR NOT HAVE_opencv_cudafilters)
 
88
    ocv_list_filterout(cpp_samples "/gpu/")
 
89
  endif()
 
90
 
 
91
  ocv_list_filterout(cpp_samples "viz")
 
92
 
 
93
  if(NOT HAVE_IPP_A)
 
94
    ocv_list_filterout(cpp_samples "/ippasync/")
 
95
  endif()
 
96
 
 
97
  foreach(sample_filename ${cpp_samples})
 
98
    if(NOT "${sample_filename}" MATCHES "real_time_pose_estimation/")
 
99
        get_filename_component(sample ${sample_filename} NAME_WE)
 
100
        OPENCV_DEFINE_CPP_EXAMPLE(${sample}  ${sample_filename})
 
101
    endif()
 
102
  endforeach()
 
103
 
 
104
  include("tutorial_code/calib3d/real_time_pose_estimation/CMakeLists.txt")
 
105
endif()
 
106
 
 
107
if(INSTALL_C_EXAMPLES AND NOT WIN32)
 
108
  file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
 
109
  install(FILES ${C_SAMPLES}
 
110
          DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/cpp
 
111
          PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
 
112
endif()