CMakeLists.txt 69 KB

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