CMakeLists.txt 73 KB

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