Merge pull request #20446 from alalek:cmake_eliminate_modules_scope

pull/20488/head
Alexander Alekhin 3 years ago
commit d52e4e5df3
  1. 4
      CMakeLists.txt
  2. 39
      cmake/OpenCVModule.cmake
  3. 28
      modules/CMakeLists.txt
  4. 3
      modules/highgui/CMakeLists.txt
  5. 11
      modules/highgui/cmake/detect_gtk.cmake
  6. 2
      modules/highgui/cmake/detect_win32ui.cmake
  7. 19
      modules/highgui/cmake/init.cmake
  8. 2
      modules/videoio/cmake/detect_android_camera.cmake
  9. 2
      modules/videoio/cmake/detect_android_mediandk.cmake
  10. 4
      modules/videoio/cmake/detect_aravis.cmake
  11. 2
      modules/videoio/cmake/detect_avfoundation.cmake
  12. 5
      modules/videoio/cmake/detect_dc1394.cmake
  13. 2
      modules/videoio/cmake/detect_dshow.cmake
  14. 7
      modules/videoio/cmake/detect_ffmpeg.cmake
  15. 2
      modules/videoio/cmake/detect_gphoto.cmake
  16. 6
      modules/videoio/cmake/detect_gstreamer.cmake
  17. 2
      modules/videoio/cmake/detect_ios.cmake
  18. 2
      modules/videoio/cmake/detect_msdk.cmake
  19. 3
      modules/videoio/cmake/detect_msmf.cmake
  20. 4
      modules/videoio/cmake/detect_openni2.cmake
  21. 2
      modules/videoio/cmake/detect_pvapi.cmake
  22. 4
      modules/videoio/cmake/detect_realsense.cmake
  23. 2
      modules/videoio/cmake/detect_ueye.cmake
  24. 2
      modules/videoio/cmake/detect_v4l.cmake
  25. 2
      modules/videoio/cmake/detect_ximea.cmake
  26. 2
      modules/videoio/cmake/detect_xine.cmake
  27. 19
      modules/videoio/cmake/init.cmake

@ -914,7 +914,7 @@ add_subdirectory(include)
ocv_add_modules_compiler_options() ocv_add_modules_compiler_options()
# OpenCV modules # OpenCV modules
add_subdirectory(modules) ocv_register_modules()
# Generate targets for documentation # Generate targets for documentation
add_subdirectory(doc) add_subdirectory(doc)
@ -1244,7 +1244,7 @@ endif(WIN32)
# ========================== GUI ========================== # ========================== GUI ==========================
status("") status("")
status(" GUI: ") status(" GUI: " "${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
if(WITH_QT OR HAVE_QT) if(WITH_QT OR HAVE_QT)
if(HAVE_QT5) if(HAVE_QT5)

@ -254,7 +254,7 @@ function(_glob_locations out_paths out_names)
list(LENGTH paths before) list(LENGTH paths before)
get_filename_component(path "${path}" ABSOLUTE) get_filename_component(path "${path}" ABSOLUTE)
# Either module itself # Either module itself
if(NOT path STREQUAL CMAKE_CURRENT_SOURCE_DIR AND EXISTS "${path}/CMakeLists.txt") if(NOT path STREQUAL "${OpenCV_SOURCE_DIR}/modules" AND EXISTS "${path}/CMakeLists.txt")
get_filename_component(name "${path}" NAME) get_filename_component(name "${path}" NAME)
list(APPEND paths "${path}") list(APPEND paths "${path}")
list(APPEND names "${name}") list(APPEND names "${name}")
@ -296,7 +296,7 @@ macro(_add_modules_1 paths names)
list(GET ${names} ${i} __name) list(GET ${names} ${i} __name)
#message(STATUS "First pass: ${__name} => ${__path}") #message(STATUS "First pass: ${__name} => ${__path}")
include("${__path}/cmake/init.cmake" OPTIONAL) include("${__path}/cmake/init.cmake" OPTIONAL)
add_subdirectory("${__path}" "${CMAKE_CURRENT_BINARY_DIR}/.firstpass/${__name}") add_subdirectory("${__path}" "${OpenCV_BINARY_DIR}/modules/.firstpass/${__name}")
endforeach() endforeach()
endif() endif()
endmacro() endmacro()
@ -316,7 +316,7 @@ macro(_add_modules_2)
endif() endif()
string(REGEX REPLACE "^opencv_" "" name "${m}") string(REGEX REPLACE "^opencv_" "" name "${m}")
#message(STATUS "Second pass: ${name} => ${OPENCV_MODULE_${m}_LOCATION}") #message(STATUS "Second pass: ${name} => ${OPENCV_MODULE_${m}_LOCATION}")
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${name}") add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${OpenCV_BINARY_DIR}/modules/${name}")
endif() endif()
ocv_cmake_hook(POST_MODULES_CREATE_${the_module}) ocv_cmake_hook(POST_MODULES_CREATE_${the_module})
endforeach() endforeach()
@ -369,7 +369,6 @@ macro(ocv_glob_modules main_root)
__ocv_resolve_dependencies() __ocv_resolve_dependencies()
# create modules # create modules
set(OPENCV_INITIAL_PASS OFF PARENT_SCOPE)
set(OPENCV_INITIAL_PASS OFF) set(OPENCV_INITIAL_PASS OFF)
ocv_cmake_hook(PRE_MODULES_CREATE) ocv_cmake_hook(PRE_MODULES_CREATE)
_add_modules_2(${OPENCV_MODULES_BUILD}) _add_modules_2(${OPENCV_MODULES_BUILD})
@ -377,6 +376,37 @@ macro(ocv_glob_modules main_root)
endmacro() endmacro()
# called by root CMakeLists.txt
macro(ocv_register_modules)
if(NOT OPENCV_MODULES_PATH)
set(OPENCV_MODULES_PATH "${OpenCV_SOURCE_DIR}/modules")
endif()
ocv_glob_modules(${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
# build lists of modules to be documented
set(OPENCV_MODULES_MAIN "")
set(OPENCV_MODULES_EXTRA "")
foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
list(APPEND OPENCV_MODULES_MAIN ${mod})
else()
list(APPEND OPENCV_MODULES_EXTRA ${mod})
endif()
endforeach()
ocv_list_sort(OPENCV_MODULES_MAIN)
ocv_list_sort(OPENCV_MODULES_EXTRA)
set(FIXED_ORDER_MODULES core imgproc imgcodecs videoio highgui video calib3d features2d objdetect dnn ml flann photo stitching)
list(REMOVE_ITEM OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES})
set(OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES} ${OPENCV_MODULES_MAIN})
set(OPENCV_MODULES_MAIN ${OPENCV_MODULES_MAIN} CACHE INTERNAL "List of main modules" FORCE)
set(OPENCV_MODULES_EXTRA ${OPENCV_MODULES_EXTRA} CACHE INTERNAL "List of extra modules" FORCE)
endmacro()
# disables OpenCV module with missing dependencies # disables OpenCV module with missing dependencies
function(__ocv_module_turn_off the_module) function(__ocv_module_turn_off the_module)
list(REMOVE_ITEM OPENCV_MODULES_DISABLED_AUTO "${the_module}") list(REMOVE_ITEM OPENCV_MODULES_DISABLED_AUTO "${the_module}")
@ -877,6 +907,7 @@ macro(ocv_create_module)
endmacro() endmacro()
macro(_ocv_create_module) macro(_ocv_create_module)
add_definitions(-D__OPENCV_BUILD=1)
ocv_compiler_optimization_process_sources(OPENCV_MODULE_${the_module}_SOURCES OPENCV_MODULE_${the_module}_DEPS_EXT ${the_module}) ocv_compiler_optimization_process_sources(OPENCV_MODULE_${the_module}_SOURCES OPENCV_MODULE_${the_module}_DEPS_EXT ${the_module})
set(__module_headers ${OPENCV_MODULE_${the_module}_HEADERS}) set(__module_headers ${OPENCV_MODULE_${the_module}_HEADERS})

@ -1,28 +0,0 @@
add_definitions(-D__OPENCV_BUILD=1)
if(NOT OPENCV_MODULES_PATH)
set(OPENCV_MODULES_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
endif()
ocv_glob_modules(${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
# build lists of modules to be documented
set(OPENCV_MODULES_MAIN "")
set(OPENCV_MODULES_EXTRA "")
foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
list(APPEND OPENCV_MODULES_MAIN ${mod})
else()
list(APPEND OPENCV_MODULES_EXTRA ${mod})
endif()
endforeach()
ocv_list_sort(OPENCV_MODULES_MAIN)
ocv_list_sort(OPENCV_MODULES_EXTRA)
set(FIXED_ORDER_MODULES core imgproc imgcodecs videoio highgui video calib3d features2d objdetect dnn ml flann photo stitching)
list(REMOVE_ITEM OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES})
set(OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES} ${OPENCV_MODULES_MAIN})
set(OPENCV_MODULES_MAIN ${OPENCV_MODULES_MAIN} CACHE INTERNAL "List of main modules" FORCE)
set(OPENCV_MODULES_EXTRA ${OPENCV_MODULES_EXTRA} CACHE INTERNAL "List of extra modules" FORCE)

@ -218,7 +218,8 @@ endif()
if(NOT OPENCV_HIGHGUI_BUILTIN_BACKEND) if(NOT OPENCV_HIGHGUI_BUILTIN_BACKEND)
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "NONE") set(OPENCV_HIGHGUI_BUILTIN_BACKEND "NONE")
endif() endif()
message(STATUS "highgui: using builtin backend: ${OPENCV_HIGHGUI_BUILTIN_BACKEND}") # FIXIT: propagate to root CMake message(STATUS "highgui: using builtin backend: ${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
set(OPENCV_HIGHGUI_BUILTIN_BACKEND "${OPENCV_HIGHGUI_BUILTIN_BACKEND}" PARENT_SCOPE) # informational
if(TRUE) if(TRUE)
# these variables are set by 'ocv_append_build_options(HIGHGUI ...)' # these variables are set by 'ocv_append_build_options(HIGHGUI ...)'

@ -6,8 +6,6 @@ if(WITH_GTK)
if(HAVE_GTK3) if(HAVE_GTK3)
ocv_add_external_target(gtk3 "${GTK3_INCLUDE_DIRS}" "${GTK3_LIBRARIES}" "HAVE_GTK3;HAVE_GTK") ocv_add_external_target(gtk3 "${GTK3_INCLUDE_DIRS}" "${GTK3_LIBRARIES}" "HAVE_GTK3;HAVE_GTK")
set(HAVE_GTK TRUE) set(HAVE_GTK TRUE)
set(HAVE_GTK3 ${HAVE_GTK3} PARENT_SCOPE)
set(GTK3_VERSION "${GTK3_VERSION}" PARENT_SCOPE) # informational
endif() endif()
endif() endif()
if((PROJECT_NAME STREQUAL "OpenCV" AND HIGHGUI_ENABLE_PLUGINS) OR NOT HAVE_GTK3) if((PROJECT_NAME STREQUAL "OpenCV" AND HIGHGUI_ENABLE_PLUGINS) OR NOT HAVE_GTK3)
@ -19,8 +17,6 @@ if(WITH_GTK)
else() else()
ocv_add_external_target(gtk2 "${GTK2_INCLUDE_DIRS}" "${GTK2_LIBRARIES}" "HAVE_GTK2;HAVE_GTK") ocv_add_external_target(gtk2 "${GTK2_INCLUDE_DIRS}" "${GTK2_LIBRARIES}" "HAVE_GTK2;HAVE_GTK")
set(HAVE_GTK TRUE) set(HAVE_GTK TRUE)
set(HAVE_GTK2 ${HAVE_GTK2} PARENT_SCOPE)
set(GTK2_VERSION "${GTK2_VERSION}" PARENT_SCOPE) # informational
endif() endif()
endif() endif()
endif() endif()
@ -29,15 +25,11 @@ if(WITH_GTK)
message(FATAL_ERROR "gthread not found. This library is required when building with GTK support") message(FATAL_ERROR "gthread not found. This library is required when building with GTK support")
else() else()
ocv_add_external_target(gthread "${GTHREAD_INCLUDE_DIRS}" "${GTHREAD_LIBRARIES}" "HAVE_GTHREAD") ocv_add_external_target(gthread "${GTHREAD_INCLUDE_DIRS}" "${GTHREAD_LIBRARIES}" "HAVE_GTHREAD")
set(HAVE_GTHREAD "${HAVE_GTHREAD}" PARENT_SCOPE) # informational
set(GTHREAD_VERSION "${GTHREAD_VERSION}" PARENT_SCOPE) # informational
endif() endif()
if((WITH_OPENGL OR HAVE_OPENGL) AND HAVE_GTK2) if((WITH_OPENGL OR HAVE_OPENGL) AND HAVE_GTK2)
ocv_check_modules(GTKGLEXT gtkglext-1.0) ocv_check_modules(GTKGLEXT gtkglext-1.0)
if(HAVE_GTKGLEXT) if(HAVE_GTKGLEXT)
ocv_add_external_target(gtkglext "${GTKGLEXT_INCLUDE_DIRS}" "${GTKGLEXT_LIBRARIES}" "HAVE_GTKGLEXT") ocv_add_external_target(gtkglext "${GTKGLEXT_INCLUDE_DIRS}" "${GTKGLEXT_LIBRARIES}" "HAVE_GTKGLEXT")
set(HAVE_GTKGLEXT "${HAVE_GTKGLEXT}" PARENT_SCOPE) # informational
set(GTKGLEXT_VERSION "${GTKGLEXT_VERSION}" PARENT_SCOPE) # informational
endif() endif()
endif() endif()
elseif(HAVE_GTK) elseif(HAVE_GTK)
@ -48,9 +40,6 @@ if(WITH_OPENGL AND HAVE_GTKGLEXT)
find_package(OpenGL QUIET) find_package(OpenGL QUIET)
if(OPENGL_FOUND) if(OPENGL_FOUND)
set(HAVE_OPENGL TRUE) set(HAVE_OPENGL TRUE)
#set(HAVE_OPENGL ${HAVE_OPENGL} PARENT_SCOPE)
ocv_add_external_target(gtk_opengl "${OPENGL_INCLUDE_DIRS}" "${OPENGL_LIBRARIES}" "HAVE_OPENGL") ocv_add_external_target(gtk_opengl "${OPENGL_INCLUDE_DIRS}" "${OPENGL_LIBRARIES}" "HAVE_OPENGL")
endif() endif()
endif() endif()
set(HAVE_GTK ${HAVE_GTK} PARENT_SCOPE)

@ -13,5 +13,3 @@ if(WITH_WIN32UI)
ocv_add_external_target(win32ui "" "${__libs}" "HAVE_WIN32UI") ocv_add_external_target(win32ui "" "${__libs}" "HAVE_WIN32UI")
endif() endif()
endif() endif()
set(HAVE_WIN32UI "${HAVE_WIN32UI}" PARENT_SCOPE) # informational

@ -27,20 +27,11 @@ endif()
include(FindPkgConfig) include(FindPkgConfig)
# FIXIT: stop using PARENT_SCOPE in dependencies macro(add_backend backend_id cond_var)
if(PROJECT_NAME STREQUAL "OpenCV") if(${cond_var})
macro(add_backend backend_id cond_var) include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
if(${cond_var}) endif()
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake") endmacro()
endif()
endmacro()
else()
function(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endfunction()
endif()
add_backend("gtk" WITH_GTK) add_backend("gtk" WITH_GTK)
add_backend("win32ui" WITH_WIN32UI) add_backend("win32ui" WITH_WIN32UI)

@ -4,5 +4,3 @@ if(ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 23)
set(libs "-landroid -llog -lcamera2ndk") set(libs "-landroid -llog -lcamera2ndk")
ocv_add_external_target(android_native_camera "" "${libs}" "HAVE_ANDROID_NATIVE_CAMERA") ocv_add_external_target(android_native_camera "" "${libs}" "HAVE_ANDROID_NATIVE_CAMERA")
endif() endif()
set(HAVE_ANDROID_NATIVE_CAMERA ${HAVE_ANDROID_NATIVE_CAMERA} PARENT_SCOPE)

@ -4,5 +4,3 @@ if(ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 20)
set(libs "-landroid -llog -lmediandk") set(libs "-landroid -llog -lmediandk")
ocv_add_external_target(android_mediandk "" "${libs}" "HAVE_ANDROID_MEDIANDK") ocv_add_external_target(android_mediandk "" "${libs}" "HAVE_ANDROID_MEDIANDK")
endif() endif()
set(HAVE_ANDROID_MEDIANDK ${HAVE_ANDROID_MEDIANDK} PARENT_SCOPE)

@ -21,7 +21,7 @@ if(NOT HAVE_ARAVIS_API)
string(REGEX REPLACE ".*ARAVIS_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}") string(REGEX REPLACE ".*ARAVIS_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*ARAVIS_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}") string(REGEX REPLACE ".*ARAVIS_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*ARAVIS_MICRO_VERSION[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}") string(REGEX REPLACE ".*ARAVIS_MICRO_VERSION[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}")
set(ARAVIS_VERSION "${ver_major}.${ver_minor}.${ver_micro}" PARENT_SCOPE) # informational set(ARAVIS_VERSION "${ver_major}.${ver_minor}.${ver_micro}") # informational
set(ARAVIS_INCLUDE_DIRS "${ARAVIS_INCLUDE}") set(ARAVIS_INCLUDE_DIRS "${ARAVIS_INCLUDE}")
set(ARAVIS_LIBRARIES "${ARAVIS_LIBRARY}") set(ARAVIS_LIBRARIES "${ARAVIS_LIBRARY}")
endif() endif()
@ -30,5 +30,3 @@ endif()
if(HAVE_ARAVIS_API) if(HAVE_ARAVIS_API)
ocv_add_external_target(aravis "${ARAVIS_INCLUDE_DIRS}" "${ARAVIS_LIBRARIES}" "HAVE_ARAVIS_API") ocv_add_external_target(aravis "${ARAVIS_INCLUDE_DIRS}" "${ARAVIS_LIBRARIES}" "HAVE_ARAVIS_API")
endif() endif()
set(HAVE_ARAVIS_API ${HAVE_ARAVIS_API} PARENT_SCOPE)

@ -14,5 +14,3 @@ if(APPLE)
endif() endif()
ocv_add_external_target(avfoundation "" "${libs}" "HAVE_AVFOUNDATION") ocv_add_external_target(avfoundation "" "${libs}" "HAVE_AVFOUNDATION")
endif() endif()
set(HAVE_AVFOUNDATION ${HAVE_AVFOUNDATION} PARENT_SCOPE)

@ -2,7 +2,6 @@
if(NOT HAVE_DC1394_2 AND PKG_CONFIG_FOUND) if(NOT HAVE_DC1394_2 AND PKG_CONFIG_FOUND)
ocv_check_modules(DC1394_2 libdc1394-2) ocv_check_modules(DC1394_2 libdc1394-2)
if(DC1394_2_FOUND) if(DC1394_2_FOUND)
set(DC1394_2_VERSION "${DC1394_2_VERSION}" PARENT_SCOPE) # informational
set(HAVE_DC1394_2 TRUE) set(HAVE_DC1394_2 TRUE)
endif() endif()
endif() endif()
@ -20,12 +19,10 @@ if(NOT HAVE_DC1394_2)
set(HAVE_DC1394_2 TRUE) set(HAVE_DC1394_2 TRUE)
set(DC1394_2_INCLUDE_DIRS "${DC1394_INCLUDE}") set(DC1394_2_INCLUDE_DIRS "${DC1394_INCLUDE}")
set(DC1394_2_LIBRARIES "${DC1394_LIBRARY}") set(DC1394_2_LIBRARIES "${DC1394_LIBRARY}")
set(DC1394_2_VERSION "unknown" PARENT_SCOPE) # informational set(DC1394_2_VERSION "unknown") # informational
endif() endif()
endif() endif()
if(HAVE_DC1394_2) if(HAVE_DC1394_2)
ocv_add_external_target(dc1394_2 "${DC1394_2_INCLUDE_DIRS}" "${DC1394_2_LIBRARIES}" "HAVE_DC1394_2") ocv_add_external_target(dc1394_2 "${DC1394_2_INCLUDE_DIRS}" "${DC1394_2_LIBRARIES}" "HAVE_DC1394_2")
endif() endif()
set(HAVE_DC1394_2 ${HAVE_DC1394_2} PARENT_SCOPE)

@ -10,5 +10,3 @@ endif()
if(HAVE_DSHOW) if(HAVE_DSHOW)
ocv_add_external_target(dshow "" "" "HAVE_DSHOW") ocv_add_external_target(dshow "" "" "HAVE_DSHOW")
endif() endif()
set(HAVE_DSHOW ${HAVE_DSHOW} PARENT_SCOPE)

@ -14,11 +14,6 @@ if(NOT HAVE_FFMPEG AND WIN32 AND NOT ARM AND NOT OPENCV_FFMPEG_SKIP_DOWNLOAD)
download_win_ffmpeg(FFMPEG_CMAKE_SCRIPT) download_win_ffmpeg(FFMPEG_CMAKE_SCRIPT)
if(FFMPEG_CMAKE_SCRIPT) if(FFMPEG_CMAKE_SCRIPT)
include("${FFMPEG_CMAKE_SCRIPT}") include("${FFMPEG_CMAKE_SCRIPT}")
set(FFMPEG_libavcodec_VERSION ${FFMPEG_libavcodec_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavformat_VERSION ${FFMPEG_libavformat_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavutil_VERSION ${FFMPEG_libavutil_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libswscale_VERSION ${FFMPEG_libswscale_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavresample_VERSION ${FFMPEG_libavresample_VERSION} PARENT_SCOPE) # info
set(HAVE_FFMPEG TRUE) set(HAVE_FFMPEG TRUE)
set(HAVE_FFMPEG_WRAPPER TRUE) set(HAVE_FFMPEG_WRAPPER TRUE)
endif() endif()
@ -132,5 +127,3 @@ elseif(HAVE_FFMPEG)
ocv_add_external_target(ffmpeg.plugin_deps "${__plugin_include_dirs}" "${__plugin_include_libs}" "${__plugin_defines}") ocv_add_external_target(ffmpeg.plugin_deps "${__plugin_include_dirs}" "${__plugin_include_libs}" "${__plugin_defines}")
endif() endif()
endif() endif()
set(HAVE_FFMPEG ${HAVE_FFMPEG} PARENT_SCOPE)

@ -9,5 +9,3 @@ endif()
if(HAVE_GPHOTO2) if(HAVE_GPHOTO2)
ocv_add_external_target(gphoto2 "${GPHOTO2_INCLUDE_DIRS}" "${GPHOTO2_LIBRARIES}" "HAVE_GPHOTO2") ocv_add_external_target(gphoto2 "${GPHOTO2_INCLUDE_DIRS}" "${GPHOTO2_LIBRARIES}" "HAVE_GPHOTO2")
endif() endif()
set(HAVE_GPHOTO2 ${HAVE_GPHOTO2} PARENT_SCOPE)

@ -69,7 +69,7 @@ if(NOT HAVE_GSTREAMER AND WIN32)
string(REGEX REPLACE ".*GST_VERSION_MAJOR[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}") string(REGEX REPLACE ".*GST_VERSION_MAJOR[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*GST_VERSION_MINOR[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}") string(REGEX REPLACE ".*GST_VERSION_MINOR[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*GST_VERSION_MICRO[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}") string(REGEX REPLACE ".*GST_VERSION_MICRO[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}")
set(GSTREAMER_VERSION "${ver_major}.${ver_minor}.${ver_micro}" PARENT_SCOPE) # informational set(GSTREAMER_VERSION "${ver_major}.${ver_minor}.${ver_micro}") # informational
set(HAVE_GSTREAMER TRUE) set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_LIBRARIES set(GSTREAMER_LIBRARIES
${GSTREAMER_gstreamer_LIBRARY} ${GSTREAMER_gstreamer_LIBRARY}
@ -95,7 +95,7 @@ if(NOT HAVE_GSTREAMER AND PKG_CONFIG_FOUND)
ocv_check_modules(GSTREAMER_video gstreamer-video-1.0) ocv_check_modules(GSTREAMER_video gstreamer-video-1.0)
if(GSTREAMER_base_FOUND AND GSTREAMER_app_FOUND AND GSTREAMER_riff_FOUND AND GSTREAMER_pbutils_FOUND AND GSTREAMER_video_FOUND) if(GSTREAMER_base_FOUND AND GSTREAMER_app_FOUND AND GSTREAMER_riff_FOUND AND GSTREAMER_pbutils_FOUND AND GSTREAMER_video_FOUND)
set(HAVE_GSTREAMER TRUE) set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_VERSION ${GSTREAMER_base_VERSION} PARENT_SCOPE) # informational set(GSTREAMER_VERSION ${GSTREAMER_base_VERSION}) # informational
set(GSTREAMER_LIBRARIES ${GSTREAMER_base_LIBRARIES} ${GSTREAMER_app_LIBRARIES} ${GSTREAMER_riff_LIBRARIES} ${GSTREAMER_pbutils_LIBRARIES} ${GSTREAMER_video_LIBRARIES}) set(GSTREAMER_LIBRARIES ${GSTREAMER_base_LIBRARIES} ${GSTREAMER_app_LIBRARIES} ${GSTREAMER_riff_LIBRARIES} ${GSTREAMER_pbutils_LIBRARIES} ${GSTREAMER_video_LIBRARIES})
set(GSTREAMER_INCLUDE_DIRS ${GSTREAMER_base_INCLUDE_DIRS} ${GSTREAMER_app_INCLUDE_DIRS} ${GSTREAMER_riff_INCLUDE_DIRS} ${GSTREAMER_pbutils_INCLUDE_DIRS} ${GSTREAMER_video_INCLUDE_DIRS}) set(GSTREAMER_INCLUDE_DIRS ${GSTREAMER_base_INCLUDE_DIRS} ${GSTREAMER_app_INCLUDE_DIRS} ${GSTREAMER_riff_INCLUDE_DIRS} ${GSTREAMER_pbutils_INCLUDE_DIRS} ${GSTREAMER_video_INCLUDE_DIRS})
endif() endif()
@ -104,5 +104,3 @@ endif()
if(HAVE_GSTREAMER) if(HAVE_GSTREAMER)
ocv_add_external_target(gstreamer "${GSTREAMER_INCLUDE_DIRS}" "${GSTREAMER_LIBRARIES}" "HAVE_GSTREAMER") ocv_add_external_target(gstreamer "${GSTREAMER_INCLUDE_DIRS}" "${GSTREAMER_LIBRARIES}" "HAVE_GSTREAMER")
endif() endif()
set(HAVE_GSTREAMER ${HAVE_GSTREAMER} PARENT_SCOPE)

@ -11,5 +11,3 @@ if(APPLE AND IOS)
"-framework UIKit") "-framework UIKit")
ocv_add_external_target(cap_ios "" "${libs}" "HAVE_CAP_IOS") ocv_add_external_target(cap_ios "" "${libs}" "HAVE_CAP_IOS")
endif() endif()
set(HAVE_CAP_IOS ${HAVE_CAP_IOS} PARENT_SCOPE)

@ -70,5 +70,3 @@ if(HAVE_MFX)
list(APPEND MFX_DEFS "HAVE_MFX") list(APPEND MFX_DEFS "HAVE_MFX")
ocv_add_external_target(mediasdk "${MFX_INCLUDE_DIRS}" "${MFX_LIBRARIES}" "${MFX_DEFS}") ocv_add_external_target(mediasdk "${MFX_INCLUDE_DIRS}" "${MFX_LIBRARIES}" "${MFX_DEFS}")
endif() endif()
set(HAVE_MFX ${HAVE_MFX} PARENT_SCOPE)

@ -20,6 +20,3 @@ if(HAVE_MSMF)
endif() endif()
ocv_add_external_target(msmf "" "" "${defs}") ocv_add_external_target(msmf "" "" "${defs}")
endif() endif()
set(HAVE_MSMF ${HAVE_MSMF} PARENT_SCOPE)
set(HAVE_MSMF_DXVA ${HAVE_MSMF_DXVA} PARENT_SCOPE)

@ -42,8 +42,6 @@ if(HAVE_OPENNI2)
string(REGEX REPLACE ".*ONI_VERSION_MAJOR[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}") string(REGEX REPLACE ".*ONI_VERSION_MAJOR[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*ONI_VERSION_MINOR[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}") string(REGEX REPLACE ".*ONI_VERSION_MINOR[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*ONI_VERSION_MAINTENANCE[^0-9]+([0-9]+).*" "\\1" ver_maint "${ver_strings}") string(REGEX REPLACE ".*ONI_VERSION_MAINTENANCE[^0-9]+([0-9]+).*" "\\1" ver_maint "${ver_strings}")
set(OPENNI2_VERSION "${ver_major}.${ver_minor}.${ver_maint}" PARENT_SCOPE) # informational set(OPENNI2_VERSION "${ver_major}.${ver_minor}.${ver_maint}") # informational
ocv_add_external_target(openni2 "${OPENNI2_INCLUDE_DIRS}" "${OPENNI2_LIBRARIES}" "HAVE_OPENNI2") ocv_add_external_target(openni2 "${OPENNI2_INCLUDE_DIRS}" "${OPENNI2_LIBRARIES}" "HAVE_OPENNI2")
endif() endif()
set(HAVE_OPENNI2 ${HAVE_OPENNI2} PARENT_SCOPE)

@ -19,5 +19,3 @@ endif()
if(HAVE_PVAPI) if(HAVE_PVAPI)
ocv_add_external_target(pvapi "${PVAPI_INCLUDE}" "${PVAPI_LIBRARY}" "HAVE_PVAPI") ocv_add_external_target(pvapi "${PVAPI_INCLUDE}" "${PVAPI_LIBRARY}" "HAVE_PVAPI")
endif() endif()
set(HAVE_PVAPI ${HAVE_PVAPI} PARENT_SCOPE)

@ -4,7 +4,7 @@ if(NOT HAVE_LIBREALSENSE)
find_package(realsense2 QUIET) find_package(realsense2 QUIET)
if(realsense2_FOUND) if(realsense2_FOUND)
set(HAVE_LIBREALSENSE TRUE) set(HAVE_LIBREALSENSE TRUE)
set(LIBREALSENSE_VERSION "${realsense2_VERSION}" PARENT_SCOPE) # informational set(LIBREALSENSE_VERSION "${realsense2_VERSION}") # informational
ocv_add_external_target(librealsense "" "${realsense2_LIBRARY}" "HAVE_LIBREALSENSE") ocv_add_external_target(librealsense "" "${realsense2_LIBRARY}" "HAVE_LIBREALSENSE")
endif() endif()
endif() endif()
@ -20,7 +20,7 @@ if(NOT HAVE_LIBREALSENSE)
string(REGEX REPLACE ".*RS2_API_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}") string(REGEX REPLACE ".*RS2_API_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*RS2_API_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}") string(REGEX REPLACE ".*RS2_API_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*RS2_API_PATCH_VERSION[^0-9]+([0-9]+).*" "\\1" ver_patch "${ver_strings}") string(REGEX REPLACE ".*RS2_API_PATCH_VERSION[^0-9]+([0-9]+).*" "\\1" ver_patch "${ver_strings}")
set(LIBREALSENSE_VERSION "${ver_major}.${ver_minor}.${ver_patch}" PARENT_SCOPE) # informational set(LIBREALSENSE_VERSION "${ver_major}.${ver_minor}.${ver_patch}") # informational
ocv_add_external_target(librealsense "${LIBREALSENSE_INCLUDE_DIR}" "${LIBREALSENSE_LIBRARIES}" "HAVE_LIBREALSENSE") ocv_add_external_target(librealsense "${LIBREALSENSE_INCLUDE_DIR}" "${LIBREALSENSE_LIBRARIES}" "HAVE_LIBREALSENSE")
endif() endif()
endif() endif()

@ -21,5 +21,3 @@ unset(_WIN_LIB_SUFFIX)
if(HAVE_UEYE) if(HAVE_UEYE)
ocv_add_external_target(ueye "${UEYE_INCLUDE}" "${UEYE_LIBRARY}" "HAVE_UEYE") ocv_add_external_target(ueye "${UEYE_INCLUDE}" "${UEYE_LIBRARY}" "HAVE_UEYE")
endif() endif()
set(HAVE_UEYE ${HAVE_UEYE} PARENT_SCOPE)

@ -15,5 +15,3 @@ if(NOT HAVE_V4L)
ocv_add_external_target(v4l "" "" "${defs}") ocv_add_external_target(v4l "" "" "${defs}")
endif() endif()
endif() endif()
set(HAVE_V4L ${HAVE_V4L} PARENT_SCOPE)

@ -28,5 +28,3 @@ endif()
if(HAVE_XIMEA) if(HAVE_XIMEA)
ocv_add_external_target(ximea "${XIMEA_INCLUDE}" "${XIMEA_LIBRARY}" "HAVE_XIMEA") ocv_add_external_target(ximea "${XIMEA_INCLUDE}" "${XIMEA_LIBRARY}" "HAVE_XIMEA")
endif() endif()
set(HAVE_XIMEA ${HAVE_XIMEA} PARENT_SCOPE)

@ -5,5 +5,3 @@ endif()
if(HAVE_XINE) if(HAVE_XINE)
ocv_add_external_target(xine "${XINE_INCLUDE_DIRS}" "${XINE_LIBRARIES}" "HAVE_XINE") ocv_add_external_target(xine "${XINE_INCLUDE_DIRS}" "${XINE_LIBRARIES}" "HAVE_XINE")
endif() endif()
set(HAVE_XINE ${HAVE_XINE} PARENT_SCOPE)

@ -1,19 +1,10 @@
include(FindPkgConfig) include(FindPkgConfig)
# FIXIT: stop using PARENT_SCOPE in dependencies macro(add_backend backend_id cond_var)
if(PROJECT_NAME STREQUAL "OpenCV") if(${cond_var})
macro(add_backend backend_id cond_var) include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
if(${cond_var}) endif()
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake") endmacro()
endif()
endmacro()
else()
function(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endfunction()
endif()
add_backend("ffmpeg" WITH_FFMPEG) add_backend("ffmpeg" WITH_FFMPEG)
add_backend("gstreamer" WITH_GSTREAMER) add_backend("gstreamer" WITH_GSTREAMER)

Loading…
Cancel
Save