Merge pull request #22562 from cudawarped:add_bindings_to_cuda_fastNlMeansDenoising
[platform/upstream/opencv.git] / CMakeLists.txt
1 # ----------------------------------------------------------------------------
2 #  Root CMake file for OpenCV
3 #
4 #    From the off-tree build directory, invoke:
5 #      $ cmake <PATH_TO_OPENCV_ROOT>
6 #
7 # ----------------------------------------------------------------------------
8
9 # Disable in-source builds to prevent source tree corruption.
10 if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}")
11   message(FATAL_ERROR "
12 FATAL: In-source builds are not allowed.
13        You should create a separate directory for build files.
14 ")
15 endif()
16
17
18 include(cmake/OpenCVMinDepVersions.cmake)
19
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)
26 else()
27   cmake_minimum_required(VERSION "${MIN_VER_CMAKE}" FATAL_ERROR)
28 endif()
29
30 #
31 # Configure CMake policies
32 #
33 if(POLICY CMP0026)
34   cmake_policy(SET CMP0026 NEW)
35 endif()
36
37 if(POLICY CMP0042)
38   cmake_policy(SET CMP0042 NEW)  # CMake 3.0+ (2.8.12): MacOS "@rpath" in target's install name
39 endif()
40
41 if(POLICY CMP0046)
42   cmake_policy(SET CMP0046 NEW)  # warn about non-existed dependencies
43 endif()
44
45 if(POLICY CMP0051)
46   cmake_policy(SET CMP0051 NEW)
47 endif()
48
49 if(POLICY CMP0054)  # CMake 3.1: Only interpret if() arguments as variables or keywords when unquoted.
50   cmake_policy(SET CMP0054 NEW)
51 endif()
52
53 if(POLICY CMP0056)
54   cmake_policy(SET CMP0056 NEW)  # try_compile(): link flags
55 endif()
56
57 if(POLICY CMP0066)
58   cmake_policy(SET CMP0066 NEW)  # CMake 3.7: try_compile(): use per-config flags, like CMAKE_CXX_FLAGS_RELEASE
59 endif()
60
61 if(POLICY CMP0067)
62   cmake_policy(SET CMP0067 NEW)  # CMake 3.8: try_compile(): honor language standard variables (like C++11)
63 endif()
64
65 if(POLICY CMP0068)
66   cmake_policy(SET CMP0068 NEW)  # CMake 3.9+: `RPATH` settings on macOS do not affect `install_name`.
67 endif()
68
69 if(POLICY CMP0075)
70   cmake_policy(SET CMP0075 NEW)  # CMake 3.12+: Include file check macros honor `CMAKE_REQUIRED_LIBRARIES`
71 endif()
72
73 if(POLICY CMP0077)
74   cmake_policy(SET CMP0077 NEW)  # CMake 3.13+: option() honors normal variables.
75 endif()
76
77 #
78 # Configure OpenCV CMake hooks
79 #
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})
87   endforeach()
88 endif()
89
90 ocv_cmake_hook(CMAKE_INIT)
91
92 # must go before the project()/enable_language() commands
93 ocv_update(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
94 if(NOT DEFINED CMAKE_BUILD_TYPE
95     AND NOT OPENCV_SKIP_DEFAULT_BUILD_TYPE
96 )
97   message(STATUS "'Release' build type is used by default. Use CMAKE_BUILD_TYPE to specify build type (Release or Debug)")
98   set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build")
99 endif()
100 if(DEFINED CMAKE_BUILD_TYPE)
101   set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${CMAKE_CONFIGURATION_TYPES}")
102 endif()
103
104 option(ENABLE_PIC "Generate position independent code (necessary for shared libraries)" TRUE)
105 set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_PIC})
106
107 ocv_cmake_hook(PRE_CMAKE_BOOTSTRAP)
108
109 # Bootstrap CMake system: setup CMAKE_SYSTEM_NAME and other vars
110 if(OPENCV_WORKAROUND_CMAKE_20989)
111   set(CMAKE_SYSTEM_PROCESSOR_BACKUP ${CMAKE_SYSTEM_PROCESSOR})
112 endif()
113 enable_language(CXX C)
114 if(OPENCV_WORKAROUND_CMAKE_20989)
115   set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR_BACKUP})
116 endif()
117
118 ocv_cmake_hook(POST_CMAKE_BOOTSTRAP)
119
120 if(NOT OPENCV_SKIP_CMAKE_SYSTEM_FILE)
121   include("cmake/platforms/OpenCV-${CMAKE_SYSTEM_NAME}.cmake" OPTIONAL RESULT_VARIABLE "OPENCV_CMAKE_SYSTEM_FILE")
122   if(NOT OPENCV_CMAKE_SYSTEM_FILE)
123     message(STATUS "OpenCV: system-specific configuration file is not found: '${CMAKE_SYSTEM_NAME}'")
124   endif()
125 endif()
126
127 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)  # https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.html
128   if(NOT CMAKE_TOOLCHAIN_FILE)
129     if(WIN32)
130       set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
131     else()
132       set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation Directory" FORCE)
133     endif()
134   else()
135     # any cross-compiling
136     set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory" FORCE)
137   endif()
138 endif()
139
140 enable_testing()
141
142 project(OpenCV CXX C)
143
144 if(MSVC)
145   set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
146 endif()
147
148 ocv_cmake_eval(DEBUG_PRE ONCE)
149
150 ocv_clear_vars(OpenCVModules_TARGETS)
151
152 include(cmake/OpenCVDownload.cmake)
153
154 set(BUILD_LIST "" CACHE STRING "Build only listed modules (comma-separated, e.g. 'videoio,dnn,ts')")
155
156 # ----------------------------------------------------------------------------
157 # Break in case of popular CMake configuration mistakes
158 # ----------------------------------------------------------------------------
159 if(NOT CMAKE_SIZEOF_VOID_P GREATER 0)
160   message(FATAL_ERROR "CMake fails to determine the bitness of the target platform.
161   Please check your CMake and compiler installation. If you are cross-compiling then ensure that your CMake toolchain file correctly sets the compiler details.")
162 endif()
163
164 # ----------------------------------------------------------------------------
165 # Detect compiler and target platform architecture
166 # ----------------------------------------------------------------------------
167 include(cmake/OpenCVDetectCXXCompiler.cmake)
168 ocv_cmake_hook(POST_DETECT_COMPILER)
169
170 # Add these standard paths to the search paths for FIND_LIBRARY
171 # to find libraries from these locations first
172 if(UNIX AND NOT ANDROID)
173   if(X86_64 OR CMAKE_SIZEOF_VOID_P EQUAL 8)
174     if(EXISTS /lib64)
175       list(APPEND CMAKE_LIBRARY_PATH /lib64)
176     else()
177       list(APPEND CMAKE_LIBRARY_PATH /lib)
178     endif()
179     if(EXISTS /usr/lib64)
180       list(APPEND CMAKE_LIBRARY_PATH /usr/lib64)
181     else()
182       list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
183     endif()
184   elseif(X86 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
185     if(EXISTS /lib32)
186       list(APPEND CMAKE_LIBRARY_PATH /lib32)
187     else()
188       list(APPEND CMAKE_LIBRARY_PATH /lib)
189     endif()
190     if(EXISTS /usr/lib32)
191       list(APPEND CMAKE_LIBRARY_PATH /usr/lib32)
192     else()
193       list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
194     endif()
195   endif()
196 endif()
197
198 # Add these standard paths to the search paths for FIND_PATH
199 # to find include files from these locations first
200 if(MINGW)
201   if(EXISTS /mingw)
202       list(APPEND CMAKE_INCLUDE_PATH /mingw)
203   endif()
204   if(EXISTS /mingw32)
205       list(APPEND CMAKE_INCLUDE_PATH /mingw32)
206   endif()
207   if(EXISTS /mingw64)
208       list(APPEND CMAKE_INCLUDE_PATH /mingw64)
209   endif()
210 endif()
211
212 # ----------------------------------------------------------------------------
213 # OpenCV cmake options
214 # ----------------------------------------------------------------------------
215
216 OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF)
217
218 # 3rd party libs
219 OCV_OPTION(OPENCV_FORCE_3RDPARTY_BUILD   "Force using 3rdparty code from source" OFF)
220 OCV_OPTION(BUILD_ZLIB               "Build zlib from source"             (WIN32 OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
221 OCV_OPTION(BUILD_TIFF               "Build libtiff from source"          (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
222 OCV_OPTION(BUILD_OPENJPEG           "Build OpenJPEG from source"         (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
223 OCV_OPTION(BUILD_JASPER             "Build libjasper from source"        (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
224 OCV_OPTION(BUILD_JPEG               "Build libjpeg from source"          (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
225 OCV_OPTION(BUILD_PNG                "Build libpng from source"           (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
226 OCV_OPTION(BUILD_OPENEXR            "Build openexr from source"          (OPENCV_FORCE_3RDPARTY_BUILD) )
227 OCV_OPTION(BUILD_WEBP               "Build WebP from source"             (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
228 OCV_OPTION(BUILD_TBB                "Download and build TBB from source" (ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
229 OCV_OPTION(BUILD_IPP_IW             "Build IPP IW from source"           (NOT MINGW OR OPENCV_FORCE_3RDPARTY_BUILD) IF (X86_64 OR X86) AND NOT WINRT )
230 OCV_OPTION(BUILD_ITT                "Build Intel ITT from source"
231     (NOT MINGW OR OPENCV_FORCE_3RDPARTY_BUILD)
232     IF (X86_64 OR X86 OR ARM OR AARCH64 OR PPC64 OR PPC64LE) AND NOT WINRT AND NOT APPLE_FRAMEWORK
233 )
234
235 # Optional 3rd party components
236 # ===================================================
237 OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON
238   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
239   VERIFY HAVE_DC1394_2)
240 OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON
241   VISIBLE_IF APPLE
242   VERIFY HAVE_AVFOUNDATION)
243 OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
244   VISIBLE_IF IOS
245   VERIFY HAVE_CAP_IOS)
246 OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION)
247   VISIBLE_IF (ARM OR AARCH64) AND NOT IOS)
248 OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON
249   VISIBLE_IF ANDROID
250   VERIFY HAVE_CPUFEATURES)
251 OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON
252   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT CMAKE_CROSSCOMPILING
253   VERIFY HAVE_VTK)
254 OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" OFF
255   VISIBLE_IF NOT IOS AND NOT WINRT
256   VERIFY HAVE_CUDA)
257 OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" WITH_CUDA
258   VISIBLE_IF WITH_CUDA
259   VERIFY HAVE_CUFFT)
260 OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" WITH_CUDA
261   VISIBLE_IF WITH_CUDA
262   VERIFY HAVE_CUBLAS)
263 OCV_OPTION(WITH_CUDNN "Include NVIDIA CUDA Deep Neural Network (cuDNN) library support" WITH_CUDA
264   VISIBLE_IF WITH_CUDA
265   VERIFY HAVE_CUDNN)
266 OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF  # disabled, details: https://github.com/opencv/opencv/issues/14850
267   VISIBLE_IF WITH_CUDA
268   VERIFY HAVE_NVCUVID)
269 OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" (NOT CV_DISABLE_OPTIMIZATION AND NOT CMAKE_CROSSCOMPILING)
270   VISIBLE_IF NOT WINRT
271   VERIFY HAVE_EIGEN)
272 OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" (NOT ANDROID)
273   VISIBLE_IF NOT IOS AND NOT WINRT
274   VERIFY HAVE_FFMPEG)
275 OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON
276   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
277   VERIFY HAVE_GSTREAMER AND GSTREAMER_VERSION VERSION_GREATER "0.99")
278 OCV_OPTION(WITH_GTK "Include GTK support" ON
279   VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
280   VERIFY HAVE_GTK)
281 OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF
282   VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
283   VERIFY HAVE_GTK AND NOT HAVE_GTK3)
284 OCV_OPTION(WITH_WAYLAND "Include Wayland support" OFF
285         VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
286         VERIFY HAVE_WAYLAND)
287 OCV_OPTION(WITH_IPP "Include Intel IPP support" (NOT MINGW AND NOT CV_DISABLE_OPTIMIZATION)
288   VISIBLE_IF (X86_64 OR X86) AND NOT WINRT AND NOT IOS
289   VERIFY HAVE_IPP)
290 OCV_OPTION(WITH_HALIDE "Include Halide support" OFF
291   VISIBLE_IF TRUE
292   VERIFY HAVE_HALIDE)
293 OCV_OPTION(WITH_VULKAN "Include Vulkan support" OFF
294   VISIBLE_IF TRUE
295   VERIFY HAVE_VULKAN)
296 # replacement for deprecated options: WITH_INF_ENGINE, WITH_NGRAPH
297 OCV_OPTION(WITH_OPENVINO "Include Intel OpenVINO toolkit support" (WITH_INF_ENGINE)
298   VISIBLE_IF TRUE
299   VERIFY TARGET ocv.3rdparty.openvino)
300 OCV_OPTION(WITH_WEBNN "Include WebNN support" OFF
301   VISIBLE_IF TRUE
302   VERIFY HAVE_WEBNN)
303 OCV_OPTION(WITH_JASPER "Include JPEG2K support (Jasper)" ON
304   VISIBLE_IF NOT IOS
305   VERIFY HAVE_JASPER)
306 OCV_OPTION(WITH_OPENJPEG "Include JPEG2K support (OpenJPEG)" ON
307   VISIBLE_IF NOT IOS
308   VERIFY HAVE_OPENJPEG)
309 OCV_OPTION(WITH_JPEG "Include JPEG support" ON
310   VISIBLE_IF TRUE
311   VERIFY HAVE_JPEG)
312 OCV_OPTION(WITH_WEBP "Include WebP support" ON
313   VISIBLE_IF NOT WINRT
314   VERIFY HAVE_WEBP)
315 OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ((WIN32 OR ANDROID OR APPLE) OR BUILD_OPENEXR) OR NOT CMAKE_CROSSCOMPILING
316   VISIBLE_IF NOT APPLE_FRAMEWORK AND NOT WINRT
317   VERIFY HAVE_OPENEXR)
318 OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF
319   VISIBLE_IF NOT ANDROID AND NOT WINRT
320   VERIFY HAVE_OPENGL)
321 OCV_OPTION(WITH_OPENVX "Include OpenVX support" OFF
322   VISIBLE_IF TRUE
323   VERIFY HAVE_OPENVX)
324 OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF
325   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
326   VERIFY HAVE_OPENNI)
327 OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF
328   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
329   VERIFY HAVE_OPENNI2)
330 OCV_OPTION(WITH_PNG "Include PNG support" ON
331   VISIBLE_IF TRUE
332   VERIFY HAVE_PNG)
333 OCV_OPTION(WITH_SPNG "Include SPNG support" OFF
334   VISIBLE_IF TRUE
335   VERIFY HAVE_SPNG)
336 OCV_OPTION(WITH_GDCM "Include DICOM support" OFF
337   VISIBLE_IF TRUE
338   VERIFY HAVE_GDCM)
339 OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" OFF
340   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
341   VERIFY HAVE_PVAPI)
342 OCV_OPTION(WITH_ARAVIS "Include Aravis GigE support" OFF
343   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT WIN32
344   VERIFY HAVE_ARAVIS_API)
345 OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF
346   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
347   VERIFY HAVE_QT)
348 OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON
349   VISIBLE_IF WIN32 AND NOT WINRT
350   VERIFY HAVE_WIN32UI)
351 OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF
352   VISIBLE_IF NOT IOS AND NOT WINRT
353   VERIFY HAVE_TBB)
354 OCV_OPTION(WITH_HPX "Include Ste||ar Group HPX support" OFF
355   VISIBLE_IF TRUE
356   VERIFY HAVE_HPX)
357 OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF
358   VISIBLE_IF TRUE
359   VERIFY HAVE_OPENMP)
360 OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON
361   VISIBLE_IF NOT WIN32 OR MINGW
362   VERIFY HAVE_PTHREADS_PF)
363 OCV_OPTION(WITH_TIFF "Include TIFF support" ON
364   VISIBLE_IF NOT IOS
365   VERIFY HAVE_TIFF)
366 OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON
367   VISIBLE_IF UNIX AND NOT ANDROID AND NOT APPLE
368   VERIFY HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
369 OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON
370   VISIBLE_IF WIN32 AND NOT ARM AND NOT WINRT
371   VERIFY HAVE_DSHOW)
372 OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" NOT MINGW
373   VISIBLE_IF WIN32
374   VERIFY HAVE_MSMF)
375 OCV_OPTION(WITH_MSMF_DXVA "Enable hardware acceleration in Media Foundation backend" WITH_MSMF
376   VISIBLE_IF WIN32
377   VERIFY HAVE_MSMF_DXVA)
378 OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF
379   VISIBLE_IF NOT ANDROID AND NOT WINRT
380   VERIFY HAVE_XIMEA)
381 OCV_OPTION(WITH_UEYE "Include UEYE camera support" OFF
382   VISIBLE_IF NOT ANDROID AND NOT APPLE AND NOT WINRT
383   VERIFY HAVE_UEYE)
384 OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF
385   VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
386   VERIFY HAVE_XINE)
387 OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF
388   VISIBLE_IF TRUE
389   VERIFY HAVE_CLP)
390 OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" (NOT ANDROID AND NOT CV_DISABLE_OPTIMIZATION)
391   VISIBLE_IF NOT IOS AND NOT WINRT
392   VERIFY HAVE_OPENCL)
393 OCV_OPTION(WITH_OPENCL_SVM "Include OpenCL Shared Virtual Memory support" OFF
394   VISIBLE_IF TRUE
395   VERIFY HAVE_OPENCL_SVM) # experimental
396 OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON
397   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
398   VERIFY HAVE_CLAMDFFT)
399 OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON
400   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
401   VERIFY HAVE_CLAMDBLAS)
402 OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON
403   VISIBLE_IF WIN32 AND NOT WINRT
404   VERIFY HAVE_DIRECTX)
405 OCV_OPTION(WITH_OPENCL_D3D11_NV "Include NVIDIA OpenCL D3D11 support" WITH_DIRECTX
406   VISIBLE_IF WIN32 AND NOT WINRT
407   VERIFY HAVE_OPENCL_D3D11_NV)
408 OCV_OPTION(WITH_LIBREALSENSE "Include Intel librealsense support" OFF
409   VISIBLE_IF NOT WITH_INTELPERC
410   VERIFY HAVE_LIBREALSENSE)
411 OCV_OPTION(WITH_VA "Include VA support" (X86_64 OR X86)
412   VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
413   VERIFY HAVE_VA)
414 OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" (X86_64 OR X86)
415   VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
416   VERIFY HAVE_VA_INTEL)
417 OCV_OPTION(WITH_MFX "Include Intel Media SDK support" OFF
418   VISIBLE_IF (UNIX AND NOT ANDROID) OR (WIN32 AND NOT WINRT AND NOT MINGW)
419   VERIFY HAVE_MFX)
420 OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF
421   VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
422   VERIFY HAVE_GDAL)
423 OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" OFF
424   VISIBLE_IF UNIX AND NOT ANDROID AND NOT IOS
425   VERIFY HAVE_GPHOTO2)
426 OCV_OPTION(WITH_LAPACK "Include Lapack library support" (NOT CV_DISABLE_OPTIMIZATION)
427   VISIBLE_IF NOT ANDROID AND NOT IOS
428   VERIFY HAVE_LAPACK)
429 OCV_OPTION(WITH_ITT "Include Intel ITT support" ON
430   VISIBLE_IF NOT APPLE_FRAMEWORK
431   VERIFY HAVE_ITT)
432 OCV_OPTION(WITH_PROTOBUF "Enable libprotobuf" ON
433   VISIBLE_IF TRUE
434   VERIFY HAVE_PROTOBUF)
435 OCV_OPTION(WITH_IMGCODEC_HDR "Include HDR support" ON
436   VISIBLE_IF TRUE
437   VERIFY HAVE_IMGCODEC_HDR)
438 OCV_OPTION(WITH_IMGCODEC_SUNRASTER "Include SUNRASTER support" ON
439   VISIBLE_IF TRUE
440   VERIFY HAVE_IMGCODEC_SUNRASTER)
441 OCV_OPTION(WITH_IMGCODEC_PXM "Include PNM (PBM,PGM,PPM) and PAM formats support" ON
442   VISIBLE_IF TRUE
443   VERIFY HAVE_IMGCODEC_PXM)
444 OCV_OPTION(WITH_IMGCODEC_PFM "Include PFM formats support" ON
445   VISIBLE_IF TRUE
446   VERIFY HAVE_IMGCODEC_PFM)
447 OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON
448   VISIBLE_IF TRUE
449   VERIFY HAVE_QUIRC)
450 OCV_OPTION(WITH_ANDROID_MEDIANDK "Use Android Media NDK for Video I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 20)
451   VISIBLE_IF ANDROID
452   VERIFY HAVE_ANDROID_MEDIANDK)
453 OCV_OPTION(WITH_ANDROID_NATIVE_CAMERA "Use Android NDK for Camera I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 23)
454   VISIBLE_IF ANDROID
455   VERIFY HAVE_ANDROID_NATIVE_CAMERA)
456 OCV_OPTION(WITH_TENGINE "Include Arm Inference Tengine support" OFF
457   VISIBLE_IF (ARM OR AARCH64) AND (UNIX OR ANDROID) AND NOT IOS
458   VERIFY HAVE_TENGINE)
459 OCV_OPTION(WITH_ONNX "Include Microsoft ONNX Runtime support" OFF
460   VISIBLE_IF TRUE
461   VERIFY HAVE_ONNX)
462 OCV_OPTION(WITH_TIMVX "Include Tim-VX support" OFF
463   VISIBLE_IF TRUE
464   VERIFY HAVE_TIMVX)
465 OCV_OPTION(WITH_OBSENSOR "Include obsensor support (Orbbec RGB-D modules: Astra+/Femto)" ON
466   VISIBLE_IF (WIN32 AND NOT ARM AND NOT WINRT) OR ( UNIX AND NOT APPLE AND NOT ANDROID)
467   VERIFY HAVE_OBSENSOR)
468
469 # OpenCV build components
470 # ===================================================
471 OCV_OPTION(BUILD_SHARED_LIBS        "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" NOT (ANDROID OR APPLE_FRAMEWORK) )
472 OCV_OPTION(BUILD_opencv_apps        "Build utility applications (used for example to train classifiers)" (NOT ANDROID AND NOT WINRT) IF (NOT APPLE_FRAMEWORK) )
473 OCV_OPTION(BUILD_opencv_js          "Build JavaScript bindings by Emscripten" OFF )
474 OCV_OPTION(BUILD_ANDROID_PROJECTS   "Build Android projects providing .apk files" ON  IF ANDROID )
475 OCV_OPTION(BUILD_ANDROID_EXAMPLES   "Build examples for Android platform"         ON  IF ANDROID )
476 OCV_OPTION(BUILD_DOCS               "Create build rules for OpenCV Documentation" OFF  IF (NOT WINRT AND NOT APPLE_FRAMEWORK))
477 OCV_OPTION(BUILD_EXAMPLES           "Build all examples"                          OFF )
478 OCV_OPTION(BUILD_PACKAGE            "Enables 'make package_source' command"       ON  IF NOT WINRT)
479 OCV_OPTION(BUILD_PERF_TESTS         "Build performance tests"                     NOT INSTALL_CREATE_DISTRIB  IF (NOT APPLE_FRAMEWORK) )
480 OCV_OPTION(BUILD_TESTS              "Build accuracy & regression tests"           NOT INSTALL_CREATE_DISTRIB  IF (NOT APPLE_FRAMEWORK) )
481 OCV_OPTION(BUILD_WITH_DEBUG_INFO    "Include debug info into release binaries ('OFF' means default settings)" OFF )
482 OCV_OPTION(BUILD_WITH_STATIC_CRT    "Enables use of statically linked CRT for statically linked OpenCV" ON IF MSVC )
483 OCV_OPTION(BUILD_WITH_DYNAMIC_IPP   "Enables dynamic linking of IPP (only for standalone IPP)" OFF )
484 OCV_OPTION(BUILD_FAT_JAVA_LIB       "Create Java wrapper exporting all functions of OpenCV library (requires static build of OpenCV modules)" ANDROID IF NOT BUILD_SHARED_LIBS)
485 OCV_OPTION(BUILD_ANDROID_SERVICE    "Build OpenCV Manager for Google Play" OFF IF ANDROID )
486 OCV_OPTION(BUILD_CUDA_STUBS         "Build CUDA modules stubs when no CUDA SDK" OFF  IF (NOT APPLE_FRAMEWORK) )
487 OCV_OPTION(BUILD_JAVA               "Enable Java support"                         (ANDROID OR NOT CMAKE_CROSSCOMPILING)  IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
488 OCV_OPTION(BUILD_OBJC               "Enable Objective-C support"                  ON  IF APPLE_FRAMEWORK )
489 OCV_OPTION(BUILD_KOTLIN_EXTENSIONS  "Build Kotlin extensions (Android)"           ON  IF ANDROID )
490
491 # OpenCV installation options
492 # ===================================================
493 OCV_OPTION(INSTALL_CREATE_DISTRIB   "Change install rules to build the distribution package" OFF )
494 OCV_OPTION(INSTALL_BIN_EXAMPLES     "Install prebuilt examples" WIN32 IF BUILD_EXAMPLES)
495 OCV_OPTION(INSTALL_C_EXAMPLES       "Install C examples"        OFF )
496 OCV_OPTION(INSTALL_PYTHON_EXAMPLES  "Install Python examples"   OFF )
497 OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples"  OFF IF ANDROID )
498 OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT APPLE_FRAMEWORK AND BUILD_SHARED_LIBS) )
499 OCV_OPTION(INSTALL_TESTS            "Install accuracy and performance test binaries and test data" OFF)
500
501 # OpenCV build options
502 # ===================================================
503 OCV_OPTION(ENABLE_CCACHE              "Use ccache"                                               (UNIX AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja" OR CMAKE_GENERATOR MATCHES "Xcode")) )
504 OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers"                                  MSVC IF (MSVC OR (NOT IOS AND NOT CMAKE_CROSSCOMPILING) ) )
505 OCV_OPTION(ENABLE_SOLUTION_FOLDERS    "Solution folder in Visual Studio or in other IDEs"        (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) )
506 OCV_OPTION(ENABLE_PROFILING           "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF  IF CV_GCC )
507 OCV_OPTION(ENABLE_COVERAGE            "Enable coverage collection with  GCov"                    OFF  IF CV_GCC )
508 OCV_OPTION(OPENCV_ENABLE_MEMORY_SANITIZER "Better support for memory/address sanitizers"         OFF)
509 OCV_OPTION(ENABLE_OMIT_FRAME_POINTER  "Enable -fomit-frame-pointer for GCC"                      ON   IF CV_GCC )
510 OCV_OPTION(ENABLE_POWERPC             "Enable PowerPC for GCC"                                   ON   IF (CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
511 OCV_OPTION(ENABLE_FAST_MATH           "Enable compiler options for fast math optimizations on FP computations (not recommended)" OFF)
512 if(NOT IOS AND (NOT ANDROID OR OPENCV_ANDROID_USE_LEGACY_FLAGS) AND CMAKE_CROSSCOMPILING)  # Use CPU_BASELINE instead
513 OCV_OPTION(ENABLE_NEON                "Enable NEON instructions"                                 (NEON OR ANDROID_ARM_NEON OR AARCH64) IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
514 OCV_OPTION(ENABLE_VFPV3               "Enable VFPv3-D32 instructions"                            OFF  IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
515 endif()
516 OCV_OPTION(ENABLE_NOISY_WARNINGS      "Show all warnings even if they are too noisy"             OFF )
517 OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors"                                 OFF )
518 OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF  IF ANDROID )
519 OCV_OPTION(ENABLE_IMPL_COLLECTION     "Collect implementation data on function call"             OFF )
520 OCV_OPTION(ENABLE_INSTRUMENTATION     "Instrument functions to collect calls trace and performance" OFF )
521 OCV_OPTION(ENABLE_GNU_STL_DEBUG       "Enable GNU STL Debug mode (defines _GLIBCXX_DEBUG)"       OFF IF CV_GCC )
522 OCV_OPTION(ENABLE_BUILD_HARDENING     "Enable hardening of the resulting binaries (against security attacks, detects memory corruption, etc)" OFF)
523 OCV_OPTION(ENABLE_LTO                 "Enable Link Time Optimization" OFF IF CV_GCC OR MSVC)
524 OCV_OPTION(ENABLE_THIN_LTO            "Enable Thin LTO" OFF IF CV_CLANG)
525 OCV_OPTION(GENERATE_ABI_DESCRIPTOR    "Generate XML file for abi_compliance_checker tool" OFF IF UNIX)
526 OCV_OPTION(OPENCV_GENERATE_PKGCONFIG  "Generate .pc file for pkg-config build tool (deprecated)" OFF)
527 OCV_OPTION(CV_ENABLE_INTRINSICS       "Use intrinsic-based optimized code" ON )
528 OCV_OPTION(CV_DISABLE_OPTIMIZATION    "Disable explicit optimized code (dispatched code/intrinsics/loop unrolling/etc)" OFF )
529 OCV_OPTION(CV_TRACE                   "Enable OpenCV code trace" ON)
530 OCV_OPTION(OPENCV_GENERATE_SETUPVARS  "Generate setup_vars* scripts" ON IF (NOT ANDROID AND NOT APPLE_FRAMEWORK) )
531 OCV_OPTION(ENABLE_CONFIG_VERIFICATION "Fail build if actual configuration doesn't match requested (WITH_XXX != HAVE_XXX)" OFF)
532 OCV_OPTION(OPENCV_ENABLE_MEMALIGN     "Enable posix_memalign or memalign usage" ON)
533 OCV_OPTION(OPENCV_DISABLE_FILESYSTEM_SUPPORT "Disable filesystem support" OFF)
534 OCV_OPTION(OPENCV_DISABLE_THREAD_SUPPORT "Build the library without multi-threaded code." OFF)
535 OCV_OPTION(OPENCV_SEMIHOSTING         "Build the library for semihosting target (Arm). See https://developer.arm.com/documentation/100863/latest." OFF)
536
537 OCV_OPTION(ENABLE_PYLINT              "Add target with Pylint checks"                            (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
538 OCV_OPTION(ENABLE_FLAKE8              "Add target with Python flake8 checker"                    (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
539
540 if(ENABLE_IMPL_COLLECTION)
541   add_definitions(-DCV_COLLECT_IMPL_DATA)
542 endif()
543
544 if(OPENCV_DISABLE_FILESYSTEM_SUPPORT)
545   add_definitions(-DOPENCV_HAVE_FILESYSTEM_SUPPORT=0)
546 endif()
547
548 set(OPENCV_MATHJAX_RELPATH "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0" CACHE STRING "URI to a MathJax installation")
549
550 # ----------------------------------------------------------------------------
551 #  Get actual OpenCV version number from sources
552 # ----------------------------------------------------------------------------
553 include(cmake/OpenCVVersion.cmake)
554
555 ocv_cmake_hook(POST_OPTIONS)
556
557 # ----------------------------------------------------------------------------
558 #  Build & install layouts
559 # ----------------------------------------------------------------------------
560
561 if(OPENCV_TEST_DATA_PATH)
562   get_filename_component(OPENCV_TEST_DATA_PATH ${OPENCV_TEST_DATA_PATH} ABSOLUTE)
563 endif()
564
565 # Save libs and executables in the same place
566 set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications")
567
568 if(ANDROID)
569   set(LIBRARY_OUTPUT_PATH                "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
570   ocv_update(3P_LIBRARY_OUTPUT_PATH      "${OpenCV_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}")
571 else()
572   set(LIBRARY_OUTPUT_PATH                "${OpenCV_BINARY_DIR}/lib")
573   ocv_update(3P_LIBRARY_OUTPUT_PATH      "${OpenCV_BINARY_DIR}/3rdparty/lib")
574 endif()
575
576 if(ANDROID)
577   if(ANDROID_ABI MATCHES "NEON")
578     set(ENABLE_NEON ON)
579   endif()
580   if(ANDROID_ABI MATCHES "VFPV3")
581     set(ENABLE_VFPV3 ON)
582   endif()
583 endif()
584
585 if(WIN32)
586   # Postfix of DLLs:
587   ocv_update(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}")
588   ocv_update(OPENCV_DEBUG_POSTFIX d)
589 else()
590   # Postfix of so's:
591   ocv_update(OPENCV_DLLVERSION "")
592   ocv_update(OPENCV_DEBUG_POSTFIX "")
593 endif()
594
595 if(DEFINED CMAKE_DEBUG_POSTFIX)
596   set(OPENCV_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
597 endif()
598
599 if((INSTALL_CREATE_DISTRIB AND BUILD_SHARED_LIBS AND NOT DEFINED BUILD_opencv_world) OR APPLE_FRAMEWORK)
600   set(BUILD_opencv_world ON CACHE INTERNAL "")
601 endif()
602
603 include(cmake/OpenCVInstallLayout.cmake)
604
605 # ----------------------------------------------------------------------------
606 #  Path for build/platform -specific headers
607 # ----------------------------------------------------------------------------
608 ocv_update(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
609 ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
610
611 # ----------------------------------------------------------------------------
612 #  Path for additional modules
613 # ----------------------------------------------------------------------------
614 set(OPENCV_EXTRA_MODULES_PATH "" CACHE PATH "Where to look for additional OpenCV modules (can be ;-separated list of paths)")
615
616 # ----------------------------------------------------------------------------
617 #  Autodetect if we are in a GIT repository
618 # ----------------------------------------------------------------------------
619 find_host_package(Git QUIET)
620
621 if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
622   ocv_git_describe(OPENCV_VCSVERSION "${OpenCV_SOURCE_DIR}")
623 elseif(NOT DEFINED OPENCV_VCSVERSION)
624   # We don't have git:
625   set(OPENCV_VCSVERSION "unknown")
626 endif()
627
628
629 # ----------------------------------------------------------------------------
630 # OpenCV compiler and linker options
631 # ----------------------------------------------------------------------------
632
633 ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)
634
635 # --- Python Support ---
636 if(NOT IOS)
637   include(cmake/OpenCVDetectPython.cmake)
638 endif()
639
640 include(cmake/OpenCVCompilerOptions.cmake)
641
642 ocv_cmake_hook(POST_COMPILER_OPTIONS)
643
644 # ----------------------------------------------------------------------------
645 #       CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC..
646 # ----------------------------------------------------------------------------
647 if(UNIX OR MINGW)
648   if(NOT APPLE_FRAMEWORK OR OPENCV_ENABLE_PKG_CONFIG)
649     if(CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{PKG_CONFIG_LIBDIR} AND NOT DEFINED ENV{PKG_CONFIG_SYSROOT_DIR}
650         AND NOT OPENCV_ENABLE_PKG_CONFIG
651     )
652       if(NOT PkgConfig_FOUND)
653         message(STATUS "OpenCV disables pkg-config to avoid using of host libraries. Consider using PKG_CONFIG_LIBDIR to specify target SYSROOT")
654       elseif(OPENCV_SKIP_PKG_CONFIG_WARNING)
655         message(WARNING "pkg-config is enabled in cross-compilation mode without defining of PKG_CONFIG_LIBDIR environment variable. This may lead to misconfigured host-based dependencies.")
656       endif()
657     elseif(OPENCV_DISABLE_PKG_CONFIG)
658       if(PkgConfig_FOUND)
659         message(WARNING "OPENCV_DISABLE_PKG_CONFIG flag has no effect")
660       endif()
661     else()
662       find_package(PkgConfig QUIET)
663     endif()
664   endif()
665   include(CheckFunctionExists)
666   include(CheckIncludeFile)
667   include(CheckSymbolExists)
668
669   if(NOT APPLE)
670     CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD)
671     if(ANDROID)
672       set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m log)
673     elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|NetBSD|DragonFly|OpenBSD|Haiku")
674       set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m pthread)
675     elseif(EMSCRIPTEN)
676       # no need to link to system libs with emscripten
677     elseif(QNXNTO)
678       set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m)
679     elseif(MINGW)
680       set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} pthread)
681     else()
682       set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
683     endif()
684   else()
685     set(HAVE_PTHREAD 1)
686   endif()
687
688   # Ensure that libpthread is not listed as one of the libraries to pass to the linker.
689   if (OPENCV_DISABLE_THREAD_SUPPORT)
690     list(REMOVE_ITEM OPENCV_LINKER_LIBS pthread)
691   endif()
692
693   if(OPENCV_ENABLE_MEMALIGN)
694     CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
695     CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
696     if(HAVE_MALLOC_H)
697       CHECK_SYMBOL_EXISTS(memalign malloc.h HAVE_MEMALIGN)
698     endif()
699     # TODO:
700     # - std::aligned_alloc() C++17 / C11
701   endif()
702 elseif(WIN32)
703   include(CheckIncludeFile)
704   include(CheckSymbolExists)
705
706   if(OPENCV_ENABLE_MEMALIGN)
707     CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
708     if(HAVE_MALLOC_H)
709       CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE_WIN32_ALIGNED_MALLOC)
710     endif()
711   endif()
712 endif()
713
714 include(cmake/OpenCVPCHSupport.cmake)
715 include(cmake/OpenCVModule.cmake)
716
717 # ----------------------------------------------------------------------------
718 #  Detect endianness of build platform
719 # ----------------------------------------------------------------------------
720
721 if(IOS)
722   # test_big_endian needs try_compile, which doesn't work for iOS
723   # http://public.kitware.com/Bug/view.php?id=12288
724   set(WORDS_BIGENDIAN 0)
725 else()
726   include(TestBigEndian)
727   test_big_endian(WORDS_BIGENDIAN)
728 endif()
729
730 # ----------------------------------------------------------------------------
731 #  Detect 3rd-party libraries
732 # ----------------------------------------------------------------------------
733
734 if(ANDROID AND WITH_CPUFEATURES)
735   add_subdirectory(3rdparty/cpufeatures)
736   set(HAVE_CPUFEATURES 1)
737 endif()
738
739 include(cmake/OpenCVFindFrameworks.cmake)
740
741 include(cmake/OpenCVFindLibsGrfmt.cmake)
742 include(cmake/OpenCVFindLibsGUI.cmake)
743 include(cmake/OpenCVFindLibsVideo.cmake)
744 include(cmake/OpenCVFindLibsPerf.cmake)
745 include(cmake/OpenCVFindLAPACK.cmake)
746 include(cmake/OpenCVFindProtobuf.cmake)
747 if(WITH_TENGINE)
748   include(cmake/OpenCVFindTengine.cmake)
749 endif()
750 if(WITH_TIMVX)
751   include(cmake/OpenCVFindTIMVX.cmake)
752 endif()
753
754 # ----------------------------------------------------------------------------
755 #  Detect other 3rd-party libraries/tools
756 # ----------------------------------------------------------------------------
757
758 # --- Java Support ---
759 if(BUILD_JAVA)
760   if(ANDROID)
761     include(cmake/android/OpenCVDetectAndroidSDK.cmake)
762   else()
763     include(cmake/OpenCVDetectApacheAnt.cmake)
764     find_package(JNI)
765   endif()
766 endif()
767
768 if(ENABLE_PYLINT AND PYTHON_DEFAULT_AVAILABLE)
769   include(cmake/OpenCVPylint.cmake)
770 endif()
771 if(ENABLE_FLAKE8 AND PYTHON_DEFAULT_AVAILABLE)
772   find_package(Flake8 QUIET)
773   if(NOT FLAKE8_FOUND OR NOT FLAKE8_EXECUTABLE)
774     include("${CMAKE_CURRENT_LIST_DIR}/cmake/FindFlake8.cmake")
775   endif()
776   if(FLAKE8_FOUND)
777     list(APPEND OPENCV_FLAKE8_EXCLUDES ".git" "__pycache__" "config.py" "*.config.py" "config-*.py")
778     list(APPEND OPENCV_FLAKE8_EXCLUDES "svgfig.py")  # 3rdparty
779     if(NOT PYTHON3_VERSION_STRING VERSION_GREATER 3.6)
780       # Python 3.6+ (PEP 526): variable annotations (type hints)
781       list(APPEND OPENCV_FLAKE8_EXCLUDES "samples/dnn/dnn_model_runner/dnn_conversion/common/test/configs")
782     endif()
783     string(REPLACE ";" "," OPENCV_FLAKE8_EXCLUDES_STR "${OPENCV_FLAKE8_EXCLUDES}")
784     add_custom_target(check_flake8
785         COMMAND "${FLAKE8_EXECUTABLE}" . --count --select=E9,E901,E999,F821,F822,F823 --show-source --statistics --exclude='${OPENCV_FLAKE8_EXCLUDES_STR}'
786         WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
787         COMMENT "Running flake8"
788     )
789   endif()
790 endif()
791
792
793 if(ANDROID AND ANDROID_EXECUTABLE AND ANT_EXECUTABLE AND (ANT_VERSION VERSION_GREATER 1.7) AND (ANDROID_TOOLS_Pkg_Revision GREATER 13))
794   SET(CAN_BUILD_ANDROID_PROJECTS TRUE)
795 else()
796   SET(CAN_BUILD_ANDROID_PROJECTS FALSE)
797 endif()
798
799 # --- OpenCL ---
800 if(WITH_OPENCL)
801   include(cmake/OpenCVDetectOpenCL.cmake)
802 endif()
803
804 # --- Halide ---
805 if(WITH_HALIDE)
806   include(cmake/OpenCVDetectHalide.cmake)
807 endif()
808
809 # --- VkCom ---
810 if(WITH_VULKAN)
811   include(cmake/OpenCVDetectVulkan.cmake)
812 endif()
813
814 # --- WebNN ---
815 if(WITH_WEBNN)
816   include(cmake/OpenCVDetectWebNN.cmake)
817 endif()
818
819 # --- Inference Engine ---
820 if(WITH_INF_ENGINE OR WITH_OPENVINO)
821   include(cmake/OpenCVDetectInferenceEngine.cmake)
822 endif()
823
824 # --- DirectX ---
825 if(WITH_DIRECTX)
826   include(cmake/OpenCVDetectDirectX.cmake)
827 endif()
828
829 if(WITH_VTK)
830   include(cmake/OpenCVDetectVTK.cmake)
831 endif()
832
833 if(WITH_OPENVX)
834   include(cmake/FindOpenVX.cmake)
835 endif()
836
837 if(WITH_QUIRC)
838   add_subdirectory(3rdparty/quirc)
839   set(HAVE_QUIRC TRUE)
840 endif()
841
842 if(WITH_ONNX)
843   include(cmake/FindONNX.cmake)
844 endif()
845
846 # ----------------------------------------------------------------------------
847 # OpenCV HAL
848 # ----------------------------------------------------------------------------
849 set(_hal_includes "")
850 macro(ocv_hal_register HAL_LIBRARIES_VAR HAL_HEADERS_VAR HAL_INCLUDE_DIRS_VAR)
851   # 1. libraries
852   foreach (l ${${HAL_LIBRARIES_VAR}})
853     if(NOT TARGET ${l})
854       get_filename_component(l "${l}" ABSOLUTE)
855     endif()
856     list(APPEND OPENCV_HAL_LINKER_LIBS ${l})
857   endforeach()
858   # 2. headers
859   foreach (h ${${HAL_HEADERS_VAR}})
860     set(_hal_includes "${_hal_includes}\n#include \"${h}\"")
861   endforeach()
862   # 3. include paths
863   ocv_include_directories(${${HAL_INCLUDE_DIRS_VAR}})
864 endmacro()
865
866 if(NOT DEFINED OpenCV_HAL)
867   set(OpenCV_HAL "OpenCV_HAL")
868 endif()
869
870 if(HAVE_OPENVX)
871   if(NOT ";${OpenCV_HAL};" MATCHES ";openvx;")
872     set(OpenCV_HAL "openvx;${OpenCV_HAL}")
873   endif()
874 endif()
875
876 if(WITH_CAROTENE)
877   ocv_debug_message(STATUS "Enable carotene acceleration")
878   if(NOT ";${OpenCV_HAL};" MATCHES ";carotene;")
879     set(OpenCV_HAL "carotene;${OpenCV_HAL}")
880   endif()
881 endif()
882
883 foreach(hal ${OpenCV_HAL})
884   if(hal STREQUAL "carotene")
885     if(";${CPU_BASELINE_FINAL};" MATCHES ";NEON;")
886       add_subdirectory(3rdparty/carotene/hal)
887       ocv_hal_register(CAROTENE_HAL_LIBRARIES CAROTENE_HAL_HEADERS CAROTENE_HAL_INCLUDE_DIRS)
888       list(APPEND OpenCV_USED_HAL "carotene (ver ${CAROTENE_HAL_VERSION})")
889     else()
890       message(STATUS "Carotene: NEON is not available, disabling carotene...")
891     endif()
892   elseif(hal STREQUAL "openvx")
893     add_subdirectory(3rdparty/openvx)
894     ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS)
895     list(APPEND OpenCV_USED_HAL "openvx (ver ${OPENVX_HAL_VERSION})")
896   else()
897     ocv_debug_message(STATUS "OpenCV HAL: ${hal} ...")
898     ocv_clear_vars(OpenCV_HAL_LIBRARIES OpenCV_HAL_HEADERS OpenCV_HAL_INCLUDE_DIRS)
899     find_package(${hal} NO_MODULE QUIET)
900     if(${hal}_FOUND)
901       ocv_hal_register(OpenCV_HAL_LIBRARIES OpenCV_HAL_HEADERS OpenCV_HAL_INCLUDE_DIRS)
902       list(APPEND OpenCV_USED_HAL "${hal} (ver ${${hal}_VERSION})")
903     endif()
904   endif()
905 endforeach()
906 configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/custom_hal.hpp.in" "${CMAKE_BINARY_DIR}/custom_hal.hpp" @ONLY)
907 unset(_hal_includes)
908
909
910 # ----------------------------------------------------------------------------
911 # Code trace support
912 # ----------------------------------------------------------------------------
913 if(CV_TRACE)
914   include(cmake/OpenCVDetectTrace.cmake)
915 endif()
916
917 ocv_cmake_hook(POST_DETECT_DEPENDECIES)  # typo, deprecated (2019-06)
918 ocv_cmake_hook(POST_DETECT_DEPENDENCIES)
919
920 # ----------------------------------------------------------------------------
921 # Solution folders:
922 # ----------------------------------------------------------------------------
923 if(ENABLE_SOLUTION_FOLDERS)
924   set_property(GLOBAL PROPERTY USE_FOLDERS ON)
925   set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
926 endif()
927
928 # Extra OpenCV targets: uninstall, package_source, perf, etc.
929 include(cmake/OpenCVExtraTargets.cmake)
930
931 # ----------------------------------------------------------------------------
932 # Process subdirectories
933 # ----------------------------------------------------------------------------
934
935 # opencv.hpp and legacy headers
936 add_subdirectory(include)
937
938 # Enable compiler options for OpenCV modules/apps/samples only (ignore 3rdparty)
939 ocv_add_modules_compiler_options()
940
941 # OpenCV modules
942 ocv_register_modules()
943
944 # Generate targets for documentation
945 add_subdirectory(doc)
946
947 # various data that is used by cv libraries and/or demo applications.
948 add_subdirectory(data)
949
950 # extra applications
951 if(BUILD_opencv_apps)
952   add_subdirectory(apps)
953 endif()
954
955 # examples
956 if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES OR INSTALL_C_EXAMPLES)
957   add_subdirectory(samples)
958 endif()
959
960 if(ANDROID)
961   add_subdirectory(platforms/android/service)
962 endif()
963
964 # ----------------------------------------------------------------------------
965 # Finalization: generate configuration-based files
966 # ----------------------------------------------------------------------------
967
968 ocv_cmake_hook(PRE_FINALIZE)
969
970 # Generate platform-dependent and configuration-dependent headers
971 include(cmake/OpenCVGenHeaders.cmake)
972
973 # Generate opencv.pc for pkg-config command
974 if(OPENCV_GENERATE_PKGCONFIG)
975   include(cmake/OpenCVGenPkgconfig.cmake)
976 endif()
977
978 # Generate OpenCV.mk for ndk-build (Android build tool)
979 include(cmake/OpenCVGenAndroidMK.cmake)
980
981 # Generate OpenCVConfig.cmake and OpenCVConfig-version.cmake for cmake projects
982 include(cmake/OpenCVGenConfig.cmake)
983
984 # Generate Info.plist for the IOS framework
985 if(APPLE_FRAMEWORK)
986   include(cmake/OpenCVGenInfoPlist.cmake)
987 endif()
988
989 # Generate ABI descriptor
990 include(cmake/OpenCVGenABI.cmake)
991
992 # Generate environment setup file
993 if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
994   if(ANDROID)
995     get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY)
996     configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in"
997                    "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
998     install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
999             DESTINATION ./ COMPONENT tests)
1000   elseif(WIN32)
1001     configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_windows.cmd.in"
1002                    "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd" @ONLY)
1003     install(PROGRAMS "${CMAKE_BINARY_DIR}/win-install/opencv_run_all_tests.cmd"
1004             DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
1005   elseif(UNIX)
1006     configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in"
1007                    "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
1008     install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
1009             DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
1010   endif()
1011 endif()
1012
1013 if(NOT OPENCV_README_FILE)
1014   if(ANDROID)
1015     set(OPENCV_README_FILE ${CMAKE_CURRENT_SOURCE_DIR}/platforms/android/README.android)
1016   endif()
1017 endif()
1018
1019 if(NOT OPENCV_LICENSE_FILE)
1020   set(OPENCV_LICENSE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
1021 endif()
1022
1023 # for UNIX it does not make sense as LICENSE and readme will be part of the package automatically
1024 if(ANDROID OR NOT UNIX)
1025   install(FILES ${OPENCV_LICENSE_FILE}
1026         PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
1027         DESTINATION ./ COMPONENT libs)
1028   if(OPENCV_README_FILE)
1029     install(FILES ${OPENCV_README_FILE}
1030             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
1031             DESTINATION ./ COMPONENT libs)
1032   endif()
1033 endif()
1034
1035 if(COMMAND ocv_pylint_finalize)
1036   ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/modules/python/test)
1037   ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/samples/python)
1038   ocv_pylint_add_directory(${CMAKE_CURRENT_LIST_DIR}/samples/dnn)
1039   ocv_pylint_add_directory_recurse(${CMAKE_CURRENT_LIST_DIR}/samples/python/tutorial_code)
1040   ocv_pylint_finalize()
1041 endif()
1042 if(TARGET check_pylint)
1043   message(STATUS "Registered 'check_pylint' target: using ${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}), checks: ${PYLINT_TOTAL_TARGETS}")
1044 endif()
1045 if(TARGET check_flake8)
1046   message(STATUS "Registered 'check_flake8' target: using ${FLAKE8_EXECUTABLE} (ver: ${FLAKE8_VERSION})")
1047 endif()
1048
1049 if(OPENCV_GENERATE_SETUPVARS)
1050   include(cmake/OpenCVGenSetupVars.cmake)
1051 endif()
1052
1053 # ----------------------------------------------------------------------------
1054 # Summary:
1055 # ----------------------------------------------------------------------------
1056 status("")
1057 status("General configuration for OpenCV ${OPENCV_VERSION} =====================================")
1058 if(OPENCV_VCSVERSION)
1059   status("  Version control:" ${OPENCV_VCSVERSION})
1060 endif()
1061 if(OPENCV_EXTRA_MODULES_PATH AND NOT BUILD_INFO_SKIP_EXTRA_MODULES)
1062   set(__dump_extra_header OFF)
1063   foreach(p ${OPENCV_EXTRA_MODULES_PATH})
1064     if(EXISTS ${p})
1065       if(NOT __dump_extra_header)
1066         set(__dump_extra_header ON)
1067         status("")
1068         status("  Extra modules:")
1069       else()
1070         status("")
1071       endif()
1072       ocv_git_describe(EXTRA_MODULES_VCSVERSION "${p}")
1073       status("    Location (extra):" ${p})
1074       status("    Version control (extra):" ${EXTRA_MODULES_VCSVERSION})
1075     endif()
1076   endforeach()
1077   unset(__dump_extra_header)
1078 endif()
1079
1080 # ========================== build platform ==========================
1081 status("")
1082 status("  Platform:")
1083 if(NOT DEFINED OPENCV_TIMESTAMP
1084     AND NOT BUILD_INFO_SKIP_TIMESTAMP
1085 )
1086   string(TIMESTAMP OPENCV_TIMESTAMP "" UTC)
1087   set(OPENCV_TIMESTAMP "${OPENCV_TIMESTAMP}" CACHE STRING "Timestamp of OpenCV build configuration" FORCE)
1088 endif()
1089 if(OPENCV_TIMESTAMP)
1090   status("    Timestamp:"      ${OPENCV_TIMESTAMP})
1091 endif()
1092 status("    Host:"             ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR})
1093 if(CMAKE_CROSSCOMPILING)
1094   status("    Target:"         ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR})
1095 endif()
1096 status("    CMake:"            ${CMAKE_VERSION})
1097 status("    CMake generator:"  ${CMAKE_GENERATOR})
1098 status("    CMake build tool:" ${CMAKE_BUILD_TOOL})
1099 if(MSVC)
1100   status("    MSVC:"           ${MSVC_VERSION})
1101 endif()
1102 if(CMAKE_GENERATOR MATCHES Xcode)
1103   status("    Xcode:"          ${XCODE_VERSION})
1104 endif()
1105 if(CMAKE_GENERATOR MATCHES "Xcode|Visual Studio|Multi-Config")
1106   status("    Configuration:"  ${CMAKE_CONFIGURATION_TYPES})
1107 else()
1108   status("    Configuration:"  ${CMAKE_BUILD_TYPE})
1109 endif()
1110
1111
1112 # ========================= CPU code generation mode =========================
1113 status("")
1114 status("  CPU/HW features:")
1115 status("    Baseline:"  "${CPU_BASELINE_FINAL}")
1116 if(NOT CPU_BASELINE STREQUAL CPU_BASELINE_FINAL)
1117   status("      requested:"  "${CPU_BASELINE}")
1118 endif()
1119 if(CPU_BASELINE_REQUIRE)
1120   status("      required:"  "${CPU_BASELINE_REQUIRE}")
1121 endif()
1122 if(CPU_BASELINE_DISABLE)
1123   status("      disabled:"  "${CPU_BASELINE_DISABLE}")
1124 endif()
1125 if(CPU_DISPATCH_FINAL OR CPU_DISPATCH)
1126   status("    Dispatched code generation:"  "${CPU_DISPATCH_FINAL}")
1127   if(NOT CPU_DISPATCH STREQUAL CPU_DISPATCH_FINAL)
1128     status("      requested:"  "${CPU_DISPATCH}")
1129   endif()
1130   if(CPU_DISPATCH_REQUIRE)
1131     status("      required:"  "${CPU_DISPATCH_REQUIRE}")
1132   endif()
1133   foreach(OPT ${CPU_DISPATCH_FINAL})
1134     status("      ${OPT} (${CPU_${OPT}_USAGE_COUNT} files):"  "+ ${CPU_DISPATCH_${OPT}_INCLUDED}")
1135   endforeach()
1136 endif()
1137
1138 # ========================== C/C++ options ==========================
1139 if(CMAKE_CXX_COMPILER_VERSION)
1140   set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} (ver ${CMAKE_CXX_COMPILER_VERSION})")
1141 else()
1142   set(OPENCV_COMPILER_STR "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}")
1143 endif()
1144 string(STRIP "${OPENCV_COMPILER_STR}" OPENCV_COMPILER_STR)
1145
1146 status("")
1147 status("  C/C++:")
1148 status("    Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
1149 if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD)
1150   status("    C++ standard:"           "${CMAKE_CXX_STANDARD}")
1151 endif()
1152 status("    C++ Compiler:"           ${OPENCV_COMPILER_STR})
1153 status("    C++ flags (Release):"    ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
1154 status("    C++ flags (Debug):"      ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
1155 status("    C Compiler:"             ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1})
1156 status("    C flags (Release):"      ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE})
1157 status("    C flags (Debug):"        ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG})
1158 if(WIN32)
1159   status("    Linker flags (Release):" ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE})
1160   status("    Linker flags (Debug):"   ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG})
1161 else()
1162   status("    Linker flags (Release):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE})
1163   status("    Linker flags (Debug):"   ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
1164 endif()
1165 status("    ccache:"                  OPENCV_COMPILER_IS_CCACHE THEN YES ELSE NO)
1166 status("    Precompiled headers:"     PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS THEN YES ELSE NO)
1167
1168 if(OPENCV_DISABLE_FILESYSTEM_SUPPORT)
1169   status("    Filesystem support is disabled")
1170 endif()
1171
1172 # ========================== Dependencies ============================
1173 ocv_get_all_libs(deps_modules deps_extra deps_3rdparty)
1174 status("    Extra dependencies:" ${deps_extra})
1175 status("    3rdparty dependencies:" ${deps_3rdparty})
1176
1177 # ========================== OpenCV modules ==========================
1178 status("")
1179 status("  OpenCV modules:")
1180 set(OPENCV_MODULES_BUILD_ST "")
1181 foreach(the_module ${OPENCV_MODULES_BUILD})
1182   if(NOT OPENCV_MODULE_${the_module}_CLASS STREQUAL "INTERNAL" OR the_module STREQUAL "opencv_ts")
1183     list(APPEND OPENCV_MODULES_BUILD_ST "${the_module}")
1184   endif()
1185 endforeach()
1186 string(REPLACE "opencv_" "" OPENCV_MODULES_BUILD_ST          "${OPENCV_MODULES_BUILD_ST}")
1187 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_USER_ST  "${OPENCV_MODULES_DISABLED_USER}")
1188 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_AUTO_ST  "${OPENCV_MODULES_DISABLED_AUTO}")
1189 string(REPLACE "opencv_" "" OPENCV_MODULES_DISABLED_FORCE_ST "${OPENCV_MODULES_DISABLED_FORCE}")
1190 list(SORT OPENCV_MODULES_BUILD_ST)
1191 list(SORT OPENCV_MODULES_DISABLED_USER_ST)
1192 list(SORT OPENCV_MODULES_DISABLED_AUTO_ST)
1193 list(SORT OPENCV_MODULES_DISABLED_FORCE_ST)
1194 status("    To be built:"            OPENCV_MODULES_BUILD          THEN ${OPENCV_MODULES_BUILD_ST}          ELSE "-")
1195 status("    Disabled:"               OPENCV_MODULES_DISABLED_USER  THEN ${OPENCV_MODULES_DISABLED_USER_ST}  ELSE "-")
1196 status("    Disabled by dependency:" OPENCV_MODULES_DISABLED_AUTO  THEN ${OPENCV_MODULES_DISABLED_AUTO_ST}  ELSE "-")
1197 status("    Unavailable:"            OPENCV_MODULES_DISABLED_FORCE THEN ${OPENCV_MODULES_DISABLED_FORCE_ST} ELSE "-")
1198
1199 ocv_build_features_string(apps_status
1200   IF BUILD_TESTS AND HAVE_opencv_ts THEN "tests"
1201   IF BUILD_PERF_TESTS AND HAVE_opencv_ts THEN "perf_tests"
1202   IF BUILD_EXAMPLES THEN "examples"
1203   IF BUILD_opencv_apps THEN "apps"
1204   IF BUILD_ANDROID_SERVICE THEN "android_service"
1205   IF (BUILD_ANDROID_EXAMPLES OR INSTALL_ANDROID_EXAMPLES) AND CAN_BUILD_ANDROID_PROJECTS THEN "android_examples"
1206   ELSE "-")
1207 status("    Applications:" "${apps_status}")
1208 ocv_build_features_string(docs_status
1209     IF TARGET doxygen_cpp THEN "doxygen"
1210     IF TARGET doxygen_python THEN "python"
1211     IF TARGET doxygen_javadoc THEN "javadoc"
1212     IF BUILD_opencv_js OR DEFINED OPENCV_JS_LOCATION THEN "js"
1213     ELSE "NO"
1214 )
1215 status("    Documentation:" "${docs_status}")
1216 status("    Non-free algorithms:" OPENCV_ENABLE_NONFREE THEN "YES" ELSE "NO")
1217
1218 # ========================== Android details ==========================
1219 if(ANDROID)
1220   status("")
1221   if(DEFINED ANDROID_NDK_REVISION)
1222     set(__msg "${ANDROID_NDK} (ver ${ANDROID_NDK_REVISION})")
1223   else()
1224     set(__msg "location: ${ANDROID_NDK}")
1225   endif()
1226   status("  Android NDK: " ${__msg})
1227   status("    Android ABI:" ${ANDROID_ABI})
1228   if(BUILD_WITH_STANDALONE_TOOLCHAIN)
1229     status("    NDK toolchain:" "standalone: ${ANDROID_STANDALONE_TOOLCHAIN}")
1230   elseif(BUILD_WITH_ANDROID_NDK OR DEFINED ANDROID_TOOLCHAIN_NAME)
1231     status("    NDK toolchain:" "${ANDROID_TOOLCHAIN_NAME}")
1232   endif()
1233   status("    STL type:" ${ANDROID_STL})
1234   status("    Native API level:" ${ANDROID_NATIVE_API_LEVEL})
1235
1236   if(BUILD_ANDROID_PROJECTS)
1237     status("  Android SDK: " "${ANDROID_SDK} (tools: ${ANDROID_SDK_TOOLS_VERSION} build tools: ${ANDROID_SDK_BUILD_TOOLS_VERSION})")
1238     if(ANDROID_EXECUTABLE)
1239       status("    android tool:"  "${ANDROID_EXECUTABLE}")
1240     endif()
1241   else()
1242     status("  Android SDK: " "not used, projects are not built")
1243   endif()
1244   if(DEFINED ANDROID_SDK_COMPATIBLE_TARGET)
1245     status("    SDK target:" "${ANDROID_SDK_COMPATIBLE_TARGET}")
1246   endif()
1247   if(DEFINED ANDROID_PROJECTS_BUILD_TYPE)
1248     if(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT")
1249       status("    Projects build scripts:" "Ant/Eclipse compatible")
1250     elseif(ANDROID_PROJECTS_BUILD_TYPE STREQUAL "ANT")
1251       status("    Projects build scripts:" "Gradle")
1252     endif()
1253   endif()
1254 endif()
1255
1256 # ================== Windows RT features ==================
1257 if(WIN32)
1258 status("")
1259 status("  Windows RT support:" WINRT THEN YES ELSE NO)
1260   if(WINRT)
1261     status("    Building for Microsoft platform: " ${CMAKE_SYSTEM_NAME})
1262     status("    Building for architectures: " ${CMAKE_VS_EFFECTIVE_PLATFORMS})
1263     status("    Building for version: " ${CMAKE_SYSTEM_VERSION})
1264     if (DEFINED ENABLE_WINRT_MODE_NATIVE)
1265       status("    Building for C++ without CX extensions")
1266     endif()
1267   endif()
1268 endif(WIN32)
1269
1270 # ========================== GUI ==========================
1271 status("")
1272 status("  GUI: " "${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
1273
1274 if(WITH_WAYLAND OR HAVE_WAYLAND)
1275   if(HAVE_WAYLAND_CLIENT)
1276     status("    Wayland Client:" "YES (ver ${WAYLAND_CLIENT_VERSION})")
1277   endif()
1278   if(HAVE_WAYLAND_CURSOR)
1279     status("    Wayland Cursor:" "YES (ver ${WAYLAND_CURSOR_VERSION})")
1280   endif()
1281   if(HAVE_WAYLAND_PROTOCOL)
1282     status("    Wayland Protocol:" "YES (ver ${WAYLAND_PROTOCOL_VERSION})")
1283   endif()
1284   if(HAVE_WAYLAND_EGL)
1285     status("    Wayland EGL:" "YES (ver ${WAYLAND_EGL_VERSION})")
1286   endif()
1287   if(HAVE_XKBCOMMON)
1288     status("    Xkbcommon:" "YES (ver ${XKBCOMMON_VERSION})")
1289   endif()
1290 endif()
1291
1292 if(WITH_QT OR HAVE_QT)
1293   if(HAVE_QT)
1294     status("    QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
1295     if(HAVE_QT_OPENGL)
1296       if(Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES)
1297         status("      QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES} ${Qt${QT_VERSION_MAJOR}OpenGL_VERSION_STRING})" ELSE NO)
1298       else()
1299         status("      QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
1300       endif()
1301     else()
1302       status("      QT OpenGL support:" "NO")
1303     endif()
1304   else()
1305     status("    QT:" "NO")
1306   endif()
1307 endif()
1308
1309 if(WITH_WIN32UI)
1310   status("    Win32 UI:" HAVE_WIN32UI THEN YES ELSE NO)
1311 endif()
1312
1313 if(HAVE_COCOA)  # APPLE
1314   status("    Cocoa:"  YES)
1315 endif()
1316
1317 if(WITH_GTK OR HAVE_GTK)
1318   if(HAVE_GTK3)
1319     status("    GTK+:" "YES (ver ${GTK3_VERSION})")
1320   elseif(HAVE_GTK)
1321     status("    GTK+:" "YES (ver ${GTK2_VERSION})")
1322   else()
1323     status("    GTK+:" "NO")
1324   endif()
1325   if(HAVE_GTK)
1326     status(  "      GThread :" HAVE_GTHREAD THEN "YES (ver ${GTHREAD_VERSION})" ELSE NO)
1327     status(  "      GtkGlExt:" HAVE_GTKGLEXT THEN "YES (ver ${GTKGLEXT_VERSION})" ELSE NO)
1328   endif()
1329 endif()
1330
1331 if(WITH_OPENGL OR HAVE_OPENGL)
1332   status("    OpenGL support:" HAVE_OPENGL THEN "YES (${OPENGL_LIBRARIES})" ELSE NO)
1333 endif()
1334
1335 if(WITH_VTK OR HAVE_VTK)
1336   status("    VTK support:" HAVE_VTK THEN "YES (ver ${VTK_VERSION})" ELSE NO)
1337 endif()
1338
1339 # ========================== MEDIA IO ==========================
1340 status("")
1341 status("  Media I/O: ")
1342 status("    ZLib:"   ZLIB_FOUND THEN "${ZLIB_LIBRARIES} (ver ${ZLIB_VERSION_STRING})" ELSE "build (ver ${ZLIB_VERSION_STRING})")
1343
1344 if(WITH_JPEG OR HAVE_JPEG)
1345   if(NOT HAVE_JPEG)
1346     status("    JPEG:" NO)
1347   elseif(BUILD_JPEG)
1348     status("    JPEG:" "build-${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
1349     if(ENABLE_LIBJPEG_TURBO_SIMD)
1350       status("        SIMD Support Request:" "YES")
1351       if(HAVE_LIBJPEG_TURBO_SIMD)
1352         status("        SIMD Support:" "YES")
1353       else()
1354         status("        SIMD Support:" "NO")
1355       endif()
1356     else()
1357       status("        SIMD Support Request:" "NO")
1358     endif()
1359   else()
1360     status("    JPEG:" "${JPEG_LIBRARY} (ver ${JPEG_LIB_VERSION})")
1361   endif()
1362 endif()
1363
1364 if(WITH_WEBP OR HAVE_WEBP)
1365   status("    WEBP:" WEBP_FOUND THEN "${WEBP_LIBRARY} (ver ${WEBP_VERSION})" ELSE "build (ver ${WEBP_VERSION})")
1366 endif()
1367
1368 if(WITH_PNG OR HAVE_PNG OR WITH_SPNG)
1369   if(WITH_SPNG)
1370     status("    PNG:" "build-${SPNG_LIBRARY} (ver ${SPNG_VERSION})")
1371   else()
1372     status("    PNG:"  PNG_FOUND  THEN "${PNG_LIBRARY} (ver ${PNG_VERSION})" ELSE "build (ver ${PNG_VERSION})")
1373   endif()
1374 endif()
1375
1376 if(WITH_TIFF OR HAVE_TIFF)
1377   status("    TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION} / ${TIFF_VERSION_STRING})" ELSE "build (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})")
1378 endif()
1379
1380 if(HAVE_OPENJPEG)
1381   status("    JPEG 2000:" OpenJPEG_FOUND
1382       THEN "OpenJPEG (ver ${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION})"
1383       ELSE "build (ver ${OPENJPEG_VERSION})"
1384   )
1385 elseif(HAVE_JASPER)
1386   status("    JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build Jasper (ver ${JASPER_VERSION_STRING})")
1387 elseif(WITH_OPENJPEG OR WITH_JASPER)
1388   status("    JPEG 2000:" "NO")
1389 endif()
1390
1391 if(WITH_OPENEXR OR HAVE_OPENEXR)
1392   if(HAVE_OPENEXR)
1393     status("    OpenEXR:" OPENEXR_FOUND THEN "${OPENEXR_LIBRARIES} (ver ${OPENEXR_VERSION})" ELSE "build (ver ${OPENEXR_VERSION})")
1394   else()
1395     status("    OpenEXR:" "NO")
1396   endif()
1397 endif()
1398
1399 if(WITH_GDAL OR HAVE_GDAL)
1400   status("    GDAL:" HAVE_GDAL THEN "YES (${GDAL_LIBRARY})" ELSE "NO")
1401 endif()
1402
1403 if(WITH_GDCM OR HAVE_GDCM)
1404   status("    GDCM:" HAVE_GDCM THEN "YES (${GDCM_VERSION})" ELSE "NO")
1405 endif()
1406
1407 if(WITH_IMGCODEC_HDR OR DEFINED HAVE_IMGCODEC_HDR)
1408   status("    HDR:" HAVE_IMGCODEC_HDR THEN "YES" ELSE "NO")
1409 endif()
1410
1411 if(WITH_IMGCODEC_SUNRASTER OR DEFINED HAVE_IMGCODEC_SUNRASTER)
1412   status("    SUNRASTER:" HAVE_IMGCODEC_SUNRASTER THEN "YES" ELSE "NO")
1413 endif()
1414
1415 if(WITH_IMGCODEC_PXM OR DEFINED HAVE_IMGCODEC_PXM)
1416   status("    PXM:" HAVE_IMGCODEC_PXM THEN "YES" ELSE "NO")
1417 endif()
1418
1419 if(WITH_IMGCODEC_PFM OR DEFINED HAVE_IMGCODEC_PFM)
1420   status("    PFM:" HAVE_IMGCODEC_PFM THEN "YES" ELSE "NO")
1421 endif()
1422
1423 # ========================== VIDEO IO ==========================
1424 status("")
1425 status("  Video I/O:")
1426
1427 if(WITH_1394 OR HAVE_DC1394_2)
1428   status("    DC1394:" HAVE_DC1394_2 THEN "YES (${DC1394_2_VERSION})" ELSE NO)
1429 endif()
1430
1431 if(WITH_FFMPEG OR HAVE_FFMPEG)
1432   if(OPENCV_FFMPEG_USE_FIND_PACKAGE)
1433     status("    FFMPEG:"       HAVE_FFMPEG         THEN "YES (find_package)"                       ELSE "NO (find_package)")
1434   elseif(WIN32)
1435     status("    FFMPEG:"       HAVE_FFMPEG         THEN "YES (prebuilt binaries)"                  ELSE NO)
1436   else()
1437     status("    FFMPEG:"       HAVE_FFMPEG         THEN YES ELSE NO)
1438   endif()
1439   status("      avcodec:"      FFMPEG_libavcodec_VERSION    THEN "YES (${FFMPEG_libavcodec_VERSION})"    ELSE NO)
1440   status("      avformat:"     FFMPEG_libavformat_VERSION   THEN "YES (${FFMPEG_libavformat_VERSION})"   ELSE NO)
1441   status("      avutil:"       FFMPEG_libavutil_VERSION     THEN "YES (${FFMPEG_libavutil_VERSION})"     ELSE NO)
1442   status("      swscale:"      FFMPEG_libswscale_VERSION    THEN "YES (${FFMPEG_libswscale_VERSION})"    ELSE NO)
1443   status("      avresample:"   FFMPEG_libavresample_VERSION THEN "YES (${FFMPEG_libavresample_VERSION})" ELSE NO)
1444 endif()
1445
1446 if(WITH_GSTREAMER OR HAVE_GSTREAMER)
1447   status("    GStreamer:" HAVE_GSTREAMER THEN "YES (${GSTREAMER_VERSION})" ELSE NO)
1448 endif()
1449
1450 if(WITH_OPENNI2 OR HAVE_OPENNI2)
1451   status("    OpenNI2:"        HAVE_OPENNI2    THEN "YES (${OPENNI2_VERSION})" ELSE NO)
1452 endif()
1453
1454 if(WITH_PVAPI OR HAVE_PVAPI)
1455   status("    PvAPI:" HAVE_PVAPI THEN YES ELSE NO)
1456 endif()
1457
1458 if(WITH_ARAVIS OR HAVE_ARAVIS_API)
1459   status("    Aravis SDK:" HAVE_ARAVIS_API THEN "YES (${ARAVIS_VERSION})" ELSE NO)
1460 endif()
1461
1462 if(WITH_AVFOUNDATION OR HAVE_AVFOUNDATION)
1463   status("    AVFoundation:" HAVE_AVFOUNDATION THEN YES ELSE NO)
1464 endif()
1465
1466 if(HAVE_CAP_IOS)
1467   status("    iOS capture:" YES)
1468 endif()
1469
1470 if(WITH_V4L OR HAVE_V4L)
1471   ocv_build_features_string(v4l_status
1472     IF HAVE_CAMV4L2 THEN "linux/videodev2.h"
1473     IF HAVE_VIDEOIO THEN "sys/videoio.h"
1474     ELSE "NO")
1475   status("    v4l/v4l2:" HAVE_V4L THEN "YES (${v4l_status})" ELSE NO)
1476 endif()
1477
1478 if(WITH_DSHOW OR HAVE_DSHOW)
1479   status("    DirectShow:" HAVE_DSHOW THEN YES ELSE NO)
1480 endif()
1481
1482 if(WITH_MSMF OR HAVE_MSMF)
1483   status("    Media Foundation:" HAVE_MSMF THEN YES ELSE NO)
1484   status("      DXVA:" HAVE_MSMF_DXVA THEN YES ELSE NO)
1485 endif()
1486
1487 if(WITH_XIMEA OR HAVE_XIMEA)
1488   status("    XIMEA:" HAVE_XIMEA THEN YES ELSE NO)
1489 endif()
1490
1491 if(WITH_UEYE OR HAVE_UEYE)
1492   status("    uEye:" HAVE_UEYE THEN YES ELSE NO)
1493 endif()
1494
1495 if(WITH_XINE OR HAVE_XINE)
1496   status("    Xine:"           HAVE_XINE           THEN "YES (ver ${XINE_VERSION})"     ELSE NO)
1497 endif()
1498
1499 if(WITH_LIBREALSENSE OR HAVE_LIBREALSENSE)
1500   status("    Intel RealSense:" HAVE_LIBREALSENSE THEN "YES (${LIBREALSENSE_VERSION})" ELSE NO)
1501 endif()
1502
1503 if(WITH_MFX OR HAVE_MFX)
1504   if(HAVE_MFX)
1505     if(MFX_LIBRARY)
1506       set(__details " (${MFX_LIBRARY})")
1507     elseif(MFX_LIBRARIES)
1508       set(__details " (${MFX_LIBRARIES})")
1509     else()
1510       set(__details " (unknown)")
1511     endif()
1512   endif()
1513   status("    Intel Media SDK:" HAVE_MFX      THEN "YES${__details}" ELSE NO)
1514 endif()
1515
1516 if(WITH_GPHOTO2 OR HAVE_GPHOTO2)
1517   status("    gPhoto2:"        HAVE_GPHOTO2        THEN "YES"                                 ELSE NO)
1518 endif()
1519
1520 # Order is similar to CV_PARALLEL_FRAMEWORK in core/src/parallel.cpp
1521 ocv_build_features_string(parallel_status EXCLUSIVE
1522   IF HAVE_TBB THEN "TBB (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})"
1523   IF HAVE_HPX THEN "HPX"
1524   IF HAVE_OPENMP THEN "OpenMP"
1525   IF HAVE_GCD THEN "GCD"
1526   IF WINRT OR HAVE_CONCURRENCY THEN "Concurrency"
1527   IF HAVE_PTHREADS_PF THEN "pthreads"
1528   ELSE "none")
1529 status("")
1530 status("  Parallel framework:" "${parallel_status}")
1531 if (OPENCV_DISABLE_THREAD_SUPPORT)
1532   status("" "Multi thread code explicitly disabled with OPENCV_DISABLE_THREAD_SUPPORT.")
1533   if(HAVE_PTHREADS_PF OR HAVE_HPX OR HAVE_OPENMP OR HAVE_GCD OR HAVE_CONCURRENCY)
1534     message(FATAL_ERROR "Not all parallel frameworks have been disabled (using ${parallel_status}).")
1535   endif()
1536   if(HAVE_PTHREAD)
1537     message(FATAL_ERROR "Thread execution might be in use in some component.")
1538   endif()
1539 endif()
1540
1541 if(CV_TRACE OR OPENCV_TRACE)
1542   ocv_build_features_string(trace_status EXCLUSIVE
1543     IF HAVE_ITT THEN "with Intel ITT"
1544     ELSE "built-in")
1545   status("")
1546   status("  Trace: " OPENCV_TRACE THEN "YES (${trace_status})" ELSE NO)
1547 endif()
1548
1549 # ========================== Other third-party libraries ==========================
1550 status("")
1551 status("  Other third-party libraries:")
1552
1553 if(WITH_IPP AND HAVE_IPP)
1554   status("    Intel IPP:" "${IPP_VERSION_STR} [${IPP_VERSION_MAJOR}.${IPP_VERSION_MINOR}.${IPP_VERSION_BUILD}]")
1555   status("           at:" "${IPP_ROOT_DIR}")
1556   if(NOT HAVE_IPP_ICV)
1557     status("       linked:" BUILD_WITH_DYNAMIC_IPP THEN "dynamic" ELSE "static")
1558   endif()
1559   if(HAVE_IPP_IW)
1560     if(BUILD_IPP_IW)
1561       status("    Intel IPP IW:" "sources (${IW_VERSION_MAJOR}.${IW_VERSION_MINOR}.${IW_VERSION_UPDATE})")
1562     else()
1563       status("    Intel IPP IW:" "binaries (${IW_VERSION_MAJOR}.${IW_VERSION_MINOR}.${IW_VERSION_UPDATE})")
1564     endif()
1565     status("              at:" "${IPP_IW_PATH}")
1566   else()
1567     status("    Intel IPP IW:"   NO)
1568   endif()
1569 endif()
1570
1571 if(WITH_VA OR HAVE_VA)
1572   status("    VA:"            HAVE_VA          THEN "YES" ELSE NO)
1573 endif()
1574
1575 if(WITH_TENGINE OR HAVE_TENGINE)
1576   status("    Tengine:"      HAVE_TENGINE     THEN "YES (${TENGINE_LIBRARIES})" ELSE NO)
1577 endif()
1578
1579 if(WITH_LAPACK OR HAVE_LAPACK)
1580   status("    Lapack:"      HAVE_LAPACK     THEN "YES (${LAPACK_LIBRARIES})" ELSE NO)
1581 endif()
1582
1583 if(WITH_HALIDE OR HAVE_HALIDE)
1584   status("    Halide:"     HAVE_HALIDE      THEN "YES (${HALIDE_LIBRARIES} ${HALIDE_INCLUDE_DIRS})" ELSE NO)
1585 endif()
1586
1587 if(HAVE_OPENVINO
1588     OR (WITH_OPENVINO AND NOT WITH_INF_ENGINE AND NOT INF_ENGINE_TARGET)
1589 )
1590   status("    OpenVINO:" TARGET openvino::runtime THEN "YES (${OpenVINO_VERSION})" ELSE "NO")
1591 else()
1592   if(WITH_INF_ENGINE OR INF_ENGINE_TARGET)
1593     if(INF_ENGINE_TARGET)
1594       list(GET INF_ENGINE_TARGET 0 ie_target)
1595       set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})")
1596       ocv_get_imported_target(ie_target "${ie_target}")
1597       get_target_property(_lib ${ie_target} IMPORTED_LOCATION)
1598       get_target_property(_lib_imp_rel ${ie_target} IMPORTED_IMPLIB_RELEASE)
1599       get_target_property(_lib_imp_dbg ${ie_target} IMPORTED_IMPLIB_DEBUG)
1600       get_target_property(_lib_rel ${ie_target} IMPORTED_LOCATION_RELEASE)
1601       get_target_property(_lib_dbg ${ie_target} IMPORTED_LOCATION_DEBUG)
1602       ocv_build_features_string(_lib
1603         IF _lib THEN "${_lib}"
1604         IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
1605         IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
1606         IF _lib_rel  THEN "${_lib_rel}"
1607         IF _lib_dbg  THEN "${_lib_dbg}"
1608         ELSE "unknown"
1609       )
1610       get_target_property(_inc ${ie_target} INTERFACE_INCLUDE_DIRECTORIES)
1611       status("    Inference Engine:" "${__msg}")
1612       status("        * libs:" "${_lib}")
1613       status("        * includes:" "${_inc}")
1614     else()
1615       status("    Inference Engine:"     "NO")
1616     endif()
1617   endif()
1618   if(WITH_NGRAPH OR HAVE_NGRAPH)
1619     if(HAVE_NGRAPH)
1620       ocv_get_imported_target(__target ngraph::ngraph)
1621       set(__msg "YES (${ngraph_VERSION})")
1622       get_target_property(_lib ${__target} IMPORTED_LOCATION)
1623       get_target_property(_lib_imp_rel ${__target} IMPORTED_IMPLIB_RELEASE)
1624       get_target_property(_lib_imp_dbg ${__target} IMPORTED_IMPLIB_DEBUG)
1625       get_target_property(_lib_rel ${__target} IMPORTED_LOCATION_RELEASE)
1626       get_target_property(_lib_dbg ${__target} IMPORTED_LOCATION_DEBUG)
1627       ocv_build_features_string(_lib
1628         IF _lib THEN "${_lib}"
1629         IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
1630         IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
1631         IF _lib_rel  THEN "${_lib_rel}"
1632         IF _lib_dbg  THEN "${_lib_dbg}"
1633         ELSE "unknown"
1634       )
1635       get_target_property(_inc ${__target} INTERFACE_INCLUDE_DIRECTORIES)
1636       status("    nGraph:" "${__msg}")
1637       status("        * libs:" "${_lib}")
1638       status("        * includes:" "${_inc}")
1639     else()
1640       status("    nGraph:"     "NO")
1641     endif()
1642   endif()
1643 endif()
1644
1645 if(WITH_EIGEN OR HAVE_EIGEN)
1646   status("    Eigen:"      HAVE_EIGEN       THEN "YES (ver ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})" ELSE NO)
1647 endif()
1648
1649 if(WITH_OPENVX OR HAVE_OPENVX)
1650   status("    OpenVX:"     HAVE_OPENVX      THEN "YES (${OPENVX_LIBRARIES})" ELSE "NO")
1651 endif()
1652
1653 status("    Custom HAL:" OpenCV_USED_HAL  THEN "YES (${OpenCV_USED_HAL})" ELSE "NO")
1654
1655 foreach(s ${CUSTOM_STATUS})
1656   status(${CUSTOM_STATUS_${s}})
1657 endforeach()
1658
1659 if(WITH_CUDA OR HAVE_CUDA)
1660   ocv_build_features_string(cuda_features
1661     IF HAVE_CUFFT THEN "CUFFT"
1662     IF HAVE_CUBLAS THEN "CUBLAS"
1663     IF HAVE_NVCUVID THEN "NVCUVID"
1664     IF CUDA_FAST_MATH THEN "FAST_MATH"
1665     ELSE "no extra features")
1666   status("")
1667   status("  NVIDIA CUDA:" HAVE_CUDA THEN "YES (ver ${CUDA_VERSION_STRING}, ${cuda_features})" ELSE NO)
1668   if(HAVE_CUDA)
1669     status("    NVIDIA GPU arch:"      ${OPENCV_CUDA_ARCH_BIN})
1670     status("    NVIDIA PTX archs:"     ${OPENCV_CUDA_ARCH_PTX})
1671   endif()
1672  endif()
1673
1674  if(WITH_CUDNN OR HAVE_CUDNN)
1675     status("")
1676     status("  cuDNN:" HAVE_CUDNN THEN "YES (ver ${CUDNN_VERSION})" ELSE NO)
1677 endif()
1678
1679 if(WITH_VULKAN OR HAVE_VULKAN)
1680   status("")
1681   status("  Vulkan:"     HAVE_VULKAN THEN "YES" ELSE "NO")
1682   if(HAVE_VULKAN)
1683     status("    Include path:"  VULKAN_INCLUDE_DIRS THEN "${VULKAN_INCLUDE_DIRS}" ELSE "NO")
1684     status("    Link libraries:" VULKAN_LIBRARIES THEN "${VULKAN_LIBRARIES}" ELSE "Dynamic load")
1685   endif()
1686 endif()
1687
1688 if(WITH_WEBNN OR HAVE_WEBNN)
1689   status("")
1690   status("  WebNN:"     HAVE_WEBNN THEN "YES" ELSE "NO")
1691   if(HAVE_WEBNN AND NOT EMSCRIPTEN)
1692     status("    Include path:"  WEBNN_HEADER_DIRS THEN "${WEBNN_HEADER_DIRS}" ELSE "NO")
1693     status("    Link libraries:" WEBNN_LIBRARIES THEN "${WEBNN_LIBRARIES}" ELSE "NO")
1694   endif()
1695 endif()
1696
1697 if(WITH_TIMVX)
1698   status("")
1699   status("  Tim-VX:"     HAVE_TIMVX THEN "YES" ELSE "NO")
1700   if(HAVE_TIMVX)
1701     status("    Include path"  TIMVX_INCLUDE_DIR THEN "${TIMVX_INCLUDE_DIR}" ELSE "NO")
1702     status("    Link libraries:" TIMVX_LIBRARY THEN "${TIMVX_LIBRARY}" ELSE "NO")
1703     status("    VIVANTE SDK path" VIVANTE_SDK_DIR THEN "${VIVANTE_SDK_DIR}" ELSE "NO")
1704   endif()
1705 endif()
1706
1707 if(WITH_OPENCL OR HAVE_OPENCL)
1708   ocv_build_features_string(opencl_features
1709     IF HAVE_OPENCL_SVM THEN "SVM"
1710     IF HAVE_CLAMDFFT THEN "AMDFFT"
1711     IF HAVE_CLAMDBLAS THEN "AMDBLAS"
1712     IF HAVE_OPENCL_D3D11_NV THEN "NVD3D11"
1713     IF HAVE_VA_INTEL THEN "INTELVA"
1714     ELSE "no extra features")
1715   status("")
1716   status("  OpenCL:"     HAVE_OPENCL   THEN   "YES (${opencl_features})" ELSE "NO")
1717   if(HAVE_OPENCL)
1718     status("    Include path:"  OPENCL_INCLUDE_DIRS THEN "${OPENCL_INCLUDE_DIRS}" ELSE "NO")
1719     status("    Link libraries:"       OPENCL_LIBRARIES THEN "${OPENCL_LIBRARIES}" ELSE "Dynamic load")
1720   endif()
1721 endif()
1722
1723 if(WITH_ONNX OR HAVE_ONNX)
1724   status("")
1725   status("  ONNX:"     HAVE_ONNX THEN "YES" ELSE "NO")
1726   if(HAVE_ONNX)
1727     status("    Include path:"  ONNX_INCLUDE_DIR THEN "${ONNX_INCLUDE_DIR}" ELSE "NO")
1728     status("    Link libraries:" ONNX_LIBRARIES THEN "${ONNX_LIBRARIES}" ELSE "NO")
1729   endif()
1730 endif()
1731
1732 # ========================== python ==========================
1733 if(BUILD_opencv_python2)
1734   status("")
1735   status("  Python 2:")
1736   status("    Interpreter:"     PYTHON2INTERP_FOUND  THEN "${PYTHON2_EXECUTABLE} (ver ${PYTHON2_VERSION_STRING})"       ELSE NO)
1737   if(PYTHON2LIBS_VERSION_STRING)
1738     status("    Libraries:"   HAVE_opencv_python2  THEN  "${PYTHON2_LIBRARIES} (ver ${PYTHON2LIBS_VERSION_STRING})"   ELSE NO)
1739   else()
1740     status("    Libraries:"   HAVE_opencv_python2  THEN  "${PYTHON2_LIBRARIES}"                                      ELSE NO)
1741   endif()
1742   status("    numpy:"         PYTHON2_NUMPY_INCLUDE_DIRS THEN "${PYTHON2_NUMPY_INCLUDE_DIRS} (ver ${PYTHON2_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
1743   status("    install path:"  HAVE_opencv_python2  THEN "${__INSTALL_PATH_PYTHON2}"                            ELSE "-")
1744 endif()
1745
1746 if(BUILD_opencv_python3)
1747   status("")
1748   status("  Python 3:")
1749   status("    Interpreter:"     PYTHON3INTERP_FOUND  THEN "${PYTHON3_EXECUTABLE} (ver ${PYTHON3_VERSION_STRING})"       ELSE NO)
1750   if(PYTHON3LIBS_VERSION_STRING)
1751     status("    Libraries:"   HAVE_opencv_python3  THEN  "${PYTHON3_LIBRARIES} (ver ${PYTHON3LIBS_VERSION_STRING})"   ELSE NO)
1752   else()
1753     status("    Libraries:"   HAVE_opencv_python3  THEN  "${PYTHON3_LIBRARIES}"                                      ELSE NO)
1754   endif()
1755   status("    numpy:"         PYTHON3_NUMPY_INCLUDE_DIRS THEN "${PYTHON3_NUMPY_INCLUDE_DIRS} (ver ${PYTHON3_NUMPY_VERSION})" ELSE "NO (Python3 wrappers can not be generated)")
1756   status("    install path:"  HAVE_opencv_python3  THEN "${__INSTALL_PATH_PYTHON3}"                            ELSE "-")
1757 endif()
1758
1759 status("")
1760 status("  Python (for build):"  PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE NO)
1761
1762 # ========================== java ==========================
1763 if(BUILD_JAVA)
1764   status("")
1765   status("  Java:"            BUILD_FAT_JAVA_LIB  THEN "export all functions"                                      ELSE "")
1766   status("    ant:"           ANT_EXECUTABLE      THEN "${ANT_EXECUTABLE} (ver ${ANT_VERSION})"                    ELSE NO)
1767   if(NOT ANDROID)
1768     status("    JNI:"         JNI_INCLUDE_DIRS    THEN "${JNI_INCLUDE_DIRS}"                                       ELSE NO)
1769   endif()
1770   status("    Java wrappers:" HAVE_opencv_java                                                            THEN YES ELSE NO)
1771   status("    Java tests:"    BUILD_TESTS AND opencv_test_java_BINARY_DIR                                 THEN YES ELSE NO)
1772 endif()
1773
1774 # ========================== Objective-C =======================
1775 if(BUILD_OBJC)
1776   status("")
1777   status("  Objective-C wrappers:" HAVE_opencv_objc                                                       THEN YES ELSE NO)
1778 endif()
1779
1780 ocv_cmake_hook(STATUS_DUMP_EXTRA)
1781
1782 # ========================== auxiliary ==========================
1783 status("")
1784 status("  Install to:" "${CMAKE_INSTALL_PREFIX}")
1785 status("-----------------------------------------------------------------")
1786 status("")
1787
1788
1789 ocv_finalize_status()
1790
1791 if(ENABLE_CONFIG_VERIFICATION)
1792   ocv_verify_config()
1793 endif()
1794
1795 if(HAVE_CUDA AND COMMAND CUDA_BUILD_CLEAN_TARGET)
1796   CUDA_BUILD_CLEAN_TARGET()
1797 endif()
1798
1799 ocv_cmake_hook(POST_FINALIZE)
1800
1801 # ----------------------------------------------------------------------------
1802 # CPack stuff
1803 # ----------------------------------------------------------------------------
1804
1805 include(cmake/OpenCVPackaging.cmake)
1806
1807 # This should be the last command
1808 ocv_cmake_dump_vars("" TOFILE "CMakeVars.txt")
1809 ocv_cmake_eval(DEBUG_POST ONCE)