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_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3)
21 cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
22 elseif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
23 cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
24 #Required to resolve linker error issues due to incompatibility with CMake v3.0+ policies.
25 #CMake fails to find _fseeko() which leads to subsequent linker error.
26 #See details here: http://www.cmake.org/Wiki/CMake/Policies
27 cmake_policy(VERSION 2.8)
29 cmake_minimum_required(VERSION "${MIN_VER_CMAKE}" FATAL_ERROR)
32 option(ENABLE_PIC "Generate position independent code (necessary for shared libraries)" TRUE)
33 set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_PIC})
35 # Following block can break build in case of cross-compiling
36 # but CMAKE_CROSSCOMPILING variable will be set only on project(OpenCV) command
37 # so we will try to detect cross-compiling by the presence of CMAKE_TOOLCHAIN_FILE
38 if(NOT DEFINED CMAKE_INSTALL_PREFIX)
39 if(NOT CMAKE_TOOLCHAIN_FILE)
40 # it _must_ go before project(OpenCV) in order to work
42 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
44 set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory")
47 #Android: set output folder to ${CMAKE_BINARY_DIR}
48 set(LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH "root for library output, set this to change where android libs are compiled to" )
50 set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory")
54 if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
59 add_definitions(-DWINRT -DNO_GETENV)
61 # Making definitions available to other configurations and
62 # to filter dependency restrictions at compile time.
63 if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone)
65 add_definitions(-DWINRT_PHONE)
66 elseif(CMAKE_SYSTEM_NAME MATCHES WindowsStore)
68 add_definitions(-DWINRT_STORE)
71 if(CMAKE_SYSTEM_VERSION MATCHES 10)
73 add_definitions(-DWINRT_10)
74 elseif(CMAKE_SYSTEM_VERSION MATCHES 8.1)
76 add_definitions(-DWINRT_8_1)
77 elseif(CMAKE_SYSTEM_VERSION MATCHES 8.0)
79 add_definitions(-DWINRT_8_0)
84 cmake_policy(SET CMP0026 NEW)
88 cmake_policy(SET CMP0042 NEW)
92 cmake_policy(SET CMP0046 NEW)
96 cmake_policy(SET CMP0051 NEW)
99 if(POLICY CMP0054) # CMake 3.1: Only interpret if() arguments as variables or keywords when unquoted.
100 cmake_policy(SET CMP0054 NEW)
104 cmake_policy(SET CMP0056 NEW)
108 cmake_policy(SET CMP0067 NEW)
111 include(cmake/OpenCVUtils.cmake)
112 ocv_cmake_reset_hooks()
113 ocv_check_environment_variables(OPENCV_CMAKE_HOOKS_DIR)
114 if(DEFINED OPENCV_CMAKE_HOOKS_DIR)
115 foreach(__dir ${OPENCV_CMAKE_HOOKS_DIR})
116 get_filename_component(__dir "${__dir}" ABSOLUTE)
117 ocv_cmake_hook_register_dir(${__dir})
121 ocv_cmake_hook(CMAKE_INIT)
123 # must go before the project command
124 ocv_update(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
125 if(DEFINED CMAKE_BUILD_TYPE)
126 set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
131 project(OpenCV CXX C)
134 set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
137 ocv_cmake_eval(DEBUG_PRE ONCE)
139 ocv_clear_vars(OpenCVModules_TARGETS)
141 include(cmake/OpenCVDownload.cmake)
143 set(BUILD_LIST "" CACHE STRING "Build only listed modules (comma-separated, e.g. 'videoio,dnn,ts')")
145 # ----------------------------------------------------------------------------
146 # Break in case of popular CMake configuration mistakes
147 # ----------------------------------------------------------------------------
148 if(NOT CMAKE_SIZEOF_VOID_P GREATER 0)
149 message(FATAL_ERROR "CMake fails to determine the bitness of the target platform.
150 Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.")
153 # ----------------------------------------------------------------------------
154 # Detect compiler and target platform architecture
155 # ----------------------------------------------------------------------------
156 include(cmake/OpenCVDetectCXXCompiler.cmake)
157 ocv_cmake_hook(POST_DETECT_COMPILER)
159 # Add these standard paths to the search paths for FIND_LIBRARY
160 # to find libraries from these locations first
161 if(UNIX AND NOT ANDROID)
162 if(X86_64 OR CMAKE_SIZEOF_VOID_P EQUAL 8)
164 list(APPEND CMAKE_LIBRARY_PATH /lib64)
166 list(APPEND CMAKE_LIBRARY_PATH /lib)
168 if(EXISTS /usr/lib64)
169 list(APPEND CMAKE_LIBRARY_PATH /usr/lib64)
171 list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
173 elseif(X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
175 list(APPEND CMAKE_LIBRARY_PATH /lib32)
177 list(APPEND CMAKE_LIBRARY_PATH /lib)
179 if(EXISTS /usr/lib32)
180 list(APPEND CMAKE_LIBRARY_PATH /usr/lib32)
182 list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
187 # Add these standard paths to the search paths for FIND_PATH
188 # to find include files from these locations first
191 list(APPEND CMAKE_INCLUDE_PATH /mingw)
194 list(APPEND CMAKE_INCLUDE_PATH /mingw32)
197 list(APPEND CMAKE_INCLUDE_PATH /mingw64)
201 # ----------------------------------------------------------------------------
202 # OpenCV cmake options
203 # ----------------------------------------------------------------------------
205 OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF)
208 OCV_OPTION(OPENCV_FORCE_3RDPARTY_BUILD "Force using 3rdparty code from source" OFF)
209 OCV_OPTION(BUILD_ZLIB "Build zlib from source" (WIN32 OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
210 OCV_OPTION(BUILD_TIFF "Build libtiff from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
211 OCV_OPTION(BUILD_JASPER "Build libjasper from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
212 OCV_OPTION(BUILD_JPEG "Build libjpeg from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
213 OCV_OPTION(BUILD_PNG "Build libpng from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
214 OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
215 OCV_OPTION(BUILD_WEBP "Build WebP from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
216 OCV_OPTION(BUILD_TBB "Download and build TBB from source" (ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
217 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 )
218 OCV_OPTION(BUILD_ITT "Build Intel ITT from source" (NOT MINGW OR OPENCV_FORCE_3RDPARTY_BUILD) IF (X86_64 OR X86) AND NOT WINRT AND NOT APPLE_FRAMEWORK )
220 # Optional 3rd party components
221 # ===================================================
222 OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON
223 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
224 VERIFY HAVE_DC1394_2)
225 OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON
227 VERIFY HAVE_AVFOUNDATION)
228 OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
231 OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" ON
232 VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT (CMAKE_VERSION VERSION_LESS "2.8.11"))
233 OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON
235 VERIFY HAVE_CPUFEATURES)
236 OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON
237 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT CMAKE_CROSSCOMPILING
239 OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" OFF
240 VISIBLE_IF NOT IOS AND NOT WINRT
242 OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" WITH_CUDA
245 OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" WITH_CUDA
248 OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" WITH_CUDA
251 OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" (NOT CV_DISABLE_OPTIMIZATION)
252 VISIBLE_IF NOT WINRT AND NOT CMAKE_CROSSCOMPILING
254 OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" (NOT ANDROID)
255 VISIBLE_IF NOT IOS AND NOT WINRT
257 OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON
258 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
259 VERIFY HAVE_GSTREAMER AND GSTREAMER_VERSION VERSION_GREATER "0.99")
260 OCV_OPTION(WITH_GTK "Include GTK support" ON
261 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
263 OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF
264 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
265 VERIFY HAVE_GTK AND NOT HAVE_GTK3)
266 OCV_OPTION(WITH_IPP "Include Intel IPP support" (NOT MINGW AND NOT CV_DISABLE_OPTIMIZATION)
267 VISIBLE_IF (X86_64 OR X86) AND NOT WINRT AND NOT IOS
269 OCV_OPTION(WITH_HALIDE "Include Halide support" OFF
272 OCV_OPTION(WITH_VULKAN "Include Vulkan support" OFF
275 OCV_OPTION(WITH_INF_ENGINE "Include Intel Inference Engine support" OFF
277 VERIFY INF_ENGINE_TARGET)
278 OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON
281 OCV_OPTION(WITH_JPEG "Include JPEG support" ON
284 OCV_OPTION(WITH_WEBP "Include WebP support" ON
287 OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON
288 VISIBLE_IF NOT IOS AND NOT WINRT
290 OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF
291 VISIBLE_IF NOT ANDROID AND NOT WINRT
293 OCV_OPTION(WITH_OPENVX "Include OpenVX support" OFF
296 OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF
297 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
299 OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF
300 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
302 OCV_OPTION(WITH_PNG "Include PNG support" ON
305 OCV_OPTION(WITH_GDCM "Include DICOM support" OFF
308 OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" OFF
309 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
311 OCV_OPTION(WITH_ARAVIS "Include Aravis GigE support" OFF
312 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT WIN32
313 VERIFY HAVE_ARAVIS_API)
314 OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF
315 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
317 OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON
318 VISIBLE_IF WIN32 AND NOT WINRT
320 OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF
321 VISIBLE_IF NOT IOS AND NOT WINRT
323 OCV_OPTION(WITH_HPX "Include Ste||ar Group HPX support" OFF
326 OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF
329 OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON
330 VISIBLE_IF NOT WIN32 OR MINGW
331 VERIFY HAVE_PTHREADS_PF)
332 OCV_OPTION(WITH_TIFF "Include TIFF support" ON
335 OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON
336 VISIBLE_IF UNIX AND NOT ANDROID AND NOT APPLE
337 VERIFY HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
338 OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON
339 VISIBLE_IF WIN32 AND NOT ARM AND NOT WINRT
341 OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" NOT MINGW
344 OCV_OPTION(WITH_MSMF_DXVA "Enable hardware acceleration in Media Foundation backend" WITH_MSMF
346 VERIFY HAVE_MSMF_DXVA)
347 OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF
348 VISIBLE_IF NOT ANDROID AND NOT WINRT
350 OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF
351 VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
353 OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF
356 OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" (NOT ANDROID AND NOT CV_DISABLE_OPTIMIZATION)
357 VISIBLE_IF NOT IOS AND NOT WINRT
359 OCV_OPTION(WITH_OPENCL_SVM "Include OpenCL Shared Virtual Memory support" OFF
361 VERIFY HAVE_OPENCL_SVM) # experimental
362 OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON
363 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
364 VERIFY HAVE_CLAMDFFT)
365 OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON
366 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
367 VERIFY HAVE_CLAMDBLAS)
368 OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON
369 VISIBLE_IF WIN32 AND NOT WINRT
371 OCV_OPTION(WITH_LIBREALSENSE "Include Intel librealsense support" OFF
372 VISIBLE_IF NOT WITH_INTELPERC
373 VERIFY HAVE_LIBREALSENSE)
374 OCV_OPTION(WITH_VA "Include VA support" OFF
375 VISIBLE_IF UNIX AND NOT ANDROID
377 OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" OFF
378 VISIBLE_IF UNIX AND NOT ANDROID
379 VERIFY HAVE_VA_INTEL)
380 OCV_OPTION(WITH_MFX "Include Intel Media SDK support" OFF
381 VISIBLE_IF (UNIX AND NOT ANDROID) OR (WIN32 AND NOT WINRT AND NOT MINGW)
383 OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF
384 VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
386 OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" OFF
387 VISIBLE_IF UNIX AND NOT ANDROID AND NOT IOS
389 OCV_OPTION(WITH_LAPACK "Include Lapack library support" (NOT CV_DISABLE_OPTIMIZATION)
390 VISIBLE_IF NOT ANDROID AND NOT IOS
392 OCV_OPTION(WITH_ITT "Include Intel ITT support" ON
393 VISIBLE_IF NOT APPLE_FRAMEWORK
395 OCV_OPTION(WITH_PROTOBUF "Enable libprotobuf" ON
397 VERIFY HAVE_PROTOBUF)
398 OCV_OPTION(WITH_IMGCODEC_HDR "Include HDR support" ON
400 VERIFY HAVE_IMGCODEC_HDR)
401 OCV_OPTION(WITH_IMGCODEC_SUNRASTER "Include SUNRASTER support" ON
403 VERIFY HAVE_IMGCODEC_SUNRASTER)
404 OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support" ON
406 VERIFY HAVE_IMGCODEC_PXM)
407 OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON
409 VERIFY HAVE_IMGCODEC_PFM)
410 OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON
414 # OpenCV build components
415 # ===================================================
416 OCV_OPTION(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" NOT (ANDROID OR APPLE_FRAMEWORK) )
417 OCV_OPTION(BUILD_opencv_apps "Build utility applications (used for example to train classifiers)" (NOT ANDROID AND NOT WINRT) IF (NOT APPLE_FRAMEWORK) )
418 OCV_OPTION(BUILD_opencv_js "Build JavaScript bindings by Emscripten" OFF )
419 OCV_OPTION(BUILD_ANDROID_PROJECTS "Build Android projects providing .apk files" ON IF ANDROID )
420 OCV_OPTION(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" ON IF ANDROID )
421 OCV_OPTION(BUILD_DOCS "Create build rules for OpenCV Documentation" OFF IF (NOT WINRT AND NOT APPLE_FRAMEWORK))
422 OCV_OPTION(BUILD_EXAMPLES "Build all examples" OFF )
423 OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" ON IF NOT WINRT)
424 OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" NOT INSTALL_CREATE_DISTRIB IF (NOT APPLE_FRAMEWORK) )
425 OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" NOT INSTALL_CREATE_DISTRIB IF (NOT APPLE_FRAMEWORK) )
426 OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into release binaries ('OFF' means default settings)" OFF )
427 OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of statically linked CRT for statically linked OpenCV" ON IF MSVC )
428 OCV_OPTION(BUILD_WITH_DYNAMIC_IPP "Enables dynamic linking of IPP (only for standalone IPP)" OFF )
429 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)
430 OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
431 OCV_OPTION(BUILD_CUDA_STUBS "Build CUDA modules stubs when no CUDA SDK" OFF IF (NOT APPLE_FRAMEWORK) )
432 OCV_OPTION(BUILD_JAVA "Enable Java support" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
434 # OpenCV installation options
435 # ===================================================
436 OCV_OPTION(INSTALL_CREATE_DISTRIB "Change install rules to build the distribution package" OFF )
437 OCV_OPTION(INSTALL_C_EXAMPLES "Install C examples" OFF )
438 OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
439 OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )
440 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) )
441 OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binaries and test data" OFF)
443 # OpenCV build options
444 # ===================================================
445 OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND NOT IOS AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja")) )
446 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (MSVC OR (NOT IOS AND NOT CMAKE_CROSSCOMPILING) ) )
447 OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) )
448 OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CV_GCC )
449 OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CV_GCC )
450 OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CV_GCC )
451 OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
452 OCV_OPTION(ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF (CV_GCC AND (X86 OR X86_64)) )
453 if(NOT IOS AND (NOT ANDROID OR OPENCV_ANDROID_USE_LEGACY_FLAGS)) # Use CPU_BASELINE instead
454 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) )
455 OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
457 OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF )
458 OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF )
459 OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID )
460 OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF )
461 OCV_OPTION(ENABLE_INSTRUMENTATION "Instrument functions to collect calls trace and performance" OFF )
462 OCV_OPTION(ENABLE_GNU_STL_DEBUG "Enable GNU STL Debug mode (defines _GLIBCXX_DEBUG)" OFF IF ((NOT CMAKE_VERSION VERSION_LESS "2.8.11") AND CV_GCC) )
463 OCV_OPTION(ENABLE_BUILD_HARDENING "Enable hardening of the resulting binaries (against security attacks, detects memory corruption, etc)" OFF)
464 OCV_OPTION(ENABLE_LTO "Enable Link Time Optimization" OFF IF CV_GCC OR MSVC)
465 OCV_OPTION(ENABLE_THIN_LTO "Enable Thin LTO" OFF IF CV_CLANG)
466 OCV_OPTION(GENERATE_ABI_DESCRIPTOR "Generate XML file for abi_compliance_checker tool" OFF IF UNIX)
467 OCV_OPTION(OPENCV_GENERATE_PKGCONFIG "Generate .pc file for pkg-config build tool (deprecated)" OFF)
468 OCV_OPTION(CV_ENABLE_INTRINSICS "Use intrinsic-based optimized code" ON )
469 OCV_OPTION(CV_DISABLE_OPTIMIZATION "Disable explicit optimized code (dispatched code/intrinsics/loop unrolling/etc)" OFF )
470 OCV_OPTION(CV_TRACE "Enable OpenCV code trace" ON)
471 OCV_OPTION(OPENCV_GENERATE_SETUPVARS "Generate setup_vars* scripts" ON IF (NOT ANDROID AND NOT APPLE_FRAMEWORK) )
472 OCV_OPTION(ENABLE_CONFIG_VERIFICATION "Fail build if actual configuration doesn't match requested (WITH_XXX != HAVE_XXX)" OFF)
474 OCV_OPTION(ENABLE_PYLINT "Add target with Pylint checks" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
475 OCV_OPTION(ENABLE_FLAKE8 "Add target with Python flake8 checker" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
477 if(ENABLE_IMPL_COLLECTION)
478 add_definitions(-DCV_COLLECT_IMPL_DATA)
482 # ----------------------------------------------------------------------------
483 # Get actual OpenCV version number from sources
484 # ----------------------------------------------------------------------------
485 include(cmake/OpenCVVersion.cmake)
487 ocv_cmake_hook(POST_OPTIONS)
489 # ----------------------------------------------------------------------------
490 # Build & install layouts
491 # ----------------------------------------------------------------------------
493 # Save libs and executables in the same place
494 set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications")
497 if(ANDROID_ABI MATCHES "NEON")
500 if(ANDROID_ABI MATCHES "VFPV3")
506 ocv_update(OPENCV_DOC_INSTALL_PATH doc)
509 if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
510 if(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH)
511 ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/")
513 message(STATUS "Can't detect runtime and/or arch")
514 ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "")
517 ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "sdk/native/")
519 ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "")
523 ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples/${ANDROID_NDK_ABI_NAME}")
525 ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples")
529 ocv_update(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin/${ANDROID_NDK_ABI_NAME}")
531 ocv_update(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin")
534 if(NOT OPENCV_TEST_INSTALL_PATH)
535 ocv_update(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
538 if (OPENCV_TEST_DATA_PATH)
539 get_filename_component(OPENCV_TEST_DATA_PATH ${OPENCV_TEST_DATA_PATH} ABSOLUTE)
543 ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "sdk/etc/testdata")
545 ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "testdata")
549 set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
550 ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}")
551 ocv_update(OPENCV_LIB_INSTALL_PATH sdk/native/libs/${ANDROID_NDK_ABI_NAME})
552 ocv_update(OPENCV_LIB_ARCHIVE_INSTALL_PATH sdk/native/staticlibs/${ANDROID_NDK_ABI_NAME})
553 ocv_update(OPENCV_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME})
554 ocv_update(OPENCV_CONFIG_INSTALL_PATH sdk/native/jni)
555 ocv_update(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include)
556 ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native)
557 ocv_update(OPENCV_OTHER_INSTALL_PATH sdk/etc)
558 ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
560 set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib")
561 ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
563 if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
565 ocv_update(OPENCV_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}")
567 ocv_update(OPENCV_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}lib${LIB_SUFFIX}")
569 ocv_update(OPENCV_3P_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}")
570 ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH samples)
571 ocv_update(OPENCV_JAR_INSTALL_PATH java)
572 ocv_update(OPENCV_OTHER_INSTALL_PATH etc)
573 ocv_update(OPENCV_CONFIG_INSTALL_PATH ".")
574 ocv_update(OPENCV_INCLUDE_INSTALL_PATH "include")
575 ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
577 # Note: layout differs from OpenCV 3.4
578 include(GNUInstallDirs)
579 ocv_update(OPENCV_INCLUDE_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}/opencv4")
580 ocv_update(OPENCV_LIB_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}")
581 ocv_update(OPENCV_CONFIG_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}/cmake/opencv4")
582 ocv_update(OPENCV_3P_LIB_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}/opencv4/3rdparty")
583 ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4/samples")
584 ocv_update(OPENCV_DOC_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/doc/opencv4")
585 ocv_update(OPENCV_JAR_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/java/opencv4")
586 ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4/testdata")
587 ocv_update(OPENCV_OTHER_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4")
588 ocv_update(OPENCV_LICENSES_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/licenses/opencv4")
590 #ocv_update(OPENCV_PYTHON_INSTALL_PATH "python") # no default value, see https://github.com/opencv/opencv/issues/13202
593 ocv_update(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
594 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
596 if(INSTALL_TO_MANGLED_PATHS)
598 OPENCV_INCLUDE_INSTALL_PATH
599 # file names include version (.so/.dll): OPENCV_LIB_INSTALL_PATH
600 OPENCV_CONFIG_INSTALL_PATH
601 OPENCV_3P_LIB_INSTALL_PATH
602 OPENCV_SAMPLES_SRC_INSTALL_PATH
603 OPENCV_DOC_INSTALL_PATH
604 # JAR file name includes version: OPENCV_JAR_INSTALL_PATH
605 OPENCV_TEST_DATA_INSTALL_PATH
606 OPENCV_OTHER_INSTALL_PATH
608 string(REGEX REPLACE "opencv[0-9]*" "opencv-${OPENCV_VERSION}" ${v} "${${v}}")
613 ocv_update(OPENCV_JNI_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}")
614 elseif(INSTALL_CREATE_DISTRIB)
615 ocv_update(OPENCV_JNI_INSTALL_PATH "${OPENCV_JAR_INSTALL_PATH}/${OpenCV_ARCH}")
617 ocv_update(OPENCV_JNI_INSTALL_PATH "${OPENCV_JAR_INSTALL_PATH}")
619 ocv_update(OPENCV_JNI_BIN_INSTALL_PATH "${OPENCV_JNI_INSTALL_PATH}")
621 if(NOT OPENCV_LIB_ARCHIVE_INSTALL_PATH)
622 set(OPENCV_LIB_ARCHIVE_INSTALL_PATH ${OPENCV_LIB_INSTALL_PATH})
627 set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
628 set(OPENCV_DEBUG_POSTFIX d)
631 set(OPENCV_DLLVERSION "")
632 set(OPENCV_DEBUG_POSTFIX "")
635 if(DEFINED CMAKE_DEBUG_POSTFIX)
636 set(OPENCV_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
639 if((INSTALL_CREATE_DISTRIB AND BUILD_SHARED_LIBS AND NOT DEFINED BUILD_opencv_world) OR APPLE_FRAMEWORK)
640 set(BUILD_opencv_world ON CACHE INTERNAL "")
643 # ----------------------------------------------------------------------------
644 # Path for build/platform -specific headers
645 # ----------------------------------------------------------------------------
646 ocv_update(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
647 ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
649 # ----------------------------------------------------------------------------
650 # Path for additional modules
651 # ----------------------------------------------------------------------------
652 set(OPENCV_EXTRA_MODULES_PATH "" CACHE PATH "Where to look for additional OpenCV modules (can be ;-separated list of paths)")
654 # ----------------------------------------------------------------------------
655 # Autodetect if we are in a GIT repository
656 # ----------------------------------------------------------------------------
657 find_host_package(Git QUIET)
659 if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
660 ocv_git_describe(OPENCV_VCSVERSION "${OpenCV_SOURCE_DIR}")
661 elseif(NOT DEFINED OPENCV_VCSVERSION)
663 set(OPENCV_VCSVERSION "unknown")
667 # ----------------------------------------------------------------------------
668 # OpenCV compiler and linker options
669 # ----------------------------------------------------------------------------
670 # In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release:
671 if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja" AND "${CMAKE_BUILD_TYPE}" STREQUAL "")
672 set(CMAKE_BUILD_TYPE Release)
675 ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)
677 # --- Python Support ---
679 include(cmake/OpenCVDetectPython.cmake)
682 include(cmake/OpenCVCompilerOptions.cmake)
684 ocv_cmake_hook(POST_COMPILER_OPTIONS)
686 # ----------------------------------------------------------------------------
687 # CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
688 # ----------------------------------------------------------------------------
690 if(NOT APPLE_FRAMEWORK OR OPENCV_ENABLE_PKG_CONFIG)
691 if(CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{PKG_CONFIG_LIBDIR}
692 AND NOT OPENCV_ENABLE_PKG_CONFIG
694 if(NOT PkgConfig_FOUND)
695 message(STATUS "OpenCV disables pkg-config to avoid using of host libraries. Consider using PKG_CONFIG_LIBDIR to specify target SYSROOT")
696 elseif(OPENCV_SKIP_PKG_CONFIG_WARNING)
697 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.")
699 elseif(OPENCV_DISABLE_PKG_CONFIG)
701 message(WARNING "OPENCV_DISABLE_PKG_CONFIG flag has no effect")
704 find_package(PkgConfig QUIET)
707 include(CheckFunctionExists)
708 include(CheckIncludeFile)
709 include(CheckSymbolExists)
712 CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD)
714 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m log)
715 elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|DragonFly|OpenBSD|Haiku")
716 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m pthread)
718 # no need to link to system libs with emscripten
720 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
726 CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
727 CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
729 CHECK_SYMBOL_EXISTS(memalign malloc.h HAVE_MEMALIGN)
733 include(cmake/OpenCVPCHSupport.cmake)
734 include(cmake/OpenCVModule.cmake)
736 # ----------------------------------------------------------------------------
737 # Detect endianness of build platform
738 # ----------------------------------------------------------------------------
741 # test_big_endian needs try_compile, which doesn't work for iOS
742 # http://public.kitware.com/Bug/view.php?id=12288
743 set(WORDS_BIGENDIAN 0)
745 include(TestBigEndian)
746 test_big_endian(WORDS_BIGENDIAN)
749 # ----------------------------------------------------------------------------
750 # Detect 3rd-party libraries
751 # ----------------------------------------------------------------------------
753 if(ANDROID AND WITH_CPUFEATURES)
754 add_subdirectory(3rdparty/cpufeatures)
755 set(HAVE_CPUFEATURES 1)
758 include(cmake/OpenCVFindFrameworks.cmake)
760 include(cmake/OpenCVFindLibsGrfmt.cmake)
761 include(cmake/OpenCVFindLibsGUI.cmake)
762 include(cmake/OpenCVFindLibsVideo.cmake)
763 include(cmake/OpenCVFindLibsPerf.cmake)
764 include(cmake/OpenCVFindLAPACK.cmake)
765 include(cmake/OpenCVFindProtobuf.cmake)
767 # ----------------------------------------------------------------------------
768 # Detect other 3rd-party libraries/tools
769 # ----------------------------------------------------------------------------
771 # --- Java Support ---
774 include(cmake/android/OpenCVDetectAndroidSDK.cmake)
776 include(cmake/OpenCVDetectApacheAnt.cmake)
781 if(ENABLE_PYLINT AND PYTHON_DEFAULT_AVAILABLE)
782 include(cmake/OpenCVPylint.cmake)
784 if(ENABLE_FLAKE8 AND PYTHON_DEFAULT_AVAILABLE)
785 find_package(Flake8 QUIET)
786 if(NOT FLAKE8_FOUND OR NOT FLAKE8_EXECUTABLE)
787 include("${CMAKE_CURRENT_LIST_DIR}/cmake/FindFlake8.cmake")
790 add_custom_target(check_flake8
791 COMMAND "${FLAKE8_EXECUTABLE}" . --count --select=E9,E901,E999,F821,F822,F823 --show-source --statistics --exclude='.git,__pycache__,*.config.py,svgfig.py'
792 WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
793 COMMENT "Running flake8"
799 if(ANDROID AND ANDROID_EXECUTABLE AND ANT_EXECUTABLE AND (ANT_VERSION VERSION_GREATER 1.7) AND (ANDROID_TOOLS_Pkg_Revision GREATER 13))
800 SET(CAN_BUILD_ANDROID_PROJECTS TRUE)
802 SET(CAN_BUILD_ANDROID_PROJECTS FALSE)
807 include(cmake/OpenCVDetectOpenCL.cmake)
812 include(cmake/OpenCVDetectHalide.cmake)
817 include(cmake/OpenCVDetectVulkan.cmake)
820 # --- Inference Engine ---
822 include(cmake/OpenCVDetectInferenceEngine.cmake)
827 include(cmake/OpenCVDetectDirectX.cmake)
831 include(cmake/OpenCVDetectVTK.cmake)
835 include(cmake/FindOpenVX.cmake)
839 add_subdirectory(3rdparty/quirc)
842 # ----------------------------------------------------------------------------
844 # ----------------------------------------------------------------------------
845 set(_hal_includes "")
846 macro(ocv_hal_register HAL_LIBRARIES_VAR HAL_HEADERS_VAR HAL_INCLUDE_DIRS_VAR)
848 foreach (l ${${HAL_LIBRARIES_VAR}})
850 get_filename_component(l "${l}" ABSOLUTE)
852 list(APPEND OPENCV_HAL_LINKER_LIBS ${l})
855 foreach (h ${${HAL_HEADERS_VAR}})
856 set(_hal_includes "${_hal_includes}\n#include \"${h}\"")
859 ocv_include_directories(${${HAL_INCLUDE_DIRS_VAR}})
862 if(NOT DEFINED OpenCV_HAL)
863 set(OpenCV_HAL "OpenCV_HAL")
867 if(NOT ";${OpenCV_HAL};" MATCHES ";openvx;")
868 set(OpenCV_HAL "openvx;${OpenCV_HAL}")
873 ocv_debug_message(STATUS "Enable carotene acceleration")
874 if(NOT ";${OpenCV_HAL};" MATCHES ";carotene;")
875 set(OpenCV_HAL "carotene;${OpenCV_HAL}")
879 foreach(hal ${OpenCV_HAL})
880 if(hal STREQUAL "carotene")
881 add_subdirectory(3rdparty/carotene/hal)
882 ocv_hal_register(CAROTENE_HAL_LIBRARIES CAROTENE_HAL_HEADERS CAROTENE_HAL_INCLUDE_DIRS)
883 list(APPEND OpenCV_USED_HAL "carotene (ver ${CAROTENE_HAL_VERSION})")
884 elseif(hal STREQUAL "openvx")
885 add_subdirectory(3rdparty/openvx)
886 ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS)
887 list(APPEND OpenCV_USED_HAL "openvx (ver ${OPENVX_HAL_VERSION})")
889 ocv_debug_message(STATUS "OpenCV HAL: ${hal} ...")
890 ocv_clear_vars(OpenCV_HAL_LIBRARIES OpenCV_HAL_HEADERS OpenCV_HAL_INCLUDE_DIRS)
891 find_package(${hal} NO_MODULE QUIET)
893 ocv_hal_register(OpenCV_HAL_LIBRARIES OpenCV_HAL_HEADERS OpenCV_HAL_INCLUDE_DIRS)
894 list(APPEND OpenCV_USED_HAL "${hal} (ver ${${hal}_VERSION})")
898 configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/custom_hal.hpp.in" "${CMAKE_BINARY_DIR}/custom_hal.hpp" @ONLY)
902 # ----------------------------------------------------------------------------
903 # Add CUDA libraries (needed for apps/tools, samples)
904 # ----------------------------------------------------------------------------
906 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY})
908 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cublas_LIBRARY})
911 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cufft_LIBRARY})
913 foreach(p ${CUDA_LIBS_PATH})
914 if(MSVC AND CMAKE_GENERATOR MATCHES "Ninja|JOM")
915 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CMAKE_LIBRARY_PATH_FLAG}"${p}")
917 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CMAKE_LIBRARY_PATH_FLAG}${p})
923 # ----------------------------------------------------------------------------
925 # ----------------------------------------------------------------------------
927 include(cmake/OpenCVDetectTrace.cmake)
930 ocv_cmake_hook(POST_DETECT_DEPENDECIES)
932 # ----------------------------------------------------------------------------
934 # ----------------------------------------------------------------------------
935 if(ENABLE_SOLUTION_FOLDERS)
936 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
937 set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
940 # Extra OpenCV targets: uninstall, package_source, perf, etc.
941 include(cmake/OpenCVExtraTargets.cmake)
943 # ----------------------------------------------------------------------------
944 # Process subdirectories
945 # ----------------------------------------------------------------------------
947 # opencv.hpp and legacy headers
948 add_subdirectory(include)
950 # Enable compiler options for OpenCV modules/apps/samples only (ignore 3rdparty)
951 ocv_add_modules_compiler_options()
954 add_subdirectory(modules)
956 # Generate targets for documentation
957 add_subdirectory(doc)
959 # various data that is used by cv libraries and/or demo applications.
960 add_subdirectory(data)
963 if(BUILD_opencv_apps)
964 add_subdirectory(apps)
968 if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES OR INSTALL_C_EXAMPLES)
969 add_subdirectory(samples)
973 add_subdirectory(platforms/android/service)
976 # ----------------------------------------------------------------------------
977 # Finalization: generate configuration-based files
978 # ----------------------------------------------------------------------------
980 ocv_cmake_hook(PRE_FINALIZE)
982 # Generate platform-dependent and configuration-dependent headers
983 include(cmake/OpenCVGenHeaders.cmake)
985 # Generate opencv.pc for pkg-config command
986 if(OPENCV_GENERATE_PKGCONFIG)
987 include(cmake/OpenCVGenPkgconfig.cmake)
990 # Generate OpenCV.mk for ndk-build (Android build tool)
991 include(cmake/OpenCVGenAndroidMK.cmake)
993 # Generate OpenCVConfig.cmake and OpenCVConfig-version.cmake for cmake projects
994 include(cmake/OpenCVGenConfig.cmake)
996 # Generate Info.plist for the IOS framework
998 include(cmake/OpenCVGenInfoPlist.cmake)
1001 # Generate ABI descriptor
1002 include(cmake/OpenCVGenABI.cmake)
1004 # Generate environment setup file
1005 if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
1007 get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY)
1008 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in"
1009 "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
1010 install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
1011 DESTINATION ./ COMPONENT tests)
1013 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_windows.cmd.in"
1014 "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd" @ONLY)
1015 install(PROGRAMS "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd"
1016 DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
1018 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in"
1019 "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
1020 install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
1021 DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
1025 if(NOT OPENCV_README_FILE)
1027 set(OPENCV_README_FILE ${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/README.android)
1031 if(NOT OPENCV_LICENSE_FILE)
1032 set(OPENCV_LICENSE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
1035 # for UNIX it does not make sense as LICENSE and readme will be part of the package automatically
1036 if(ANDROID OR NOT UNIX)
1037 install(FILES ${OPENCV_LICENSE_FILE}
1038 PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
1039 DESTINATION ./ COMPONENT libs)
1040 if(OPENCV_README_FILE)
1041 install(FILES ${OPENCV_README_FILE}
1042 PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
1043 DESTINATION ./ COMPONENT libs)
1047 if(COMMAND ocv_pylint_finalize)
1048 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/modules/python/test)
1049 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/samples/python)
1050 ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/samples/dnn)
1051 ocv_pylint_add_directory_recurse(${CMAKE_CURRENT_LIST_DIR}/samples/python/tutorial_code)
1052 ocv_pylint_finalize()
1055 if(OPENCV_GENERATE_SETUPVARS)
1056 include(cmake/OpenCVGenSetupVars.cmake)
1059 # ----------------------------------------------------------------------------
1061 # ----------------------------------------------------------------------------
1063 status("General configuration for OpenCV ${OPENCV_VERSION} =====================================")
1064 if(OPENCV_VCSVERSION)
1065 status(" Version control:" ${OPENCV_VCSVERSION})
1067 if(OPENCV_EXTRA_MODULES_PATH AND NOT BUILD_INFO_SKIP_EXTRA_MODULES)
1068 set(__dump_extra_header OFF)
1069 foreach(p ${OPENCV_EXTRA_MODULES_PATH})
1071 if(NOT __dump_extra_header)
1072 set(__dump_extra_header ON)
1074 status(" Extra modules:")
1078 ocv_git_describe(EXTRA_MODULES_VCSVERSION "${p}")
1079 status(" Location (extra):" ${p})
1080 status(" Version control (extra):" ${EXTRA_MODULES_VCSVERSION})
1083 unset(__dump_extra_header)
1086 # ========================== build platform ==========================
1088 status(" Platform:")
1089 if(NOT DEFINED OPENCV_TIMESTAMP
1090 AND NOT CMAKE_VERSION VERSION_LESS 2.8.11
1091 AND NOT BUILD_INFO_SKIP_TIMESTAMP
1093 string(TIMESTAMP OPENCV_TIMESTAMP "" UTC)
1094 set(OPENCV_TIMESTAMP "${OPENCV_TIMESTAMP}" CACHE STRING "Timestamp of OpenCV build configuration" FORCE)
1096 if(OPENCV_TIMESTAMP)
1097 status(" Timestamp:" ${OPENCV_TIMESTAMP})
1099 status(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
1100 if(CMAKE_CROSSCOMPILING)
1101 status(" Target:" ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
1103 status(" CMake:" ${CMAKE_VERSION})
1104 status(" CMake generator:" ${CMAKE_GENERATOR})
1105 status(" CMake build tool:" ${CMAKE_BUILD_TOOL})
1107 status(" MSVC:" ${MSVC_VERSION})
1109 if(CMAKE_GENERATOR MATCHES Xcode)
1110 status(" Xcode:" ${XCODE_VERSION})
1112 if(NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
1113 status(" Configuration:" ${CMAKE_BUILD_TYPE})
1117 # ========================= CPU code generation mode =========================
1119 status(" CPU/HW features:")
1120 status(" Baseline:" "${CPU_BASELINE_FINAL}")
1121 if(NOT CPU_BASELINE STREQUAL CPU_BASELINE_FINAL)
1122 status(" requested:" "${CPU_BASELINE}")
1124 if(CPU_BASELINE_REQUIRE)
1125 status(" required:" "${CPU_BASELINE_REQUIRE}")
1127 if(CPU_BASELINE_DISABLE)
1128 status(" disabled:" "${CPU_BASELINE_DISABLE}")
1130 if(CPU_DISPATCH_FINAL OR CPU_DISPATCH)
1131 status(" Dispatched code generation:" "${CPU_DISPATCH_FINAL}")
1132 if(NOT CPU_DISPATCH STREQUAL CPU_DISPATCH_FINAL)
1133 status(" requested:" "${CPU_DISPATCH}")
1135 if(CPU_DISPATCH_REQUIRE)
1136 status(" required:" "${CPU_DISPATCH_REQUIRE}")
1138 foreach(OPT ${CPU_DISPATCH_FINAL})
1139 status(" ${OPT} (${CPU_${OPT}_USAGE_COUNT} files):" "+ ${CPU_DISPATCH_${OPT}_INCLUDED}")
1143 # ========================== C/C++ options ==========================
1144 if(CMAKE_CXX_COMPILER_VERSION)
1145 set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (ver ${CMAKE_CXX_COMPILER_VERSION})")
1147 set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
1149 string(STRIP "${OPENCV_COMPILER_STR}" OPENCV_COMPILER_STR)
1153 status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
1154 status(" C++ Compiler:" ${OPENCV_COMPILER_STR})
1155 status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
1156 status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
1157 status(" C Compiler:" ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
1158 status(" C flags (Release):" ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE})
1159 status(" C flags (Debug):" ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG})
1161 status(" Linker flags (Release):" ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
1162 status(" Linker flags (Debug):" ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
1164 status(" Linker flags (Release):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
1165 status(" Linker flags (Debug):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
1167 status(" ccache:" OPENCV_COMPILER_IS_CCACHE THEN YES ELSE NO)
1168 status(" Precompiled headers:" PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS THEN YES ELSE NO)
1170 # ========================== Dependencies ============================
1171 ocv_get_all_libs(deps_modules deps_extra deps_3rdparty)
1172 status(" Extra dependencies:" ${deps_extra})
1173 status(" 3rdparty dependencies:" ${deps_3rdparty})
1175 # ========================== OpenCV modules ==========================
1177 status(" OpenCV modules:")
1178 string(REPLACE "opencv_" "" OPENCV_MODULES_BUILD_ST "${OPENCV_MODULES_BUILD}")
1179 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_USER_ST "${OPENCV_MODULES_DISABLED_USER}")
1180 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_AUTO_ST "${OPENCV_MODULES_DISABLED_AUTO}")
1181 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_FORCE_ST "${OPENCV_MODULES_DISABLED_FORCE}")
1182 list(SORT OPENCV_MODULES_BUILD_ST)
1183 list(SORT OPENCV_MODULES_DISABLED_USER_ST)
1184 list(SORT OPENCV_MODULES_DISABLED_AUTO_ST)
1185 list(SORT OPENCV_MODULES_DISABLED_FORCE_ST)
1186 status(" To be built:" OPENCV_MODULES_BUILD THEN ${OPENCV_MODULES_BUILD_ST} ELSE "-")
1187 status(" Disabled:" OPENCV_MODULES_DISABLED_USER THEN ${OPENCV_MODULES_DISABLED_USER_ST} ELSE "-")
1188 status(" Disabled by dependency:" OPENCV_MODULES_DISABLED_AUTO THEN ${OPENCV_MODULES_DISABLED_AUTO_ST} ELSE "-")
1189 status(" Unavailable:" OPENCV_MODULES_DISABLED_FORCE THEN ${OPENCV_MODULES_DISABLED_FORCE_ST} ELSE "-")
1191 ocv_build_features_string(apps_status
1192 IF BUILD_TESTS AND HAVE_opencv_ts THEN "tests"
1193 IF BUILD_PERF_TESTS AND HAVE_opencv_ts THEN "perf_tests"
1194 IF BUILD_EXAMPLES THEN "examples"
1195 IF BUILD_opencv_apps THEN "apps"
1196 IF BUILD_ANDROID_SERVICE THEN "android_service"
1197 IF BUILD_ANDROID_EXAMPLES AND CAN_BUILD_ANDROID_PROJECTS THEN "android_examples"
1199 status(" Applications:" "${apps_status}")
1200 ocv_build_features_string(docs_status
1201 IF TARGET doxygen_cpp THEN "doxygen"
1202 IF TARGET doxygen_python THEN "python"
1203 IF TARGET doxygen_javadoc THEN "javadoc"
1204 IF BUILD_opencv_js OR DEFINED OPENCV_JS_LOCATION THEN "js"
1207 status(" Documentation:" "${docs_status}")
1208 status(" Non-free algorithms:" OPENCV_ENABLE_NONFREE THEN "YES" ELSE "NO")
1210 # ========================== Android details ==========================
1213 if(DEFINED ANDROID_NDK_REVISION)
1214 set(__msg "${ANDROID_NDK} (ver ${ANDROID_NDK_REVISION})")
1216 set(__msg "location: ${ANDROID_NDK}")
1218 status(" Android NDK: " ${__msg})
1219 status(" Android ABI:" ${ANDROID_ABI})
1220 if(BUILD_WITH_STANDALONE_TOOLCHAIN)
1221 status(" NDK toolchain:" "standalone: ${ANDROID_STANDALONE_TOOLCHAIN}")
1222 elseif(BUILD_WITH_ANDROID_NDK OR DEFINED ANDROID_TOOLCHAIN_NAME)
1223 status(" NDK toolchain:" "${ANDROID_TOOLCHAIN_NAME}")
1225 status(" STL type:" ${ANDROID_STL})
1226 status(" Native API level:" ${ANDROID_NATIVE_API_LEVEL})
1228 if(BUILD_ANDROID_PROJECTS)
1229 status(" Android SDK: " "${ANDROID_SDK} (tools: ${ANDROID_SDK_TOOLS_VERSION} build tools: ${ANDROID_SDK_BUILD_TOOLS_VERSION})")
1230 if(ANDROID_EXECUTABLE)
1231 status(" android tool:" "${ANDROID_EXECUTABLE}")
1234 status(" Android SDK: " "not used, projects are not built")
1236 if(DEFINED ANDROID_SDK_COMPATIBLE_TARGET)
1237 status(" SDK target:" "${ANDROID_SDK_COMPATIBLE_TARGET}")
1239 if(DEFINED ANDROID_PROJECTS_BUILD_TYPE)
1240 if(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT")
1241 status(" Projects build scripts:" "Ant/Eclipse compatible")
1242 elseif(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT")
1243 status(" Projects build scripts:" "Gradle")
1248 # ================== Windows RT features ==================
1251 status(" Windows RT support:" WINRT THEN YES ELSE NO)
1253 status(" Building for Microsoft platform: " ${CMAKE_SYSTEM_NAME})
1254 status(" Building for architectures: " ${CMAKE_VS_EFFECTIVE_PLATFORMS})
1255 status(" Building for version: " ${CMAKE_SYSTEM_VERSION})
1256 if (DEFINED ENABLE_WINRT_MODE_NATIVE)
1257 status(" Building for C++ without CX extensions")
1262 # ========================== GUI ==========================
1266 if(WITH_QT OR HAVE_QT)
1268 status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
1269 status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
1271 status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
1272 status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
1279 status(" Win32 UI:" HAVE_WIN32UI THEN YES ELSE NO)
1282 if(HAVE_COCOA) # APPLE
1283 status(" Cocoa:" YES)
1286 if(WITH_GTK OR HAVE_GTK)
1288 status(" GTK+:" "YES (ver ${ALIASOF_gtk+-3.0_VERSION})")
1290 status(" GTK+:" "YES (ver ${ALIASOF_gtk+-2.0_VERSION})")
1292 status(" GTK+:" "NO")
1295 status( " GThread :" HAVE_GTHREAD THEN "YES (ver ${ALIASOF_gthread-2.0_VERSION})" ELSE NO)
1296 status( " GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${ALIASOF_gtkglext-1.0_VERSION})" ELSE NO)
1300 if(WITH_OPENGL OR HAVE_OPENGL)
1301 status(" OpenGL support:" HAVE_OPENGL THEN "YES (${OPENGL_LIBRARIES})" ELSE NO)
1304 if(WITH_VTK OR HAVE_VTK)
1305 status(" VTK support:" HAVE_VTK THEN "YES (ver ${VTK_VERSION})" ELSE NO)
1308 # ========================== MEDIA IO ==========================
1310 status(" Media I/O: ")
1311 status(" ZLib:" ZLIB_FOUND THEN "${ZLIB_LIBRARIES} (ver ${ZLIB_VERSION_STRING})" ELSE "build (ver ${ZLIB_VERSION_STRING})")
1313 if(WITH_JPEG OR HAVE_JPEG)
1317 status(" JPEG:" "build-${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
1319 status(" JPEG:" "${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
1323 if(WITH_WEBP OR HAVE_WEBP)
1324 status(" WEBP:" WEBP_FOUND THEN "${WEBP_LIBRARY} (ver ${WEBP_VERSION})" ELSE "build (ver ${WEBP_VERSION})")
1327 if(WITH_PNG OR HAVE_PNG)
1328 status(" PNG:" PNG_FOUND THEN "${PNG_LIBRARY} (ver ${PNG_VERSION})" ELSE "build (ver ${PNG_VERSION})")
1331 if(WITH_TIFF OR HAVE_TIFF)
1332 status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION} / ${TIFF_VERSION_STRING})" ELSE "build (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})")
1335 if(WITH_JASPER OR HAVE_JASPER)
1336 status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build (ver ${JASPER_VERSION_STRING})")
1339 if(WITH_OPENEXR OR HAVE_OPENEXR)
1340 status(" OpenEXR:" OPENEXR_FOUND THEN "${OPENEXR_LIBRARIES} (ver ${OPENEXR_VERSION})" ELSE "build (ver ${OPENEXR_VERSION})")
1343 if(WITH_GDAL OR HAVE_GDAL)
1344 status(" GDAL:" HAVE_GDAL THEN "YES (${GDAL_LIBRARY})" ELSE "NO")
1347 if(WITH_GDCM OR HAVE_GDCM)
1348 status(" GDCM:" HAVE_GDCM THEN "YES (${GDCM_VERSION})" ELSE "NO")
1351 if(WITH_IMGCODEC_HDR OR DEFINED HAVE_IMGCODEC_HDR)
1352 status(" HDR:" HAVE_IMGCODEC_HDR THEN "YES" ELSE "NO")
1355 if(WITH_IMGCODEC_SUNRASTER OR DEFINED HAVE_IMGCODEC_SUNRASTER)
1356 status(" SUNRASTER:" HAVE_IMGCODEC_SUNRASTER THEN "YES" ELSE "NO")
1359 if(WITH_IMGCODEC_PXM OR DEFINED HAVE_IMGCODEC_PXM)
1360 status(" PXM:" HAVE_IMGCODEC_PXM THEN "YES" ELSE "NO")
1363 if(WITH_IMGCODEC_PFM OR DEFINED HAVE_IMGCODEC_PFM)
1364 status(" PFM:" HAVE_IMGCODEC_PFM THEN "YES" ELSE "NO")
1367 # ========================== VIDEO IO ==========================
1369 status(" Video I/O:")
1371 if(WITH_1394 OR HAVE_DC1394_2)
1372 status(" DC1394:" HAVE_DC1394_2 THEN "YES (${DC1394_2_VERSION})" ELSE NO)
1375 if(WITH_FFMPEG OR HAVE_FFMPEG)
1376 if(OPENCV_FFMPEG_USE_FIND_PACKAGE)
1377 status(" FFMPEG:" HAVE_FFMPEG THEN "YES (find_package)" ELSE "NO (find_package)")
1379 status(" FFMPEG:" HAVE_FFMPEG THEN "YES (prebuilt binaries)" ELSE NO)
1381 status(" FFMPEG:" HAVE_FFMPEG THEN YES ELSE NO)
1383 status(" avcodec:" FFMPEG_libavcodec_VERSION THEN "YES (${FFMPEG_libavcodec_VERSION})" ELSE NO)
1384 status(" avformat:" FFMPEG_libavformat_VERSION THEN "YES (${FFMPEG_libavformat_VERSION})" ELSE NO)
1385 status(" avutil:" FFMPEG_libavutil_VERSION THEN "YES (${FFMPEG_libavutil_VERSION})" ELSE NO)
1386 status(" swscale:" FFMPEG_libswscale_VERSION THEN "YES (${FFMPEG_libswscale_VERSION})" ELSE NO)
1387 status(" avresample:" FFMPEG_libavresample_VERSION THEN "YES (${FFMPEG_libavresample_VERSION})" ELSE NO)
1390 if(WITH_GSTREAMER OR HAVE_GSTREAMER)
1391 status(" GStreamer:" HAVE_GSTREAMER THEN "YES (${GSTREAMER_VERSION})" ELSE NO)
1394 if(WITH_OPENNI2 OR HAVE_OPENNI2)
1395 status(" OpenNI2:" HAVE_OPENNI2 THEN "YES (${OPENNI2_VERSION})" ELSE NO)
1398 if(WITH_PVAPI OR HAVE_PVAPI)
1399 status(" PvAPI:" HAVE_PVAPI THEN YES ELSE NO)
1402 if(WITH_ARAVIS OR HAVE_ARAVIS_API)
1403 status(" Aravis SDK:" HAVE_ARAVIS_API THEN "YES (${ARAVIS_VERSION})" ELSE NO)
1406 if(WITH_AVFOUNDATION OR HAVE_AVFOUNDATION)
1407 status(" AVFoundation:" HAVE_AVFOUNDATION THEN YES ELSE NO)
1411 status(" iOS capture:" YES)
1414 if(WITH_V4L OR HAVE_V4L)
1415 ocv_build_features_string(v4l_status
1416 IF HAVE_CAMV4L2 THEN "linux/videodev2.h"
1417 IF HAVE_VIDEOIO THEN "sys/videoio.h"
1419 status(" v4l/v4l2:" HAVE_V4L THEN "YES (${v4l_status})" ELSE NO)
1422 if(WITH_DSHOW OR HAVE_DSHOW)
1423 status(" DirectShow:" HAVE_DSHOW THEN YES ELSE NO)
1426 if(WITH_MSMF OR HAVE_MSMF)
1427 status(" Media Foundation:" HAVE_MSMF THEN YES ELSE NO)
1428 status(" DXVA:" HAVE_MSMF_DXVA THEN YES ELSE NO)
1431 if(WITH_XIMEA OR HAVE_XIMEA)
1432 status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO)
1435 if(WITH_XINE OR HAVE_XINE)
1436 status(" Xine:" HAVE_XINE THEN "YES (${XINE_VERSION})" ELSE NO)
1439 if(WITH_LIBREALSENSE OR HAVE_LIBREALSENSE)
1440 status(" Intel RealSense:" HAVE_LIBREALSENSE THEN "YES (${LIBREALSENSE_VERSION})" ELSE NO)
1443 if(WITH_MFX OR HAVE_MFX)
1444 status(" Intel Media SDK:" HAVE_MFX THEN "YES (${MFX_LIBRARY})" 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_VA_INTEL OR HAVE_VA_INTEL)
1498 status(" Intel VA-API/OpenCL:" HAVE_VA_INTEL THEN "YES (OpenCL: ${VA_INTEL_IOCL_ROOT})" 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 set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})")
1512 get_target_property(_lib ${INF_ENGINE_TARGET} IMPORTED_LOCATION)
1514 get_target_property(_lib_rel ${INF_ENGINE_TARGET} IMPORTED_IMPLIB_RELEASE)
1515 get_target_property(_lib_dbg ${INF_ENGINE_TARGET} IMPORTED_IMPLIB_DEBUG)
1516 set(_lib "${_lib_rel} / ${_lib_dbg}")
1518 get_target_property(_inc ${INF_ENGINE_TARGET} INTERFACE_INCLUDE_DIRECTORIES)
1519 status(" Inference Engine:" "${__msg}")
1520 status(" libs:" "${_lib}")
1521 status(" includes:" "${_inc}")
1523 status(" Inference Engine:" "NO")
1527 if(WITH_EIGEN OR HAVE_EIGEN)
1528 status(" Eigen:" HAVE_EIGEN THEN "YES (ver ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})" ELSE NO)
1531 if(WITH_OPENVX OR HAVE_OPENVX)
1532 status(" OpenVX:" HAVE_OPENVX THEN "YES (${OPENVX_LIBRARIES})" ELSE "NO")
1535 status(" Custom HAL:" OpenCV_USED_HAL THEN "YES (${OpenCV_USED_HAL})" ELSE "NO")
1537 foreach(s ${CUSTOM_STATUS})
1538 status(${CUSTOM_STATUS_${s}})
1541 if(WITH_CUDA OR HAVE_CUDA)
1542 ocv_build_features_string(cuda_features
1543 IF HAVE_CUFFT THEN "CUFFT"
1544 IF HAVE_CUBLAS THEN "CUBLAS"
1545 IF HAVE_NVCUVID THEN "NVCUVID"
1546 IF CUDA_FAST_MATH THEN "FAST_MATH"
1547 ELSE "no extra features")
1549 status(" NVIDIA CUDA:" HAVE_CUDA THEN "YES (ver ${CUDA_VERSION_STRING}, ${cuda_features})" ELSE NO)
1551 status(" NVIDIA GPU arch:" ${OPENCV_CUDA_ARCH_BIN})
1552 status(" NVIDIA PTX archs:" ${OPENCV_CUDA_ARCH_PTX})
1556 if(WITH_VULKAN OR HAVE_VULKAN)
1558 status(" Vulkan:" HAVE_VULKAN THEN "YES" ELSE "NO")
1560 status(" Include path:" VULKAN_INCLUDE_DIRS THEN "${VULKAN_INCLUDE_DIRS}" ELSE "NO")
1561 status(" Link libraries:" VULKAN_LIBRARIES THEN "${VULKAN_LIBRARIES}" ELSE "Dynamic load")
1565 if(WITH_OPENCL OR HAVE_OPENCL)
1566 ocv_build_features_string(opencl_features
1567 IF HAVE_OPENCL_SVM THEN "SVM"
1568 IF HAVE_CLAMDFFT THEN "AMDFFT"
1569 IF HAVE_CLAMDBLAS THEN "AMDBLAS"
1570 ELSE "no extra features")
1572 status(" OpenCL:" HAVE_OPENCL THEN "YES (${opencl_features})" ELSE "NO")
1574 status(" Include path:" OPENCL_INCLUDE_DIRS THEN "${OPENCL_INCLUDE_DIRS}" ELSE "NO")
1575 status(" Link libraries:" OPENCL_LIBRARIES THEN "${OPENCL_LIBRARIES}" ELSE "Dynamic load")
1579 # ========================== python ==========================
1580 if(BUILD_opencv_python2)
1582 status(" Python 2:")
1583 status(" Interpreter:" PYTHON2INTERP_FOUND THEN "${PYTHON2_EXECUTABLE} (ver ${PYTHON2_VERSION_STRING})" ELSE NO)
1584 if(PYTHON2LIBS_VERSION_STRING)
1585 status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES} (ver ${PYTHON2LIBS_VERSION_STRING})" ELSE NO)
1587 status(" Libraries:" HAVE_opencv_python2 THEN "${PYTHON2_LIBRARIES}" ELSE NO)
1589 status(" numpy:" PYTHON2_NUMPY_INCLUDE_DIRS THEN "${PYTHON2_NUMPY_INCLUDE_DIRS} (ver ${PYTHON2_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
1590 status(" install path:" HAVE_opencv_python2 THEN "${__INSTALL_PATH_PYTHON2}" ELSE "-")
1593 if(BUILD_opencv_python3)
1595 status(" Python 3:")
1596 status(" Interpreter:" PYTHON3INTERP_FOUND THEN "${PYTHON3_EXECUTABLE} (ver ${PYTHON3_VERSION_STRING})" ELSE NO)
1597 if(PYTHON3LIBS_VERSION_STRING)
1598 status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES} (ver ${PYTHON3LIBS_VERSION_STRING})" ELSE NO)
1600 status(" Libraries:" HAVE_opencv_python3 THEN "${PYTHON3_LIBRARIES}" ELSE NO)
1602 status(" numpy:" PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
1603 status(" install path:" HAVE_opencv_python3 THEN "${__INSTALL_PATH_PYTHON3}" ELSE "-")
1607 status(" Python (for build):" PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE NO)
1608 if(PYLINT_FOUND AND PYLINT_EXECUTABLE)
1609 status(" Pylint:" PYLINT_FOUND THEN "${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}, checks: ${PYLINT_TOTAL_TARGETS})" ELSE NO)
1611 if(FLAKE8_FOUND AND FLAKE8_EXECUTABLE)
1612 status(" Flake8:" FLAKE8_FOUND THEN "${FLAKE8_EXECUTABLE} (ver: ${FLAKE8_VERSION})" ELSE NO)
1615 # ========================== java ==========================
1616 if(BUILD_JAVA OR BUILD_opencv_java)
1618 status(" Java:" BUILD_FAT_JAVA_LIB THEN "export all functions" ELSE "")
1619 status(" ant:" ANT_EXECUTABLE THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})" ELSE NO)
1621 status(" JNI:" JNI_INCLUDE_DIRS THEN "${JNI_INCLUDE_DIRS}" ELSE NO)
1623 status(" Java wrappers:" HAVE_opencv_java THEN YES ELSE NO)
1624 status(" Java tests:" BUILD_TESTS AND opencv_test_java_BINARY_DIR THEN YES ELSE NO)
1627 ocv_cmake_hook(STATUS_DUMP_EXTRA)
1629 # ========================== auxiliary ==========================
1631 status(" Install to:" "${CMAKE_INSTALL_PREFIX}")
1632 status("-----------------------------------------------------------------")
1636 ocv_finalize_status()
1638 if(ENABLE_CONFIG_VERIFICATION)
1642 ocv_cmake_hook(POST_FINALIZE)
1644 # ----------------------------------------------------------------------------
1646 # ----------------------------------------------------------------------------
1648 include(cmake/OpenCVPackaging.cmake)
1650 # This should be the last command
1651 ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
1652 ocv_cmake_eval(DEBUG_POST ONCE)