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(DEFINED CMAKE_BUILD_TYPE)
95 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${CMAKE_CONFIGURATION_TYPES}")
98 option(ENABLE_PIC "Generate position independent code (necessary for shared libraries)" TRUE)
99 set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_PIC})
101 ocv_cmake_hook(PRE_CMAKE_BOOTSTRAP)
103 # Bootstap CMake system: setup CMAKE_SYSTEM_NAME and other vars
104 if(OPENCV_WORKAROUND_CMAKE_20989)
105 set(CMAKE_SYSTEM_PROCESSOR_BACKUP ${CMAKE_SYSTEM_PROCESSOR})
107 enable_language(CXX C)
108 if(OPENCV_WORKAROUND_CMAKE_20989)
109 set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR_BACKUP})
112 ocv_cmake_hook(POST_CMAKE_BOOTSTRAP)
114 if(NOT OPENCV_SKIP_CMAKE_SYSTEM_FILE)
115 include("cmake/platforms/OpenCV-${CMAKE_SYSTEM_NAME}.cmake" OPTIONAL RESULT_VARIABLE "OPENCV_CMAKE_SYSTEM_FILE")
116 if(NOT OPENCV_CMAKE_SYSTEM_FILE)
117 message(STATUS "OpenCV: system-specific configuration file is not found: '${CMAKE_SYSTEM_NAME}'")
121 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) # https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.html
122 if(NOT CMAKE_TOOLCHAIN_FILE)
124 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
126 set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory" FORCE)
129 # any cross-compiling
130 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
136 project(OpenCV CXX C)
139 set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
142 ocv_cmake_eval(DEBUG_PRE ONCE)
144 ocv_clear_vars(OpenCVModules_TARGETS)
146 include(cmake/OpenCVDownload.cmake)
148 set(BUILD_LIST "" CACHE STRING "Build only listed modules (comma-separated, e.g. 'videoio,dnn,ts')")
150 # ----------------------------------------------------------------------------
151 # Break in case of popular CMake configuration mistakes
152 # ----------------------------------------------------------------------------
153 if(NOT CMAKE_SIZEOF_VOID_P GREATER 0)
154 message(FATAL_ERROR "CMake fails to determine the bitness of the target platform.
155 Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.")
158 # ----------------------------------------------------------------------------
159 # Detect compiler and target platform architecture
160 # ----------------------------------------------------------------------------
161 include(cmake/OpenCVDetectCXXCompiler.cmake)
162 ocv_cmake_hook(POST_DETECT_COMPILER)
164 # Add these standard paths to the search paths for FIND_LIBRARY
165 # to find libraries from these locations first
166 if(UNIX AND NOT ANDROID)
167 if(X86_64 OR CMAKE_SIZEOF_VOID_P EQUAL 8)
169 list(APPEND CMAKE_LIBRARY_PATH /lib64)
171 list(APPEND CMAKE_LIBRARY_PATH /lib)
173 if(EXISTS /usr/lib64)
174 list(APPEND CMAKE_LIBRARY_PATH /usr/lib64)
176 list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
178 elseif(X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
180 list(APPEND CMAKE_LIBRARY_PATH /lib32)
182 list(APPEND CMAKE_LIBRARY_PATH /lib)
184 if(EXISTS /usr/lib32)
185 list(APPEND CMAKE_LIBRARY_PATH /usr/lib32)
187 list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
192 # Add these standard paths to the search paths for FIND_PATH
193 # to find include files from these locations first
196 list(APPEND CMAKE_INCLUDE_PATH /mingw)
199 list(APPEND CMAKE_INCLUDE_PATH /mingw32)
202 list(APPEND CMAKE_INCLUDE_PATH /mingw64)
206 # ----------------------------------------------------------------------------
207 # OpenCV cmake options
208 # ----------------------------------------------------------------------------
210 OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF)
213 OCV_OPTION(OPENCV_FORCE_3RDPARTY_BUILD "Force using 3rdparty code from source" OFF)
214 OCV_OPTION(BUILD_ZLIB "Build zlib from source" (WIN32 OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
215 OCV_OPTION(BUILD_TIFF "Build libtiff from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
216 OCV_OPTION(BUILD_OPENJPEG "Build OpenJPEG from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
217 OCV_OPTION(BUILD_JASPER "Build libjasper from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
218 OCV_OPTION(BUILD_JPEG "Build libjpeg from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
219 OCV_OPTION(BUILD_PNG "Build libpng from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
220 OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
221 OCV_OPTION(BUILD_WEBP "Build WebP from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
222 OCV_OPTION(BUILD_TBB "Download and build TBB from source" (ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
223 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 )
224 OCV_OPTION(BUILD_ITT "Build Intel ITT from source"
225 (NOT MINGW OR OPENCV_FORCE_3RDPARTY_BUILD)
226 IF (X86_64 OR X86 OR ARM OR AARCH64 OR PPC64 OR PPC64LE) AND NOT WINRT AND NOT APPLE_FRAMEWORK
229 # Optional 3rd party components
230 # ===================================================
231 OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON
232 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
233 VERIFY HAVE_DC1394_2)
234 OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON
236 VERIFY HAVE_AVFOUNDATION)
237 OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
240 OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" ON
241 VISIBLE_IF (ARM OR AARCH64) AND NOT IOS)
242 OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON
244 VERIFY HAVE_CPUFEATURES)
245 OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON
246 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT CMAKE_CROSSCOMPILING
248 OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" OFF
249 VISIBLE_IF NOT IOS AND NOT WINRT
251 OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" WITH_CUDA
254 OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" WITH_CUDA
257 OCV_OPTION(WITH_CUDNN "Include NVIDIA CUDA Deep Neural Network (cuDNN) library support" WITH_CUDA
260 OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF # disabled, details: https://github.com/opencv/opencv/issues/14850
263 OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" (NOT CV_DISABLE_OPTIMIZATION AND NOT CMAKE_CROSSCOMPILING)
266 OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" (NOT ANDROID)
267 VISIBLE_IF NOT IOS AND NOT WINRT
269 OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON
270 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
271 VERIFY HAVE_GSTREAMER AND GSTREAMER_VERSION VERSION_GREATER "0.99")
272 OCV_OPTION(WITH_GTK "Include GTK support" ON
273 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
275 OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF
276 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
277 VERIFY HAVE_GTK AND NOT HAVE_GTK3)
278 OCV_OPTION(WITH_IPP "Include Intel IPP support" (NOT MINGW AND NOT CV_DISABLE_OPTIMIZATION)
279 VISIBLE_IF (X86_64 OR X86) AND NOT WINRT AND NOT IOS
281 OCV_OPTION(WITH_HALIDE "Include Halide support" OFF
284 OCV_OPTION(WITH_VULKAN "Include Vulkan support" OFF
287 OCV_OPTION(WITH_INF_ENGINE "Include Intel Inference Engine support" OFF
289 VERIFY INF_ENGINE_TARGET)
290 OCV_OPTION(WITH_NGRAPH "Include nGraph support" WITH_INF_ENGINE
292 VERIFY TARGET ngraph::ngraph)
293 OCV_OPTION(WITH_JASPER "Include JPEG2K support (Jasper)" ON
296 OCV_OPTION(WITH_OPENJPEG "Include JPEG2K support (OpenJPEG)" ON
298 VERIFY HAVE_OPENJPEG)
299 OCV_OPTION(WITH_JPEG "Include JPEG support" ON
302 OCV_OPTION(WITH_WEBP "Include WebP support" ON
305 OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" BUILD_OPENEXR OR NOT CMAKE_CROSSCOMPILING
306 VISIBLE_IF NOT APPLE_FRAMEWORK AND NOT WINRT
308 OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF
309 VISIBLE_IF NOT ANDROID AND NOT WINRT
311 OCV_OPTION(WITH_OPENVX "Include OpenVX support" OFF
314 OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF
315 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
317 OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF
318 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
320 OCV_OPTION(WITH_PNG "Include PNG support" ON
323 OCV_OPTION(WITH_GDCM "Include DICOM support" OFF
326 OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" OFF
327 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
329 OCV_OPTION(WITH_ARAVIS "Include Aravis GigE support" OFF
330 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT WIN32
331 VERIFY HAVE_ARAVIS_API)
332 OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF
333 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
335 OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON
336 VISIBLE_IF WIN32 AND NOT WINRT
338 OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF
339 VISIBLE_IF NOT IOS AND NOT WINRT
341 OCV_OPTION(WITH_HPX "Include Ste||ar Group HPX support" OFF
344 OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF
347 OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON
348 VISIBLE_IF NOT WIN32 OR MINGW
349 VERIFY HAVE_PTHREADS_PF)
350 OCV_OPTION(WITH_TIFF "Include TIFF support" ON
353 OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON
354 VISIBLE_IF UNIX AND NOT ANDROID AND NOT APPLE
355 VERIFY HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
356 OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON
357 VISIBLE_IF WIN32 AND NOT ARM AND NOT WINRT
359 OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" NOT MINGW
362 OCV_OPTION(WITH_MSMF_DXVA "Enable hardware acceleration in Media Foundation backend" WITH_MSMF
364 VERIFY HAVE_MSMF_DXVA)
365 OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF
366 VISIBLE_IF NOT ANDROID AND NOT WINRT
368 OCV_OPTION(WITH_UEYE "Include UEYE camera support" OFF
369 VISIBLE_IF NOT ANDROID AND NOT APPLE AND NOT WINRT
371 OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF
372 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
374 OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF
377 OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" (NOT ANDROID AND NOT CV_DISABLE_OPTIMIZATION)
378 VISIBLE_IF NOT IOS AND NOT WINRT
380 OCV_OPTION(WITH_OPENCL_SVM "Include OpenCL Shared Virtual Memory support" OFF
382 VERIFY HAVE_OPENCL_SVM) # experimental
383 OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON
384 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
385 VERIFY HAVE_CLAMDFFT)
386 OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON
387 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
388 VERIFY HAVE_CLAMDBLAS)
389 OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON
390 VISIBLE_IF WIN32 AND NOT WINRT
392 OCV_OPTION(WITH_OPENCL_D3D11_NV "Include NVIDIA OpenCL D3D11 support" WITH_DIRECTX
393 VISIBLE_IF WIN32 AND NOT WINRT
394 VERIFY HAVE_OPENCL_D3D11_NV)
395 OCV_OPTION(WITH_LIBREALSENSE "Include Intel librealsense support" OFF
396 VISIBLE_IF NOT WITH_INTELPERC
397 VERIFY HAVE_LIBREALSENSE)
398 OCV_OPTION(WITH_VA "Include VA support" (X86_64 OR X86)
399 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
401 OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" (X86_64 OR X86)
402 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
403 VERIFY HAVE_VA_INTEL)
404 OCV_OPTION(WITH_MFX "Include Intel Media SDK support" OFF
405 VISIBLE_IF (UNIX AND NOT ANDROID) OR (WIN32 AND NOT WINRT AND NOT MINGW)
407 OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF
408 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
410 OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" OFF
411 VISIBLE_IF UNIX AND NOT ANDROID AND NOT IOS
413 OCV_OPTION(WITH_LAPACK "Include Lapack library support" (NOT CV_DISABLE_OPTIMIZATION)
414 VISIBLE_IF NOT ANDROID AND NOT IOS
416 OCV_OPTION(WITH_ITT "Include Intel ITT support" ON
417 VISIBLE_IF NOT APPLE_FRAMEWORK
419 OCV_OPTION(WITH_PROTOBUF "Enable libprotobuf" ON
421 VERIFY HAVE_PROTOBUF)
422 OCV_OPTION(WITH_IMGCODEC_HDR "Include HDR support" ON
424 VERIFY HAVE_IMGCODEC_HDR)
425 OCV_OPTION(WITH_IMGCODEC_SUNRASTER "Include SUNRASTER support" ON
427 VERIFY HAVE_IMGCODEC_SUNRASTER)
428 OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support" ON
430 VERIFY HAVE_IMGCODEC_PXM)
431 OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON
433 VERIFY HAVE_IMGCODEC_PFM)
434 OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON
437 OCV_OPTION(WITH_ANDROID_MEDIANDK "Use Android Media NDK for Video I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 20)
439 VERIFY HAVE_ANDROID_MEDIANDK)
440 OCV_OPTION(WITH_ANDROID_NATIVE_CAMERA "Use Android NDK for Camera I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 23)
442 VERIFY HAVE_ANDROID_NATIVE_CAMERA)
443 OCV_OPTION(WITH_TENGINE "Include Arm Inference Tengine support" OFF
444 VISIBLE_IF (ARM OR AARCH64) AND (UNIX OR ANDROID) AND NOT IOS
446 OCV_OPTION(WITH_ONNX "Include Microsoft ONNX Runtime support" OFF
450 # OpenCV build components
451 # ===================================================
452 OCV_OPTION(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" NOT (ANDROID OR APPLE_FRAMEWORK) )
453 OCV_OPTION(BUILD_opencv_apps "Build utility applications (used for example to train classifiers)" (NOT ANDROID AND NOT WINRT) IF (NOT APPLE_FRAMEWORK) )
454 OCV_OPTION(BUILD_opencv_js "Build JavaScript bindings by Emscripten" OFF )
455 OCV_OPTION(BUILD_ANDROID_PROJECTS "Build Android projects providing .apk files" ON IF ANDROID )
456 OCV_OPTION(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" ON IF ANDROID )
457 OCV_OPTION(BUILD_DOCS "Create build rules for OpenCV Documentation" OFF IF (NOT WINRT AND NOT APPLE_FRAMEWORK))
458 OCV_OPTION(BUILD_EXAMPLES "Build all examples" OFF )
459 OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" ON IF NOT WINRT)
460 OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" NOT INSTALL_CREATE_DISTRIB IF (NOT APPLE_FRAMEWORK) )
461 OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" NOT INSTALL_CREATE_DISTRIB IF (NOT APPLE_FRAMEWORK) )
462 OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into release binaries ('OFF' means default settings)" OFF )
463 OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for statically linked OpenCV" ON IF MSVC )
464 OCV_OPTION(BUILD_WITH_DYNAMIC_IPP "Enables dynamic linking of IPP (only for standalone IPP)" OFF )
465 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)
466 OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
467 OCV_OPTION(BUILD_CUDA_STUBS "Build CUDA modules stubs when no CUDA SDK" OFF IF (NOT APPLE_FRAMEWORK) )
468 OCV_OPTION(BUILD_JAVA "Enable Java support" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
469 OCV_OPTION(BUILD_OBJC "Enable Objective-C support" ON IF APPLE_FRAMEWORK )
470 OCV_OPTION(BUILD_KOTLIN_EXTENSIONS "Build Kotlin extensions (Android)" ON IF ANDROID )
472 # OpenCV installation options
473 # ===================================================
474 OCV_OPTION(INSTALL_CREATE_DISTRIB "Change install rules to build the distribution package" OFF )
475 OCV_OPTION(INSTALL_BIN_EXAMPLES "Install prebuilt examples" WIN32 IF BUILD_EXAMPLES)
476 OCV_OPTION(INSTALL_C_EXAMPLES "Install C examples" OFF )
477 OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
478 OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )
479 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) )
480 OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binaries and test data" OFF)
482 # OpenCV build options
483 # ===================================================
484 OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja" OR CMAKE_GENERATOR MATCHES "Xcode")) )
485 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" MSVC IF (MSVC OR (NOT IOS AND NOT CMAKE_CROSSCOMPILING) ) )
486 OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) )
487 OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CV_GCC )
488 OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CV_GCC )
489 OCV_OPTION(OPENCV_ENABLE_MEMORY_SANITIZER "Better support for memory/address sanitizers" OFF)
490 OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CV_GCC )
491 OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
492 OCV_OPTION(ENABLE_FAST_MATH "Enable compiler options for fast math optimizations on FP computations (not recommended)" OFF)
493 if(NOT IOS AND (NOT ANDROID OR OPENCV_ANDROID_USE_LEGACY_FLAGS) AND CMAKE_CROSSCOMPILING) # Use CPU_BASELINE instead
494 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) )
495 OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
497 OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF )
498 OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF )
499 OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID )
500 OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF )
501 OCV_OPTION(ENABLE_INSTRUMENTATION "Instrument functions to collect calls trace and performance" OFF )
502 OCV_OPTION(ENABLE_GNU_STL_DEBUG "Enable GNU STL Debug mode (defines _GLIBCXX_DEBUG)" OFF IF CV_GCC )
503 OCV_OPTION(ENABLE_BUILD_HARDENING "Enable hardening of the resulting binaries (against security attacks, detects memory corruption, etc)" OFF)
504 OCV_OPTION(ENABLE_LTO "Enable Link Time Optimization" OFF IF CV_GCC OR MSVC)
505 OCV_OPTION(ENABLE_THIN_LTO "Enable Thin LTO" OFF IF CV_CLANG)
506 OCV_OPTION(GENERATE_ABI_DESCRIPTOR "Generate XML file for abi_compliance_checker tool" OFF IF UNIX)
507 OCV_OPTION(OPENCV_GENERATE_PKGCONFIG "Generate .pc file for pkg-config build tool (deprecated)" OFF)
508 OCV_OPTION(CV_ENABLE_INTRINSICS "Use intrinsic-based optimized code" ON )
509 OCV_OPTION(CV_DISABLE_OPTIMIZATION "Disable explicit optimized code (dispatched code/intrinsics/loop unrolling/etc)" OFF )
510 OCV_OPTION(CV_TRACE "Enable OpenCV code trace" ON)
511 OCV_OPTION(OPENCV_GENERATE_SETUPVARS "Generate setup_vars* scripts" ON IF (NOT ANDROID AND NOT APPLE_FRAMEWORK) )
512 OCV_OPTION(ENABLE_CONFIG_VERIFICATION "Fail build if actual configuration doesn't match requested (WITH_XXX != HAVE_XXX)" OFF)
513 OCV_OPTION(OPENCV_ENABLE_MEMALIGN "Enable posix_memalign or memalign usage" ON)
514 OCV_OPTION(OPENCV_DISABLE_FILESYSTEM_SUPPORT "Disable filesystem support" OFF)
516 OCV_OPTION(ENABLE_PYLINT "Add target with Pylint checks" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
517 OCV_OPTION(ENABLE_FLAKE8 "Add target with Python flake8 checker" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
519 if(ENABLE_IMPL_COLLECTION)
520 add_definitions(-DCV_COLLECT_IMPL_DATA)
523 if(OPENCV_DISABLE_FILESYSTEM_SUPPORT)
524 add_definitions(-DOPENCV_HAVE_FILESYSTEM_SUPPORT=0)
527 set(OPENCV_MATHJAX_RELPATH "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0" CACHE STRING "URI to a MathJax installation")
529 # ----------------------------------------------------------------------------
530 # Get actual OpenCV version number from sources
531 # ----------------------------------------------------------------------------
532 include(cmake/OpenCVVersion.cmake)
534 ocv_cmake_hook(POST_OPTIONS)
536 # ----------------------------------------------------------------------------
537 # Build & install layouts
538 # ----------------------------------------------------------------------------
540 if(OPENCV_TEST_DATA_PATH)
541 get_filename_component(OPENCV_TEST_DATA_PATH ${OPENCV_TEST_DATA_PATH} ABSOLUTE)
544 # Save libs and executables in the same place
545 set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications")
548 set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
549 ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}")
551 set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib")
552 ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib")
556 if(ANDROID_ABI MATCHES "NEON")
559 if(ANDROID_ABI MATCHES "VFPV3")
566 ocv_update(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
567 ocv_update(OPENCV_DEBUG_POSTFIX d)
570 ocv_update(OPENCV_DLLVERSION "")
571 ocv_update(OPENCV_DEBUG_POSTFIX "")
574 if(DEFINED CMAKE_DEBUG_POSTFIX)
575 set(OPENCV_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
578 if((INSTALL_CREATE_DISTRIB AND BUILD_SHARED_LIBS AND NOT DEFINED BUILD_opencv_world) OR APPLE_FRAMEWORK)
579 set(BUILD_opencv_world ON CACHE INTERNAL "")
582 include(cmake/OpenCVInstallLayout.cmake)
584 # ----------------------------------------------------------------------------
585 # Path for build/platform -specific headers
586 # ----------------------------------------------------------------------------
587 ocv_update(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
588 ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
590 # ----------------------------------------------------------------------------
591 # Path for additional modules
592 # ----------------------------------------------------------------------------
593 set(OPENCV_EXTRA_MODULES_PATH "" CACHE PATH "Where to look for additional OpenCV modules (can be ;-separated list of paths)")
595 # ----------------------------------------------------------------------------
596 # Autodetect if we are in a GIT repository
597 # ----------------------------------------------------------------------------
598 find_host_package(Git QUIET)
600 if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
601 ocv_git_describe(OPENCV_VCSVERSION "${OpenCV_SOURCE_DIR}")
602 elseif(NOT DEFINED OPENCV_VCSVERSION)
604 set(OPENCV_VCSVERSION "unknown")
608 # ----------------------------------------------------------------------------
609 # OpenCV compiler and linker options
610 # ----------------------------------------------------------------------------
611 # In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release:
612 if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja" AND "${CMAKE_BUILD_TYPE}" STREQUAL "")
613 set(CMAKE_BUILD_TYPE Release)
616 ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)
618 # --- Python Support ---
620 include(cmake/OpenCVDetectPython.cmake)
623 include(cmake/OpenCVCompilerOptions.cmake)
625 ocv_cmake_hook(POST_COMPILER_OPTIONS)
627 # ----------------------------------------------------------------------------
628 # CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
629 # ----------------------------------------------------------------------------
631 if(NOT APPLE_FRAMEWORK OR OPENCV_ENABLE_PKG_CONFIG)
632 if(CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{PKG_CONFIG_LIBDIR} AND NOT DEFINED ENV{PKG_CONFIG_SYSROOT_DIR}
633 AND NOT OPENCV_ENABLE_PKG_CONFIG
635 if(NOT PkgConfig_FOUND)
636 message(STATUS "OpenCV disables pkg-config to avoid using of host libraries. Consider using PKG_CONFIG_LIBDIR to specify target SYSROOT")
637 elseif(OPENCV_SKIP_PKG_CONFIG_WARNING)
638 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.")
640 elseif(OPENCV_DISABLE_PKG_CONFIG)
642 message(WARNING "OPENCV_DISABLE_PKG_CONFIG flag has no effect")
645 find_package(PkgConfig QUIET)
648 include(CheckFunctionExists)
649 include(CheckIncludeFile)
650 include(CheckSymbolExists)
653 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD)
655 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m log)
656 elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|NetBSD|DragonFly|OpenBSD|Haiku")
657 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m pthread)
659 # no need to link to system libs with emscripten
661 # no need to link to system libs with QNX
663 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
669 if(OPENCV_ENABLE_MEMALIGN)
670 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
671 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
673 CHECK_SYMBOL_EXISTS(memalign malloc.h HAVE_MEMALIGN)
676 # - std::aligned_alloc() C++17 / C11
679 include(CheckIncludeFile)
680 include(CheckSymbolExists)
682 if(OPENCV_ENABLE_MEMALIGN)
683 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
685 CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE_WIN32_ALIGNED_MALLOC)
690 include(cmake/OpenCVPCHSupport.cmake)
691 include(cmake/OpenCVModule.cmake)
693 # ----------------------------------------------------------------------------
694 # Detect endianness of build platform
695 # ----------------------------------------------------------------------------
698 # test_big_endian needs try_compile, which doesn't work for iOS
699 # http://public.kitware.com/Bug/view.php?id=12288
700 set(WORDS_BIGENDIAN 0)
702 include(TestBigEndian)
703 test_big_endian(WORDS_BIGENDIAN)
706 # ----------------------------------------------------------------------------
707 # Detect 3rd-party libraries
708 # ----------------------------------------------------------------------------
710 if(ANDROID AND WITH_CPUFEATURES)
711 add_subdirectory(3rdparty/cpufeatures)
712 set(HAVE_CPUFEATURES 1)
715 include(cmake/OpenCVFindFrameworks.cmake)
717 include(cmake/OpenCVFindLibsGrfmt.cmake)
718 include(cmake/OpenCVFindLibsGUI.cmake)
719 include(cmake/OpenCVFindLibsVideo.cmake)
720 include(cmake/OpenCVFindLibsPerf.cmake)
721 include(cmake/OpenCVFindLAPACK.cmake)
722 include(cmake/OpenCVFindProtobuf.cmake)
724 include(cmake/OpenCVFindTengine.cmake)
727 # ----------------------------------------------------------------------------
728 # Detect other 3rd-party libraries/tools
729 # ----------------------------------------------------------------------------
731 # --- Java Support ---
734 include(cmake/android/OpenCVDetectAndroidSDK.cmake)
736 include(cmake/OpenCVDetectApacheAnt.cmake)
741 if(ENABLE_PYLINT AND PYTHON_DEFAULT_AVAILABLE)
742 include(cmake/OpenCVPylint.cmake)
744 if(ENABLE_FLAKE8 AND PYTHON_DEFAULT_AVAILABLE)
745 find_package(Flake8 QUIET)
746 if(NOT FLAKE8_FOUND OR NOT FLAKE8_EXECUTABLE)
747 include("${CMAKE_CURRENT_LIST_DIR}/cmake/FindFlake8.cmake")
750 list(APPEND OPENCV_FLAKE8_EXCLUDES ".git" "__pycache__" "config.py" "*.config.py" "config-*.py")
751 list(APPEND OPENCV_FLAKE8_EXCLUDES "svgfig.py") # 3rdparty
752 if(NOT PYTHON3_VERSION_STRING VERSION_GREATER 3.6)
753 # Python 3.6+ (PEP 526): variable annotations (type hints)
754 list(APPEND OPENCV_FLAKE8_EXCLUDES "samples/dnn/dnn_model_runner/dnn_conversion/common/test/configs")
756 string(REPLACE ";" "," OPENCV_FLAKE8_EXCLUDES_STR "${OPENCV_FLAKE8_EXCLUDES}")
757 add_custom_target(check_flake8
758 COMMAND "${FLAKE8_EXECUTABLE}" . --count --select=E9,E901,E999,F821,F822,F823 --show-source --statistics --exclude='${OPENCV_FLAKE8_EXCLUDES_STR}'
759 WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
760 COMMENT "Running flake8"
766 if(ANDROID AND ANDROID_EXECUTABLE AND ANT_EXECUTABLE AND (ANT_VERSION VERSION_GREATER 1.7) AND (ANDROID_TOOLS_Pkg_Revision GREATER 13))
767 SET(CAN_BUILD_ANDROID_PROJECTS TRUE)
769 SET(CAN_BUILD_ANDROID_PROJECTS FALSE)
774 include(cmake/OpenCVDetectOpenCL.cmake)
779 include(cmake/OpenCVDetectHalide.cmake)
784 include(cmake/OpenCVDetectVulkan.cmake)
787 # --- Inference Engine ---
789 include(cmake/OpenCVDetectInferenceEngine.cmake)
794 include(cmake/OpenCVDetectDirectX.cmake)
798 include(cmake/OpenCVDetectVTK.cmake)
802 include(cmake/FindOpenVX.cmake)
806 add_subdirectory(3rdparty/quirc)
811 include(cmake/FindONNX.cmake)
814 # ----------------------------------------------------------------------------
816 # ----------------------------------------------------------------------------
817 set(_hal_includes "")
818 macro(ocv_hal_register HAL_LIBRARIES_VAR HAL_HEADERS_VAR HAL_INCLUDE_DIRS_VAR)
820 foreach (l ${${HAL_LIBRARIES_VAR}})
822 get_filename_component(l "${l}" ABSOLUTE)
824 list(APPEND OPENCV_HAL_LINKER_LIBS ${l})
827 foreach (h ${${HAL_HEADERS_VAR}})
828 set(_hal_includes "${_hal_includes}\n#include \"${h}\"")
831 ocv_include_directories(${${HAL_INCLUDE_DIRS_VAR}})
834 if(NOT DEFINED OpenCV_HAL)
835 set(OpenCV_HAL "OpenCV_HAL")
839 if(NOT ";${OpenCV_HAL};" MATCHES ";openvx;")
840 set(OpenCV_HAL "openvx;${OpenCV_HAL}")
845 ocv_debug_message(STATUS "Enable carotene acceleration")
846 if(NOT ";${OpenCV_HAL};" MATCHES ";carotene;")
847 set(OpenCV_HAL "carotene;${OpenCV_HAL}")
851 foreach(hal ${OpenCV_HAL})
852 if(hal STREQUAL "carotene")
853 if(";${CPU_BASELINE_FINAL};" MATCHES ";NEON;")
854 add_subdirectory(3rdparty/carotene/hal)
855 ocv_hal_register(CAROTENE_HAL_LIBRARIES CAROTENE_HAL_HEADERS CAROTENE_HAL_INCLUDE_DIRS)
856 list(APPEND OpenCV_USED_HAL "carotene (ver ${CAROTENE_HAL_VERSION})")
858 message(STATUS "Carotene: NEON is not available, disabling carotene...")
860 elseif(hal STREQUAL "openvx")
861 add_subdirectory(3rdparty/openvx)
862 ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS)
863 list(APPEND OpenCV_USED_HAL "openvx (ver ${OPENVX_HAL_VERSION})")
865 ocv_debug_message(STATUS "OpenCV HAL: ${hal} ...")
866 ocv_clear_vars(OpenCV_HAL_LIBRARIES OpenCV_HAL_HEADERS OpenCV_HAL_INCLUDE_DIRS)
867 find_package(${hal} NO_MODULE QUIET)
869 ocv_hal_register(OpenCV_HAL_LIBRARIES OpenCV_HAL_HEADERS OpenCV_HAL_INCLUDE_DIRS)
870 list(APPEND OpenCV_USED_HAL "${hal} (ver ${${hal}_VERSION})")
874 configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/custom_hal.hpp.in" "${CMAKE_BINARY_DIR}/custom_hal.hpp" @ONLY)
878 # ----------------------------------------------------------------------------
880 # ----------------------------------------------------------------------------
882 include(cmake/OpenCVDetectTrace.cmake)
885 ocv_cmake_hook(POST_DETECT_DEPENDECIES) # typo, deprecated (2019-06)
886 ocv_cmake_hook(POST_DETECT_DEPENDENCIES)
888 # ----------------------------------------------------------------------------
890 # ----------------------------------------------------------------------------
891 if(ENABLE_SOLUTION_FOLDERS)
892 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
893 set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
896 # Extra OpenCV targets: uninstall, package_source, perf, etc.
897 include(cmake/OpenCVExtraTargets.cmake)
899 # ----------------------------------------------------------------------------
900 # Process subdirectories
901 # ----------------------------------------------------------------------------
903 # opencv.hpp and legacy headers
904 add_subdirectory(include)
906 # Enable compiler options for OpenCV modules/apps/samples only (ignore 3rdparty)
907 ocv_add_modules_compiler_options()
910 add_subdirectory(modules)
912 # Generate targets for documentation
913 add_subdirectory(doc)
915 # various data that is used by cv libraries and/or demo applications.
916 add_subdirectory(data)
919 if(BUILD_opencv_apps)
920 add_subdirectory(apps)
924 if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES OR INSTALL_C_EXAMPLES)
925 add_subdirectory(samples)
929 add_subdirectory(platforms/android/service)
932 # ----------------------------------------------------------------------------
933 # Finalization: generate configuration-based files
934 # ----------------------------------------------------------------------------
936 ocv_cmake_hook(PRE_FINALIZE)
938 # Generate platform-dependent and configuration-dependent headers
939 include(cmake/OpenCVGenHeaders.cmake)
941 # Generate opencv.pc for pkg-config command
942 if(OPENCV_GENERATE_PKGCONFIG)
943 include(cmake/OpenCVGenPkgconfig.cmake)
946 # Generate OpenCV.mk for ndk-build (Android build tool)
947 include(cmake/OpenCVGenAndroidMK.cmake)
949 # Generate OpenCVConfig.cmake and OpenCVConfig-version.cmake for cmake projects
950 include(cmake/OpenCVGenConfig.cmake)
952 # Generate Info.plist for the IOS framework
954 include(cmake/OpenCVGenInfoPlist.cmake)
957 # Generate ABI descriptor
958 include(cmake/OpenCVGenABI.cmake)
960 # Generate environment setup file
961 if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
963 get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY)
964 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in"
965 "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
966 install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
967 DESTINATION ./ COMPONENT tests)
969 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_windows.cmd.in"
970 "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd" @ONLY)
971 install(PROGRAMS "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd"
972 DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
974 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in"
975 "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
976 install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
977 DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
981 if(NOT OPENCV_README_FILE)
983 set(OPENCV_README_FILE ${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/README.android)
987 if(NOT OPENCV_LICENSE_FILE)
988 set(OPENCV_LICENSE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
991 # for UNIX it does not make sense as LICENSE and readme will be part of the package automatically
992 if(ANDROID OR NOT UNIX)
993 install(FILES ${OPENCV_LICENSE_FILE}
994 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
995 DESTINATION ./ COMPONENT libs)
996 if(OPENCV_README_FILE)
997 install(FILES ${OPENCV_README_FILE}
998 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
999 DESTINATION ./ COMPONENT libs)
1003 if(COMMAND ocv_pylint_finalize)
1004 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/modules/python/test)
1005 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/samples/python)
1006 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/samples/dnn)
1007 ocv_pylint_add_directory_recurse(${CMAKE_CURRENT_LIST_DIR}/samples/python/tutorial_code)
1008 ocv_pylint_finalize()
1010 if(TARGET check_pylint)
1011 message(STATUS "Registered 'check_pylint' target: using ${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}), checks: ${PYLINT_TOTAL_TARGETS}")
1013 if(TARGET check_flake8)
1014 message(STATUS "Registered 'check_flake8' target: using ${FLAKE8_EXECUTABLE} (ver: ${FLAKE8_VERSION})")
1017 if(OPENCV_GENERATE_SETUPVARS)
1018 include(cmake/OpenCVGenSetupVars.cmake)
1021 # ----------------------------------------------------------------------------
1023 # ----------------------------------------------------------------------------
1025 status("General configuration for OpenCV ${OPENCV_VERSION} =====================================")
1026 if(OPENCV_VCSVERSION)
1027 status(" Version control:" ${OPENCV_VCSVERSION})
1029 if(OPENCV_EXTRA_MODULES_PATH AND NOT BUILD_INFO_SKIP_EXTRA_MODULES)
1030 set(__dump_extra_header OFF)
1031 foreach(p ${OPENCV_EXTRA_MODULES_PATH})
1033 if(NOT __dump_extra_header)
1034 set(__dump_extra_header ON)
1036 status(" Extra modules:")
1040 ocv_git_describe(EXTRA_MODULES_VCSVERSION "${p}")
1041 status(" Location (extra):" ${p})
1042 status(" Version control (extra):" ${EXTRA_MODULES_VCSVERSION})
1045 unset(__dump_extra_header)
1048 # ========================== build platform ==========================
1050 status(" Platform:")
1051 if(NOT DEFINED OPENCV_TIMESTAMP
1052 AND NOT BUILD_INFO_SKIP_TIMESTAMP
1054 string(TIMESTAMP OPENCV_TIMESTAMP "" UTC)
1055 set(OPENCV_TIMESTAMP "${OPENCV_TIMESTAMP}" CACHE STRING "Timestamp of OpenCV build configuration" FORCE)
1057 if(OPENCV_TIMESTAMP)
1058 status(" Timestamp:" ${OPENCV_TIMESTAMP})
1060 status(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
1061 if(CMAKE_CROSSCOMPILING)
1062 status(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
1064 status(" CMake:" ${CMAKE_VERSION})
1065 status(" CMake generator:" ${CMAKE_GENERATOR})
1066 status(" CMake build tool:" ${CMAKE_BUILD_TOOL})
1068 status(" MSVC:" ${MSVC_VERSION})
1070 if(CMAKE_GENERATOR MATCHES Xcode)
1071 status(" Xcode:" ${XCODE_VERSION})
1073 if(CMAKE_GENERATOR MATCHES "Xcode|Visual Studio|Multi-Config")
1074 status(" Configuration:" ${CMAKE_CONFIGURATION_TYPES})
1076 status(" Configuration:" ${CMAKE_BUILD_TYPE})
1080 # ========================= CPU code generation mode =========================
1082 status(" CPU/HW features:")
1083 status(" Baseline:" "${CPU_BASELINE_FINAL}")
1084 if(NOT CPU_BASELINE STREQUAL CPU_BASELINE_FINAL)
1085 status(" requested:" "${CPU_BASELINE}")
1087 if(CPU_BASELINE_REQUIRE)
1088 status(" required:" "${CPU_BASELINE_REQUIRE}")
1090 if(CPU_BASELINE_DISABLE)
1091 status(" disabled:" "${CPU_BASELINE_DISABLE}")
1093 if(CPU_DISPATCH_FINAL OR CPU_DISPATCH)
1094 status(" Dispatched code generation:" "${CPU_DISPATCH_FINAL}")
1095 if(NOT CPU_DISPATCH STREQUAL CPU_DISPATCH_FINAL)
1096 status(" requested:" "${CPU_DISPATCH}")
1098 if(CPU_DISPATCH_REQUIRE)
1099 status(" required:" "${CPU_DISPATCH_REQUIRE}")
1101 foreach(OPT ${CPU_DISPATCH_FINAL})
1102 status(" ${OPT} (${CPU_${OPT}_USAGE_COUNT} files):" "+ ${CPU_DISPATCH_${OPT}_INCLUDED}")
1106 # ========================== C/C++ options ==========================
1107 if(CMAKE_CXX_COMPILER_VERSION)
1108 set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (ver ${CMAKE_CXX_COMPILER_VERSION})")
1110 set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
1112 string(STRIP "${OPENCV_COMPILER_STR}" OPENCV_COMPILER_STR)
1116 status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
1117 if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD)
1118 status(" C++ standard:" "${CMAKE_CXX_STANDARD}")
1120 status(" C++ Compiler:" ${OPENCV_COMPILER_STR})
1121 status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
1122 status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
1123 status(" C Compiler:" ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
1124 status(" C flags (Release):" ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE})
1125 status(" C flags (Debug):" ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG})
1127 status(" Linker flags (Release):" ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
1128 status(" Linker flags (Debug):" ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
1130 status(" Linker flags (Release):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
1131 status(" Linker flags (Debug):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
1133 status(" ccache:" OPENCV_COMPILER_IS_CCACHE THEN YES ELSE NO)
1134 status(" Precompiled headers:" PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS THEN YES ELSE NO)
1136 if(OPENCV_DISABLE_FILESYSTEM_SUPPORT)
1137 status(" Filesystem support is disabled")
1140 # ========================== Dependencies ============================
1141 ocv_get_all_libs(deps_modules deps_extra deps_3rdparty)
1142 status(" Extra dependencies:" ${deps_extra})
1143 status(" 3rdparty dependencies:" ${deps_3rdparty})
1145 # ========================== OpenCV modules ==========================
1147 status(" OpenCV modules:")
1148 set(OPENCV_MODULES_BUILD_ST "")
1149 foreach(the_module ${OPENCV_MODULES_BUILD})
1150 if(NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "INTERNAL" OR the_module STREQUAL "opencv_ts")
1151 list(APPEND OPENCV_MODULES_BUILD_ST "${the_module}")
1154 string(REPLACE "opencv_" "" OPENCV_MODULES_BUILD_ST "${OPENCV_MODULES_BUILD_ST}")
1155 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_USER_ST "${OPENCV_MODULES_DISABLED_USER}")
1156 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_AUTO_ST "${OPENCV_MODULES_DISABLED_AUTO}")
1157 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_FORCE_ST "${OPENCV_MODULES_DISABLED_FORCE}")
1158 list(SORT OPENCV_MODULES_BUILD_ST)
1159 list(SORT OPENCV_MODULES_DISABLED_USER_ST)
1160 list(SORT OPENCV_MODULES_DISABLED_AUTO_ST)
1161 list(SORT OPENCV_MODULES_DISABLED_FORCE_ST)
1162 status(" To be built:" OPENCV_MODULES_BUILD THEN ${OPENCV_MODULES_BUILD_ST} ELSE "-")
1163 status(" Disabled:" OPENCV_MODULES_DISABLED_USER THEN ${OPENCV_MODULES_DISABLED_USER_ST} ELSE "-")
1164 status(" Disabled by dependency:" OPENCV_MODULES_DISABLED_AUTO THEN ${OPENCV_MODULES_DISABLED_AUTO_ST} ELSE "-")
1165 status(" Unavailable:" OPENCV_MODULES_DISABLED_FORCE THEN ${OPENCV_MODULES_DISABLED_FORCE_ST} ELSE "-")
1167 ocv_build_features_string(apps_status
1168 IF BUILD_TESTS AND HAVE_opencv_ts THEN "tests"
1169 IF BUILD_PERF_TESTS AND HAVE_opencv_ts THEN "perf_tests"
1170 IF BUILD_EXAMPLES THEN "examples"
1171 IF BUILD_opencv_apps THEN "apps"
1172 IF BUILD_ANDROID_SERVICE THEN "android_service"
1173 IF (BUILD_ANDROID_EXAMPLES OR INSTALL_ANDROID_EXAMPLES) AND CAN_BUILD_ANDROID_PROJECTS THEN "android_examples"
1175 status(" Applications:" "${apps_status}")
1176 ocv_build_features_string(docs_status
1177 IF TARGET doxygen_cpp THEN "doxygen"
1178 IF TARGET doxygen_python THEN "python"
1179 IF TARGET doxygen_javadoc THEN "javadoc"
1180 IF BUILD_opencv_js OR DEFINED OPENCV_JS_LOCATION THEN "js"
1183 status(" Documentation:" "${docs_status}")
1184 status(" Non-free algorithms:" OPENCV_ENABLE_NONFREE THEN "YES" ELSE "NO")
1186 # ========================== Android details ==========================
1189 if(DEFINED ANDROID_NDK_REVISION)
1190 set(__msg "${ANDROID_NDK} (ver ${ANDROID_NDK_REVISION})")
1192 set(__msg "location: ${ANDROID_NDK}")
1194 status(" Android NDK: " ${__msg})
1195 status(" Android ABI:" ${ANDROID_ABI})
1196 if(BUILD_WITH_STANDALONE_TOOLCHAIN)
1197 status(" NDK toolchain:" "standalone: ${ANDROID_STANDALONE_TOOLCHAIN}")
1198 elseif(BUILD_WITH_ANDROID_NDK OR DEFINED ANDROID_TOOLCHAIN_NAME)
1199 status(" NDK toolchain:" "${ANDROID_TOOLCHAIN_NAME}")
1201 status(" STL type:" ${ANDROID_STL})
1202 status(" Native API level:" ${ANDROID_NATIVE_API_LEVEL})
1204 if(BUILD_ANDROID_PROJECTS)
1205 status(" Android SDK: " "${ANDROID_SDK} (tools: ${ANDROID_SDK_TOOLS_VERSION} build tools: ${ANDROID_SDK_BUILD_TOOLS_VERSION})")
1206 if(ANDROID_EXECUTABLE)
1207 status(" android tool:" "${ANDROID_EXECUTABLE}")
1210 status(" Android SDK: " "not used, projects are not built")
1212 if(DEFINED ANDROID_SDK_COMPATIBLE_TARGET)
1213 status(" SDK target:" "${ANDROID_SDK_COMPATIBLE_TARGET}")
1215 if(DEFINED ANDROID_PROJECTS_BUILD_TYPE)
1216 if(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT")
1217 status(" Projects build scripts:" "Ant/Eclipse compatible")
1218 elseif(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT")
1219 status(" Projects build scripts:" "Gradle")
1224 # ================== Windows RT features ==================
1227 status(" Windows RT support:" WINRT THEN YES ELSE NO)
1229 status(" Building for Microsoft platform: " ${CMAKE_SYSTEM_NAME})
1230 status(" Building for architectures: " ${CMAKE_VS_EFFECTIVE_PLATFORMS})
1231 status(" Building for version: " ${CMAKE_SYSTEM_VERSION})
1232 if (DEFINED ENABLE_WINRT_MODE_NATIVE)
1233 status(" Building for C++ without CX extensions")
1238 # ========================== GUI ==========================
1242 if(WITH_QT OR HAVE_QT)
1244 status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
1245 status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
1247 status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
1248 status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
1255 status(" Win32 UI:" HAVE_WIN32UI THEN YES ELSE NO)
1258 if(HAVE_COCOA) # APPLE
1259 status(" Cocoa:" YES)
1262 if(WITH_GTK OR HAVE_GTK)
1264 status(" GTK+:" "YES (ver ${GTK3_VERSION})")
1266 status(" GTK+:" "YES (ver ${GTK2_VERSION})")
1268 status(" GTK+:" "NO")
1271 status( " GThread :" HAVE_GTHREAD THEN "YES (ver ${GTHREAD_VERSION})" ELSE NO)
1272 status( " GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${GTKGLEXT_VERSION})" ELSE NO)
1276 if(WITH_OPENGL OR HAVE_OPENGL)
1277 status(" OpenGL support:" HAVE_OPENGL THEN "YES (${OPENGL_LIBRARIES})" ELSE NO)
1280 if(WITH_VTK OR HAVE_VTK)
1281 status(" VTK support:" HAVE_VTK THEN "YES (ver ${VTK_VERSION})" ELSE NO)
1284 # ========================== MEDIA IO ==========================
1286 status(" Media I/O: ")
1287 status(" ZLib:" ZLIB_FOUND THEN "${ZLIB_LIBRARIES} (ver ${ZLIB_VERSION_STRING})" ELSE "build (ver ${ZLIB_VERSION_STRING})")
1289 if(WITH_JPEG OR HAVE_JPEG)
1293 status(" JPEG:" "build-${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
1295 status(" JPEG:" "${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
1299 if(WITH_WEBP OR HAVE_WEBP)
1300 status(" WEBP:" WEBP_FOUND THEN "${WEBP_LIBRARY} (ver ${WEBP_VERSION})" ELSE "build (ver ${WEBP_VERSION})")
1303 if(WITH_PNG OR HAVE_PNG)
1304 status(" PNG:" PNG_FOUND THEN "${PNG_LIBRARY} (ver ${PNG_VERSION})" ELSE "build (ver ${PNG_VERSION})")
1307 if(WITH_TIFF OR HAVE_TIFF)
1308 status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION} / ${TIFF_VERSION_STRING})" ELSE "build (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})")
1312 status(" JPEG 2000:" OpenJPEG_FOUND
1313 THEN "OpenJPEG (ver ${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION})"
1314 ELSE "build (ver ${OPENJPEG_VERSION})"
1317 status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build Jasper (ver ${JASPER_VERSION_STRING})")
1318 elseif(WITH_OPENJPEG OR WITH_JASPER)
1319 status(" JPEG 2000:" "NO")
1322 if(WITH_OPENEXR OR HAVE_OPENEXR)
1324 status(" OpenEXR:" OPENEXR_FOUND THEN "${OPENEXR_LIBRARIES} (ver ${OPENEXR_VERSION})" ELSE "build (ver ${OPENEXR_VERSION})")
1326 status(" OpenEXR:" "NO")
1330 if(WITH_GDAL OR HAVE_GDAL)
1331 status(" GDAL:" HAVE_GDAL THEN "YES (${GDAL_LIBRARY})" ELSE "NO")
1334 if(WITH_GDCM OR HAVE_GDCM)
1335 status(" GDCM:" HAVE_GDCM THEN "YES (${GDCM_VERSION})" ELSE "NO")
1338 if(WITH_IMGCODEC_HDR OR DEFINED HAVE_IMGCODEC_HDR)
1339 status(" HDR:" HAVE_IMGCODEC_HDR THEN "YES" ELSE "NO")
1342 if(WITH_IMGCODEC_SUNRASTER OR DEFINED HAVE_IMGCODEC_SUNRASTER)
1343 status(" SUNRASTER:" HAVE_IMGCODEC_SUNRASTER THEN "YES" ELSE "NO")
1346 if(WITH_IMGCODEC_PXM OR DEFINED HAVE_IMGCODEC_PXM)
1347 status(" PXM:" HAVE_IMGCODEC_PXM THEN "YES" ELSE "NO")
1350 if(WITH_IMGCODEC_PFM OR DEFINED HAVE_IMGCODEC_PFM)
1351 status(" PFM:" HAVE_IMGCODEC_PFM THEN "YES" ELSE "NO")
1354 # ========================== VIDEO IO ==========================
1356 status(" Video I/O:")
1358 if(WITH_1394 OR HAVE_DC1394_2)
1359 status(" DC1394:" HAVE_DC1394_2 THEN "YES (${DC1394_2_VERSION})" ELSE NO)
1362 if(WITH_FFMPEG OR HAVE_FFMPEG)
1363 if(OPENCV_FFMPEG_USE_FIND_PACKAGE)
1364 status(" FFMPEG:" HAVE_FFMPEG THEN "YES (find_package)" ELSE "NO (find_package)")
1366 status(" FFMPEG:" HAVE_FFMPEG THEN "YES (prebuilt binaries)" ELSE NO)
1368 status(" FFMPEG:" HAVE_FFMPEG THEN YES ELSE NO)
1370 status(" avcodec:" FFMPEG_libavcodec_VERSION THEN "YES (${FFMPEG_libavcodec_VERSION})" ELSE NO)
1371 status(" avformat:" FFMPEG_libavformat_VERSION THEN "YES (${FFMPEG_libavformat_VERSION})" ELSE NO)
1372 status(" avutil:" FFMPEG_libavutil_VERSION THEN "YES (${FFMPEG_libavutil_VERSION})" ELSE NO)
1373 status(" swscale:" FFMPEG_libswscale_VERSION THEN "YES (${FFMPEG_libswscale_VERSION})" ELSE NO)
1374 status(" avresample:" FFMPEG_libavresample_VERSION THEN "YES (${FFMPEG_libavresample_VERSION})" ELSE NO)
1377 if(WITH_GSTREAMER OR HAVE_GSTREAMER)
1378 status(" GStreamer:" HAVE_GSTREAMER THEN "YES (${GSTREAMER_VERSION})" ELSE NO)
1381 if(WITH_OPENNI2 OR HAVE_OPENNI2)
1382 status(" OpenNI2:" HAVE_OPENNI2 THEN "YES (${OPENNI2_VERSION})" ELSE NO)
1385 if(WITH_PVAPI OR HAVE_PVAPI)
1386 status(" PvAPI:" HAVE_PVAPI THEN YES ELSE NO)
1389 if(WITH_ARAVIS OR HAVE_ARAVIS_API)
1390 status(" Aravis SDK:" HAVE_ARAVIS_API THEN "YES (${ARAVIS_VERSION})" ELSE NO)
1393 if(WITH_AVFOUNDATION OR HAVE_AVFOUNDATION)
1394 status(" AVFoundation:" HAVE_AVFOUNDATION THEN YES ELSE NO)
1398 status(" iOS capture:" YES)
1401 if(WITH_V4L OR HAVE_V4L)
1402 ocv_build_features_string(v4l_status
1403 IF HAVE_CAMV4L2 THEN "linux/videodev2.h"
1404 IF HAVE_VIDEOIO THEN "sys/videoio.h"
1406 status(" v4l/v4l2:" HAVE_V4L THEN "YES (${v4l_status})" ELSE NO)
1409 if(WITH_DSHOW OR HAVE_DSHOW)
1410 status(" DirectShow:" HAVE_DSHOW THEN YES ELSE NO)
1413 if(WITH_MSMF OR HAVE_MSMF)
1414 status(" Media Foundation:" HAVE_MSMF THEN YES ELSE NO)
1415 status(" DXVA:" HAVE_MSMF_DXVA THEN YES ELSE NO)
1418 if(WITH_XIMEA OR HAVE_XIMEA)
1419 status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO)
1422 if(WITH_UEYE OR HAVE_UEYE)
1423 status(" uEye:" HAVE_UEYE THEN YES ELSE NO)
1426 if(WITH_XINE OR HAVE_XINE)
1427 status(" Xine:" HAVE_XINE THEN "YES (ver ${XINE_VERSION})" ELSE NO)
1430 if(WITH_LIBREALSENSE OR HAVE_LIBREALSENSE)
1431 status(" Intel RealSense:" HAVE_LIBREALSENSE THEN "YES (${LIBREALSENSE_VERSION})" ELSE NO)
1434 if(WITH_MFX OR HAVE_MFX)
1437 set(__details " (${MFX_LIBRARY})")
1438 elseif(MFX_LIBRARIES)
1439 set(__details " (${MFX_LIBRARIES})")
1441 set(__details " (unknown)")
1444 status(" Intel Media SDK:" HAVE_MFX THEN "YES${__details}" ELSE NO)
1447 if(WITH_GPHOTO2 OR HAVE_GPHOTO2)
1448 status(" gPhoto2:" HAVE_GPHOTO2 THEN "YES" ELSE NO)
1451 # Order is similar to CV_PARALLEL_FRAMEWORK in core/src/parallel.cpp
1452 ocv_build_features_string(parallel_status EXCLUSIVE
1453 IF HAVE_TBB THEN "TBB (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})"
1454 IF HAVE_HPX THEN "HPX"
1455 IF HAVE_OPENMP THEN "OpenMP"
1456 IF HAVE_GCD THEN "GCD"
1457 IF WINRT OR HAVE_CONCURRENCY THEN "Concurrency"
1458 IF HAVE_PTHREADS_PF THEN "pthreads"
1461 status(" Parallel framework:" "${parallel_status}")
1463 if(CV_TRACE OR OPENCV_TRACE)
1464 ocv_build_features_string(trace_status EXCLUSIVE
1465 IF HAVE_ITT THEN "with Intel ITT"
1468 status(" Trace: " OPENCV_TRACE THEN "YES (${trace_status})" ELSE NO)
1471 # ========================== Other third-party libraries ==========================
1473 status(" Other third-party libraries:")
1475 if(WITH_IPP AND HAVE_IPP)
1476 status(" Intel IPP:" "${IPP_VERSION_STR} [${IPP_VERSION_MAJOR}.${IPP_VERSION_MINOR}.${IPP_VERSION_BUILD}]")
1477 status(" at:" "${IPP_ROOT_DIR}")
1478 if(NOT HAVE_IPP_ICV)
1479 status(" linked:" BUILD_WITH_DYNAMIC_IPP THEN "dynamic" ELSE "static")
1483 status(" Intel IPP IW:" "sources (${IW_VERSION_MAJOR}.${IW_VERSION_MINOR}.${IW_VERSION_UPDATE})")
1485 status(" Intel IPP IW:" "binaries (${IW_VERSION_MAJOR}.${IW_VERSION_MINOR}.${IW_VERSION_UPDATE})")
1487 status(" at:" "${IPP_IW_PATH}")
1489 status(" Intel IPP IW:" NO)
1493 if(WITH_VA OR HAVE_VA)
1494 status(" VA:" HAVE_VA THEN "YES" ELSE NO)
1497 if(WITH_TENGINE OR HAVE_TENGINE)
1498 status(" Tengine:" HAVE_TENGINE THEN "YES (${TENGINE_LIBRARIES})" ELSE NO)
1501 if(WITH_LAPACK OR HAVE_LAPACK)
1502 status(" Lapack:" HAVE_LAPACK THEN "YES (${LAPACK_LIBRARIES})" ELSE NO)
1505 if(WITH_HALIDE OR HAVE_HALIDE)
1506 status(" Halide:" HAVE_HALIDE THEN "YES (${HALIDE_LIBRARIES} ${HALIDE_INCLUDE_DIRS})" ELSE NO)
1509 if(WITH_INF_ENGINE OR INF_ENGINE_TARGET)
1510 if(INF_ENGINE_TARGET)
1511 list(GET INF_ENGINE_TARGET 0 ie_target)
1512 set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})")
1513 get_target_property(_lib ${ie_target} IMPORTED_LOCATION)
1514 get_target_property(_lib_imp_rel ${ie_target} IMPORTED_IMPLIB_RELEASE)
1515 get_target_property(_lib_imp_dbg ${ie_target} IMPORTED_IMPLIB_DEBUG)
1516 get_target_property(_lib_rel ${ie_target} IMPORTED_LOCATION_RELEASE)
1517 get_target_property(_lib_dbg ${ie_target} IMPORTED_LOCATION_DEBUG)
1518 ocv_build_features_string(_lib
1519 IF _lib THEN "${_lib}"
1520 IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
1521 IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
1522 IF _lib_rel THEN "${_lib_rel}"
1523 IF _lib_dbg THEN "${_lib_dbg}"
1526 get_target_property(_inc ${ie_target} INTERFACE_INCLUDE_DIRECTORIES)
1527 status(" Inference Engine:" "${__msg}")
1528 status(" * libs:" "${_lib}")
1529 status(" * includes:" "${_inc}")
1531 status(" Inference Engine:" "NO")
1534 if(WITH_NGRAPH OR HAVE_NGRAPH)
1536 set(__target ngraph::ngraph)
1537 set(__msg "YES (${ngraph_VERSION})")
1538 get_target_property(_lib ${__target} IMPORTED_LOCATION)
1539 get_target_property(_lib_imp_rel ${__target} IMPORTED_IMPLIB_RELEASE)
1540 get_target_property(_lib_imp_dbg ${__target} IMPORTED_IMPLIB_DEBUG)
1541 get_target_property(_lib_rel ${__target} IMPORTED_LOCATION_RELEASE)
1542 get_target_property(_lib_dbg ${__target} IMPORTED_LOCATION_DEBUG)
1543 ocv_build_features_string(_lib
1544 IF _lib THEN "${_lib}"
1545 IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
1546 IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
1547 IF _lib_rel THEN "${_lib_rel}"
1548 IF _lib_dbg THEN "${_lib_dbg}"
1551 get_target_property(_inc ${__target} INTERFACE_INCLUDE_DIRECTORIES)
1552 status(" nGraph:" "${__msg}")
1553 status(" * libs:" "${_lib}")
1554 status(" * includes:" "${_inc}")
1556 status(" nGraph:" "NO")
1560 if(WITH_EIGEN OR HAVE_EIGEN)
1561 status(" Eigen:" HAVE_EIGEN THEN "YES (ver ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})" ELSE NO)
1564 if(WITH_OPENVX OR HAVE_OPENVX)
1565 status(" OpenVX:" HAVE_OPENVX THEN "YES (${OPENVX_LIBRARIES})" ELSE "NO")
1568 status(" Custom HAL:" OpenCV_USED_HAL THEN "YES (${OpenCV_USED_HAL})" ELSE "NO")
1570 foreach(s ${CUSTOM_STATUS})
1571 status(${CUSTOM_STATUS_${s}})
1574 if(WITH_CUDA OR HAVE_CUDA)
1575 ocv_build_features_string(cuda_features
1576 IF HAVE_CUFFT THEN "CUFFT"
1577 IF HAVE_CUBLAS THEN "CUBLAS"
1578 IF HAVE_NVCUVID THEN "NVCUVID"
1579 IF CUDA_FAST_MATH THEN "FAST_MATH"
1580 ELSE "no extra features")
1582 status(" NVIDIA CUDA:" HAVE_CUDA THEN "YES (ver ${CUDA_VERSION_STRING}, ${cuda_features})" ELSE NO)
1584 status(" NVIDIA GPU arch:" ${OPENCV_CUDA_ARCH_BIN})
1585 status(" NVIDIA PTX archs:" ${OPENCV_CUDA_ARCH_PTX})
1589 if(WITH_CUDNN OR HAVE_CUDNN)
1591 status(" cuDNN:" HAVE_CUDNN THEN "YES (ver ${CUDNN_VERSION})" ELSE NO)
1594 if(WITH_VULKAN OR HAVE_VULKAN)
1596 status(" Vulkan:" HAVE_VULKAN THEN "YES" ELSE "NO")
1598 status(" Include path:" VULKAN_INCLUDE_DIRS THEN "${VULKAN_INCLUDE_DIRS}" ELSE "NO")
1599 status(" Link libraries:" VULKAN_LIBRARIES THEN "${VULKAN_LIBRARIES}" ELSE "Dynamic load")
1603 if(WITH_OPENCL OR HAVE_OPENCL)
1604 ocv_build_features_string(opencl_features
1605 IF HAVE_OPENCL_SVM THEN "SVM"
1606 IF HAVE_CLAMDFFT THEN "AMDFFT"
1607 IF HAVE_CLAMDBLAS THEN "AMDBLAS"
1608 IF HAVE_OPENCL_D3D11_NV THEN "NVD3D11"
1609 IF HAVE_VA_INTEL THEN "INTELVA"
1610 ELSE "no extra features")
1612 status(" OpenCL:" HAVE_OPENCL THEN "YES (${opencl_features})" ELSE "NO")
1614 status(" Include path:" OPENCL_INCLUDE_DIRS THEN "${OPENCL_INCLUDE_DIRS}" ELSE "NO")
1615 status(" Link libraries:" OPENCL_LIBRARIES THEN "${OPENCL_LIBRARIES}" ELSE "Dynamic load")
1619 if(WITH_ONNX OR HAVE_ONNX)
1621 status(" ONNX:" HAVE_ONNX THEN "YES" ELSE "NO")
1623 status(" Include path:" ONNX_INCLUDE_DIR THEN "${ONNX_INCLUDE_DIR}" ELSE "NO")
1624 status(" Link libraries:" ONNX_LIBRARIES THEN "${ONNX_LIBRARIES}" ELSE "NO")
1628 # ========================== python ==========================
1629 if(BUILD_opencv_python2)
1631 status(" Python 2:")
1632 status(" Interpreter:" PYTHON2INTERP_FOUND THEN "${PYTHON2_EXECUTABLE} (ver ${PYTHON2_VERSION_STRING})" ELSE NO)
1633 if(PYTHON2LIBS_VERSION_STRING)
1634 status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES} (ver ${PYTHON2LIBS_VERSION_STRING})" ELSE NO)
1636 status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES}" ELSE NO)
1638 status(" numpy:" PYTHON2_NUMPY_INCLUDE_DIRS THEN "${PYTHON2_NUMPY_INCLUDE_DIRS} (ver ${PYTHON2_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
1639 status(" install path:" HAVE_opencv_python2 THEN "${__INSTALL_PATH_PYTHON2}" ELSE "-")
1642 if(BUILD_opencv_python3)
1644 status(" Python 3:")
1645 status(" Interpreter:" PYTHON3INTERP_FOUND THEN "${PYTHON3_EXECUTABLE} (ver ${PYTHON3_VERSION_STRING})" ELSE NO)
1646 if(PYTHON3LIBS_VERSION_STRING)
1647 status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES} (ver ${PYTHON3LIBS_VERSION_STRING})" ELSE NO)
1649 status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES}" ELSE NO)
1651 status(" numpy:" PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
1652 status(" install path:" HAVE_opencv_python3 THEN "${__INSTALL_PATH_PYTHON3}" ELSE "-")
1656 status(" Python (for build):" PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE NO)
1658 # ========================== java ==========================
1661 status(" Java:" BUILD_FAT_JAVA_LIB THEN "export all functions" ELSE "")
1662 status(" ant:" ANT_EXECUTABLE THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})" ELSE NO)
1664 status(" JNI:" JNI_INCLUDE_DIRS THEN "${JNI_INCLUDE_DIRS}" ELSE NO)
1666 status(" Java wrappers:" HAVE_opencv_java THEN YES ELSE NO)
1667 status(" Java tests:" BUILD_TESTS AND opencv_test_java_BINARY_DIR THEN YES ELSE NO)
1670 # ========================== Objective-C =======================
1673 status(" Objective-C wrappers:" HAVE_opencv_objc THEN YES ELSE NO)
1676 ocv_cmake_hook(STATUS_DUMP_EXTRA)
1678 # ========================== auxiliary ==========================
1680 status(" Install to:" "${CMAKE_INSTALL_PREFIX}")
1681 status("-----------------------------------------------------------------")
1685 ocv_finalize_status()
1687 if(ENABLE_CONFIG_VERIFICATION)
1691 if(HAVE_CUDA AND COMMAND CUDA_BUILD_CLEAN_TARGET)
1692 CUDA_BUILD_CLEAN_TARGET()
1695 ocv_cmake_hook(POST_FINALIZE)
1697 # ----------------------------------------------------------------------------
1699 # ----------------------------------------------------------------------------
1701 include(cmake/OpenCVPackaging.cmake)
1703 # This should be the last command
1704 ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
1705 ocv_cmake_eval(DEBUG_POST ONCE)