1 # ----------------------------------------------------------------------------
2 # Root CMake file for OpenCV
4 # From the off-tree build directory, invoke:
5 # $ cmake <PATH_TO_OPENCV_ROOT>
7 # ----------------------------------------------------------------------------
9 # Disable in-source builds to prevent source tree corruption.
10 if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
12 FATAL: In-source builds are not allowed.
13 You should create a separate directory for build files.
18 include(cmake/OpenCVMinDepVersions.cmake)
20 if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
21 cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
22 #Required to resolve linker error issues due to incompatibility with CMake v3.0+ policies.
23 #CMake fails to find _fseeko() which leads to subsequent linker error.
24 #See details here: http://www.cmake.org/Wiki/CMake/Policies
25 cmake_policy(VERSION 2.8)
27 cmake_minimum_required(VERSION "${MIN_VER_CMAKE}" FATAL_ERROR)
31 # Configure CMake policies
34 cmake_policy(SET CMP0026 NEW)
38 cmake_policy(SET CMP0042 NEW) # CMake 3.0+ (2.8.12): MacOS "@rpath" in target's install name
42 cmake_policy(SET CMP0046 NEW) # warn about non-existed dependencies
46 cmake_policy(SET CMP0051 NEW)
49 if(POLICY CMP0054) # CMake 3.1: Only interpret if() arguments as variables or keywords when unquoted.
50 cmake_policy(SET CMP0054 NEW)
54 cmake_policy(SET CMP0056 NEW) # try_compile(): link flags
58 cmake_policy(SET CMP0066 NEW) # CMake 3.7: try_compile(): use per-config flags, like CMAKE_CXX_FLAGS_RELEASE
62 cmake_policy(SET CMP0067 NEW) # CMake 3.8: try_compile(): honor language standard variables (like C++11)
66 cmake_policy(SET CMP0068 NEW) # CMake 3.9+: `RPATH` settings on macOS do not affect `install_name`.
70 cmake_policy(SET CMP0075 NEW) # CMake 3.12+: Include file check macros honor `CMAKE_REQUIRED_LIBRARIES`
74 cmake_policy(SET CMP0077 NEW) # CMake 3.13+: option() honors normal variables.
78 # Configure OpenCV CMake hooks
80 include(cmake/OpenCVUtils.cmake)
81 ocv_cmake_reset_hooks()
82 ocv_check_environment_variables(OPENCV_CMAKE_HOOKS_DIR)
83 if(DEFINED OPENCV_CMAKE_HOOKS_DIR)
84 foreach(__dir ${OPENCV_CMAKE_HOOKS_DIR})
85 get_filename_component(__dir "${__dir}" ABSOLUTE)
86 ocv_cmake_hook_register_dir(${__dir})
90 ocv_cmake_hook(CMAKE_INIT)
92 # must go before the project()/enable_language() commands
93 ocv_update(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
94 if(NOT DEFINED CMAKE_BUILD_TYPE
95 AND NOT OPENCV_SKIP_DEFAULT_BUILD_TYPE
97 message(STATUS "'Release' build type is used by default. Use CMAKE_BUILD_TYPE to specify build type (Release or Debug)")
98 set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build")
100 if(DEFINED CMAKE_BUILD_TYPE)
101 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${CMAKE_CONFIGURATION_TYPES}")
104 option(ENABLE_PIC "Generate position independent code (necessary for shared libraries)" TRUE)
105 set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_PIC})
107 ocv_cmake_hook(PRE_CMAKE_BOOTSTRAP)
109 # Bootstrap CMake system: setup CMAKE_SYSTEM_NAME and other vars
110 if(OPENCV_WORKAROUND_CMAKE_20989)
111 set(CMAKE_SYSTEM_PROCESSOR_BACKUP ${CMAKE_SYSTEM_PROCESSOR})
113 enable_language(CXX C)
114 if(OPENCV_WORKAROUND_CMAKE_20989)
115 set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR_BACKUP})
118 ocv_cmake_hook(POST_CMAKE_BOOTSTRAP)
120 if(NOT OPENCV_SKIP_CMAKE_SYSTEM_FILE)
121 include("cmake/platforms/OpenCV-${CMAKE_SYSTEM_NAME}.cmake" OPTIONAL RESULT_VARIABLE "OPENCV_CMAKE_SYSTEM_FILE")
122 if(NOT OPENCV_CMAKE_SYSTEM_FILE)
123 message(STATUS "OpenCV: system-specific configuration file is not found: '${CMAKE_SYSTEM_NAME}'")
127 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.html
128 if(NOT CMAKE_TOOLCHAIN_FILE)
130 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
132 set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory" FORCE)
135 # any cross-compiling
136 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
142 project(OpenCV CXX C)
145 set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
148 ocv_cmake_eval(DEBUG_PRE ONCE)
150 ocv_clear_vars(OpenCVModules_TARGETS)
152 include(cmake/OpenCVDownload.cmake)
154 set(BUILD_LIST "" CACHE STRING "Build only listed modules (comma-separated, e.g. 'videoio,dnn,ts')")
156 # ----------------------------------------------------------------------------
157 # Break in case of popular CMake configuration mistakes
158 # ----------------------------------------------------------------------------
159 if(NOT CMAKE_SIZEOF_VOID_P GREATER 0)
160 message(FATAL_ERROR "CMake fails to determine the bitness of the target platform.
161 Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.")
164 # ----------------------------------------------------------------------------
165 # Detect compiler and target platform architecture
166 # ----------------------------------------------------------------------------
167 include(cmake/OpenCVDetectCXXCompiler.cmake)
168 ocv_cmake_hook(POST_DETECT_COMPILER)
170 # Add these standard paths to the search paths for FIND_LIBRARY
171 # to find libraries from these locations first
172 if(UNIX AND NOT ANDROID)
173 if(X86_64 OR CMAKE_SIZEOF_VOID_P EQUAL 8)
175 list(APPEND CMAKE_LIBRARY_PATH /lib64)
177 list(APPEND CMAKE_LIBRARY_PATH /lib)
179 if(EXISTS /usr/lib64)
180 list(APPEND CMAKE_LIBRARY_PATH /usr/lib64)
182 list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
184 elseif(X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
186 list(APPEND CMAKE_LIBRARY_PATH /lib32)
188 list(APPEND CMAKE_LIBRARY_PATH /lib)
190 if(EXISTS /usr/lib32)
191 list(APPEND CMAKE_LIBRARY_PATH /usr/lib32)
193 list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
198 # Add these standard paths to the search paths for FIND_PATH
199 # to find include files from these locations first
202 list(APPEND CMAKE_INCLUDE_PATH /mingw)
205 list(APPEND CMAKE_INCLUDE_PATH /mingw32)
208 list(APPEND CMAKE_INCLUDE_PATH /mingw64)
212 # ----------------------------------------------------------------------------
213 # OpenCV cmake options
214 # ----------------------------------------------------------------------------
216 OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF)
219 OCV_OPTION(OPENCV_FORCE_3RDPARTY_BUILD "Force using 3rdparty code from source" OFF)
220 OCV_OPTION(BUILD_ZLIB "Build zlib from source" (WIN32 OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
221 OCV_OPTION(BUILD_TIFF "Build libtiff from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
222 OCV_OPTION(BUILD_OPENJPEG "Build OpenJPEG from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
223 OCV_OPTION(BUILD_JASPER "Build libjasper from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
224 OCV_OPTION(BUILD_JPEG "Build libjpeg from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
225 OCV_OPTION(BUILD_PNG "Build libpng from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
226 OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (OPENCV_FORCE_3RDPARTY_BUILD) )
227 OCV_OPTION(BUILD_WEBP "Build WebP from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
228 OCV_OPTION(BUILD_TBB "Download and build TBB from source" (ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
229 OCV_OPTION(BUILD_IPP_IW "Build IPP IW from source" (NOT MINGW OR OPENCV_FORCE_3RDPARTY_BUILD) IF (X86_64 OR X86) AND NOT WINRT )
230 OCV_OPTION(BUILD_ITT "Build Intel ITT from source"
231 (NOT MINGW OR OPENCV_FORCE_3RDPARTY_BUILD)
232 IF (X86_64 OR X86 OR ARM OR AARCH64 OR PPC64 OR PPC64LE) AND NOT WINRT AND NOT APPLE_FRAMEWORK
235 # Optional 3rd party components
236 # ===================================================
237 OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON
238 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
239 VERIFY HAVE_DC1394_2)
240 OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON
242 VERIFY HAVE_AVFOUNDATION)
243 OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
246 OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION)
247 VISIBLE_IF (ARM OR AARCH64) AND NOT IOS)
248 OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON
250 VERIFY HAVE_CPUFEATURES)
251 OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON
252 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT CMAKE_CROSSCOMPILING
254 OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" OFF
255 VISIBLE_IF NOT IOS AND NOT WINRT
257 OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" WITH_CUDA
260 OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" WITH_CUDA
263 OCV_OPTION(WITH_CUDNN "Include NVIDIA CUDA Deep Neural Network (cuDNN) library support" WITH_CUDA
266 OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF # disabled, details: https://github.com/opencv/opencv/issues/14850
269 OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" (NOT CV_DISABLE_OPTIMIZATION AND NOT CMAKE_CROSSCOMPILING)
272 OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" (NOT ANDROID)
273 VISIBLE_IF NOT IOS AND NOT WINRT
275 OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON
276 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
277 VERIFY HAVE_GSTREAMER AND GSTREAMER_VERSION VERSION_GREATER "0.99")
278 OCV_OPTION(WITH_GTK "Include GTK support" ON
279 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
281 OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF
282 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
283 VERIFY HAVE_GTK AND NOT HAVE_GTK3)
284 OCV_OPTION(WITH_WAYLAND "Include Wayland support" OFF
285 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
287 OCV_OPTION(WITH_IPP "Include Intel IPP support" (NOT MINGW AND NOT CV_DISABLE_OPTIMIZATION)
288 VISIBLE_IF (X86_64 OR X86) AND NOT WINRT AND NOT IOS
290 OCV_OPTION(WITH_HALIDE "Include Halide support" OFF
293 OCV_OPTION(WITH_VULKAN "Include Vulkan support" OFF
296 # replacement for deprecated options: WITH_INF_ENGINE, WITH_NGRAPH
297 OCV_OPTION(WITH_OPENVINO "Include Intel OpenVINO toolkit support" (WITH_INF_ENGINE)
299 VERIFY TARGET ocv.3rdparty.openvino)
300 OCV_OPTION(WITH_WEBNN "Include WebNN support" OFF
303 OCV_OPTION(WITH_JASPER "Include JPEG2K support (Jasper)" ON
306 OCV_OPTION(WITH_OPENJPEG "Include JPEG2K support (OpenJPEG)" ON
308 VERIFY HAVE_OPENJPEG)
309 OCV_OPTION(WITH_JPEG "Include JPEG support" ON
312 OCV_OPTION(WITH_WEBP "Include WebP support" ON
315 OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ((WIN32 OR ANDROID OR APPLE) OR BUILD_OPENEXR) OR NOT CMAKE_CROSSCOMPILING
316 VISIBLE_IF NOT APPLE_FRAMEWORK AND NOT WINRT
318 OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF
319 VISIBLE_IF NOT ANDROID AND NOT WINRT
321 OCV_OPTION(WITH_OPENVX "Include OpenVX support" OFF
324 OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF
325 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
327 OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF
328 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
330 OCV_OPTION(WITH_PNG "Include PNG support" ON
333 OCV_OPTION(WITH_SPNG "Include SPNG support" OFF
336 OCV_OPTION(WITH_GDCM "Include DICOM support" OFF
339 OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" OFF
340 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
342 OCV_OPTION(WITH_ARAVIS "Include Aravis GigE support" OFF
343 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT WIN32
344 VERIFY HAVE_ARAVIS_API)
345 OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF
346 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
348 OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON
349 VISIBLE_IF WIN32 AND NOT WINRT
351 OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF
352 VISIBLE_IF NOT IOS AND NOT WINRT
354 OCV_OPTION(WITH_HPX "Include Ste||ar Group HPX support" OFF
357 OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF
360 OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON
361 VISIBLE_IF NOT WIN32 OR MINGW
362 VERIFY HAVE_PTHREADS_PF)
363 OCV_OPTION(WITH_TIFF "Include TIFF support" ON
366 OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON
367 VISIBLE_IF UNIX AND NOT ANDROID AND NOT APPLE
368 VERIFY HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
369 OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON
370 VISIBLE_IF WIN32 AND NOT ARM AND NOT WINRT
372 OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" NOT MINGW
375 OCV_OPTION(WITH_MSMF_DXVA "Enable hardware acceleration in Media Foundation backend" WITH_MSMF
377 VERIFY HAVE_MSMF_DXVA)
378 OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF
379 VISIBLE_IF NOT ANDROID AND NOT WINRT
381 OCV_OPTION(WITH_UEYE "Include UEYE camera support" OFF
382 VISIBLE_IF NOT ANDROID AND NOT APPLE AND NOT WINRT
384 OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF
385 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
387 OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF
390 OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" (NOT ANDROID AND NOT CV_DISABLE_OPTIMIZATION)
391 VISIBLE_IF NOT IOS AND NOT WINRT
393 OCV_OPTION(WITH_OPENCL_SVM "Include OpenCL Shared Virtual Memory support" OFF
395 VERIFY HAVE_OPENCL_SVM) # experimental
396 OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON
397 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
398 VERIFY HAVE_CLAMDFFT)
399 OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON
400 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
401 VERIFY HAVE_CLAMDBLAS)
402 OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON
403 VISIBLE_IF WIN32 AND NOT WINRT
405 OCV_OPTION(WITH_OPENCL_D3D11_NV "Include NVIDIA OpenCL D3D11 support" WITH_DIRECTX
406 VISIBLE_IF WIN32 AND NOT WINRT
407 VERIFY HAVE_OPENCL_D3D11_NV)
408 OCV_OPTION(WITH_LIBREALSENSE "Include Intel librealsense support" OFF
409 VISIBLE_IF NOT WITH_INTELPERC
410 VERIFY HAVE_LIBREALSENSE)
411 OCV_OPTION(WITH_VA "Include VA support" (X86_64 OR X86)
412 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
414 OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" (X86_64 OR X86)
415 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
416 VERIFY HAVE_VA_INTEL)
417 OCV_OPTION(WITH_MFX "Include Intel Media SDK support" OFF
418 VISIBLE_IF (UNIX AND NOT ANDROID) OR (WIN32 AND NOT WINRT AND NOT MINGW)
420 OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF
421 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
423 OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" OFF
424 VISIBLE_IF UNIX AND NOT ANDROID AND NOT IOS
426 OCV_OPTION(WITH_LAPACK "Include Lapack library support" (NOT CV_DISABLE_OPTIMIZATION)
427 VISIBLE_IF NOT ANDROID AND NOT IOS
429 OCV_OPTION(WITH_ITT "Include Intel ITT support" ON
430 VISIBLE_IF NOT APPLE_FRAMEWORK
432 OCV_OPTION(WITH_PROTOBUF "Enable libprotobuf" ON
434 VERIFY HAVE_PROTOBUF)
435 OCV_OPTION(WITH_IMGCODEC_HDR "Include HDR support" ON
437 VERIFY HAVE_IMGCODEC_HDR)
438 OCV_OPTION(WITH_IMGCODEC_SUNRASTER "Include SUNRASTER support" ON
440 VERIFY HAVE_IMGCODEC_SUNRASTER)
441 OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support" ON
443 VERIFY HAVE_IMGCODEC_PXM)
444 OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON
446 VERIFY HAVE_IMGCODEC_PFM)
447 OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON
450 OCV_OPTION(WITH_ANDROID_MEDIANDK "Use Android Media NDK for Video I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 20)
452 VERIFY HAVE_ANDROID_MEDIANDK)
453 OCV_OPTION(WITH_ANDROID_NATIVE_CAMERA "Use Android NDK for Camera I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 23)
455 VERIFY HAVE_ANDROID_NATIVE_CAMERA)
456 OCV_OPTION(WITH_TENGINE "Include Arm Inference Tengine support" OFF
457 VISIBLE_IF (ARM OR AARCH64) AND (UNIX OR ANDROID) AND NOT IOS
459 OCV_OPTION(WITH_ONNX "Include Microsoft ONNX Runtime support" OFF
462 OCV_OPTION(WITH_TIMVX "Include Tim-VX support" OFF
465 OCV_OPTION(WITH_OBSENSOR "Include obsensor support (Orbbec RGB-D modules: Astra+/Femto)" ON
466 VISIBLE_IF (WIN32 AND NOT ARM AND NOT WINRT) OR ( UNIX AND NOT APPLE AND NOT ANDROID)
467 VERIFY HAVE_OBSENSOR)
469 # OpenCV build components
470 # ===================================================
471 OCV_OPTION(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" NOT (ANDROID OR APPLE_FRAMEWORK) )
472 OCV_OPTION(BUILD_opencv_apps "Build utility applications (used for example to train classifiers)" (NOT ANDROID AND NOT WINRT) IF (NOT APPLE_FRAMEWORK) )
473 OCV_OPTION(BUILD_opencv_js "Build JavaScript bindings by Emscripten" OFF )
474 OCV_OPTION(BUILD_ANDROID_PROJECTS "Build Android projects providing .apk files" ON IF ANDROID )
475 OCV_OPTION(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" ON IF ANDROID )
476 OCV_OPTION(BUILD_DOCS "Create build rules for OpenCV Documentation" OFF IF (NOT WINRT AND NOT APPLE_FRAMEWORK))
477 OCV_OPTION(BUILD_EXAMPLES "Build all examples" OFF )
478 OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" ON IF NOT WINRT)
479 OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" NOT INSTALL_CREATE_DISTRIB IF (NOT APPLE_FRAMEWORK) )
480 OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" NOT INSTALL_CREATE_DISTRIB IF (NOT APPLE_FRAMEWORK) )
481 OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into release binaries ('OFF' means default settings)" OFF )
482 OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for statically linked OpenCV" ON IF MSVC )
483 OCV_OPTION(BUILD_WITH_DYNAMIC_IPP "Enables dynamic linking of IPP (only for standalone IPP)" OFF )
484 OCV_OPTION(BUILD_FAT_JAVA_LIB "Create Java wrapper exporting all functions of OpenCV library (requires static build of OpenCV modules)" ANDROID IF NOT BUILD_SHARED_LIBS)
485 OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
486 OCV_OPTION(BUILD_CUDA_STUBS "Build CUDA modules stubs when no CUDA SDK" OFF IF (NOT APPLE_FRAMEWORK) )
487 OCV_OPTION(BUILD_JAVA "Enable Java support" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
488 OCV_OPTION(BUILD_OBJC "Enable Objective-C support" ON IF APPLE_FRAMEWORK )
489 OCV_OPTION(BUILD_KOTLIN_EXTENSIONS "Build Kotlin extensions (Android)" ON IF ANDROID )
491 # OpenCV installation options
492 # ===================================================
493 OCV_OPTION(INSTALL_CREATE_DISTRIB "Change install rules to build the distribution package" OFF )
494 OCV_OPTION(INSTALL_BIN_EXAMPLES "Install prebuilt examples" WIN32 IF BUILD_EXAMPLES)
495 OCV_OPTION(INSTALL_C_EXAMPLES "Install C examples" OFF )
496 OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
497 OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )
498 OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT APPLE_FRAMEWORK AND BUILD_SHARED_LIBS) )
499 OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binaries and test data" OFF)
501 # OpenCV build options
502 # ===================================================
503 OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja" OR CMAKE_GENERATOR MATCHES "Xcode")) )
504 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" MSVC IF (MSVC OR (NOT IOS AND NOT CMAKE_CROSSCOMPILING) ) )
505 OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) )
506 OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CV_GCC )
507 OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CV_GCC )
508 OCV_OPTION(OPENCV_ENABLE_MEMORY_SANITIZER "Better support for memory/address sanitizers" OFF)
509 OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CV_GCC )
510 OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
511 OCV_OPTION(ENABLE_FAST_MATH "Enable compiler options for fast math optimizations on FP computations (not recommended)" OFF)
512 if(NOT IOS AND (NOT ANDROID OR OPENCV_ANDROID_USE_LEGACY_FLAGS) AND CMAKE_CROSSCOMPILING) # Use CPU_BASELINE instead
513 OCV_OPTION(ENABLE_NEON "Enable NEON instructions" (NEON OR ANDROID_ARM_NEON OR AARCH64) IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
514 OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
516 OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF )
517 OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF )
518 OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID )
519 OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF )
520 OCV_OPTION(ENABLE_INSTRUMENTATION "Instrument functions to collect calls trace and performance" OFF )
521 OCV_OPTION(ENABLE_GNU_STL_DEBUG "Enable GNU STL Debug mode (defines _GLIBCXX_DEBUG)" OFF IF CV_GCC )
522 OCV_OPTION(ENABLE_BUILD_HARDENING "Enable hardening of the resulting binaries (against security attacks, detects memory corruption, etc)" OFF)
523 OCV_OPTION(ENABLE_LTO "Enable Link Time Optimization" OFF IF CV_GCC OR MSVC)
524 OCV_OPTION(ENABLE_THIN_LTO "Enable Thin LTO" OFF IF CV_CLANG)
525 OCV_OPTION(GENERATE_ABI_DESCRIPTOR "Generate XML file for abi_compliance_checker tool" OFF IF UNIX)
526 OCV_OPTION(OPENCV_GENERATE_PKGCONFIG "Generate .pc file for pkg-config build tool (deprecated)" OFF)
527 OCV_OPTION(CV_ENABLE_INTRINSICS "Use intrinsic-based optimized code" ON )
528 OCV_OPTION(CV_DISABLE_OPTIMIZATION "Disable explicit optimized code (dispatched code/intrinsics/loop unrolling/etc)" OFF )
529 OCV_OPTION(CV_TRACE "Enable OpenCV code trace" ON)
530 OCV_OPTION(OPENCV_GENERATE_SETUPVARS "Generate setup_vars* scripts" ON IF (NOT ANDROID AND NOT APPLE_FRAMEWORK) )
531 OCV_OPTION(ENABLE_CONFIG_VERIFICATION "Fail build if actual configuration doesn't match requested (WITH_XXX != HAVE_XXX)" OFF)
532 OCV_OPTION(OPENCV_ENABLE_MEMALIGN "Enable posix_memalign or memalign usage" ON)
533 OCV_OPTION(OPENCV_DISABLE_FILESYSTEM_SUPPORT "Disable filesystem support" OFF)
534 OCV_OPTION(OPENCV_DISABLE_THREAD_SUPPORT "Build the library without multi-threaded code." OFF)
535 OCV_OPTION(OPENCV_SEMIHOSTING "Build the library for semihosting target (Arm). See https://developer.arm.com/documentation/100863/latest." OFF)
537 OCV_OPTION(ENABLE_PYLINT "Add target with Pylint checks" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
538 OCV_OPTION(ENABLE_FLAKE8 "Add target with Python flake8 checker" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
540 if(ENABLE_IMPL_COLLECTION)
541 add_definitions(-DCV_COLLECT_IMPL_DATA)
544 if(OPENCV_DISABLE_FILESYSTEM_SUPPORT)
545 add_definitions(-DOPENCV_HAVE_FILESYSTEM_SUPPORT=0)
548 set(OPENCV_MATHJAX_RELPATH "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0" CACHE STRING "URI to a MathJax installation")
550 # ----------------------------------------------------------------------------
551 # Get actual OpenCV version number from sources
552 # ----------------------------------------------------------------------------
553 include(cmake/OpenCVVersion.cmake)
555 ocv_cmake_hook(POST_OPTIONS)
557 # ----------------------------------------------------------------------------
558 # Build & install layouts
559 # ----------------------------------------------------------------------------
561 if(OPENCV_TEST_DATA_PATH)
562 get_filename_component(OPENCV_TEST_DATA_PATH ${OPENCV_TEST_DATA_PATH} ABSOLUTE)
565 # Save libs and executables in the same place
566 set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications")
569 set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
570 ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}")
572 set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib")
573 ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib")
577 if(ANDROID_ABI MATCHES "NEON")
580 if(ANDROID_ABI MATCHES "VFPV3")
587 ocv_update(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
588 ocv_update(OPENCV_DEBUG_POSTFIX d)
591 ocv_update(OPENCV_DLLVERSION "")
592 ocv_update(OPENCV_DEBUG_POSTFIX "")
595 if(DEFINED CMAKE_DEBUG_POSTFIX)
596 set(OPENCV_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
599 if((INSTALL_CREATE_DISTRIB AND BUILD_SHARED_LIBS AND NOT DEFINED BUILD_opencv_world) OR APPLE_FRAMEWORK)
600 set(BUILD_opencv_world ON CACHE INTERNAL "")
603 include(cmake/OpenCVInstallLayout.cmake)
605 # ----------------------------------------------------------------------------
606 # Path for build/platform -specific headers
607 # ----------------------------------------------------------------------------
608 ocv_update(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
609 ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
611 # ----------------------------------------------------------------------------
612 # Path for additional modules
613 # ----------------------------------------------------------------------------
614 set(OPENCV_EXTRA_MODULES_PATH "" CACHE PATH "Where to look for additional OpenCV modules (can be ;-separated list of paths)")
616 # ----------------------------------------------------------------------------
617 # Autodetect if we are in a GIT repository
618 # ----------------------------------------------------------------------------
619 find_host_package(Git QUIET)
621 if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
622 ocv_git_describe(OPENCV_VCSVERSION "${OpenCV_SOURCE_DIR}")
623 elseif(NOT DEFINED OPENCV_VCSVERSION)
625 set(OPENCV_VCSVERSION "unknown")
629 # ----------------------------------------------------------------------------
630 # OpenCV compiler and linker options
631 # ----------------------------------------------------------------------------
633 ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)
635 # --- Python Support ---
637 include(cmake/OpenCVDetectPython.cmake)
640 include(cmake/OpenCVCompilerOptions.cmake)
642 ocv_cmake_hook(POST_COMPILER_OPTIONS)
644 # ----------------------------------------------------------------------------
645 # CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
646 # ----------------------------------------------------------------------------
648 if(NOT APPLE_FRAMEWORK OR OPENCV_ENABLE_PKG_CONFIG)
649 if(CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{PKG_CONFIG_LIBDIR} AND NOT DEFINED ENV{PKG_CONFIG_SYSROOT_DIR}
650 AND NOT OPENCV_ENABLE_PKG_CONFIG
652 if(NOT PkgConfig_FOUND)
653 message(STATUS "OpenCV disables pkg-config to avoid using of host libraries. Consider using PKG_CONFIG_LIBDIR to specify target SYSROOT")
654 elseif(OPENCV_SKIP_PKG_CONFIG_WARNING)
655 message(WARNING "pkg-config is enabled in cross-compilation mode without defining of PKG_CONFIG_LIBDIR environment variable. This may lead to misconfigured host-based dependencies.")
657 elseif(OPENCV_DISABLE_PKG_CONFIG)
659 message(WARNING "OPENCV_DISABLE_PKG_CONFIG flag has no effect")
662 find_package(PkgConfig QUIET)
665 include(CheckFunctionExists)
666 include(CheckIncludeFile)
667 include(CheckSymbolExists)
670 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD)
672 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m log)
673 elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|NetBSD|DragonFly|OpenBSD|Haiku")
674 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m pthread)
676 # no need to link to system libs with emscripten
678 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m)
680 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} pthread)
682 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
688 # Ensure that libpthread is not listed as one of the libraries to pass to the linker.
689 if (OPENCV_DISABLE_THREAD_SUPPORT)
690 list(REMOVE_ITEM OPENCV_LINKER_LIBS pthread)
693 if(OPENCV_ENABLE_MEMALIGN)
694 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
695 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
697 CHECK_SYMBOL_EXISTS(memalign malloc.h HAVE_MEMALIGN)
700 # - std::aligned_alloc() C++17 / C11
703 include(CheckIncludeFile)
704 include(CheckSymbolExists)
706 if(OPENCV_ENABLE_MEMALIGN)
707 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
709 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE_WIN32_ALIGNED_MALLOC)
714 include(cmake/OpenCVPCHSupport.cmake)
715 include(cmake/OpenCVModule.cmake)
717 # ----------------------------------------------------------------------------
718 # Detect endianness of build platform
719 # ----------------------------------------------------------------------------
722 # test_big_endian needs try_compile, which doesn't work for iOS
723 # http://public.kitware.com/Bug/view.php?id=12288
724 set(WORDS_BIGENDIAN 0)
726 include(TestBigEndian)
727 test_big_endian(WORDS_BIGENDIAN)
730 # ----------------------------------------------------------------------------
731 # Detect 3rd-party libraries
732 # ----------------------------------------------------------------------------
734 if(ANDROID AND WITH_CPUFEATURES)
735 add_subdirectory(3rdparty/cpufeatures)
736 set(HAVE_CPUFEATURES 1)
739 include(cmake/OpenCVFindFrameworks.cmake)
741 include(cmake/OpenCVFindLibsGrfmt.cmake)
742 include(cmake/OpenCVFindLibsGUI.cmake)
743 include(cmake/OpenCVFindLibsVideo.cmake)
744 include(cmake/OpenCVFindLibsPerf.cmake)
745 include(cmake/OpenCVFindLAPACK.cmake)
746 include(cmake/OpenCVFindProtobuf.cmake)
748 include(cmake/OpenCVFindTengine.cmake)
751 include(cmake/OpenCVFindTIMVX.cmake)
754 # ----------------------------------------------------------------------------
755 # Detect other 3rd-party libraries/tools
756 # ----------------------------------------------------------------------------
758 # --- Java Support ---
761 include(cmake/android/OpenCVDetectAndroidSDK.cmake)
763 include(cmake/OpenCVDetectApacheAnt.cmake)
768 if(ENABLE_PYLINT AND PYTHON_DEFAULT_AVAILABLE)
769 include(cmake/OpenCVPylint.cmake)
771 if(ENABLE_FLAKE8 AND PYTHON_DEFAULT_AVAILABLE)
772 find_package(Flake8 QUIET)
773 if(NOT FLAKE8_FOUND OR NOT FLAKE8_EXECUTABLE)
774 include("${CMAKE_CURRENT_LIST_DIR}/cmake/FindFlake8.cmake")
777 list(APPEND OPENCV_FLAKE8_EXCLUDES ".git" "__pycache__" "config.py" "*.config.py" "config-*.py")
778 list(APPEND OPENCV_FLAKE8_EXCLUDES "svgfig.py") # 3rdparty
779 if(NOT PYTHON3_VERSION_STRING VERSION_GREATER 3.6)
780 # Python 3.6+ (PEP 526): variable annotations (type hints)
781 list(APPEND OPENCV_FLAKE8_EXCLUDES "samples/dnn/dnn_model_runner/dnn_conversion/common/test/configs")
783 string(REPLACE ";" "," OPENCV_FLAKE8_EXCLUDES_STR "${OPENCV_FLAKE8_EXCLUDES}")
784 add_custom_target(check_flake8
785 COMMAND "${FLAKE8_EXECUTABLE}" . --count --select=E9,E901,E999,F821,F822,F823 --show-source --statistics --exclude='${OPENCV_FLAKE8_EXCLUDES_STR}'
786 WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
787 COMMENT "Running flake8"
793 if(ANDROID AND ANDROID_EXECUTABLE AND ANT_EXECUTABLE AND (ANT_VERSION VERSION_GREATER 1.7) AND (ANDROID_TOOLS_Pkg_Revision GREATER 13))
794 SET(CAN_BUILD_ANDROID_PROJECTS TRUE)
796 SET(CAN_BUILD_ANDROID_PROJECTS FALSE)
801 include(cmake/OpenCVDetectOpenCL.cmake)
806 include(cmake/OpenCVDetectHalide.cmake)
811 include(cmake/OpenCVDetectVulkan.cmake)
816 include(cmake/OpenCVDetectWebNN.cmake)
819 # --- Inference Engine ---
820 if(WITH_INF_ENGINE OR WITH_OPENVINO)
821 include(cmake/OpenCVDetectInferenceEngine.cmake)
826 include(cmake/OpenCVDetectDirectX.cmake)
830 include(cmake/OpenCVDetectVTK.cmake)
834 include(cmake/FindOpenVX.cmake)
838 add_subdirectory(3rdparty/quirc)
843 include(cmake/FindONNX.cmake)
846 # ----------------------------------------------------------------------------
848 # ----------------------------------------------------------------------------
849 set(_hal_includes "")
850 macro(ocv_hal_register HAL_LIBRARIES_VAR HAL_HEADERS_VAR HAL_INCLUDE_DIRS_VAR)
852 foreach (l ${${HAL_LIBRARIES_VAR}})
854 get_filename_component(l "${l}" ABSOLUTE)
856 list(APPEND OPENCV_HAL_LINKER_LIBS ${l})
859 foreach (h ${${HAL_HEADERS_VAR}})
860 set(_hal_includes "${_hal_includes}\n#include \"${h}\"")
863 ocv_include_directories(${${HAL_INCLUDE_DIRS_VAR}})
866 if(NOT DEFINED OpenCV_HAL)
867 set(OpenCV_HAL "OpenCV_HAL")
871 if(NOT ";${OpenCV_HAL};" MATCHES ";openvx;")
872 set(OpenCV_HAL "openvx;${OpenCV_HAL}")
877 ocv_debug_message(STATUS "Enable carotene acceleration")
878 if(NOT ";${OpenCV_HAL};" MATCHES ";carotene;")
879 set(OpenCV_HAL "carotene;${OpenCV_HAL}")
883 foreach(hal ${OpenCV_HAL})
884 if(hal STREQUAL "carotene")
885 if(";${CPU_BASELINE_FINAL};" MATCHES ";NEON;")
886 add_subdirectory(3rdparty/carotene/hal)
887 ocv_hal_register(CAROTENE_HAL_LIBRARIES CAROTENE_HAL_HEADERS CAROTENE_HAL_INCLUDE_DIRS)
888 list(APPEND OpenCV_USED_HAL "carotene (ver ${CAROTENE_HAL_VERSION})")
890 message(STATUS "Carotene: NEON is not available, disabling carotene...")
892 elseif(hal STREQUAL "openvx")
893 add_subdirectory(3rdparty/openvx)
894 ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS)
895 list(APPEND OpenCV_USED_HAL "openvx (ver ${OPENVX_HAL_VERSION})")
897 ocv_debug_message(STATUS "OpenCV HAL: ${hal} ...")
898 ocv_clear_vars(OpenCV_HAL_LIBRARIES OpenCV_HAL_HEADERS OpenCV_HAL_INCLUDE_DIRS)
899 find_package(${hal} NO_MODULE QUIET)
901 ocv_hal_register(OpenCV_HAL_LIBRARIES OpenCV_HAL_HEADERS OpenCV_HAL_INCLUDE_DIRS)
902 list(APPEND OpenCV_USED_HAL "${hal} (ver ${${hal}_VERSION})")
906 configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/custom_hal.hpp.in" "${CMAKE_BINARY_DIR}/custom_hal.hpp" @ONLY)
910 # ----------------------------------------------------------------------------
912 # ----------------------------------------------------------------------------
914 include(cmake/OpenCVDetectTrace.cmake)
917 ocv_cmake_hook(POST_DETECT_DEPENDECIES) # typo, deprecated (2019-06)
918 ocv_cmake_hook(POST_DETECT_DEPENDENCIES)
920 # ----------------------------------------------------------------------------
922 # ----------------------------------------------------------------------------
923 if(ENABLE_SOLUTION_FOLDERS)
924 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
925 set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
928 # Extra OpenCV targets: uninstall, package_source, perf, etc.
929 include(cmake/OpenCVExtraTargets.cmake)
931 # ----------------------------------------------------------------------------
932 # Process subdirectories
933 # ----------------------------------------------------------------------------
935 # opencv.hpp and legacy headers
936 add_subdirectory(include)
938 # Enable compiler options for OpenCV modules/apps/samples only (ignore 3rdparty)
939 ocv_add_modules_compiler_options()
942 ocv_register_modules()
944 # Generate targets for documentation
945 add_subdirectory(doc)
947 # various data that is used by cv libraries and/or demo applications.
948 add_subdirectory(data)
951 if(BUILD_opencv_apps)
952 add_subdirectory(apps)
956 if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES OR INSTALL_C_EXAMPLES)
957 add_subdirectory(samples)
961 add_subdirectory(platforms/android/service)
964 # ----------------------------------------------------------------------------
965 # Finalization: generate configuration-based files
966 # ----------------------------------------------------------------------------
968 ocv_cmake_hook(PRE_FINALIZE)
970 # Generate platform-dependent and configuration-dependent headers
971 include(cmake/OpenCVGenHeaders.cmake)
973 # Generate opencv.pc for pkg-config command
974 if(OPENCV_GENERATE_PKGCONFIG)
975 include(cmake/OpenCVGenPkgconfig.cmake)
978 # Generate OpenCV.mk for ndk-build (Android build tool)
979 include(cmake/OpenCVGenAndroidMK.cmake)
981 # Generate OpenCVConfig.cmake and OpenCVConfig-version.cmake for cmake projects
982 include(cmake/OpenCVGenConfig.cmake)
984 # Generate Info.plist for the IOS framework
986 include(cmake/OpenCVGenInfoPlist.cmake)
989 # Generate ABI descriptor
990 include(cmake/OpenCVGenABI.cmake)
992 # Generate environment setup file
993 if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
995 get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY)
996 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in"
997 "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
998 install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
999 DESTINATION ./ COMPONENT tests)
1001 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_windows.cmd.in"
1002 "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd" @ONLY)
1003 install(PROGRAMS "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd"
1004 DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
1006 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in"
1007 "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
1008 install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
1009 DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
1013 if(NOT OPENCV_README_FILE)
1015 set(OPENCV_README_FILE ${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/README.android)
1019 if(NOT OPENCV_LICENSE_FILE)
1020 set(OPENCV_LICENSE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
1023 # for UNIX it does not make sense as LICENSE and readme will be part of the package automatically
1024 if(ANDROID OR NOT UNIX)
1025 install(FILES ${OPENCV_LICENSE_FILE}
1026 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
1027 DESTINATION ./ COMPONENT libs)
1028 if(OPENCV_README_FILE)
1029 install(FILES ${OPENCV_README_FILE}
1030 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
1031 DESTINATION ./ COMPONENT libs)
1035 if(COMMAND ocv_pylint_finalize)
1036 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/modules/python/test)
1037 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/samples/python)
1038 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/samples/dnn)
1039 ocv_pylint_add_directory_recurse(${CMAKE_CURRENT_LIST_DIR}/samples/python/tutorial_code)
1040 ocv_pylint_finalize()
1042 if(TARGET check_pylint)
1043 message(STATUS "Registered 'check_pylint' target: using ${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}), checks: ${PYLINT_TOTAL_TARGETS}")
1045 if(TARGET check_flake8)
1046 message(STATUS "Registered 'check_flake8' target: using ${FLAKE8_EXECUTABLE} (ver: ${FLAKE8_VERSION})")
1049 if(OPENCV_GENERATE_SETUPVARS)
1050 include(cmake/OpenCVGenSetupVars.cmake)
1053 # ----------------------------------------------------------------------------
1055 # ----------------------------------------------------------------------------
1057 status("General configuration for OpenCV ${OPENCV_VERSION} =====================================")
1058 if(OPENCV_VCSVERSION)
1059 status(" Version control:" ${OPENCV_VCSVERSION})
1061 if(OPENCV_EXTRA_MODULES_PATH AND NOT BUILD_INFO_SKIP_EXTRA_MODULES)
1062 set(__dump_extra_header OFF)
1063 foreach(p ${OPENCV_EXTRA_MODULES_PATH})
1065 if(NOT __dump_extra_header)
1066 set(__dump_extra_header ON)
1068 status(" Extra modules:")
1072 ocv_git_describe(EXTRA_MODULES_VCSVERSION "${p}")
1073 status(" Location (extra):" ${p})
1074 status(" Version control (extra):" ${EXTRA_MODULES_VCSVERSION})
1077 unset(__dump_extra_header)
1080 # ========================== build platform ==========================
1082 status(" Platform:")
1083 if(NOT DEFINED OPENCV_TIMESTAMP
1084 AND NOT BUILD_INFO_SKIP_TIMESTAMP
1086 string(TIMESTAMP OPENCV_TIMESTAMP "" UTC)
1087 set(OPENCV_TIMESTAMP "${OPENCV_TIMESTAMP}" CACHE STRING "Timestamp of OpenCV build configuration" FORCE)
1089 if(OPENCV_TIMESTAMP)
1090 status(" Timestamp:" ${OPENCV_TIMESTAMP})
1092 status(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
1093 if(CMAKE_CROSSCOMPILING)
1094 status(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
1096 status(" CMake:" ${CMAKE_VERSION})
1097 status(" CMake generator:" ${CMAKE_GENERATOR})
1098 status(" CMake build tool:" ${CMAKE_BUILD_TOOL})
1100 status(" MSVC:" ${MSVC_VERSION})
1102 if(CMAKE_GENERATOR MATCHES Xcode)
1103 status(" Xcode:" ${XCODE_VERSION})
1105 if(CMAKE_GENERATOR MATCHES "Xcode|Visual Studio|Multi-Config")
1106 status(" Configuration:" ${CMAKE_CONFIGURATION_TYPES})
1108 status(" Configuration:" ${CMAKE_BUILD_TYPE})
1112 # ========================= CPU code generation mode =========================
1114 status(" CPU/HW features:")
1115 status(" Baseline:" "${CPU_BASELINE_FINAL}")
1116 if(NOT CPU_BASELINE STREQUAL CPU_BASELINE_FINAL)
1117 status(" requested:" "${CPU_BASELINE}")
1119 if(CPU_BASELINE_REQUIRE)
1120 status(" required:" "${CPU_BASELINE_REQUIRE}")
1122 if(CPU_BASELINE_DISABLE)
1123 status(" disabled:" "${CPU_BASELINE_DISABLE}")
1125 if(CPU_DISPATCH_FINAL OR CPU_DISPATCH)
1126 status(" Dispatched code generation:" "${CPU_DISPATCH_FINAL}")
1127 if(NOT CPU_DISPATCH STREQUAL CPU_DISPATCH_FINAL)
1128 status(" requested:" "${CPU_DISPATCH}")
1130 if(CPU_DISPATCH_REQUIRE)
1131 status(" required:" "${CPU_DISPATCH_REQUIRE}")
1133 foreach(OPT ${CPU_DISPATCH_FINAL})
1134 status(" ${OPT} (${CPU_${OPT}_USAGE_COUNT} files):" "+ ${CPU_DISPATCH_${OPT}_INCLUDED}")
1138 # ========================== C/C++ options ==========================
1139 if(CMAKE_CXX_COMPILER_VERSION)
1140 set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (ver ${CMAKE_CXX_COMPILER_VERSION})")
1142 set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
1144 string(STRIP "${OPENCV_COMPILER_STR}" OPENCV_COMPILER_STR)
1148 status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
1149 if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD)
1150 status(" C++ standard:" "${CMAKE_CXX_STANDARD}")
1152 status(" C++ Compiler:" ${OPENCV_COMPILER_STR})
1153 status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
1154 status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
1155 status(" C Compiler:" ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
1156 status(" C flags (Release):" ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE})
1157 status(" C flags (Debug):" ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG})
1159 status(" Linker flags (Release):" ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
1160 status(" Linker flags (Debug):" ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
1162 status(" Linker flags (Release):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
1163 status(" Linker flags (Debug):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
1165 status(" ccache:" OPENCV_COMPILER_IS_CCACHE THEN YES ELSE NO)
1166 status(" Precompiled headers:" PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS THEN YES ELSE NO)
1168 if(OPENCV_DISABLE_FILESYSTEM_SUPPORT)
1169 status(" Filesystem support is disabled")
1172 # ========================== Dependencies ============================
1173 ocv_get_all_libs(deps_modules deps_extra deps_3rdparty)
1174 status(" Extra dependencies:" ${deps_extra})
1175 status(" 3rdparty dependencies:" ${deps_3rdparty})
1177 # ========================== OpenCV modules ==========================
1179 status(" OpenCV modules:")
1180 set(OPENCV_MODULES_BUILD_ST "")
1181 foreach(the_module ${OPENCV_MODULES_BUILD})
1182 if(NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "INTERNAL" OR the_module STREQUAL "opencv_ts")
1183 list(APPEND OPENCV_MODULES_BUILD_ST "${the_module}")
1186 string(REPLACE "opencv_" "" OPENCV_MODULES_BUILD_ST "${OPENCV_MODULES_BUILD_ST}")
1187 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_USER_ST "${OPENCV_MODULES_DISABLED_USER}")
1188 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_AUTO_ST "${OPENCV_MODULES_DISABLED_AUTO}")
1189 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_FORCE_ST "${OPENCV_MODULES_DISABLED_FORCE}")
1190 list(SORT OPENCV_MODULES_BUILD_ST)
1191 list(SORT OPENCV_MODULES_DISABLED_USER_ST)
1192 list(SORT OPENCV_MODULES_DISABLED_AUTO_ST)
1193 list(SORT OPENCV_MODULES_DISABLED_FORCE_ST)
1194 status(" To be built:" OPENCV_MODULES_BUILD THEN ${OPENCV_MODULES_BUILD_ST} ELSE "-")
1195 status(" Disabled:" OPENCV_MODULES_DISABLED_USER THEN ${OPENCV_MODULES_DISABLED_USER_ST} ELSE "-")
1196 status(" Disabled by dependency:" OPENCV_MODULES_DISABLED_AUTO THEN ${OPENCV_MODULES_DISABLED_AUTO_ST} ELSE "-")
1197 status(" Unavailable:" OPENCV_MODULES_DISABLED_FORCE THEN ${OPENCV_MODULES_DISABLED_FORCE_ST} ELSE "-")
1199 ocv_build_features_string(apps_status
1200 IF BUILD_TESTS AND HAVE_opencv_ts THEN "tests"
1201 IF BUILD_PERF_TESTS AND HAVE_opencv_ts THEN "perf_tests"
1202 IF BUILD_EXAMPLES THEN "examples"
1203 IF BUILD_opencv_apps THEN "apps"
1204 IF BUILD_ANDROID_SERVICE THEN "android_service"
1205 IF (BUILD_ANDROID_EXAMPLES OR INSTALL_ANDROID_EXAMPLES) AND CAN_BUILD_ANDROID_PROJECTS THEN "android_examples"
1207 status(" Applications:" "${apps_status}")
1208 ocv_build_features_string(docs_status
1209 IF TARGET doxygen_cpp THEN "doxygen"
1210 IF TARGET doxygen_python THEN "python"
1211 IF TARGET doxygen_javadoc THEN "javadoc"
1212 IF BUILD_opencv_js OR DEFINED OPENCV_JS_LOCATION THEN "js"
1215 status(" Documentation:" "${docs_status}")
1216 status(" Non-free algorithms:" OPENCV_ENABLE_NONFREE THEN "YES" ELSE "NO")
1218 # ========================== Android details ==========================
1221 if(DEFINED ANDROID_NDK_REVISION)
1222 set(__msg "${ANDROID_NDK} (ver ${ANDROID_NDK_REVISION})")
1224 set(__msg "location: ${ANDROID_NDK}")
1226 status(" Android NDK: " ${__msg})
1227 status(" Android ABI:" ${ANDROID_ABI})
1228 if(BUILD_WITH_STANDALONE_TOOLCHAIN)
1229 status(" NDK toolchain:" "standalone: ${ANDROID_STANDALONE_TOOLCHAIN}")
1230 elseif(BUILD_WITH_ANDROID_NDK OR DEFINED ANDROID_TOOLCHAIN_NAME)
1231 status(" NDK toolchain:" "${ANDROID_TOOLCHAIN_NAME}")
1233 status(" STL type:" ${ANDROID_STL})
1234 status(" Native API level:" ${ANDROID_NATIVE_API_LEVEL})
1236 if(BUILD_ANDROID_PROJECTS)
1237 status(" Android SDK: " "${ANDROID_SDK} (tools: ${ANDROID_SDK_TOOLS_VERSION} build tools: ${ANDROID_SDK_BUILD_TOOLS_VERSION})")
1238 if(ANDROID_EXECUTABLE)
1239 status(" android tool:" "${ANDROID_EXECUTABLE}")
1242 status(" Android SDK: " "not used, projects are not built")
1244 if(DEFINED ANDROID_SDK_COMPATIBLE_TARGET)
1245 status(" SDK target:" "${ANDROID_SDK_COMPATIBLE_TARGET}")
1247 if(DEFINED ANDROID_PROJECTS_BUILD_TYPE)
1248 if(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT")
1249 status(" Projects build scripts:" "Ant/Eclipse compatible")
1250 elseif(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT")
1251 status(" Projects build scripts:" "Gradle")
1256 # ================== Windows RT features ==================
1259 status(" Windows RT support:" WINRT THEN YES ELSE NO)
1261 status(" Building for Microsoft platform: " ${CMAKE_SYSTEM_NAME})
1262 status(" Building for architectures: " ${CMAKE_VS_EFFECTIVE_PLATFORMS})
1263 status(" Building for version: " ${CMAKE_SYSTEM_VERSION})
1264 if (DEFINED ENABLE_WINRT_MODE_NATIVE)
1265 status(" Building for C++ without CX extensions")
1270 # ========================== GUI ==========================
1272 status(" GUI: " "${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
1274 if(WITH_WAYLAND OR HAVE_WAYLAND)
1275 if(HAVE_WAYLAND_CLIENT)
1276 status(" Wayland Client:" "YES (ver ${WAYLAND_CLIENT_VERSION})")
1278 if(HAVE_WAYLAND_CURSOR)
1279 status(" Wayland Cursor:" "YES (ver ${WAYLAND_CURSOR_VERSION})")
1281 if(HAVE_WAYLAND_PROTOCOL)
1282 status(" Wayland Protocol:" "YES (ver ${WAYLAND_PROTOCOL_VERSION})")
1284 if(HAVE_WAYLAND_EGL)
1285 status(" Wayland EGL:" "YES (ver ${WAYLAND_EGL_VERSION})")
1288 status(" Xkbcommon:" "YES (ver ${XKBCOMMON_VERSION})")
1292 if(WITH_QT OR HAVE_QT)
1294 status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
1296 if(Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES)
1297 status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES} ${Qt${QT_VERSION_MAJOR}OpenGL_VERSION_STRING})" ELSE NO)
1299 status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
1302 status(" QT OpenGL support:" "NO")
1310 status(" Win32 UI:" HAVE_WIN32UI THEN YES ELSE NO)
1313 if(HAVE_COCOA) # APPLE
1314 status(" Cocoa:" YES)
1317 if(WITH_GTK OR HAVE_GTK)
1319 status(" GTK+:" "YES (ver ${GTK3_VERSION})")
1321 status(" GTK+:" "YES (ver ${GTK2_VERSION})")
1323 status(" GTK+:" "NO")
1326 status( " GThread :" HAVE_GTHREAD THEN "YES (ver ${GTHREAD_VERSION})" ELSE NO)
1327 status( " GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${GTKGLEXT_VERSION})" ELSE NO)
1331 if(WITH_OPENGL OR HAVE_OPENGL)
1332 status(" OpenGL support:" HAVE_OPENGL THEN "YES (${OPENGL_LIBRARIES})" ELSE NO)
1335 if(WITH_VTK OR HAVE_VTK)
1336 status(" VTK support:" HAVE_VTK THEN "YES (ver ${VTK_VERSION})" ELSE NO)
1339 # ========================== MEDIA IO ==========================
1341 status(" Media I/O: ")
1342 status(" ZLib:" ZLIB_FOUND THEN "${ZLIB_LIBRARIES} (ver ${ZLIB_VERSION_STRING})" ELSE "build (ver ${ZLIB_VERSION_STRING})")
1344 if(WITH_JPEG OR HAVE_JPEG)
1348 status(" JPEG:" "build-${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
1349 if(ENABLE_LIBJPEG_TURBO_SIMD)
1350 status(" SIMD Support Request:" "YES")
1351 if(HAVE_LIBJPEG_TURBO_SIMD)
1352 status(" SIMD Support:" "YES")
1354 status(" SIMD Support:" "NO")
1357 status(" SIMD Support Request:" "NO")
1360 status(" JPEG:" "${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
1364 if(WITH_WEBP OR HAVE_WEBP)
1365 status(" WEBP:" WEBP_FOUND THEN "${WEBP_LIBRARY} (ver ${WEBP_VERSION})" ELSE "build (ver ${WEBP_VERSION})")
1368 if(WITH_PNG OR HAVE_PNG OR WITH_SPNG)
1370 status(" PNG:" "build-${SPNG_LIBRARY} (ver ${SPNG_VERSION})")
1372 status(" PNG:" PNG_FOUND THEN "${PNG_LIBRARY} (ver ${PNG_VERSION})" ELSE "build (ver ${PNG_VERSION})")
1376 if(WITH_TIFF OR HAVE_TIFF)
1377 status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION} / ${TIFF_VERSION_STRING})" ELSE "build (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})")
1381 status(" JPEG 2000:" OpenJPEG_FOUND
1382 THEN "OpenJPEG (ver ${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION})"
1383 ELSE "build (ver ${OPENJPEG_VERSION})"
1386 status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build Jasper (ver ${JASPER_VERSION_STRING})")
1387 elseif(WITH_OPENJPEG OR WITH_JASPER)
1388 status(" JPEG 2000:" "NO")
1391 if(WITH_OPENEXR OR HAVE_OPENEXR)
1393 status(" OpenEXR:" OPENEXR_FOUND THEN "${OPENEXR_LIBRARIES} (ver ${OPENEXR_VERSION})" ELSE "build (ver ${OPENEXR_VERSION})")
1395 status(" OpenEXR:" "NO")
1399 if(WITH_GDAL OR HAVE_GDAL)
1400 status(" GDAL:" HAVE_GDAL THEN "YES (${GDAL_LIBRARY})" ELSE "NO")
1403 if(WITH_GDCM OR HAVE_GDCM)
1404 status(" GDCM:" HAVE_GDCM THEN "YES (${GDCM_VERSION})" ELSE "NO")
1407 if(WITH_IMGCODEC_HDR OR DEFINED HAVE_IMGCODEC_HDR)
1408 status(" HDR:" HAVE_IMGCODEC_HDR THEN "YES" ELSE "NO")
1411 if(WITH_IMGCODEC_SUNRASTER OR DEFINED HAVE_IMGCODEC_SUNRASTER)
1412 status(" SUNRASTER:" HAVE_IMGCODEC_SUNRASTER THEN "YES" ELSE "NO")
1415 if(WITH_IMGCODEC_PXM OR DEFINED HAVE_IMGCODEC_PXM)
1416 status(" PXM:" HAVE_IMGCODEC_PXM THEN "YES" ELSE "NO")
1419 if(WITH_IMGCODEC_PFM OR DEFINED HAVE_IMGCODEC_PFM)
1420 status(" PFM:" HAVE_IMGCODEC_PFM THEN "YES" ELSE "NO")
1423 # ========================== VIDEO IO ==========================
1425 status(" Video I/O:")
1427 if(WITH_1394 OR HAVE_DC1394_2)
1428 status(" DC1394:" HAVE_DC1394_2 THEN "YES (${DC1394_2_VERSION})" ELSE NO)
1431 if(WITH_FFMPEG OR HAVE_FFMPEG)
1432 if(OPENCV_FFMPEG_USE_FIND_PACKAGE)
1433 status(" FFMPEG:" HAVE_FFMPEG THEN "YES (find_package)" ELSE "NO (find_package)")
1435 status(" FFMPEG:" HAVE_FFMPEG THEN "YES (prebuilt binaries)" ELSE NO)
1437 status(" FFMPEG:" HAVE_FFMPEG THEN YES ELSE NO)
1439 status(" avcodec:" FFMPEG_libavcodec_VERSION THEN "YES (${FFMPEG_libavcodec_VERSION})" ELSE NO)
1440 status(" avformat:" FFMPEG_libavformat_VERSION THEN "YES (${FFMPEG_libavformat_VERSION})" ELSE NO)
1441 status(" avutil:" FFMPEG_libavutil_VERSION THEN "YES (${FFMPEG_libavutil_VERSION})" ELSE NO)
1442 status(" swscale:" FFMPEG_libswscale_VERSION THEN "YES (${FFMPEG_libswscale_VERSION})" ELSE NO)
1443 status(" avresample:" FFMPEG_libavresample_VERSION THEN "YES (${FFMPEG_libavresample_VERSION})" ELSE NO)
1446 if(WITH_GSTREAMER OR HAVE_GSTREAMER)
1447 status(" GStreamer:" HAVE_GSTREAMER THEN "YES (${GSTREAMER_VERSION})" ELSE NO)
1450 if(WITH_OPENNI2 OR HAVE_OPENNI2)
1451 status(" OpenNI2:" HAVE_OPENNI2 THEN "YES (${OPENNI2_VERSION})" ELSE NO)
1454 if(WITH_PVAPI OR HAVE_PVAPI)
1455 status(" PvAPI:" HAVE_PVAPI THEN YES ELSE NO)
1458 if(WITH_ARAVIS OR HAVE_ARAVIS_API)
1459 status(" Aravis SDK:" HAVE_ARAVIS_API THEN "YES (${ARAVIS_VERSION})" ELSE NO)
1462 if(WITH_AVFOUNDATION OR HAVE_AVFOUNDATION)
1463 status(" AVFoundation:" HAVE_AVFOUNDATION THEN YES ELSE NO)
1467 status(" iOS capture:" YES)
1470 if(WITH_V4L OR HAVE_V4L)
1471 ocv_build_features_string(v4l_status
1472 IF HAVE_CAMV4L2 THEN "linux/videodev2.h"
1473 IF HAVE_VIDEOIO THEN "sys/videoio.h"
1475 status(" v4l/v4l2:" HAVE_V4L THEN "YES (${v4l_status})" ELSE NO)
1478 if(WITH_DSHOW OR HAVE_DSHOW)
1479 status(" DirectShow:" HAVE_DSHOW THEN YES ELSE NO)
1482 if(WITH_MSMF OR HAVE_MSMF)
1483 status(" Media Foundation:" HAVE_MSMF THEN YES ELSE NO)
1484 status(" DXVA:" HAVE_MSMF_DXVA THEN YES ELSE NO)
1487 if(WITH_XIMEA OR HAVE_XIMEA)
1488 status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO)
1491 if(WITH_UEYE OR HAVE_UEYE)
1492 status(" uEye:" HAVE_UEYE THEN YES ELSE NO)
1495 if(WITH_XINE OR HAVE_XINE)
1496 status(" Xine:" HAVE_XINE THEN "YES (ver ${XINE_VERSION})" ELSE NO)
1499 if(WITH_LIBREALSENSE OR HAVE_LIBREALSENSE)
1500 status(" Intel RealSense:" HAVE_LIBREALSENSE THEN "YES (${LIBREALSENSE_VERSION})" ELSE NO)
1503 if(WITH_MFX OR HAVE_MFX)
1506 set(__details " (${MFX_LIBRARY})")
1507 elseif(MFX_LIBRARIES)
1508 set(__details " (${MFX_LIBRARIES})")
1510 set(__details " (unknown)")
1513 status(" Intel Media SDK:" HAVE_MFX THEN "YES${__details}" ELSE NO)
1516 if(WITH_GPHOTO2 OR HAVE_GPHOTO2)
1517 status(" gPhoto2:" HAVE_GPHOTO2 THEN "YES" ELSE NO)
1520 # Order is similar to CV_PARALLEL_FRAMEWORK in core/src/parallel.cpp
1521 ocv_build_features_string(parallel_status EXCLUSIVE
1522 IF HAVE_TBB THEN "TBB (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})"
1523 IF HAVE_HPX THEN "HPX"
1524 IF HAVE_OPENMP THEN "OpenMP"
1525 IF HAVE_GCD THEN "GCD"
1526 IF WINRT OR HAVE_CONCURRENCY THEN "Concurrency"
1527 IF HAVE_PTHREADS_PF THEN "pthreads"
1530 status(" Parallel framework:" "${parallel_status}")
1531 if (OPENCV_DISABLE_THREAD_SUPPORT)
1532 status("" "Multi thread code explicitly disabled with OPENCV_DISABLE_THREAD_SUPPORT.")
1533 if(HAVE_PTHREADS_PF OR HAVE_HPX OR HAVE_OPENMP OR HAVE_GCD OR HAVE_CONCURRENCY)
1534 message(FATAL_ERROR "Not all parallel frameworks have been disabled (using ${parallel_status}).")
1537 message(FATAL_ERROR "Thread execution might be in use in some component.")
1541 if(CV_TRACE OR OPENCV_TRACE)
1542 ocv_build_features_string(trace_status EXCLUSIVE
1543 IF HAVE_ITT THEN "with Intel ITT"
1546 status(" Trace: " OPENCV_TRACE THEN "YES (${trace_status})" ELSE NO)
1549 # ========================== Other third-party libraries ==========================
1551 status(" Other third-party libraries:")
1553 if(WITH_IPP AND HAVE_IPP)
1554 status(" Intel IPP:" "${IPP_VERSION_STR} [${IPP_VERSION_MAJOR}.${IPP_VERSION_MINOR}.${IPP_VERSION_BUILD}]")
1555 status(" at:" "${IPP_ROOT_DIR}")
1556 if(NOT HAVE_IPP_ICV)
1557 status(" linked:" BUILD_WITH_DYNAMIC_IPP THEN "dynamic" ELSE "static")
1561 status(" Intel IPP IW:" "sources (${IW_VERSION_MAJOR}.${IW_VERSION_MINOR}.${IW_VERSION_UPDATE})")
1563 status(" Intel IPP IW:" "binaries (${IW_VERSION_MAJOR}.${IW_VERSION_MINOR}.${IW_VERSION_UPDATE})")
1565 status(" at:" "${IPP_IW_PATH}")
1567 status(" Intel IPP IW:" NO)
1571 if(WITH_VA OR HAVE_VA)
1572 status(" VA:" HAVE_VA THEN "YES" ELSE NO)
1575 if(WITH_TENGINE OR HAVE_TENGINE)
1576 status(" Tengine:" HAVE_TENGINE THEN "YES (${TENGINE_LIBRARIES})" ELSE NO)
1579 if(WITH_LAPACK OR HAVE_LAPACK)
1580 status(" Lapack:" HAVE_LAPACK THEN "YES (${LAPACK_LIBRARIES})" ELSE NO)
1583 if(WITH_HALIDE OR HAVE_HALIDE)
1584 status(" Halide:" HAVE_HALIDE THEN "YES (${HALIDE_LIBRARIES} ${HALIDE_INCLUDE_DIRS})" ELSE NO)
1588 OR (WITH_OPENVINO AND NOT WITH_INF_ENGINE AND NOT INF_ENGINE_TARGET)
1590 status(" OpenVINO:" TARGET openvino::runtime THEN "YES (${OpenVINO_VERSION})" ELSE "NO")
1592 if(WITH_INF_ENGINE OR INF_ENGINE_TARGET)
1593 if(INF_ENGINE_TARGET)
1594 list(GET INF_ENGINE_TARGET 0 ie_target)
1595 set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})")
1596 ocv_get_imported_target(ie_target "${ie_target}")
1597 get_target_property(_lib ${ie_target} IMPORTED_LOCATION)
1598 get_target_property(_lib_imp_rel ${ie_target} IMPORTED_IMPLIB_RELEASE)
1599 get_target_property(_lib_imp_dbg ${ie_target} IMPORTED_IMPLIB_DEBUG)
1600 get_target_property(_lib_rel ${ie_target} IMPORTED_LOCATION_RELEASE)
1601 get_target_property(_lib_dbg ${ie_target} IMPORTED_LOCATION_DEBUG)
1602 ocv_build_features_string(_lib
1603 IF _lib THEN "${_lib}"
1604 IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
1605 IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
1606 IF _lib_rel THEN "${_lib_rel}"
1607 IF _lib_dbg THEN "${_lib_dbg}"
1610 get_target_property(_inc ${ie_target} INTERFACE_INCLUDE_DIRECTORIES)
1611 status(" Inference Engine:" "${__msg}")
1612 status(" * libs:" "${_lib}")
1613 status(" * includes:" "${_inc}")
1615 status(" Inference Engine:" "NO")
1618 if(WITH_NGRAPH OR HAVE_NGRAPH)
1620 ocv_get_imported_target(__target ngraph::ngraph)
1621 set(__msg "YES (${ngraph_VERSION})")
1622 get_target_property(_lib ${__target} IMPORTED_LOCATION)
1623 get_target_property(_lib_imp_rel ${__target} IMPORTED_IMPLIB_RELEASE)
1624 get_target_property(_lib_imp_dbg ${__target} IMPORTED_IMPLIB_DEBUG)
1625 get_target_property(_lib_rel ${__target} IMPORTED_LOCATION_RELEASE)
1626 get_target_property(_lib_dbg ${__target} IMPORTED_LOCATION_DEBUG)
1627 ocv_build_features_string(_lib
1628 IF _lib THEN "${_lib}"
1629 IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
1630 IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
1631 IF _lib_rel THEN "${_lib_rel}"
1632 IF _lib_dbg THEN "${_lib_dbg}"
1635 get_target_property(_inc ${__target} INTERFACE_INCLUDE_DIRECTORIES)
1636 status(" nGraph:" "${__msg}")
1637 status(" * libs:" "${_lib}")
1638 status(" * includes:" "${_inc}")
1640 status(" nGraph:" "NO")
1645 if(WITH_EIGEN OR HAVE_EIGEN)
1646 status(" Eigen:" HAVE_EIGEN THEN "YES (ver ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})" ELSE NO)
1649 if(WITH_OPENVX OR HAVE_OPENVX)
1650 status(" OpenVX:" HAVE_OPENVX THEN "YES (${OPENVX_LIBRARIES})" ELSE "NO")
1653 status(" Custom HAL:" OpenCV_USED_HAL THEN "YES (${OpenCV_USED_HAL})" ELSE "NO")
1655 foreach(s ${CUSTOM_STATUS})
1656 status(${CUSTOM_STATUS_${s}})
1659 if(WITH_CUDA OR HAVE_CUDA)
1660 ocv_build_features_string(cuda_features
1661 IF HAVE_CUFFT THEN "CUFFT"
1662 IF HAVE_CUBLAS THEN "CUBLAS"
1663 IF HAVE_NVCUVID THEN "NVCUVID"
1664 IF CUDA_FAST_MATH THEN "FAST_MATH"
1665 ELSE "no extra features")
1667 status(" NVIDIA CUDA:" HAVE_CUDA THEN "YES (ver ${CUDA_VERSION_STRING}, ${cuda_features})" ELSE NO)
1669 status(" NVIDIA GPU arch:" ${OPENCV_CUDA_ARCH_BIN})
1670 status(" NVIDIA PTX archs:" ${OPENCV_CUDA_ARCH_PTX})
1674 if(WITH_CUDNN OR HAVE_CUDNN)
1676 status(" cuDNN:" HAVE_CUDNN THEN "YES (ver ${CUDNN_VERSION})" ELSE NO)
1679 if(WITH_VULKAN OR HAVE_VULKAN)
1681 status(" Vulkan:" HAVE_VULKAN THEN "YES" ELSE "NO")
1683 status(" Include path:" VULKAN_INCLUDE_DIRS THEN "${VULKAN_INCLUDE_DIRS}" ELSE "NO")
1684 status(" Link libraries:" VULKAN_LIBRARIES THEN "${VULKAN_LIBRARIES}" ELSE "Dynamic load")
1688 if(WITH_WEBNN OR HAVE_WEBNN)
1690 status(" WebNN:" HAVE_WEBNN THEN "YES" ELSE "NO")
1691 if(HAVE_WEBNN AND NOT EMSCRIPTEN)
1692 status(" Include path:" WEBNN_HEADER_DIRS THEN "${WEBNN_HEADER_DIRS}" ELSE "NO")
1693 status(" Link libraries:" WEBNN_LIBRARIES THEN "${WEBNN_LIBRARIES}" ELSE "NO")
1699 status(" Tim-VX:" HAVE_TIMVX THEN "YES" ELSE "NO")
1701 status(" Include path" TIMVX_INCLUDE_DIR THEN "${TIMVX_INCLUDE_DIR}" ELSE "NO")
1702 status(" Link libraries:" TIMVX_LIBRARY THEN "${TIMVX_LIBRARY}" ELSE "NO")
1703 status(" VIVANTE SDK path" VIVANTE_SDK_DIR THEN "${VIVANTE_SDK_DIR}" ELSE "NO")
1707 if(WITH_OPENCL OR HAVE_OPENCL)
1708 ocv_build_features_string(opencl_features
1709 IF HAVE_OPENCL_SVM THEN "SVM"
1710 IF HAVE_CLAMDFFT THEN "AMDFFT"
1711 IF HAVE_CLAMDBLAS THEN "AMDBLAS"
1712 IF HAVE_OPENCL_D3D11_NV THEN "NVD3D11"
1713 IF HAVE_VA_INTEL THEN "INTELVA"
1714 ELSE "no extra features")
1716 status(" OpenCL:" HAVE_OPENCL THEN "YES (${opencl_features})" ELSE "NO")
1718 status(" Include path:" OPENCL_INCLUDE_DIRS THEN "${OPENCL_INCLUDE_DIRS}" ELSE "NO")
1719 status(" Link libraries:" OPENCL_LIBRARIES THEN "${OPENCL_LIBRARIES}" ELSE "Dynamic load")
1723 if(WITH_ONNX OR HAVE_ONNX)
1725 status(" ONNX:" HAVE_ONNX THEN "YES" ELSE "NO")
1727 status(" Include path:" ONNX_INCLUDE_DIR THEN "${ONNX_INCLUDE_DIR}" ELSE "NO")
1728 status(" Link libraries:" ONNX_LIBRARIES THEN "${ONNX_LIBRARIES}" ELSE "NO")
1732 # ========================== python ==========================
1733 if(BUILD_opencv_python2)
1735 status(" Python 2:")
1736 status(" Interpreter:" PYTHON2INTERP_FOUND THEN "${PYTHON2_EXECUTABLE} (ver ${PYTHON2_VERSION_STRING})" ELSE NO)
1737 if(PYTHON2LIBS_VERSION_STRING)
1738 status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES} (ver ${PYTHON2LIBS_VERSION_STRING})" ELSE NO)
1740 status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES}" ELSE NO)
1742 status(" numpy:" PYTHON2_NUMPY_INCLUDE_DIRS THEN "${PYTHON2_NUMPY_INCLUDE_DIRS} (ver ${PYTHON2_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
1743 status(" install path:" HAVE_opencv_python2 THEN "${__INSTALL_PATH_PYTHON2}" ELSE "-")
1746 if(BUILD_opencv_python3)
1748 status(" Python 3:")
1749 status(" Interpreter:" PYTHON3INTERP_FOUND THEN "${PYTHON3_EXECUTABLE} (ver ${PYTHON3_VERSION_STRING})" ELSE NO)
1750 if(PYTHON3LIBS_VERSION_STRING)
1751 status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES} (ver ${PYTHON3LIBS_VERSION_STRING})" ELSE NO)
1753 status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES}" ELSE NO)
1755 status(" numpy:" PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
1756 status(" install path:" HAVE_opencv_python3 THEN "${__INSTALL_PATH_PYTHON3}" ELSE "-")
1760 status(" Python (for build):" PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE NO)
1762 # ========================== java ==========================
1765 status(" Java:" BUILD_FAT_JAVA_LIB THEN "export all functions" ELSE "")
1766 status(" ant:" ANT_EXECUTABLE THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})" ELSE NO)
1768 status(" JNI:" JNI_INCLUDE_DIRS THEN "${JNI_INCLUDE_DIRS}" ELSE NO)
1770 status(" Java wrappers:" HAVE_opencv_java THEN YES ELSE NO)
1771 status(" Java tests:" BUILD_TESTS AND opencv_test_java_BINARY_DIR THEN YES ELSE NO)
1774 # ========================== Objective-C =======================
1777 status(" Objective-C wrappers:" HAVE_opencv_objc THEN YES ELSE NO)
1780 ocv_cmake_hook(STATUS_DUMP_EXTRA)
1782 # ========================== auxiliary ==========================
1784 status(" Install to:" "${CMAKE_INSTALL_PREFIX}")
1785 status("-----------------------------------------------------------------")
1789 ocv_finalize_status()
1791 if(ENABLE_CONFIG_VERIFICATION)
1795 if(HAVE_CUDA AND COMMAND CUDA_BUILD_CLEAN_TARGET)
1796 CUDA_BUILD_CLEAN_TARGET()
1799 ocv_cmake_hook(POST_FINALIZE)
1801 # ----------------------------------------------------------------------------
1803 # ----------------------------------------------------------------------------
1805 include(cmake/OpenCVPackaging.cmake)
1807 # This should be the last command
1808 ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
1809 ocv_cmake_eval(DEBUG_POST ONCE)