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