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