mirror of https://gitee.com/openkylin/opencv.git
merge upstream 4.6.0
This commit is contained in:
parent
c86debfcdc
commit
d6fa5988a3
372
CMakeLists.txt
372
CMakeLists.txt
|
@ -17,9 +17,7 @@ endif()
|
|||
|
||||
include(cmake/OpenCVMinDepVersions.cmake)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3)
|
||||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore)
|
||||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
#Required to resolve linker error issues due to incompatibility with CMake v3.0+ policies.
|
||||
#CMake fails to find _fseeko() which leads to subsequent linker error.
|
||||
|
@ -56,6 +54,10 @@ if(POLICY CMP0056)
|
|||
cmake_policy(SET CMP0056 NEW) # try_compile(): link flags
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0066)
|
||||
cmake_policy(SET CMP0066 NEW) # CMake 3.7: try_compile(): use per-config flags, like CMAKE_CXX_FLAGS_RELEASE
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0067)
|
||||
cmake_policy(SET CMP0067 NEW) # CMake 3.8: try_compile(): honor language standard variables (like C++11)
|
||||
endif()
|
||||
|
@ -68,6 +70,9 @@ if(POLICY CMP0075)
|
|||
cmake_policy(SET CMP0075 NEW) # CMake 3.12+: Include file check macros honor `CMAKE_REQUIRED_LIBRARIES`
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0077)
|
||||
cmake_policy(SET CMP0077 NEW) # CMake 3.13+: option() honors normal variables.
|
||||
endif()
|
||||
|
||||
#
|
||||
# Configure OpenCV CMake hooks
|
||||
|
@ -86,6 +91,12 @@ ocv_cmake_hook(CMAKE_INIT)
|
|||
|
||||
# must go before the project()/enable_language() commands
|
||||
ocv_update(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
|
||||
if(NOT DEFINED CMAKE_BUILD_TYPE
|
||||
AND NOT OPENCV_SKIP_DEFAULT_BUILD_TYPE
|
||||
)
|
||||
message(STATUS "'Release' build type is used by default. Use CMAKE_BUILD_TYPE to specify build type (Release or Debug)")
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build")
|
||||
endif()
|
||||
if(DEFINED CMAKE_BUILD_TYPE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${CMAKE_CONFIGURATION_TYPES}")
|
||||
endif()
|
||||
|
@ -95,8 +106,14 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ${ENABLE_PIC})
|
|||
|
||||
ocv_cmake_hook(PRE_CMAKE_BOOTSTRAP)
|
||||
|
||||
# Bootstap CMake system: setup CMAKE_SYSTEM_NAME and other vars
|
||||
# Bootstrap CMake system: setup CMAKE_SYSTEM_NAME and other vars
|
||||
if(OPENCV_WORKAROUND_CMAKE_20989)
|
||||
set(CMAKE_SYSTEM_PROCESSOR_BACKUP ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
enable_language(CXX C)
|
||||
if(OPENCV_WORKAROUND_CMAKE_20989)
|
||||
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR_BACKUP})
|
||||
endif()
|
||||
|
||||
ocv_cmake_hook(POST_CMAKE_BOOTSTRAP)
|
||||
|
||||
|
@ -202,10 +219,11 @@ OCV_OPTION(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" OFF)
|
|||
OCV_OPTION(OPENCV_FORCE_3RDPARTY_BUILD "Force using 3rdparty code from source" OFF)
|
||||
OCV_OPTION(BUILD_ZLIB "Build zlib from source" (WIN32 OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_TIFF "Build libtiff from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_OPENJPEG "Build OpenJPEG from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_JASPER "Build libjasper from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_JPEG "Build libjpeg from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_PNG "Build libpng from source" (WIN32 OR ANDROID OR APPLE OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_OPENEXR "Build openexr from source" (OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_WEBP "Build WebP from source" (((WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
OCV_OPTION(BUILD_TBB "Download and build TBB from source" (ANDROID OR OPENCV_FORCE_3RDPARTY_BUILD) )
|
||||
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 )
|
||||
|
@ -225,8 +243,8 @@ OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON
|
|||
OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
|
||||
VISIBLE_IF IOS
|
||||
VERIFY HAVE_CAP_IOS)
|
||||
OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" ON
|
||||
VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT (CMAKE_VERSION VERSION_LESS "2.8.11"))
|
||||
OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION)
|
||||
VISIBLE_IF (ARM OR AARCH64) AND NOT IOS)
|
||||
OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON
|
||||
VISIBLE_IF ANDROID
|
||||
VERIFY HAVE_CPUFEATURES)
|
||||
|
@ -272,22 +290,26 @@ OCV_OPTION(WITH_HALIDE "Include Halide support" OFF
|
|||
OCV_OPTION(WITH_VULKAN "Include Vulkan support" OFF
|
||||
VISIBLE_IF TRUE
|
||||
VERIFY HAVE_VULKAN)
|
||||
OCV_OPTION(WITH_INF_ENGINE "Include Intel Inference Engine support" OFF
|
||||
# replacement for deprecated options: WITH_INF_ENGINE, WITH_NGRAPH
|
||||
OCV_OPTION(WITH_OPENVINO "Include Intel OpenVINO toolkit support" (WITH_INF_ENGINE)
|
||||
VISIBLE_IF TRUE
|
||||
VERIFY INF_ENGINE_TARGET)
|
||||
OCV_OPTION(WITH_NGRAPH "Include nGraph support" WITH_INF_ENGINE
|
||||
VERIFY TARGET ocv.3rdparty.openvino)
|
||||
OCV_OPTION(WITH_WEBNN "Include WebNN support" OFF
|
||||
VISIBLE_IF TRUE
|
||||
VERIFY TARGET ngraph::ngraph)
|
||||
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON
|
||||
VERIFY HAVE_WEBNN)
|
||||
OCV_OPTION(WITH_JASPER "Include JPEG2K support (Jasper)" ON
|
||||
VISIBLE_IF NOT IOS
|
||||
VERIFY HAVE_JASPER)
|
||||
OCV_OPTION(WITH_OPENJPEG "Include JPEG2K support (OpenJPEG)" ON
|
||||
VISIBLE_IF NOT IOS
|
||||
VERIFY HAVE_OPENJPEG)
|
||||
OCV_OPTION(WITH_JPEG "Include JPEG support" ON
|
||||
VISIBLE_IF TRUE
|
||||
VERIFY HAVE_JPEG)
|
||||
OCV_OPTION(WITH_WEBP "Include WebP support" ON
|
||||
VISIBLE_IF NOT WINRT
|
||||
VERIFY HAVE_WEBP)
|
||||
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" BUILD_OPENEXR OR NOT CMAKE_CROSSCOMPILING
|
||||
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ((WIN32 OR ANDROID OR APPLE) OR BUILD_OPENEXR) OR NOT CMAKE_CROSSCOMPILING
|
||||
VISIBLE_IF NOT APPLE_FRAMEWORK AND NOT WINRT
|
||||
VERIFY HAVE_OPENEXR)
|
||||
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF
|
||||
|
@ -350,6 +372,9 @@ OCV_OPTION(WITH_MSMF_DXVA "Enable hardware acceleration in Media Foundation back
|
|||
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF
|
||||
VISIBLE_IF NOT ANDROID AND NOT WINRT
|
||||
VERIFY HAVE_XIMEA)
|
||||
OCV_OPTION(WITH_UEYE "Include UEYE camera support" OFF
|
||||
VISIBLE_IF NOT ANDROID AND NOT APPLE AND NOT WINRT
|
||||
VERIFY HAVE_UEYE)
|
||||
OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF
|
||||
VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
|
||||
VERIFY HAVE_XINE)
|
||||
|
@ -377,11 +402,11 @@ OCV_OPTION(WITH_OPENCL_D3D11_NV "Include NVIDIA OpenCL D3D11 support" WITH_DIREC
|
|||
OCV_OPTION(WITH_LIBREALSENSE "Include Intel librealsense support" OFF
|
||||
VISIBLE_IF NOT WITH_INTELPERC
|
||||
VERIFY HAVE_LIBREALSENSE)
|
||||
OCV_OPTION(WITH_VA "Include VA support" OFF
|
||||
VISIBLE_IF UNIX AND NOT ANDROID
|
||||
OCV_OPTION(WITH_VA "Include VA support" (X86_64 OR X86)
|
||||
VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
|
||||
VERIFY HAVE_VA)
|
||||
OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" OFF
|
||||
VISIBLE_IF UNIX AND NOT ANDROID
|
||||
OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" (X86_64 OR X86)
|
||||
VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
|
||||
VERIFY HAVE_VA_INTEL)
|
||||
OCV_OPTION(WITH_MFX "Include Intel Media SDK support" OFF
|
||||
VISIBLE_IF (UNIX AND NOT ANDROID) OR (WIN32 AND NOT WINRT AND NOT MINGW)
|
||||
|
@ -419,6 +444,18 @@ OCV_OPTION(WITH_QUIRC "Include library QR-code decoding" ON
|
|||
OCV_OPTION(WITH_ANDROID_MEDIANDK "Use Android Media NDK for Video I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 20)
|
||||
VISIBLE_IF ANDROID
|
||||
VERIFY HAVE_ANDROID_MEDIANDK)
|
||||
OCV_OPTION(WITH_ANDROID_NATIVE_CAMERA "Use Android NDK for Camera I/O (Android)" (ANDROID_NATIVE_API_LEVEL GREATER 23)
|
||||
VISIBLE_IF ANDROID
|
||||
VERIFY HAVE_ANDROID_NATIVE_CAMERA)
|
||||
OCV_OPTION(WITH_TENGINE "Include Arm Inference Tengine support" OFF
|
||||
VISIBLE_IF (ARM OR AARCH64) AND (UNIX OR ANDROID) AND NOT IOS
|
||||
VERIFY HAVE_TENGINE)
|
||||
OCV_OPTION(WITH_ONNX "Include Microsoft ONNX Runtime support" OFF
|
||||
VISIBLE_IF TRUE
|
||||
VERIFY HAVE_ONNX)
|
||||
OCV_OPTION(WITH_TIMVX "Include Tim-VX support" OFF
|
||||
VISIBLE_IF TRUE
|
||||
VERIFY HAVE_TIMVX)
|
||||
|
||||
# OpenCV build components
|
||||
# ===================================================
|
||||
|
@ -439,10 +476,13 @@ OCV_OPTION(BUILD_FAT_JAVA_LIB "Create Java wrapper exporting all functions
|
|||
OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF IF ANDROID )
|
||||
OCV_OPTION(BUILD_CUDA_STUBS "Build CUDA modules stubs when no CUDA SDK" OFF IF (NOT APPLE_FRAMEWORK) )
|
||||
OCV_OPTION(BUILD_JAVA "Enable Java support" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
|
||||
OCV_OPTION(BUILD_OBJC "Enable Objective-C support" ON IF APPLE_FRAMEWORK )
|
||||
OCV_OPTION(BUILD_KOTLIN_EXTENSIONS "Build Kotlin extensions (Android)" ON IF ANDROID )
|
||||
|
||||
# OpenCV installation options
|
||||
# ===================================================
|
||||
OCV_OPTION(INSTALL_CREATE_DISTRIB "Change install rules to build the distribution package" OFF )
|
||||
OCV_OPTION(INSTALL_BIN_EXAMPLES "Install prebuilt examples" WIN32 IF BUILD_EXAMPLES)
|
||||
OCV_OPTION(INSTALL_C_EXAMPLES "Install C examples" OFF )
|
||||
OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
|
||||
OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )
|
||||
|
@ -451,7 +491,7 @@ OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binar
|
|||
|
||||
# OpenCV build options
|
||||
# ===================================================
|
||||
OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND NOT IOS AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja")) )
|
||||
OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja" OR CMAKE_GENERATOR MATCHES "Xcode")) )
|
||||
OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" MSVC IF (MSVC OR (NOT IOS AND NOT CMAKE_CROSSCOMPILING) ) )
|
||||
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) )
|
||||
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CV_GCC )
|
||||
|
@ -460,7 +500,7 @@ OCV_OPTION(OPENCV_ENABLE_MEMORY_SANITIZER "Better support for memory/address san
|
|||
OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CV_GCC )
|
||||
OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
|
||||
OCV_OPTION(ENABLE_FAST_MATH "Enable compiler options for fast math optimizations on FP computations (not recommended)" OFF)
|
||||
if(NOT IOS AND (NOT ANDROID OR OPENCV_ANDROID_USE_LEGACY_FLAGS)) # Use CPU_BASELINE instead
|
||||
if(NOT IOS AND (NOT ANDROID OR OPENCV_ANDROID_USE_LEGACY_FLAGS) AND CMAKE_CROSSCOMPILING) # Use CPU_BASELINE instead
|
||||
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) )
|
||||
OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
|
||||
endif()
|
||||
|
@ -469,7 +509,7 @@ OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors"
|
|||
OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID )
|
||||
OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF )
|
||||
OCV_OPTION(ENABLE_INSTRUMENTATION "Instrument functions to collect calls trace and performance" OFF )
|
||||
OCV_OPTION(ENABLE_GNU_STL_DEBUG "Enable GNU STL Debug mode (defines _GLIBCXX_DEBUG)" OFF IF ((NOT CMAKE_VERSION VERSION_LESS "2.8.11") AND CV_GCC) )
|
||||
OCV_OPTION(ENABLE_GNU_STL_DEBUG "Enable GNU STL Debug mode (defines _GLIBCXX_DEBUG)" OFF IF CV_GCC )
|
||||
OCV_OPTION(ENABLE_BUILD_HARDENING "Enable hardening of the resulting binaries (against security attacks, detects memory corruption, etc)" OFF)
|
||||
OCV_OPTION(ENABLE_LTO "Enable Link Time Optimization" OFF IF CV_GCC OR MSVC)
|
||||
OCV_OPTION(ENABLE_THIN_LTO "Enable Thin LTO" OFF IF CV_CLANG)
|
||||
|
@ -481,6 +521,9 @@ OCV_OPTION(CV_TRACE "Enable OpenCV code trace" ON)
|
|||
OCV_OPTION(OPENCV_GENERATE_SETUPVARS "Generate setup_vars* scripts" ON IF (NOT ANDROID AND NOT APPLE_FRAMEWORK) )
|
||||
OCV_OPTION(ENABLE_CONFIG_VERIFICATION "Fail build if actual configuration doesn't match requested (WITH_XXX != HAVE_XXX)" OFF)
|
||||
OCV_OPTION(OPENCV_ENABLE_MEMALIGN "Enable posix_memalign or memalign usage" ON)
|
||||
OCV_OPTION(OPENCV_DISABLE_FILESYSTEM_SUPPORT "Disable filesystem support" OFF)
|
||||
OCV_OPTION(OPENCV_DISABLE_THREAD_SUPPORT "Build the library without multi-threaded code." OFF)
|
||||
OCV_OPTION(OPENCV_SEMIHOSTING "Build the library for semihosting target (Arm). See https://developer.arm.com/documentation/100863/latest." OFF)
|
||||
|
||||
OCV_OPTION(ENABLE_PYLINT "Add target with Pylint checks" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
|
||||
OCV_OPTION(ENABLE_FLAKE8 "Add target with Python flake8 checker" (BUILD_DOCS OR BUILD_EXAMPLES) IF (NOT CMAKE_CROSSCOMPILING AND NOT APPLE_FRAMEWORK) )
|
||||
|
@ -489,6 +532,10 @@ if(ENABLE_IMPL_COLLECTION)
|
|||
add_definitions(-DCV_COLLECT_IMPL_DATA)
|
||||
endif()
|
||||
|
||||
if(OPENCV_DISABLE_FILESYSTEM_SUPPORT)
|
||||
add_definitions(-DOPENCV_HAVE_FILESYSTEM_SUPPORT=0)
|
||||
endif()
|
||||
|
||||
set(OPENCV_MATHJAX_RELPATH "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0" CACHE STRING "URI to a MathJax installation")
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -573,10 +620,6 @@ endif()
|
|||
# ----------------------------------------------------------------------------
|
||||
# OpenCV compiler and linker options
|
||||
# ----------------------------------------------------------------------------
|
||||
# In case of Makefiles if the user does not setup CMAKE_BUILD_TYPE, assume it's Release:
|
||||
if(CMAKE_GENERATOR MATCHES "Makefiles|Ninja" AND "${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)
|
||||
|
||||
|
@ -622,6 +665,8 @@ if(UNIX)
|
|||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m pthread)
|
||||
elseif(EMSCRIPTEN)
|
||||
# no need to link to system libs with emscripten
|
||||
elseif(QNXNTO)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m)
|
||||
else()
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
|
||||
endif()
|
||||
|
@ -629,6 +674,11 @@ if(UNIX)
|
|||
set(HAVE_PTHREAD 1)
|
||||
endif()
|
||||
|
||||
# Ensure that libpthread is not listed as one of the libraries to pass to the linker.
|
||||
if (OPENCV_DISABLE_THREAD_SUPPORT)
|
||||
list(REMOVE_ITEM OPENCV_LINKER_LIBS pthread)
|
||||
endif()
|
||||
|
||||
if(OPENCV_ENABLE_MEMALIGN)
|
||||
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
|
||||
CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
|
||||
|
@ -636,9 +686,18 @@ if(UNIX)
|
|||
CHECK_SYMBOL_EXISTS(memalign malloc.h HAVE_MEMALIGN)
|
||||
endif()
|
||||
# TODO:
|
||||
# - _aligned_malloc() on Win32
|
||||
# - std::aligned_alloc() C++17 / C11
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
if(OPENCV_ENABLE_MEMALIGN)
|
||||
CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
|
||||
if(HAVE_MALLOC_H)
|
||||
CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE_WIN32_ALIGNED_MALLOC)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(cmake/OpenCVPCHSupport.cmake)
|
||||
|
@ -674,6 +733,12 @@ include(cmake/OpenCVFindLibsVideo.cmake)
|
|||
include(cmake/OpenCVFindLibsPerf.cmake)
|
||||
include(cmake/OpenCVFindLAPACK.cmake)
|
||||
include(cmake/OpenCVFindProtobuf.cmake)
|
||||
if(WITH_TENGINE)
|
||||
include(cmake/OpenCVFindTengine.cmake)
|
||||
endif()
|
||||
if(WITH_TIMVX)
|
||||
include(cmake/OpenCVFindTIMVX.cmake)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Detect other 3rd-party libraries/tools
|
||||
|
@ -698,8 +763,15 @@ if(ENABLE_FLAKE8 AND PYTHON_DEFAULT_AVAILABLE)
|
|||
include("${CMAKE_CURRENT_LIST_DIR}/cmake/FindFlake8.cmake")
|
||||
endif()
|
||||
if(FLAKE8_FOUND)
|
||||
list(APPEND OPENCV_FLAKE8_EXCLUDES ".git" "__pycache__" "config.py" "*.config.py" "config-*.py")
|
||||
list(APPEND OPENCV_FLAKE8_EXCLUDES "svgfig.py") # 3rdparty
|
||||
if(NOT PYTHON3_VERSION_STRING VERSION_GREATER 3.6)
|
||||
# Python 3.6+ (PEP 526): variable annotations (type hints)
|
||||
list(APPEND OPENCV_FLAKE8_EXCLUDES "samples/dnn/dnn_model_runner/dnn_conversion/common/test/configs")
|
||||
endif()
|
||||
string(REPLACE ";" "," OPENCV_FLAKE8_EXCLUDES_STR "${OPENCV_FLAKE8_EXCLUDES}")
|
||||
add_custom_target(check_flake8
|
||||
COMMAND "${FLAKE8_EXECUTABLE}" . --count --select=E9,E901,E999,F821,F822,F823 --show-source --statistics --exclude='.git,__pycache__,*.config.py,svgfig.py'
|
||||
COMMAND "${FLAKE8_EXECUTABLE}" . --count --select=E9,E901,E999,F821,F822,F823 --show-source --statistics --exclude='${OPENCV_FLAKE8_EXCLUDES_STR}'
|
||||
WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
|
||||
COMMENT "Running flake8"
|
||||
)
|
||||
|
@ -728,8 +800,13 @@ if(WITH_VULKAN)
|
|||
include(cmake/OpenCVDetectVulkan.cmake)
|
||||
endif()
|
||||
|
||||
# --- WebNN ---
|
||||
if(WITH_WEBNN)
|
||||
include(cmake/OpenCVDetectWebNN.cmake)
|
||||
endif()
|
||||
|
||||
# --- Inference Engine ---
|
||||
if(WITH_INF_ENGINE)
|
||||
if(WITH_INF_ENGINE OR WITH_OPENVINO)
|
||||
include(cmake/OpenCVDetectInferenceEngine.cmake)
|
||||
endif()
|
||||
|
||||
|
@ -750,6 +827,11 @@ if(WITH_QUIRC)
|
|||
add_subdirectory(3rdparty/quirc)
|
||||
set(HAVE_QUIRC TRUE)
|
||||
endif()
|
||||
|
||||
if(WITH_ONNX)
|
||||
include(cmake/FindONNX.cmake)
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# OpenCV HAL
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -789,9 +871,13 @@ endif()
|
|||
|
||||
foreach(hal ${OpenCV_HAL})
|
||||
if(hal STREQUAL "carotene")
|
||||
add_subdirectory(3rdparty/carotene/hal)
|
||||
ocv_hal_register(CAROTENE_HAL_LIBRARIES CAROTENE_HAL_HEADERS CAROTENE_HAL_INCLUDE_DIRS)
|
||||
list(APPEND OpenCV_USED_HAL "carotene (ver ${CAROTENE_HAL_VERSION})")
|
||||
if(";${CPU_BASELINE_FINAL};" MATCHES ";NEON;")
|
||||
add_subdirectory(3rdparty/carotene/hal)
|
||||
ocv_hal_register(CAROTENE_HAL_LIBRARIES CAROTENE_HAL_HEADERS CAROTENE_HAL_INCLUDE_DIRS)
|
||||
list(APPEND OpenCV_USED_HAL "carotene (ver ${CAROTENE_HAL_VERSION})")
|
||||
else()
|
||||
message(STATUS "Carotene: NEON is not available, disabling carotene...")
|
||||
endif()
|
||||
elseif(hal STREQUAL "openvx")
|
||||
add_subdirectory(3rdparty/openvx)
|
||||
ocv_hal_register(OPENVX_HAL_LIBRARIES OPENVX_HAL_HEADERS OPENVX_HAL_INCLUDE_DIRS)
|
||||
|
@ -842,7 +928,7 @@ add_subdirectory(include)
|
|||
ocv_add_modules_compiler_options()
|
||||
|
||||
# OpenCV modules
|
||||
add_subdirectory(modules)
|
||||
ocv_register_modules()
|
||||
|
||||
# Generate targets for documentation
|
||||
add_subdirectory(doc)
|
||||
|
@ -926,11 +1012,11 @@ endif()
|
|||
# for UNIX it does not make sense as LICENSE and readme will be part of the package automatically
|
||||
if(ANDROID OR NOT UNIX)
|
||||
install(FILES ${OPENCV_LICENSE_FILE}
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
DESTINATION ./ COMPONENT libs)
|
||||
if(OPENCV_README_FILE)
|
||||
install(FILES ${OPENCV_README_FILE}
|
||||
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
DESTINATION ./ COMPONENT libs)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -942,6 +1028,12 @@ if(COMMAND ocv_pylint_finalize)
|
|||
ocv_pylint_add_directory_recurse(${CMAKE_CURRENT_LIST_DIR}/samples/python/tutorial_code)
|
||||
ocv_pylint_finalize()
|
||||
endif()
|
||||
if(TARGET check_pylint)
|
||||
message(STATUS "Registered 'check_pylint' target: using ${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}), checks: ${PYLINT_TOTAL_TARGETS}")
|
||||
endif()
|
||||
if(TARGET check_flake8)
|
||||
message(STATUS "Registered 'check_flake8' target: using ${FLAKE8_EXECUTABLE} (ver: ${FLAKE8_VERSION})")
|
||||
endif()
|
||||
|
||||
if(OPENCV_GENERATE_SETUPVARS)
|
||||
include(cmake/OpenCVGenSetupVars.cmake)
|
||||
|
@ -978,7 +1070,6 @@ endif()
|
|||
status("")
|
||||
status(" Platform:")
|
||||
if(NOT DEFINED OPENCV_TIMESTAMP
|
||||
AND NOT CMAKE_VERSION VERSION_LESS 2.8.11
|
||||
AND NOT BUILD_INFO_SKIP_TIMESTAMP
|
||||
)
|
||||
string(TIMESTAMP OPENCV_TIMESTAMP "" UTC)
|
||||
|
@ -1000,7 +1091,9 @@ endif()
|
|||
if(CMAKE_GENERATOR MATCHES Xcode)
|
||||
status(" Xcode:" ${XCODE_VERSION})
|
||||
endif()
|
||||
if(NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
|
||||
if(CMAKE_GENERATOR MATCHES "Xcode|Visual Studio|Multi-Config")
|
||||
status(" Configuration:" ${CMAKE_CONFIGURATION_TYPES})
|
||||
else()
|
||||
status(" Configuration:" ${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
|
||||
|
@ -1042,6 +1135,9 @@ string(STRIP "${OPENCV_COMPILER_STR}" OPENCV_COMPILER_STR)
|
|||
status("")
|
||||
status(" C/C++:")
|
||||
status(" Built as dynamic libs?:" BUILD_SHARED_LIBS THEN YES ELSE NO)
|
||||
if(DEFINED CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD)
|
||||
status(" C++ standard:" "${CMAKE_CXX_STANDARD}")
|
||||
endif()
|
||||
status(" C++ Compiler:" ${OPENCV_COMPILER_STR})
|
||||
status(" C++ flags (Release):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
|
||||
status(" C++ flags (Debug):" ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
|
||||
|
@ -1058,6 +1154,10 @@ endif()
|
|||
status(" ccache:" OPENCV_COMPILER_IS_CCACHE THEN YES ELSE NO)
|
||||
status(" Precompiled headers:" PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS THEN YES ELSE NO)
|
||||
|
||||
if(OPENCV_DISABLE_FILESYSTEM_SUPPORT)
|
||||
status(" Filesystem support is disabled")
|
||||
endif()
|
||||
|
||||
# ========================== Dependencies ============================
|
||||
ocv_get_all_libs(deps_modules deps_extra deps_3rdparty)
|
||||
status(" Extra dependencies:" ${deps_extra})
|
||||
|
@ -1158,15 +1258,20 @@ endif(WIN32)
|
|||
|
||||
# ========================== GUI ==========================
|
||||
status("")
|
||||
status(" GUI: ")
|
||||
status(" GUI: " "${OPENCV_HIGHGUI_BUILTIN_BACKEND}")
|
||||
|
||||
if(WITH_QT OR HAVE_QT)
|
||||
if(HAVE_QT5)
|
||||
status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
|
||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
|
||||
elseif(HAVE_QT)
|
||||
if(HAVE_QT)
|
||||
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
|
||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
|
||||
if(HAVE_QT_OPENGL)
|
||||
if(Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES)
|
||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES} ${Qt${QT_VERSION_MAJOR}OpenGL_VERSION_STRING})" ELSE NO)
|
||||
else()
|
||||
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
|
||||
endif()
|
||||
else()
|
||||
status(" QT OpenGL support:" "NO")
|
||||
endif()
|
||||
else()
|
||||
status(" QT:" "NO")
|
||||
endif()
|
||||
|
@ -1229,8 +1334,15 @@ if(WITH_TIFF OR HAVE_TIFF)
|
|||
status(" TIFF:" TIFF_FOUND THEN "${TIFF_LIBRARY} (ver ${TIFF_VERSION} / ${TIFF_VERSION_STRING})" ELSE "build (ver ${TIFF_VERSION} - ${TIFF_VERSION_STRING})")
|
||||
endif()
|
||||
|
||||
if(WITH_JASPER OR HAVE_JASPER)
|
||||
status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build (ver ${JASPER_VERSION_STRING})")
|
||||
if(HAVE_OPENJPEG)
|
||||
status(" JPEG 2000:" OpenJPEG_FOUND
|
||||
THEN "OpenJPEG (ver ${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION})"
|
||||
ELSE "build (ver ${OPENJPEG_VERSION})"
|
||||
)
|
||||
elseif(HAVE_JASPER)
|
||||
status(" JPEG 2000:" JASPER_FOUND THEN "${JASPER_LIBRARY} (ver ${JASPER_VERSION_STRING})" ELSE "build Jasper (ver ${JASPER_VERSION_STRING})")
|
||||
elseif(WITH_OPENJPEG OR WITH_JASPER)
|
||||
status(" JPEG 2000:" "NO")
|
||||
endif()
|
||||
|
||||
if(WITH_OPENEXR OR HAVE_OPENEXR)
|
||||
|
@ -1333,6 +1445,10 @@ if(WITH_XIMEA OR HAVE_XIMEA)
|
|||
status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_UEYE OR HAVE_UEYE)
|
||||
status(" uEye:" HAVE_UEYE THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_XINE OR HAVE_XINE)
|
||||
status(" Xine:" HAVE_XINE THEN "YES (ver ${XINE_VERSION})" ELSE NO)
|
||||
endif()
|
||||
|
@ -1342,7 +1458,16 @@ if(WITH_LIBREALSENSE OR HAVE_LIBREALSENSE)
|
|||
endif()
|
||||
|
||||
if(WITH_MFX OR HAVE_MFX)
|
||||
status(" Intel Media SDK:" HAVE_MFX THEN "YES (${MFX_LIBRARY})" ELSE NO)
|
||||
if(HAVE_MFX)
|
||||
if(MFX_LIBRARY)
|
||||
set(__details " (${MFX_LIBRARY})")
|
||||
elseif(MFX_LIBRARIES)
|
||||
set(__details " (${MFX_LIBRARIES})")
|
||||
else()
|
||||
set(__details " (unknown)")
|
||||
endif()
|
||||
endif()
|
||||
status(" Intel Media SDK:" HAVE_MFX THEN "YES${__details}" ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_GPHOTO2 OR HAVE_GPHOTO2)
|
||||
|
@ -1360,6 +1485,15 @@ ocv_build_features_string(parallel_status EXCLUSIVE
|
|||
ELSE "none")
|
||||
status("")
|
||||
status(" Parallel framework:" "${parallel_status}")
|
||||
if (OPENCV_DISABLE_THREAD_SUPPORT)
|
||||
status("" "Multi thread code explicitly disabled with OPENCV_DISABLE_THREAD_SUPPORT.")
|
||||
if(HAVE_PTHREADS_PF OR HAVE_HPX OR HAVE_OPENMP OR HAVE_GCD OR HAVE_CONCURRENCY)
|
||||
message(FATAL_ERROR "Not all parallel frameworks have been disabled (using ${parallel_status}).")
|
||||
endif()
|
||||
if(HAVE_PTHREAD)
|
||||
message(FATAL_ERROR "Thread execution might be in use in some component.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CV_TRACE OR OPENCV_TRACE)
|
||||
ocv_build_features_string(trace_status EXCLUSIVE
|
||||
|
@ -1395,8 +1529,8 @@ if(WITH_VA OR HAVE_VA)
|
|||
status(" VA:" HAVE_VA THEN "YES" ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_VA_INTEL OR HAVE_VA_INTEL)
|
||||
status(" Intel VA-API/OpenCL:" HAVE_VA_INTEL THEN "YES (OpenCL: ${VA_INTEL_IOCL_ROOT})" ELSE NO)
|
||||
if(WITH_TENGINE OR HAVE_TENGINE)
|
||||
status(" Tengine:" HAVE_TENGINE THEN "YES (${TENGINE_LIBRARIES})" ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_LAPACK OR HAVE_LAPACK)
|
||||
|
@ -1407,54 +1541,61 @@ if(WITH_HALIDE OR HAVE_HALIDE)
|
|||
status(" Halide:" HAVE_HALIDE THEN "YES (${HALIDE_LIBRARIES} ${HALIDE_INCLUDE_DIRS})" ELSE NO)
|
||||
endif()
|
||||
|
||||
if(WITH_INF_ENGINE OR INF_ENGINE_TARGET)
|
||||
if(INF_ENGINE_TARGET)
|
||||
list(GET INF_ENGINE_TARGET 0 ie_target)
|
||||
set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})")
|
||||
get_target_property(_lib ${ie_target} IMPORTED_LOCATION)
|
||||
get_target_property(_lib_imp_rel ${ie_target} IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(_lib_imp_dbg ${ie_target} IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(_lib_rel ${ie_target} IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(_lib_dbg ${ie_target} IMPORTED_LOCATION_DEBUG)
|
||||
ocv_build_features_string(_lib
|
||||
IF _lib THEN "${_lib}"
|
||||
IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
|
||||
IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
|
||||
IF _lib_rel THEN "${_lib_rel}"
|
||||
IF _lib_dbg THEN "${_lib_dbg}"
|
||||
ELSE "unknown"
|
||||
)
|
||||
get_target_property(_inc ${ie_target} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
status(" Inference Engine:" "${__msg}")
|
||||
status(" * libs:" "${_lib}")
|
||||
status(" * includes:" "${_inc}")
|
||||
else()
|
||||
status(" Inference Engine:" "NO")
|
||||
if(HAVE_OPENVINO
|
||||
OR (WITH_OPENVINO AND NOT WITH_INF_ENGINE AND NOT INF_ENGINE_TARGET)
|
||||
)
|
||||
status(" OpenVINO:" TARGET openvino::runtime THEN "YES (${OpenVINO_VERSION})" ELSE "NO")
|
||||
else()
|
||||
if(WITH_INF_ENGINE OR INF_ENGINE_TARGET)
|
||||
if(INF_ENGINE_TARGET)
|
||||
list(GET INF_ENGINE_TARGET 0 ie_target)
|
||||
set(__msg "YES (${INF_ENGINE_RELEASE} / ${INF_ENGINE_VERSION})")
|
||||
ocv_get_imported_target(ie_target "${ie_target}")
|
||||
get_target_property(_lib ${ie_target} IMPORTED_LOCATION)
|
||||
get_target_property(_lib_imp_rel ${ie_target} IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(_lib_imp_dbg ${ie_target} IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(_lib_rel ${ie_target} IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(_lib_dbg ${ie_target} IMPORTED_LOCATION_DEBUG)
|
||||
ocv_build_features_string(_lib
|
||||
IF _lib THEN "${_lib}"
|
||||
IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
|
||||
IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
|
||||
IF _lib_rel THEN "${_lib_rel}"
|
||||
IF _lib_dbg THEN "${_lib_dbg}"
|
||||
ELSE "unknown"
|
||||
)
|
||||
get_target_property(_inc ${ie_target} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
status(" Inference Engine:" "${__msg}")
|
||||
status(" * libs:" "${_lib}")
|
||||
status(" * includes:" "${_inc}")
|
||||
else()
|
||||
status(" Inference Engine:" "NO")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_NGRAPH OR HAVE_NGRAPH)
|
||||
if(HAVE_NGRAPH)
|
||||
set(__target ngraph::ngraph)
|
||||
set(__msg "YES (${ngraph_VERSION})")
|
||||
get_target_property(_lib ${__target} IMPORTED_LOCATION)
|
||||
get_target_property(_lib_imp_rel ${__target} IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(_lib_imp_dbg ${__target} IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(_lib_rel ${__target} IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(_lib_dbg ${__target} IMPORTED_LOCATION_DEBUG)
|
||||
ocv_build_features_string(_lib
|
||||
IF _lib THEN "${_lib}"
|
||||
IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
|
||||
IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
|
||||
IF _lib_rel THEN "${_lib_rel}"
|
||||
IF _lib_dbg THEN "${_lib_dbg}"
|
||||
ELSE "unknown"
|
||||
)
|
||||
get_target_property(_inc ${__target} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
status(" nGraph:" "${__msg}")
|
||||
status(" * libs:" "${_lib}")
|
||||
status(" * includes:" "${_inc}")
|
||||
else()
|
||||
status(" nGraph:" "NO")
|
||||
if(WITH_NGRAPH OR HAVE_NGRAPH)
|
||||
if(HAVE_NGRAPH)
|
||||
ocv_get_imported_target(__target ngraph::ngraph)
|
||||
set(__msg "YES (${ngraph_VERSION})")
|
||||
get_target_property(_lib ${__target} IMPORTED_LOCATION)
|
||||
get_target_property(_lib_imp_rel ${__target} IMPORTED_IMPLIB_RELEASE)
|
||||
get_target_property(_lib_imp_dbg ${__target} IMPORTED_IMPLIB_DEBUG)
|
||||
get_target_property(_lib_rel ${__target} IMPORTED_LOCATION_RELEASE)
|
||||
get_target_property(_lib_dbg ${__target} IMPORTED_LOCATION_DEBUG)
|
||||
ocv_build_features_string(_lib
|
||||
IF _lib THEN "${_lib}"
|
||||
IF _lib_imp_rel AND _lib_imp_dbg THEN "${_lib_imp_rel} / ${_lib_imp_dbg}"
|
||||
IF _lib_rel AND _lib_dbg THEN "${_lib_rel} / ${_lib_dbg}"
|
||||
IF _lib_rel THEN "${_lib_rel}"
|
||||
IF _lib_dbg THEN "${_lib_dbg}"
|
||||
ELSE "unknown"
|
||||
)
|
||||
get_target_property(_inc ${__target} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
status(" nGraph:" "${__msg}")
|
||||
status(" * libs:" "${_lib}")
|
||||
status(" * includes:" "${_inc}")
|
||||
else()
|
||||
status(" nGraph:" "NO")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -1501,12 +1642,32 @@ if(WITH_VULKAN OR HAVE_VULKAN)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_WEBNN OR HAVE_WEBNN)
|
||||
status("")
|
||||
status(" WebNN:" HAVE_WEBNN THEN "YES" ELSE "NO")
|
||||
if(HAVE_WEBNN AND NOT EMSCRIPTEN)
|
||||
status(" Include path:" WEBNN_HEADER_DIRS THEN "${WEBNN_HEADER_DIRS}" ELSE "NO")
|
||||
status(" Link libraries:" WEBNN_LIBRARIES THEN "${WEBNN_LIBRARIES}" ELSE "NO")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_TIMVX)
|
||||
status("")
|
||||
status(" Tim-VX:" HAVE_TIMVX THEN "YES" ELSE "NO")
|
||||
if(HAVE_TIMVX)
|
||||
status(" Include path" TIMVX_INCLUDE_DIR THEN "${TIMVX_INCLUDE_DIR}" ELSE "NO")
|
||||
status(" Link libraries:" TIMVX_LIBRARY THEN "${TIMVX_LIBRARY}" ELSE "NO")
|
||||
status(" VIVANTE SDK path" VIVANTE_SDK_DIR THEN "${VIVANTE_SDK_DIR}" ELSE "NO")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCL OR HAVE_OPENCL)
|
||||
ocv_build_features_string(opencl_features
|
||||
IF HAVE_OPENCL_SVM THEN "SVM"
|
||||
IF HAVE_CLAMDFFT THEN "AMDFFT"
|
||||
IF HAVE_CLAMDBLAS THEN "AMDBLAS"
|
||||
IF HAVE_OPENCL_D3D11_NV THEN "NVD3D11"
|
||||
IF HAVE_VA_INTEL THEN "INTELVA"
|
||||
ELSE "no extra features")
|
||||
status("")
|
||||
status(" OpenCL:" HAVE_OPENCL THEN "YES (${opencl_features})" ELSE "NO")
|
||||
|
@ -1516,6 +1677,15 @@ if(WITH_OPENCL OR HAVE_OPENCL)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_ONNX OR HAVE_ONNX)
|
||||
status("")
|
||||
status(" ONNX:" HAVE_ONNX THEN "YES" ELSE "NO")
|
||||
if(HAVE_ONNX)
|
||||
status(" Include path:" ONNX_INCLUDE_DIR THEN "${ONNX_INCLUDE_DIR}" ELSE "NO")
|
||||
status(" Link libraries:" ONNX_LIBRARIES THEN "${ONNX_LIBRARIES}" ELSE "NO")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ========================== python ==========================
|
||||
if(BUILD_opencv_python2)
|
||||
status("")
|
||||
|
@ -1545,12 +1715,6 @@ endif()
|
|||
|
||||
status("")
|
||||
status(" Python (for build):" PYTHON_DEFAULT_AVAILABLE THEN "${PYTHON_DEFAULT_EXECUTABLE}" ELSE NO)
|
||||
if(PYLINT_FOUND AND PYLINT_EXECUTABLE)
|
||||
status(" Pylint:" PYLINT_FOUND THEN "${PYLINT_EXECUTABLE} (ver: ${PYLINT_VERSION}, checks: ${PYLINT_TOTAL_TARGETS})" ELSE NO)
|
||||
endif()
|
||||
if(FLAKE8_FOUND AND FLAKE8_EXECUTABLE)
|
||||
status(" Flake8:" FLAKE8_FOUND THEN "${FLAKE8_EXECUTABLE} (ver: ${FLAKE8_VERSION})" ELSE NO)
|
||||
endif()
|
||||
|
||||
# ========================== java ==========================
|
||||
if(BUILD_JAVA)
|
||||
|
@ -1564,6 +1728,12 @@ if(BUILD_JAVA)
|
|||
status(" Java tests:" BUILD_TESTS AND opencv_test_java_BINARY_DIR THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
# ========================== Objective-C =======================
|
||||
if(BUILD_OBJC)
|
||||
status("")
|
||||
status(" Objective-C wrappers:" HAVE_opencv_objc THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
ocv_cmake_hook(STATUS_DUMP_EXTRA)
|
||||
|
||||
# ========================== auxiliary ==========================
|
||||
|
@ -1579,6 +1749,10 @@ if(ENABLE_CONFIG_VERIFICATION)
|
|||
ocv_verify_config()
|
||||
endif()
|
||||
|
||||
if(HAVE_CUDA AND COMMAND CUDA_BUILD_CLEAN_TARGET)
|
||||
CUDA_BUILD_CLEAN_TARGET()
|
||||
endif()
|
||||
|
||||
ocv_cmake_hook(POST_FINALIZE)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
Copyright (C) 2000-2022, Intel Corporation, all rights reserved.
|
||||
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
|
||||
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
|
||||
Copyright (C) 2015-2022, OpenCV Foundation, all rights reserved.
|
||||
Copyright (C) 2008-2016, Itseez Inc., all rights reserved.
|
||||
Copyright (C) 2019-2022, Xperience AI, all rights reserved.
|
||||
Copyright (C) 2019-2022, Shenzhen Institute of Artificial Intelligence and
|
||||
Robotics for Society, all rights reserved.
|
||||
|
||||
Third party copyrights are property of their respective owners.
|
228
LICENSE
228
LICENSE
|
@ -1,42 +1,202 @@
|
|||
By downloading, copying, installing or using the software you agree to this license.
|
||||
If you do not agree to this license, do not download, install,
|
||||
copy or use the software.
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
Copyright (C) 2000-2019, Intel Corporation, all rights reserved.
|
||||
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved.
|
||||
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
|
||||
Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved.
|
||||
Copyright (C) 2015-2016, Itseez Inc., all rights reserved.
|
||||
Copyright (C) 2019, Xperience AI, all rights reserved.
|
||||
Third party copyrights are property of their respective owners.
|
||||
1. Definitions.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of the contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
This software is provided by the copyright holders and contributors "as is" and
|
||||
any express or implied warranties, including, but not limited to, the implied
|
||||
warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
In no event shall copyright holders or contributors be liable for any direct,
|
||||
indirect, incidental, special, exemplary, or consequential damages
|
||||
(including, but not limited to, procurement of substitute goods or services;
|
||||
loss of use, data, or profits; or business interruption) however caused
|
||||
and on any theory of liability, whether in contract, strict liability,
|
||||
or tort (including negligence or otherwise) arising in any way out of
|
||||
the use of this software, even if advised of the possibility of such damage.
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
|
@ -3,9 +3,13 @@
|
|||
### Resources
|
||||
|
||||
* Homepage: <https://opencv.org>
|
||||
* Docs: <https://docs.opencv.org/master/>
|
||||
* Q&A forum: <http://answers.opencv.org>
|
||||
* Courses: <https://opencv.org/courses>
|
||||
* Docs: <https://docs.opencv.org/4.x/>
|
||||
* Q&A forum: <https://forum.opencv.org>
|
||||
* previous forum (read only): <http://answers.opencv.org>
|
||||
* Issue tracking: <https://github.com/opencv/opencv/issues>
|
||||
* Additional OpenCV functionality: <https://github.com/opencv/opencv_contrib>
|
||||
|
||||
|
||||
### Contributing
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
add_definitions(-D__OPENCV_BUILD=1)
|
||||
add_definitions(-D__OPENCV_APPS=1)
|
||||
|
||||
string(REPLACE "," ";" OPENCV_INSTALL_APPS_LIST "${OPENCV_INSTALL_APPS_LIST}") # support comma-separated list (,) too
|
||||
|
||||
# Unified function for creating OpenCV applications:
|
||||
# ocv_add_application(tgt [MODULES <m1> [<m2> ...]] SRCS <src1> [<src2> ...])
|
||||
function(ocv_add_application the_target)
|
||||
|
@ -25,12 +27,14 @@ function(ocv_add_application the_target)
|
|||
set_target_properties(${the_target} PROPERTIES FOLDER "applications")
|
||||
endif()
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
if(NOT INSTALL_CREATE_DISTRIB
|
||||
OR (OPENCV_INSTALL_APPS_LIST STREQUAL "all" OR ";${OPENCV_INSTALL_APPS_LIST};" MATCHES ";${the_target};")
|
||||
)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT dev)
|
||||
elseif(INSTALL_CREATE_DISTRIB)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT dev)
|
||||
endif()
|
||||
else()
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT dev)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -55,3 +59,4 @@ ocv_add_app(annotation)
|
|||
ocv_add_app(visualisation)
|
||||
ocv_add_app(interactive-calibration)
|
||||
ocv_add_app(version)
|
||||
ocv_add_app(model-diagnostics)
|
||||
|
|
|
@ -1078,8 +1078,8 @@ void cvCreateTrainingSamples( const char* filename,
|
|||
icvPlaceDistortedSample( sample, inverse, maxintensitydev,
|
||||
maxxangle, maxyangle, maxzangle,
|
||||
0 /* nonzero means placing image without cut offs */,
|
||||
0.0 /* nozero adds random shifting */,
|
||||
0.0 /* nozero adds random scaling */,
|
||||
0.0 /* nonzero adds random shifting */,
|
||||
0.0 /* nonzero adds random scaling */,
|
||||
&data );
|
||||
|
||||
if( showsamples )
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace calib
|
|||
cv::Size boardSize;
|
||||
int charucoDictName;
|
||||
int calibrationStep;
|
||||
float charucoSquareLenght, charucoMarkerSize;
|
||||
float charucoSquareLength, charucoMarkerSize;
|
||||
float captureDelay;
|
||||
float squareSize;
|
||||
float templDst;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<opencv_storage>
|
||||
<charuco_dict>0</charuco_dict>
|
||||
<charuco_square_lenght>200</charuco_square_lenght>
|
||||
<charuco_square_length>200</charuco_square_length>
|
||||
<charuco_marker_size>100</charuco_marker_size>
|
||||
<calibration_step>1</calibration_step>
|
||||
<max_frames_num>30</max_frames_num>
|
||||
|
|
|
@ -273,7 +273,7 @@ CalibProcessor::CalibProcessor(cv::Ptr<calibrationData> data, captureParameters
|
|||
#ifdef HAVE_OPENCV_ARUCO
|
||||
mArucoDictionary = cv::aruco::getPredefinedDictionary(
|
||||
cv::aruco::PREDEFINED_DICTIONARY_NAME(capParams.charucoDictName));
|
||||
mCharucoBoard = cv::aruco::CharucoBoard::create(mBoardSize.width, mBoardSize.height, capParams.charucoSquareLenght,
|
||||
mCharucoBoard = cv::aruco::CharucoBoard::create(mBoardSize.width, mBoardSize.height, capParams.charucoSquareLength,
|
||||
capParams.charucoMarkerSize, mArucoDictionary);
|
||||
#endif
|
||||
break;
|
||||
|
|
|
@ -181,7 +181,7 @@ int main(int argc, char** argv)
|
|||
cv::aruco::getPredefinedDictionary(cv::aruco::PREDEFINED_DICTIONARY_NAME(capParams.charucoDictName));
|
||||
cv::Ptr<cv::aruco::CharucoBoard> charucoboard =
|
||||
cv::aruco::CharucoBoard::create(capParams.boardSize.width, capParams.boardSize.height,
|
||||
capParams.charucoSquareLenght, capParams.charucoMarkerSize, dictionary);
|
||||
capParams.charucoSquareLength, capParams.charucoMarkerSize, dictionary);
|
||||
globalData->totalAvgErr =
|
||||
cv::aruco::calibrateCameraCharuco(globalData->allCharucoCorners, globalData->allCharucoIds,
|
||||
charucoboard, globalData->imageSize,
|
||||
|
|
|
@ -32,12 +32,15 @@ bool calib::parametersController::loadFromFile(const std::string &inputFileName)
|
|||
|
||||
if(!reader.isOpened()) {
|
||||
std::cerr << "Warning: Unable to open " << inputFileName <<
|
||||
" Applicatioin stated with default advanced parameters" << std::endl;
|
||||
" Application started with default advanced parameters" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
readFromNode(reader["charuco_dict"], mCapParams.charucoDictName);
|
||||
readFromNode(reader["charuco_square_lenght"], mCapParams.charucoSquareLenght);
|
||||
if (readFromNode(reader["charuco_square_lenght"], mCapParams.charucoSquareLength)) {
|
||||
std::cout << "DEPRECATION: Parameter 'charuco_square_lenght' has been deprecated (typo). Use 'charuco_square_length' instead." << std::endl;
|
||||
}
|
||||
readFromNode(reader["charuco_square_length"], mCapParams.charucoSquareLength);
|
||||
readFromNode(reader["charuco_marker_size"], mCapParams.charucoMarkerSize);
|
||||
readFromNode(reader["camera_resolution"], mCapParams.cameraResolution);
|
||||
readFromNode(reader["calibration_step"], mCapParams.calibrationStep);
|
||||
|
@ -51,7 +54,7 @@ bool calib::parametersController::loadFromFile(const std::string &inputFileName)
|
|||
bool retValue =
|
||||
checkAssertion(mCapParams.charucoDictName >= 0, "Dict name must be >= 0") &&
|
||||
checkAssertion(mCapParams.charucoMarkerSize > 0, "Marker size must be positive") &&
|
||||
checkAssertion(mCapParams.charucoSquareLenght > 0, "Square size must be positive") &&
|
||||
checkAssertion(mCapParams.charucoSquareLength > 0, "Square size must be positive") &&
|
||||
checkAssertion(mCapParams.minFramesNum > 1, "Minimal number of frames for calibration < 1") &&
|
||||
checkAssertion(mCapParams.calibrationStep > 0, "Calibration step must be positive") &&
|
||||
checkAssertion(mCapParams.maxFramesNum > mCapParams.minFramesNum, "maxFramesNum < minFramesNum") &&
|
||||
|
@ -119,7 +122,7 @@ bool calib::parametersController::loadFromParser(cv::CommandLineParser &parser)
|
|||
mCapParams.board = chAruco;
|
||||
mCapParams.boardSize = cv::Size(6, 8);
|
||||
mCapParams.charucoDictName = 0;
|
||||
mCapParams.charucoSquareLenght = 200;
|
||||
mCapParams.charucoSquareLength = 200;
|
||||
mCapParams.charucoMarkerSize = 100;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
ocv_add_application(opencv_model_diagnostics
|
||||
MODULES opencv_core opencv_dnn
|
||||
SRCS model_diagnostics.cpp)
|
|
@ -0,0 +1,67 @@
|
|||
/*************************************************
|
||||
USAGE:
|
||||
./model_diagnostics -m <model file location>
|
||||
**************************************************/
|
||||
#include <opencv2/dnn.hpp>
|
||||
#include <opencv2/core/utils/filesystem.hpp>
|
||||
#include <opencv2/dnn/utils/debug_utils.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace cv;
|
||||
using namespace dnn;
|
||||
|
||||
|
||||
static
|
||||
int diagnosticsErrorCallback(int /*status*/, const char* /*func_name*/,
|
||||
const char* /*err_msg*/, const char* /*file_name*/,
|
||||
int /*line*/, void* /*userdata*/)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static std::string checkFileExists(const std::string& fileName)
|
||||
{
|
||||
if (fileName.empty() || utils::fs::exists(fileName))
|
||||
return fileName;
|
||||
|
||||
CV_Error(Error::StsObjectNotFound, "File " + fileName + " was not found! "
|
||||
"Please, specify a full path to the file.");
|
||||
}
|
||||
|
||||
std::string diagnosticKeys =
|
||||
"{ model m | | Path to the model file. }"
|
||||
"{ config c | | Path to the model configuration file. }"
|
||||
"{ framework f | | [Optional] Name of the model framework. }";
|
||||
|
||||
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
CommandLineParser argParser(argc, argv, diagnosticKeys);
|
||||
argParser.about("Use this tool to run the diagnostics of provided ONNX/TF model"
|
||||
"to obtain the information about its support (supported layers).");
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
argParser.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string model = checkFileExists(argParser.get<std::string>("model"));
|
||||
std::string config = checkFileExists(argParser.get<std::string>("config"));
|
||||
std::string frameworkId = argParser.get<std::string>("framework");
|
||||
|
||||
CV_Assert(!model.empty());
|
||||
|
||||
enableModelDiagnostics(true);
|
||||
skipModelImport(true);
|
||||
redirectError(diagnosticsErrorCallback, NULL);
|
||||
|
||||
Net ocvNet = readNet(model, config, frameworkId);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
## MOVED: opencv_stitching_tool
|
||||
|
||||
As the stitching package is now available on [PyPI](https://pypi.org/project/stitching/) the tool and belonging package are now maintained [here](https://github.com/lukasalexanderweber/stitching). The Tutorial is maintained [here](https://github.com/lukasalexanderweber/stitching_tutorial).
|
|
@ -45,7 +45,7 @@ protected:
|
|||
};
|
||||
std::vector<Feature> features;
|
||||
|
||||
cv::Mat normSum; //for nomalization calculation (L1 or L2)
|
||||
cv::Mat normSum; //for normalization calculation (L1 or L2)
|
||||
std::vector<cv::Mat> hist;
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,7 @@ inline float CvHOGEvaluator::Feature::calc( const std::vector<cv::Mat>& _hists,
|
|||
|
||||
const float *pnormSum = _normSum.ptr<float>((int)y);
|
||||
normFactor = (float)(pnormSum[fastRect[0].p0] - pnormSum[fastRect[1].p1] - pnormSum[fastRect[2].p2] + pnormSum[fastRect[3].p3]);
|
||||
res = (res > 0.001f) ? ( res / (normFactor + 0.001f) ) : 0.f; //for cutting negative values, which apper due to floating precision
|
||||
res = (res > 0.001f) ? ( res / (normFactor + 0.001f) ) : 0.f; //for cutting negative values, which appear due to floating precision
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
|
|||
fs << "}";
|
||||
}
|
||||
// save current stage
|
||||
char buf[10];
|
||||
char buf[32];
|
||||
sprintf(buf, "%s%d", "stage", i );
|
||||
string stageFilename = dirName + buf + ".xml";
|
||||
FileStorage fs( stageFilename, FileStorage::WRITE );
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
// defined in core/private.hpp
|
||||
namespace cv {
|
||||
CV_EXPORTS const char* currentParallelFramework();
|
||||
}
|
||||
|
||||
static void dumpHWFeatures(bool showAll = false)
|
||||
{
|
||||
std::cout << "OpenCV's HW features list:" << std::endl;
|
||||
|
@ -34,6 +39,16 @@ static void dumpHWFeatures(bool showAll = false)
|
|||
std::cout << "Total available: " << count << std::endl;
|
||||
}
|
||||
|
||||
static void dumpParallelFramework()
|
||||
{
|
||||
const char* parallelFramework = cv::currentParallelFramework();
|
||||
if (parallelFramework)
|
||||
{
|
||||
int threads = cv::getNumThreads();
|
||||
std::cout << "Parallel framework: " << parallelFramework << " (nthreads=" << threads << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
|
@ -47,6 +62,7 @@ int main(int argc, const char** argv)
|
|||
"{ verbose v | | show build configuration log }"
|
||||
"{ opencl | | show information about OpenCL (available platforms/devices, default selected device) }"
|
||||
"{ hw | | show detected HW features (see cv::checkHardwareSupport() function). Use --hw=0 to show available features only }"
|
||||
"{ threads | | show configured parallel framework and number of active threads }"
|
||||
);
|
||||
|
||||
if (parser.has("help"))
|
||||
|
@ -73,10 +89,17 @@ int main(int argc, const char** argv)
|
|||
{
|
||||
dumpHWFeatures(parser.get<bool>("hw"));
|
||||
}
|
||||
|
||||
if (parser.has("threads"))
|
||||
{
|
||||
dumpParallelFramework();
|
||||
}
|
||||
|
||||
#else
|
||||
std::cout << cv::getBuildInformation().c_str() << std::endl;
|
||||
cv::dumpOpenCLInformation();
|
||||
dumpHWFeatures();
|
||||
dumpParallelFramework();
|
||||
MessageBoxA(NULL, "Check console window output", "OpenCV(" CV_VERSION ")", MB_ICONINFORMATION | MB_OK);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -65,17 +65,21 @@ endif()
|
|||
|
||||
# extract version from the include
|
||||
if(CUDNN_INCLUDE_DIR)
|
||||
file(READ "${CUDNN_INCLUDE_DIR}/cudnn.h" CUDNN_H_CONTENTS)
|
||||
if(EXISTS "${CUDNN_INCLUDE_DIR}/cudnn_version.h")
|
||||
file(READ "${CUDNN_INCLUDE_DIR}/cudnn_version.h" CUDNN_H_CONTENTS)
|
||||
else()
|
||||
file(READ "${CUDNN_INCLUDE_DIR}/cudnn.h" CUDNN_H_CONTENTS)
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH "define CUDNN_MAJOR ([0-9]+)" _ "${CUDNN_H_CONTENTS}")
|
||||
set(CUDNN_MAJOR_VERSION ${CMAKE_MATCH_1} CACHE INTERNAL "")
|
||||
set(CUDNN_VERSION_MAJOR ${CMAKE_MATCH_1} CACHE INTERNAL "")
|
||||
string(REGEX MATCH "define CUDNN_MINOR ([0-9]+)" _ "${CUDNN_H_CONTENTS}")
|
||||
set(CUDNN_MINOR_VERSION ${CMAKE_MATCH_1} CACHE INTERNAL "")
|
||||
set(CUDNN_VERSION_MINOR ${CMAKE_MATCH_1} CACHE INTERNAL "")
|
||||
string(REGEX MATCH "define CUDNN_PATCHLEVEL ([0-9]+)" _ "${CUDNN_H_CONTENTS}")
|
||||
set(CUDNN_PATCH_VERSION ${CMAKE_MATCH_1} CACHE INTERNAL "")
|
||||
set(CUDNN_VERSION_PATCH ${CMAKE_MATCH_1} CACHE INTERNAL "")
|
||||
|
||||
set(CUDNN_VERSION
|
||||
"${CUDNN_MAJOR_VERSION}.${CUDNN_MINOR_VERSION}.${CUDNN_PATCH_VERSION}"
|
||||
"${CUDNN_VERSION_MAJOR}.${CUDNN_VERSION_MINOR}.${CUDNN_VERSION_PATCH}"
|
||||
CACHE
|
||||
STRING
|
||||
"cuDNN version"
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
|
||||
find_host_program(FLAKE8_EXECUTABLE flake8 PATHS /usr/bin)
|
||||
|
||||
if(FLAKE8_EXECUTABLE)
|
||||
execute_process(COMMAND ${FLAKE8_EXECUTABLE} --version OUTPUT_VARIABLE FLAKE8_VERSION_RAW ERROR_QUIET)
|
||||
if(FLAKE8_VERSION_RAW MATCHES "^([0-9\\.]+[0-9])")
|
||||
if(FLAKE8_EXECUTABLE AND NOT DEFINED FLAKE8_VERSION)
|
||||
execute_process(COMMAND ${FLAKE8_EXECUTABLE} --version RESULT_VARIABLE _result OUTPUT_VARIABLE FLAKE8_VERSION_RAW)
|
||||
if(NOT _result EQUAL 0)
|
||||
ocv_clear_vars(FLAKE8_EXECUTABLE FLAKE8_VERSION)
|
||||
elseif(FLAKE8_VERSION_RAW MATCHES "^([0-9\\.]+[0-9])")
|
||||
set(FLAKE8_VERSION "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(FLAKE8_VERSION "unknown")
|
||||
|
@ -22,6 +24,9 @@ if(FLAKE8_EXECUTABLE)
|
|||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Flake8 DEFAULT_MSG FLAKE8_EXECUTABLE)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Flake8
|
||||
REQUIRED_VARS FLAKE8_EXECUTABLE
|
||||
VERSION_VAR FLAKE8_VERSION
|
||||
)
|
||||
|
||||
mark_as_advanced(FLAKE8_EXECUTABLE FLAKE8_VERSION)
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
ocv_clear_vars(HAVE_ONNX)
|
||||
|
||||
set(ONNXRT_ROOT_DIR "" CACHE PATH "ONNX Runtime install directory")
|
||||
|
||||
# For now, check the old name ORT_INSTALL_DIR
|
||||
if(ORT_INSTALL_DIR AND NOT ONNXRT_ROOT_DIR)
|
||||
set(ONNXRT_ROOT_DIR ${ORT_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
if(ONNXRT_ROOT_DIR)
|
||||
find_library(ORT_LIB onnxruntime
|
||||
${ONNXRT_ROOT_DIR}/lib
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
find_path(ORT_INCLUDE onnxruntime_cxx_api.h
|
||||
${ONNXRT_ROOT_DIR}/include/onnxruntime/core/session
|
||||
CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
endif()
|
||||
|
||||
if(ORT_LIB AND ORT_INCLUDE)
|
||||
set(HAVE_ONNX TRUE)
|
||||
# For CMake output only
|
||||
set(ONNX_LIBRARIES "${ORT_LIB}" CACHE STRING "ONNX Runtime libraries")
|
||||
set(ONNX_INCLUDE_DIR "${ORT_INCLUDE}" CACHE STRING "ONNX Runtime include path")
|
||||
|
||||
# Link target with associated interface headers
|
||||
set(ONNX_LIBRARY "onnxruntime" CACHE STRING "ONNX Link Target")
|
||||
ocv_add_library(${ONNX_LIBRARY} SHARED IMPORTED)
|
||||
set_target_properties(${ONNX_LIBRARY} PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${ORT_INCLUDE}
|
||||
IMPORTED_LOCATION ${ORT_LIB}
|
||||
IMPORTED_IMPLIB ${ORT_LIB})
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_ONNX)
|
||||
ocv_clear_vars(HAVE_ONNX ORT_LIB ORT_INCLUDE_DIR)
|
||||
endif()
|
|
@ -12,9 +12,11 @@
|
|||
|
||||
find_host_program(PYLINT_EXECUTABLE pylint PATHS /usr/bin)
|
||||
|
||||
if(PYLINT_EXECUTABLE)
|
||||
execute_process(COMMAND ${PYLINT_EXECUTABLE} --version OUTPUT_VARIABLE PYLINT_VERSION_RAW ERROR_QUIET)
|
||||
if(PYLINT_VERSION_RAW MATCHES "pylint([^,]*) ([0-9\\.]+[0-9])")
|
||||
if(PYLINT_EXECUTABLE AND NOT DEFINED PYLINT_VERSION)
|
||||
execute_process(COMMAND ${PYLINT_EXECUTABLE} --version RESULT_VARIABLE _result OUTPUT_VARIABLE PYLINT_VERSION_RAW)
|
||||
if(NOT _result EQUAL 0)
|
||||
ocv_clear_vars(PYLINT_EXECUTABLE PYLINT_VERSION)
|
||||
elseif(PYLINT_VERSION_RAW MATCHES "pylint([^,\n]*) ([0-9\\.]+[0-9])")
|
||||
set(PYLINT_VERSION "${CMAKE_MATCH_2}")
|
||||
else()
|
||||
set(PYLINT_VERSION "unknown")
|
||||
|
@ -22,6 +24,9 @@ if(PYLINT_EXECUTABLE)
|
|||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pylint DEFAULT_MSG PYLINT_EXECUTABLE)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pylint
|
||||
REQUIRED_VARS PYLINT_EXECUTABLE
|
||||
VERSION_VAR PYLINT_VERSION
|
||||
)
|
||||
|
||||
mark_as_advanced(PYLINT_EXECUTABLE PYLINT_VERSION)
|
||||
|
|
|
@ -64,12 +64,3 @@ else()
|
|||
endif()
|
||||
endforeach(flag_var)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER "2.8.6")
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(N)
|
||||
if(NOT N EQUAL 0)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${N} ")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${N} ")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -87,11 +87,3 @@ endif()
|
|||
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OPENCV_LINKER_DEFENSES_FLAGS_COMMON}" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OPENCV_LINKER_DEFENSES_FLAGS_COMMON}" )
|
||||
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OPENCV_LINKER_DEFENSES_FLAGS_COMMON}" )
|
||||
|
||||
if(CV_GCC OR CV_CLANG)
|
||||
foreach(flags
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_DEBUG)
|
||||
string(REPLACE "-O3" "-O2" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
|
|
@ -49,6 +49,7 @@ list(APPEND CPU_ALL_OPTIMIZATIONS "AVX512_COMMON;AVX512_KNL;AVX512_KNM;AVX512_SK
|
|||
list(APPEND CPU_ALL_OPTIMIZATIONS NEON VFPV3 FP16)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS MSA)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS VSX VSX3)
|
||||
list(APPEND CPU_ALL_OPTIMIZATIONS RVV)
|
||||
list(REMOVE_DUPLICATES CPU_ALL_OPTIMIZATIONS)
|
||||
|
||||
ocv_update(CPU_VFPV3_FEATURE_ALIAS "")
|
||||
|
@ -102,6 +103,8 @@ ocv_optimization_process_obsolete_option(ENABLE_NEON NEON OFF)
|
|||
|
||||
ocv_optimization_process_obsolete_option(ENABLE_VSX VSX ON)
|
||||
|
||||
ocv_optimization_process_obsolete_option(ENABLE_RVV RVV OFF)
|
||||
|
||||
macro(ocv_is_optimization_in_list resultvar check_opt)
|
||||
set(__checked "")
|
||||
set(__queue ${ARGN})
|
||||
|
@ -238,7 +241,7 @@ if(X86 OR X86_64)
|
|||
ocv_intel_compiler_optimization_option(FP16 "-mavx" "/arch:AVX")
|
||||
ocv_intel_compiler_optimization_option(AVX "-mavx" "/arch:AVX")
|
||||
ocv_intel_compiler_optimization_option(FMA3 "" "")
|
||||
ocv_intel_compiler_optimization_option(POPCNT "" "")
|
||||
ocv_intel_compiler_optimization_option(POPCNT "-mpopcnt" "") # -mpopcnt is available since ICC 19.0.0
|
||||
ocv_intel_compiler_optimization_option(SSE4_2 "-msse4.2" "/arch:SSE4.2")
|
||||
ocv_intel_compiler_optimization_option(SSE4_1 "-msse4.1" "/arch:SSE4.1")
|
||||
ocv_intel_compiler_optimization_option(SSE3 "-msse3" "/arch:SSE3")
|
||||
|
@ -366,6 +369,14 @@ elseif(PPC64LE)
|
|||
|
||||
set(CPU_DISPATCH "VSX3" CACHE STRING "${HELP_CPU_DISPATCH}")
|
||||
set(CPU_BASELINE "VSX" CACHE STRING "${HELP_CPU_BASELINE}")
|
||||
|
||||
elseif(RISCV)
|
||||
ocv_update(CPU_RVV_TEST_FILE "${OpenCV_SOURCE_DIR}/cmake/checks/cpu_rvv.cpp")
|
||||
ocv_update(CPU_KNOWN_OPTIMIZATIONS "RVV")
|
||||
ocv_update(CPU_RVV_FLAGS_ON "")
|
||||
set(CPU_DISPATCH "RVV" CACHE STRING "${HELP_CPU_DISPATCH}")
|
||||
set(CPU_BASELINE "RVV" CACHE STRING "${HELP_CPU_BASELINE}")
|
||||
|
||||
endif()
|
||||
|
||||
# Helper values for cmake-gui
|
||||
|
|
|
@ -8,13 +8,27 @@ function(access_CMAKE_COMPILER_IS_CCACHE)
|
|||
endif()
|
||||
endfunction()
|
||||
variable_watch(CMAKE_COMPILER_IS_CCACHE access_CMAKE_COMPILER_IS_CCACHE)
|
||||
if(ENABLE_CCACHE AND NOT OPENCV_COMPILER_IS_CCACHE AND NOT CMAKE_GENERATOR MATCHES "Xcode")
|
||||
if(ENABLE_CCACHE AND NOT OPENCV_COMPILER_IS_CCACHE)
|
||||
# This works fine with Unix Makefiles and Ninja generators
|
||||
find_host_program(CCACHE_PROGRAM ccache)
|
||||
if(CCACHE_PROGRAM)
|
||||
message(STATUS "Looking for ccache - found (${CCACHE_PROGRAM})")
|
||||
get_property(__OLD_RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
|
||||
if(__OLD_RULE_LAUNCH_COMPILE)
|
||||
if(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/templates/xcode-launch-c.in" "${CMAKE_BINARY_DIR}/xcode-launch-c")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/templates/xcode-launch-cxx.in" "${CMAKE_BINARY_DIR}/xcode-launch-cxx")
|
||||
execute_process(COMMAND chmod a+rx
|
||||
"${CMAKE_BINARY_DIR}/xcode-launch-c"
|
||||
"${CMAKE_BINARY_DIR}/xcode-launch-cxx"
|
||||
)
|
||||
# Xcode project attributes
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/xcode-launch-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/xcode-launch-cxx")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/xcode-launch-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/xcode-launch-cxx")
|
||||
set(OPENCV_COMPILER_IS_CCACHE 1)
|
||||
message(STATUS "ccache: enable support through Xcode project properties")
|
||||
elseif(__OLD_RULE_LAUNCH_COMPILE)
|
||||
message(STATUS "Can't replace CMake compiler launcher")
|
||||
else()
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
|
||||
|
@ -105,12 +119,12 @@ if(CV_GCC OR CV_CLANG)
|
|||
# we want.
|
||||
add_extra_compiler_option(-Wall)
|
||||
endif()
|
||||
add_extra_compiler_option(-Werror=return-type)
|
||||
add_extra_compiler_option(-Werror=non-virtual-dtor)
|
||||
add_extra_compiler_option(-Werror=address)
|
||||
add_extra_compiler_option(-Werror=sequence-point)
|
||||
add_extra_compiler_option(-Wreturn-type)
|
||||
add_extra_compiler_option(-Wnon-virtual-dtor)
|
||||
add_extra_compiler_option(-Waddress)
|
||||
add_extra_compiler_option(-Wsequence-point)
|
||||
add_extra_compiler_option(-Wformat)
|
||||
add_extra_compiler_option(-Werror=format-security -Wformat)
|
||||
add_extra_compiler_option(-Wformat-security -Wformat)
|
||||
add_extra_compiler_option(-Wmissing-declarations)
|
||||
add_extra_compiler_option(-Wmissing-prototypes)
|
||||
add_extra_compiler_option(-Wstrict-prototypes)
|
||||
|
@ -122,7 +136,6 @@ if(CV_GCC OR CV_CLANG)
|
|||
endif()
|
||||
add_extra_compiler_option(-Wsign-promo)
|
||||
add_extra_compiler_option(-Wuninitialized)
|
||||
add_extra_compiler_option(-Winit-self)
|
||||
if(CV_GCC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0))
|
||||
add_extra_compiler_option(-Wno-psabi)
|
||||
endif()
|
||||
|
@ -153,6 +166,10 @@ if(CV_GCC OR CV_CLANG)
|
|||
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
add_extra_compiler_option(-Wno-missing-field-initializers) # GCC 4.x emits warnings about {}, fixed in GCC 5+
|
||||
endif()
|
||||
if(CV_CLANG AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
add_extra_compiler_option(-Wno-deprecated-enum-enum-conversion)
|
||||
add_extra_compiler_option(-Wno-deprecated-anon-enum-enum-conversion)
|
||||
endif()
|
||||
endif()
|
||||
add_extra_compiler_option(-fdiagnostics-show-option)
|
||||
|
||||
|
@ -161,8 +178,17 @@ if(CV_GCC OR CV_CLANG)
|
|||
add_extra_compiler_option(-Wno-long-long)
|
||||
endif()
|
||||
|
||||
# We need pthread's
|
||||
if(UNIX AND NOT ANDROID AND NOT (APPLE AND CV_CLANG)) # TODO
|
||||
# We need pthread's, unless we have explicitly disabled multi-thread execution.
|
||||
if(NOT OPENCV_DISABLE_THREAD_SUPPORT
|
||||
AND (
|
||||
(UNIX
|
||||
AND NOT ANDROID
|
||||
AND NOT (APPLE AND CV_CLANG)
|
||||
AND NOT EMSCRIPTEN
|
||||
)
|
||||
OR (EMSCRIPTEN AND WITH_PTHREADS_PF) # https://github.com/opencv/opencv/issues/20285
|
||||
)
|
||||
) # TODO
|
||||
add_extra_compiler_option(-pthread)
|
||||
endif()
|
||||
|
||||
|
@ -187,7 +213,6 @@ if(CV_GCC OR CV_CLANG)
|
|||
|
||||
# Profiling?
|
||||
if(ENABLE_PROFILING)
|
||||
add_extra_compiler_option("-pg -g")
|
||||
# turn off incompatible options
|
||||
foreach(flags CMAKE_CXX_FLAGS CMAKE_C_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
|
||||
OPENCV_EXTRA_FLAGS_RELEASE OPENCV_EXTRA_FLAGS_DEBUG OPENCV_EXTRA_C_FLAGS OPENCV_EXTRA_CXX_FLAGS)
|
||||
|
@ -195,6 +220,9 @@ if(CV_GCC OR CV_CLANG)
|
|||
string(REPLACE "-ffunction-sections" "" ${flags} "${${flags}}")
|
||||
string(REPLACE "-fdata-sections" "" ${flags} "${${flags}}")
|
||||
endforeach()
|
||||
# -pg should be placed both in the linker and in the compiler settings
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
|
||||
add_extra_compiler_option("-pg -g")
|
||||
else()
|
||||
if(MSVC)
|
||||
# TODO: Clang/C2 is not supported
|
||||
|
@ -208,9 +236,11 @@ if(CV_GCC OR CV_CLANG)
|
|||
if(APPLE)
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
set(OPENCV_EXTRA_SHARED_LINKER_FLAGS "${OPENCV_EXTRA_SHARED_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
set(OPENCV_EXTRA_MODULE_LINKER_FLAGS "${OPENCV_EXTRA_MODULE_LINKER_FLAGS} -Wl,-dead_strip")
|
||||
else()
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
set(OPENCV_EXTRA_SHARED_LINKER_FLAGS "${OPENCV_EXTRA_SHARED_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
set(OPENCV_EXTRA_MODULE_LINKER_FLAGS "${OPENCV_EXTRA_MODULE_LINKER_FLAGS} -Wl,--gc-sections")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -262,6 +292,7 @@ if(MSVC)
|
|||
set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} /Zi")
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
|
||||
set(OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE} /debug")
|
||||
set(OPENCV_EXTRA_MODULE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_MODULE_LINKER_FLAGS_RELEASE} /debug")
|
||||
endif()
|
||||
|
||||
# Remove unreferenced functions: function level linking
|
||||
|
@ -283,9 +314,15 @@ if(MSVC)
|
|||
set(OPENCV_EXTRA_C_FLAGS "${OPENCV_EXTRA_C_FLAGS} /FS")
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} /FS")
|
||||
endif()
|
||||
|
||||
if(AARCH64 AND NOT MSVC_VERSION LESS 1930)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /D _ARM64_DISTINCT_NEON_TYPES")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(cmake/OpenCVCompilerOptimizations.cmake)
|
||||
if(PROJECT_NAME STREQUAL "OpenCV")
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVCompilerOptimizations.cmake")
|
||||
endif()
|
||||
if(COMMAND ocv_compiler_optimization_options)
|
||||
ocv_compiler_optimization_options()
|
||||
endif()
|
||||
|
@ -318,6 +355,38 @@ if(PPC64LE)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Apply "-Wl,--as-needed" linker flags: https://github.com/opencv/opencv/issues/7001
|
||||
if(NOT OPENCV_SKIP_LINK_AS_NEEDED)
|
||||
if(UNIX AND (NOT APPLE OR NOT CMAKE_VERSION VERSION_LESS "3.2"))
|
||||
set(_option "-Wl,--as-needed")
|
||||
set(_saved_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_option}") # requires CMake 3.2+ and CMP0056
|
||||
ocv_check_compiler_flag(CXX "" HAVE_LINK_AS_NEEDED)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${_saved_CMAKE_EXE_LINKER_FLAGS}")
|
||||
if(HAVE_LINK_AS_NEEDED)
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS} ${_option}")
|
||||
set(OPENCV_EXTRA_SHARED_LINKER_FLAGS "${OPENCV_EXTRA_SHARED_LINKER_FLAGS} ${_option}")
|
||||
set(OPENCV_EXTRA_MODULE_LINKER_FLAGS "${OPENCV_EXTRA_MODULE_LINKER_FLAGS} ${_option}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Apply "-Wl,--no-undefined" linker flags: https://github.com/opencv/opencv/pull/21347
|
||||
if(NOT OPENCV_SKIP_LINK_NO_UNDEFINED)
|
||||
if(UNIX AND (NOT APPLE OR NOT CMAKE_VERSION VERSION_LESS "3.2"))
|
||||
set(_option "-Wl,--no-undefined")
|
||||
set(_saved_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_option}") # requires CMake 3.2+ and CMP0056
|
||||
ocv_check_compiler_flag(CXX "" HAVE_LINK_NO_UNDEFINED)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${_saved_CMAKE_EXE_LINKER_FLAGS}")
|
||||
if(HAVE_LINK_NO_UNDEFINED)
|
||||
set(OPENCV_EXTRA_EXE_LINKER_FLAGS "${OPENCV_EXTRA_EXE_LINKER_FLAGS} ${_option}")
|
||||
set(OPENCV_EXTRA_SHARED_LINKER_FLAGS "${OPENCV_EXTRA_SHARED_LINKER_FLAGS} ${_option}")
|
||||
set(OPENCV_EXTRA_MODULE_LINKER_FLAGS "${OPENCV_EXTRA_MODULE_LINKER_FLAGS} ${_option}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# combine all "extra" options
|
||||
if(NOT OPENCV_SKIP_EXTRA_COMPILER_FLAGS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_C_FLAGS}")
|
||||
|
@ -332,6 +401,9 @@ if(NOT OPENCV_SKIP_EXTRA_COMPILER_FLAGS)
|
|||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OPENCV_EXTRA_SHARED_LINKER_FLAGS}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_SHARED_LINKER_FLAGS_DEBUG}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OPENCV_EXTRA_MODULE_LINKER_FLAGS}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${OPENCV_EXTRA_MODULE_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${OPENCV_EXTRA_MODULE_LINKER_FLAGS_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
|
@ -355,6 +427,9 @@ if(MSVC)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# Enable [[attribute]] syntax checking to prevent silent failure: "attribute is ignored in this syntactic position"
|
||||
add_extra_compiler_option("/w15240")
|
||||
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127) # conditional expression is constant
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4251) # class 'std::XXX' needs to have dll-interface to be used by clients of YYY
|
||||
|
@ -377,11 +452,11 @@ if(APPLE AND NOT CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{LDFLAGS} AND EXISTS "/
|
|||
endif()
|
||||
|
||||
if(ENABLE_BUILD_HARDENING)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/OpenCVCompilerDefenses.cmake)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/OpenCVCompilerDefenses.cmake")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
include(cmake/OpenCVCRTLinkage.cmake)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/OpenCVCRTLinkage.cmake")
|
||||
add_definitions(-D_VARIADIC_MAX=10)
|
||||
endif()
|
||||
|
||||
|
@ -429,3 +504,38 @@ if(OPENCV_EXTRA_RPATH_LINK_PATH)
|
|||
message(WARNING "OPENCV_EXTRA_RPATH_LINK_PATH may not work properly because CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG is not defined (not supported)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Control MSVC /MP flag
|
||||
# Input variables: OPENCV_MSVC_PARALLEL (ON,1,2,3,...) + OPENCV_SKIP_MSVC_PARALLEL
|
||||
# Details:
|
||||
# - https://docs.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes
|
||||
# - https://docs.microsoft.com/en-us/cpp/build/reference/cl-environment-variables
|
||||
# - https://gitlab.kitware.com/cmake/cmake/merge_requests/1718/diffs
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio" AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC|Intel")
|
||||
ocv_check_environment_variables(OPENCV_SKIP_MSVC_PARALLEL)
|
||||
if(OPENCV_SKIP_MSVC_PARALLEL)
|
||||
# nothing
|
||||
elseif(" ${CMAKE_CXX_FLAGS}" MATCHES "/MP")
|
||||
# nothing, already defined in compiler flags
|
||||
elseif(DEFINED ENV{CL} AND " $ENV{CL}" MATCHES "/MP")
|
||||
# nothing, compiler will use CL environment variable
|
||||
elseif(DEFINED ENV{_CL_} AND " $ENV{_CL_}" MATCHES "/MP")
|
||||
# nothing, compiler will use _CL_ environment variable
|
||||
else()
|
||||
ocv_check_environment_variables(OPENCV_MSVC_PARALLEL)
|
||||
set(_mp_value "ON")
|
||||
if(DEFINED OPENCV_MSVC_PARALLEL)
|
||||
set(_mp_value "${OPENCV_MSVC_PARALLEL}")
|
||||
endif()
|
||||
set(OPENCV_MSVC_PARALLEL "${_mp_value}" CACHE STRING "Control MSVC /MP flag")
|
||||
if(_mp_value)
|
||||
if(_mp_value GREATER 0)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${_mp_value}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${_mp_value}")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
if(WIN32 AND NOT MSVC)
|
||||
if((WIN32 AND NOT MSVC) OR OPENCV_CMAKE_FORCE_CUDA)
|
||||
message(STATUS "CUDA compilation is disabled (due to only Visual Studio compiler supported on your platform).")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT UNIX AND CV_CLANG)
|
||||
if((NOT UNIX AND CV_CLANG) OR OPENCV_CMAKE_FORCE_CUDA)
|
||||
message(STATUS "CUDA compilation is disabled (due to Clang unsupported on your platform).")
|
||||
return()
|
||||
endif()
|
||||
|
||||
#set(OPENCV_CMAKE_CUDA_DEBUG 1)
|
||||
|
||||
if(((NOT CMAKE_VERSION VERSION_LESS "3.9.0") # requires https://gitlab.kitware.com/cmake/cmake/merge_requests/663
|
||||
OR OPENCV_CUDA_FORCE_EXTERNAL_CMAKE_MODULE)
|
||||
|
@ -28,6 +29,11 @@ endif()
|
|||
|
||||
if(CUDA_FOUND)
|
||||
set(HAVE_CUDA 1)
|
||||
if(NOT CUDA_VERSION VERSION_LESS 11.0)
|
||||
# CUDA 11.0 removes nppicom
|
||||
ocv_list_filterout(CUDA_nppi_LIBRARY "nppicom")
|
||||
ocv_list_filterout(CUDA_npp_LIBRARY "nppicom")
|
||||
endif()
|
||||
|
||||
if(WITH_CUFFT)
|
||||
set(HAVE_CUFFT 1)
|
||||
|
@ -48,11 +54,31 @@ if(CUDA_FOUND)
|
|||
endif()
|
||||
|
||||
if(WITH_NVCUVID)
|
||||
macro(ocv_cuda_SEARCH_NVCUVID_HEADER _filename _result)
|
||||
# place header file under CUDA_TOOLKIT_TARGET_DIR or CUDA_TOOLKIT_ROOT_DIR
|
||||
find_path(_header_result
|
||||
${_filename}
|
||||
PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
|
||||
ENV CUDA_PATH
|
||||
ENV CUDA_INC_PATH
|
||||
PATH_SUFFIXES include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if("x${_header_result}" STREQUAL "x_header_result-NOTFOUND")
|
||||
set(${_result} 0)
|
||||
else()
|
||||
set(${_result} 1)
|
||||
endif()
|
||||
unset(_header_result CACHE)
|
||||
endmacro()
|
||||
ocv_cuda_SEARCH_NVCUVID_HEADER("nvcuvid.h" HAVE_NVCUVID_HEADER)
|
||||
ocv_cuda_SEARCH_NVCUVID_HEADER("dynlink_nvcuvid.h" HAVE_DYNLINK_NVCUVID_HEADER)
|
||||
find_cuda_helper_libs(nvcuvid)
|
||||
if(WIN32)
|
||||
find_cuda_helper_libs(nvcuvenc)
|
||||
endif()
|
||||
if(CUDA_nvcuvid_LIBRARY)
|
||||
if(CUDA_nvcuvid_LIBRARY AND (${HAVE_NVCUVID_HEADER} OR ${HAVE_DYNLINK_NVCUVID_HEADER}))
|
||||
# make sure to have both header and library before enabling
|
||||
set(HAVE_NVCUVID 1)
|
||||
endif()
|
||||
if(CUDA_nvcuvenc_LIBRARY)
|
||||
|
@ -62,7 +88,19 @@ if(CUDA_FOUND)
|
|||
|
||||
message(STATUS "CUDA detected: " ${CUDA_VERSION})
|
||||
|
||||
set(_generations "Fermi" "Kepler" "Maxwell" "Pascal" "Volta" "Turing")
|
||||
OCV_OPTION(CUDA_ENABLE_DEPRECATED_GENERATION "Enable deprecated generations in the list" OFF)
|
||||
set(_generations "Maxwell" "Pascal" "Volta" "Turing" "Ampere")
|
||||
if(CUDA_ENABLE_DEPRECATED_GENERATION)
|
||||
set(_generations "Fermi" "${_generations}")
|
||||
set(_generations "Kepler" "${_generations}")
|
||||
endif()
|
||||
set(_arch_fermi "2.0")
|
||||
set(_arch_kepler "3.0;3.5;3.7")
|
||||
set(_arch_maxwell "5.0;5.2")
|
||||
set(_arch_pascal "6.0;6.1")
|
||||
set(_arch_volta "7.0")
|
||||
set(_arch_turing "7.5")
|
||||
set(_arch_ampere "8.0;8.6")
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
list(APPEND _generations "Auto")
|
||||
endif()
|
||||
|
@ -74,43 +112,133 @@ if(CUDA_FOUND)
|
|||
if(CUDA_GENERATION)
|
||||
if(NOT ";${_generations};" MATCHES ";${CUDA_GENERATION};")
|
||||
string(REPLACE ";" ", " _generations "${_generations}")
|
||||
message(FATAL_ERROR "ERROR: ${_generations} Generations are suppered.")
|
||||
message(FATAL_ERROR "ERROR: ${_generations} Generations are supported.")
|
||||
endif()
|
||||
unset(CUDA_ARCH_BIN CACHE)
|
||||
unset(CUDA_ARCH_PTX CACHE)
|
||||
endif()
|
||||
|
||||
SET(DETECT_ARCHS_COMMAND "${CUDA_NVCC_EXECUTABLE}" ${CUDA_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run")
|
||||
if(WIN32 AND CMAKE_LINKER) #Workaround for VS cl.exe not being in the env. path
|
||||
if(OPENCV_CUDA_DETECTION_NVCC_FLAGS MATCHES "-ccbin")
|
||||
# already specified by user
|
||||
elseif(CUDA_HOST_COMPILER AND EXISTS "${CUDA_HOST_COMPILER}")
|
||||
get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH)
|
||||
# C compiler doesn't work with --run option, forcing C++ compiler instead
|
||||
if(CUDA_HOST_COMPILER STREQUAL c_compiler_realpath OR CUDA_HOST_COMPILER STREQUAL CMAKE_C_COMPILER)
|
||||
if(DEFINED CMAKE_CXX_COMPILER)
|
||||
get_filename_component(cxx_compiler_realpath "${CMAKE_CXX_COMPILER}" REALPATH)
|
||||
LIST(APPEND OPENCV_CUDA_DETECTION_NVCC_FLAGS -ccbin "${cxx_compiler_realpath}")
|
||||
else()
|
||||
message(STATUS "CUDA: CMAKE_CXX_COMPILER is not available. You may need to specify CUDA_HOST_COMPILER.")
|
||||
endif()
|
||||
else()
|
||||
LIST(APPEND OPENCV_CUDA_DETECTION_NVCC_FLAGS -ccbin "${CUDA_HOST_COMPILER}")
|
||||
endif()
|
||||
elseif(WIN32 AND CMAKE_LINKER) # Workaround for VS cl.exe not being in the env. path
|
||||
get_filename_component(host_compiler_bindir ${CMAKE_LINKER} DIRECTORY)
|
||||
SET(DETECT_ARCHS_COMMAND ${DETECT_ARCHS_COMMAND} "-ccbin" "${host_compiler_bindir}")
|
||||
LIST(APPEND OPENCV_CUDA_DETECTION_NVCC_FLAGS -ccbin "${host_compiler_bindir}")
|
||||
else()
|
||||
if(CUDA_HOST_COMPILER)
|
||||
message(STATUS "CUDA: CUDA_HOST_COMPILER='${CUDA_HOST_COMPILER}' is not valid, autodetection may not work. Specify OPENCV_CUDA_DETECTION_NVCC_FLAGS with -ccbin option for fix that")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro(ocv_filter_available_architecture result_list)
|
||||
set(__cache_key_check "${ARGN} : ${CUDA_NVCC_EXECUTABLE} ${OPENCV_CUDA_DETECTION_NVCC_FLAGS}")
|
||||
if(DEFINED OPENCV_CACHE_CUDA_SUPPORTED_CC AND OPENCV_CACHE_CUDA_SUPPORTED_CC_check STREQUAL __cache_key_check)
|
||||
set(${result_list} "${OPENCV_CACHE_CUDA_SUPPORTED_CC}")
|
||||
else()
|
||||
set(CC_LIST ${ARGN})
|
||||
foreach(target_arch ${CC_LIST})
|
||||
string(REPLACE "." "" target_arch_short "${target_arch}")
|
||||
set(NVCC_OPTION "-gencode;arch=compute_${target_arch_short},code=sm_${target_arch_short}")
|
||||
set(_cmd "${CUDA_NVCC_EXECUTABLE}" ${OPENCV_CUDA_DETECTION_NVCC_FLAGS} ${NVCC_OPTION} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" --compile)
|
||||
execute_process(
|
||||
COMMAND ${_cmd}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res
|
||||
OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_VARIABLE _nvcc_err
|
||||
#ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(OPENCV_CMAKE_CUDA_DEBUG)
|
||||
message(WARNING "COMMAND: ${_cmd}")
|
||||
message(STATUS "Result: ${_nvcc_res}")
|
||||
message(STATUS "Out: ${_nvcc_out}")
|
||||
message(STATUS "Err: ${_nvcc_err}")
|
||||
endif()
|
||||
if(_nvcc_res EQUAL 0)
|
||||
LIST(APPEND ${result_list} "${target_arch}")
|
||||
endif()
|
||||
endforeach()
|
||||
string(STRIP "${${result_list}}" ${result_list})
|
||||
if(" ${${result_list}}" STREQUAL " ")
|
||||
message(WARNING "CUDA: Autodetection arch list is empty. Please enable OPENCV_CMAKE_CUDA_DEBUG=1 and check/specify OPENCV_CUDA_DETECTION_NVCC_FLAGS variable")
|
||||
endif()
|
||||
|
||||
# cache detected values
|
||||
set(OPENCV_CACHE_CUDA_SUPPORTED_CC ${${result_list}} CACHE INTERNAL "")
|
||||
set(OPENCV_CACHE_CUDA_SUPPORTED_CC_check "${__cache_key_check}" CACHE INTERNAL "")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_detect_native_cuda_arch status output)
|
||||
set(OPENCV_CUDA_DETECT_ARCHS_COMMAND "${CUDA_NVCC_EXECUTABLE}" ${OPENCV_CUDA_DETECTION_NVCC_FLAGS} "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run")
|
||||
set(__cache_key_check "${OPENCV_CUDA_DETECT_ARCHS_COMMAND}")
|
||||
if(DEFINED OPENCV_CACHE_CUDA_ACTIVE_CC AND OPENCV_CACHE_CUDA_ACTIVE_CC_check STREQUAL __cache_key_check)
|
||||
set(${output} "${OPENCV_CACHE_CUDA_ACTIVE_CC}")
|
||||
set(${status} 0)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${OPENCV_CUDA_DETECT_ARCHS_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE ${status}
|
||||
OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_VARIABLE _nvcc_err
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(OPENCV_CMAKE_CUDA_DEBUG)
|
||||
message(WARNING "COMMAND: ${OPENCV_CUDA_DETECT_ARCHS_COMMAND}")
|
||||
message(STATUS "Result: ${${status}}")
|
||||
message(STATUS "Out: ${_nvcc_out}")
|
||||
message(STATUS "Err: ${_nvcc_err}")
|
||||
endif()
|
||||
string(REGEX REPLACE ".*\n" "" ${output} "${_nvcc_out}") #Strip leading warning messages, if any
|
||||
|
||||
if(${status} EQUAL 0)
|
||||
# cache detected values
|
||||
set(OPENCV_CACHE_CUDA_ACTIVE_CC ${${output}} CACHE INTERNAL "")
|
||||
set(OPENCV_CACHE_CUDA_ACTIVE_CC_check "${__cache_key_check}" CACHE INTERNAL "")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
set(__cuda_arch_ptx "")
|
||||
if(CUDA_GENERATION STREQUAL "Fermi")
|
||||
set(__cuda_arch_bin "2.0")
|
||||
set(__cuda_arch_bin ${_arch_fermi})
|
||||
elseif(CUDA_GENERATION STREQUAL "Kepler")
|
||||
set(__cuda_arch_bin "3.0 3.5 3.7")
|
||||
set(__cuda_arch_bin ${_arch_kepler})
|
||||
elseif(CUDA_GENERATION STREQUAL "Maxwell")
|
||||
set(__cuda_arch_bin "5.0 5.2")
|
||||
set(__cuda_arch_bin ${_arch_maxwell})
|
||||
elseif(CUDA_GENERATION STREQUAL "Pascal")
|
||||
set(__cuda_arch_bin "6.0 6.1")
|
||||
set(__cuda_arch_bin ${_arch_pascal})
|
||||
elseif(CUDA_GENERATION STREQUAL "Volta")
|
||||
set(__cuda_arch_bin "7.0")
|
||||
set(__cuda_arch_bin ${_arch_volta})
|
||||
elseif(CUDA_GENERATION STREQUAL "Turing")
|
||||
set(__cuda_arch_bin "7.5")
|
||||
set(__cuda_arch_bin ${_arch_turing})
|
||||
elseif(CUDA_GENERATION STREQUAL "Ampere")
|
||||
set(__cuda_arch_bin ${_arch_ampere})
|
||||
elseif(CUDA_GENERATION STREQUAL "Auto")
|
||||
execute_process( COMMAND ${DETECT_ARCHS_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE ".*\n" "" _nvcc_out "${_nvcc_out}") #Strip leading warning messages, if any
|
||||
ocv_detect_native_cuda_arch(_nvcc_res _nvcc_out)
|
||||
if(NOT _nvcc_res EQUAL 0)
|
||||
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
|
||||
else()
|
||||
set(__cuda_arch_bin "${_nvcc_out}")
|
||||
string(REPLACE "2.1" "2.1(2.0)" __cuda_arch_bin "${__cuda_arch_bin}")
|
||||
string(REGEX MATCHALL "[0-9]+\\.[0-9]" __cuda_arch_bin "${_nvcc_out}")
|
||||
endif()
|
||||
elseif(CUDA_ARCH_BIN)
|
||||
message(STATUS "CUDA: Using CUDA_ARCH_BIN=${CUDA_ARCH_BIN}")
|
||||
set(__cuda_arch_bin ${CUDA_ARCH_BIN})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED __cuda_arch_bin)
|
||||
|
@ -118,27 +246,34 @@ if(CUDA_FOUND)
|
|||
set(__cuda_arch_bin "3.2")
|
||||
set(__cuda_arch_ptx "")
|
||||
elseif(AARCH64)
|
||||
execute_process( COMMAND ${DETECT_ARCHS_COMMAND}
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE ".*\n" "" _nvcc_out "${_nvcc_out}") #Strip leading warning messages, if any
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
ocv_detect_native_cuda_arch(_nvcc_res _nvcc_out)
|
||||
else()
|
||||
set(_nvcc_res -1) # emulate error, see below
|
||||
endif()
|
||||
if(NOT _nvcc_res EQUAL 0)
|
||||
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
|
||||
set(__cuda_arch_bin "5.3 6.2 7.2")
|
||||
# TX1 (5.3) TX2 (6.2) Xavier (7.2) V100 (7.0)
|
||||
ocv_filter_available_architecture(__cuda_arch_bin
|
||||
5.3
|
||||
6.2
|
||||
7.2
|
||||
7.0
|
||||
)
|
||||
else()
|
||||
set(__cuda_arch_bin "${_nvcc_out}")
|
||||
string(REPLACE "2.1" "2.1(2.0)" __cuda_arch_bin "${__cuda_arch_bin}")
|
||||
endif()
|
||||
set(__cuda_arch_ptx "")
|
||||
else()
|
||||
if(CUDA_VERSION VERSION_LESS "9.0")
|
||||
set(__cuda_arch_bin "2.0 3.0 3.5 3.7 5.0 5.2 6.0 6.1")
|
||||
elseif(CUDA_VERSION VERSION_LESS "10.0")
|
||||
set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2 6.0 6.1 7.0")
|
||||
else()
|
||||
set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2 6.0 6.1 7.0 7.5")
|
||||
endif()
|
||||
ocv_filter_available_architecture(__cuda_arch_bin
|
||||
${_arch_fermi}
|
||||
${_arch_kepler}
|
||||
${_arch_maxwell}
|
||||
${_arch_pascal}
|
||||
${_arch_volta}
|
||||
${_arch_turing}
|
||||
${_arch_ampere}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -148,12 +283,14 @@ if(CUDA_FOUND)
|
|||
string(REGEX REPLACE "\\." "" ARCH_BIN_NO_POINTS "${CUDA_ARCH_BIN}")
|
||||
string(REGEX REPLACE "\\." "" ARCH_PTX_NO_POINTS "${CUDA_ARCH_PTX}")
|
||||
|
||||
# Ckeck if user specified 1.0 compute capability: we don't support it
|
||||
string(REGEX MATCH "1.0" HAS_ARCH_10 "${CUDA_ARCH_BIN} ${CUDA_ARCH_PTX}")
|
||||
set(CUDA_ARCH_BIN_OR_PTX_10 0)
|
||||
if(NOT ${HAS_ARCH_10} STREQUAL "")
|
||||
set(CUDA_ARCH_BIN_OR_PTX_10 1)
|
||||
endif()
|
||||
# Check if user specified 1.0/2.1 compute capability: we don't support it
|
||||
macro(ocv_wipeout_deprecated_cc target_cc)
|
||||
if(" ${CUDA_ARCH_BIN} ${CUDA_ARCH_PTX}" MATCHES " ${target_cc}")
|
||||
message(SEND_ERROR "CUDA: ${target_cc} compute capability is not supported - exclude it from ARCH/PTX list and re-run CMake")
|
||||
endif()
|
||||
endmacro()
|
||||
ocv_wipeout_deprecated_cc("1.0")
|
||||
ocv_wipeout_deprecated_cc("2.1")
|
||||
|
||||
# NVCC flags to be set
|
||||
set(NVCC_FLAGS_EXTRA "")
|
||||
|
@ -262,7 +399,14 @@ if(CUDA_FOUND)
|
|||
endif()
|
||||
|
||||
if(UNIX OR APPLE)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC --std=c++11)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC)
|
||||
if(NOT " ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_DEBUG} ${CUDA_NVCC_FLAGS}" MATCHES "-std=")
|
||||
if(CUDA_VERSION VERSION_LESS "11.0")
|
||||
list(APPEND CUDA_NVCC_FLAGS "--std=c++11")
|
||||
else()
|
||||
list(APPEND CUDA_NVCC_FLAGS "--std=c++14")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(APPLE)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only)
|
||||
|
@ -336,6 +480,13 @@ if(HAVE_CUDA)
|
|||
set(CUDA_cufft_LIBRARY_ABS ${CUDA_cufft_LIBRARY})
|
||||
ocv_convert_to_lib_name(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio"
|
||||
AND NOT OPENCV_SKIP_CUDA_CMAKE_SUPPRESS_REGENERATION
|
||||
)
|
||||
message(STATUS "CUDA: MSVS generator is detected. Disabling CMake re-run checks (CMAKE_SUPPRESS_REGENERATION=ON). You need to run CMake manually if updates are required.")
|
||||
set(CMAKE_SUPPRESS_REGENERATION ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -98,6 +98,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
|
|||
set(PPC64 1)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips.*|MIPS.*)")
|
||||
set(MIPS 1)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(riscv.*|RISCV.*)")
|
||||
set(RISCV 1)
|
||||
else()
|
||||
if(NOT OPENCV_SUPPRESS_MESSAGE_UNRECOGNIZED_SYSTEM_PROCESSOR)
|
||||
message(WARNING "OpenCV: unrecognized target processor configuration")
|
||||
|
@ -169,6 +171,8 @@ elseif(MSVC)
|
|||
set(OpenCV_RUNTIME vc15)
|
||||
elseif(MSVC_VERSION MATCHES "^192[0-9]$")
|
||||
set(OpenCV_RUNTIME vc16)
|
||||
elseif(MSVC_VERSION MATCHES "^193[0-9]$")
|
||||
set(OpenCV_RUNTIME vc17)
|
||||
else()
|
||||
message(WARNING "OpenCV does not recognize MSVC_VERSION \"${MSVC_VERSION}\". Cannot set OpenCV_RUNTIME")
|
||||
endif()
|
||||
|
@ -192,11 +196,13 @@ if(CMAKE_VERSION VERSION_LESS "3.1")
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
|
||||
if(CMAKE_CXX11_COMPILE_FEATURES)
|
||||
set(HAVE_CXX11 ON)
|
||||
if(NOT OPENCV_SKIP_CMAKE_CXX_STANDARD)
|
||||
ocv_update(CMAKE_CXX_STANDARD 11)
|
||||
ocv_update(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||
ocv_update(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++11 instead of -std=gnu++11
|
||||
if(CMAKE_CXX11_COMPILE_FEATURES)
|
||||
set(HAVE_CXX11 ON)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_CXX11)
|
||||
ocv_check_compiler_flag(CXX "" HAVE_CXX11 "${OpenCV_SOURCE_DIR}/cmake/checks/cxx11.cpp")
|
||||
|
@ -213,7 +219,13 @@ if(NOT HAVE_CXX11)
|
|||
message(FATAL_ERROR "OpenCV 4.x requires C++11")
|
||||
endif()
|
||||
|
||||
if((HAVE_CXX11
|
||||
set(__OPENCV_ENABLE_ATOMIC_LONG_LONG OFF)
|
||||
if(HAVE_CXX11 AND (X86 OR X86_64))
|
||||
set(__OPENCV_ENABLE_ATOMIC_LONG_LONG ON)
|
||||
endif()
|
||||
option(OPENCV_ENABLE_ATOMIC_LONG_LONG "Enable C++ compiler support for atomic<long long>" ${__OPENCV_ENABLE_ATOMIC_LONG_LONG})
|
||||
|
||||
if((HAVE_CXX11 AND OPENCV_ENABLE_ATOMIC_LONG_LONG
|
||||
AND NOT MSVC
|
||||
AND NOT (X86 OR X86_64)
|
||||
AND NOT OPENCV_SKIP_LIBATOMIC_COMPILER_CHECK)
|
||||
|
@ -224,9 +236,14 @@ if((HAVE_CXX11
|
|||
list(APPEND CMAKE_REQUIRED_LIBRARIES atomic)
|
||||
ocv_check_compiler_flag(CXX "" HAVE_CXX_ATOMICS_WITH_LIB "${OpenCV_SOURCE_DIR}/cmake/checks/atomic_check.cpp")
|
||||
if(HAVE_CXX_ATOMICS_WITH_LIB)
|
||||
set(HAVE_ATOMIC_LONG_LONG ON)
|
||||
list(APPEND OPENCV_LINKER_LIBS atomic)
|
||||
else()
|
||||
message(FATAL_ERROR "C++11 compiler must support std::atomic")
|
||||
message(STATUS "Compiler doesn't support std::atomic<long long>")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_ATOMIC_LONG_LONG ON)
|
||||
endif()
|
||||
else(HAVE_CXX11 AND OPENCV_ENABLE_ATOMIC_LONG_LONG)
|
||||
set(HAVE_ATOMIC_LONG_LONG ${OPENCV_ENABLE_ATOMIC_LONG_LONG})
|
||||
endif()
|
||||
|
|
|
@ -9,9 +9,14 @@ set(HALIDE_ROOT_DIR "${HALIDE_ROOT_DIR}" CACHE PATH "Halide root directory")
|
|||
if(NOT HAVE_HALIDE)
|
||||
find_package(Halide QUIET) # Try CMake-based config files
|
||||
if(Halide_FOUND)
|
||||
set(HALIDE_INCLUDE_DIRS "${Halide_INCLUDE_DIRS}" CACHE PATH "Halide include directories" FORCE)
|
||||
set(HALIDE_LIBRARIES "${Halide_LIBRARIES}" CACHE PATH "Halide libraries" FORCE)
|
||||
set(HAVE_HALIDE TRUE)
|
||||
if(TARGET Halide::Halide) # modern Halide scripts defines imported target
|
||||
set(HALIDE_INCLUDE_DIRS "")
|
||||
set(HALIDE_LIBRARIES "Halide::Halide")
|
||||
set(HAVE_HALIDE TRUE)
|
||||
else()
|
||||
# using HALIDE_INCLUDE_DIRS / Halide_LIBRARIES
|
||||
set(HAVE_HALIDE TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -28,18 +33,15 @@ if(NOT HAVE_HALIDE AND HALIDE_ROOT_DIR)
|
|||
)
|
||||
if(HALIDE_LIBRARY AND HALIDE_INCLUDE_DIR)
|
||||
# TODO try_compile
|
||||
set(HALIDE_INCLUDE_DIRS "${HALIDE_INCLUDE_DIR}" CACHE PATH "Halide include directories" FORCE)
|
||||
set(HALIDE_LIBRARIES "${HALIDE_LIBRARY}" CACHE PATH "Halide libraries" FORCE)
|
||||
set(HALIDE_INCLUDE_DIRS "${HALIDE_INCLUDE_DIR}")
|
||||
set(HALIDE_LIBRARIES "${HALIDE_LIBRARY}")
|
||||
set(HAVE_HALIDE TRUE)
|
||||
endif()
|
||||
if(NOT HAVE_HALIDE)
|
||||
ocv_clear_vars(HALIDE_LIBRARIES HALIDE_INCLUDE_DIRS CACHE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_HALIDE)
|
||||
include_directories(${HALIDE_INCLUDE_DIRS})
|
||||
if(HALIDE_INCLUDE_DIRS)
|
||||
include_directories(${HALIDE_INCLUDE_DIRS})
|
||||
endif()
|
||||
list(APPEND OPENCV_LINKER_LIBS ${HALIDE_LIBRARIES})
|
||||
else()
|
||||
ocv_clear_vars(HALIDE_INCLUDE_DIRS HALIDE_LIBRARIES)
|
||||
endif()
|
||||
|
|
|
@ -1,108 +1,68 @@
|
|||
# The script detects Intel(R) Inference Engine installation
|
||||
#
|
||||
# Cache variables:
|
||||
# INF_ENGINE_RELEASE - a number reflecting IE source interface (linked with OpenVINO release)
|
||||
#
|
||||
# Detect parameters:
|
||||
# 1. Native cmake IE package:
|
||||
# - environment variable InferenceEngine_DIR is set to location of cmake module
|
||||
# 2. Custom location:
|
||||
# - INF_ENGINE_INCLUDE_DIRS - headers search location
|
||||
# - INF_ENGINE_LIB_DIRS - library search location
|
||||
# 3. OpenVINO location:
|
||||
# - environment variable INTEL_OPENVINO_DIR is set to location of OpenVINO installation dir
|
||||
# - INF_ENGINE_PLATFORM - part of name of library directory representing its platform
|
||||
# The script detects Intel(R) OpenVINO(TM) runtime installation
|
||||
#
|
||||
# Result:
|
||||
# INF_ENGINE_TARGET - set to name of imported library target representing InferenceEngine
|
||||
#
|
||||
# - target ocv.3rdparty.openvino
|
||||
|
||||
function(add_custom_ie_build _inc _lib _lib_rel _lib_dbg _msg)
|
||||
if(NOT _inc OR NOT (_lib OR _lib_rel OR _lib_dbg))
|
||||
if(WITH_OPENVINO)
|
||||
find_package(OpenVINO QUIET)
|
||||
if(OpenVINO_FOUND)
|
||||
message(STATUS "OpenVINO FOUND: ${OpenVINO_VERSION}")
|
||||
math(EXPR ver "${OpenVINO_VERSION_MAJOR} * 1000000 + ${OpenVINO_VERSION_MINOR} * 10000 + ${OpenVINO_VERSION_PATCH} * 100")
|
||||
ocv_add_external_target(openvino "" "openvino::runtime" "INF_ENGINE_RELEASE=${ver};HAVE_NGRAPH;HAVE_DNN_NGRAPH;HAVE_INF_ENGINE")
|
||||
set(HAVE_OPENVINO 1)
|
||||
return()
|
||||
endif()
|
||||
add_library(inference_engine UNKNOWN IMPORTED)
|
||||
set_target_properties(inference_engine PROPERTIES
|
||||
IMPORTED_LOCATION "${_lib}"
|
||||
IMPORTED_IMPLIB_RELEASE "${_lib_rel}"
|
||||
IMPORTED_IMPLIB_DEBUG "${_lib_dbg}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_inc}"
|
||||
)
|
||||
endif()
|
||||
|
||||
find_library(ie_builder_custom_lib "inference_engine_nn_builder" PATHS "${INF_ENGINE_LIB_DIRS}" NO_DEFAULT_PATH)
|
||||
if(EXISTS "${ie_builder_custom_lib}")
|
||||
add_library(inference_engine_nn_builder UNKNOWN IMPORTED)
|
||||
set_target_properties(inference_engine_nn_builder PROPERTIES
|
||||
IMPORTED_LOCATION "${ie_builder_custom_lib}"
|
||||
)
|
||||
endif()
|
||||
# ======================
|
||||
|
||||
if(NOT INF_ENGINE_RELEASE VERSION_GREATER "2018050000")
|
||||
find_library(INF_ENGINE_OMP_LIBRARY iomp5 PATHS "${INF_ENGINE_OMP_DIR}" NO_DEFAULT_PATH)
|
||||
if(NOT INF_ENGINE_OMP_LIBRARY)
|
||||
message(WARNING "OpenMP for IE have not been found. Set INF_ENGINE_OMP_DIR variable if you experience build errors.")
|
||||
else()
|
||||
set_target_properties(inference_engine PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${INF_ENGINE_OMP_LIBRARY}")
|
||||
endif()
|
||||
if(WITH_OPENVINO)
|
||||
find_package(OpenVINO QUIET)
|
||||
if(OpenVINO_FOUND)
|
||||
message(STATUS "OpenVINO FOUND: ${OpenVINO_VERSION}")
|
||||
math(EXPR ver "${OpenVINO_VERSION_MAJOR} * 1000000 + ${OpenVINO_VERSION_MINOR} * 10000 + ${OpenVINO_VERSION_PATCH} * 100")
|
||||
ocv_add_external_target(openvino "" "openvino::runtime" "INF_ENGINE_RELEASE=${ver};HAVE_NGRAPH;HAVE_DNN_NGRAPH;HAVE_INF_ENGINE")
|
||||
set(HAVE_OPENVINO 1)
|
||||
return()
|
||||
endif()
|
||||
set(INF_ENGINE_VERSION "Unknown" CACHE STRING "")
|
||||
set(INF_ENGINE_TARGET inference_engine)
|
||||
if(TARGET inference_engine_nn_builder)
|
||||
list(APPEND INF_ENGINE_TARGET inference_engine_nn_builder)
|
||||
set(_msg "${_msg}, with IE NN Builder API")
|
||||
endif()
|
||||
set(INF_ENGINE_TARGET "${INF_ENGINE_TARGET}" PARENT_SCOPE)
|
||||
message(STATUS "Detected InferenceEngine: ${_msg}")
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
# ======================
|
||||
|
||||
find_package(InferenceEngine QUIET)
|
||||
if(InferenceEngine_FOUND)
|
||||
set(INF_ENGINE_TARGET ${InferenceEngine_LIBRARIES})
|
||||
set(INF_ENGINE_VERSION "${InferenceEngine_VERSION}" CACHE STRING "")
|
||||
set(INF_ENGINE_VERSION "${InferenceEngine_VERSION}")
|
||||
message(STATUS "Detected InferenceEngine: cmake package (${InferenceEngine_VERSION})")
|
||||
endif()
|
||||
|
||||
if(NOT INF_ENGINE_TARGET AND INF_ENGINE_LIB_DIRS AND INF_ENGINE_INCLUDE_DIRS)
|
||||
find_path(ie_custom_inc "inference_engine.hpp" PATHS "${INF_ENGINE_INCLUDE_DIRS}" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_lib "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_lib_rel "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}/Release" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_lib_dbg "inference_engine" PATHS "${INF_ENGINE_LIB_DIRS}/Debug" NO_DEFAULT_PATH)
|
||||
add_custom_ie_build("${ie_custom_inc}" "${ie_custom_lib}" "${ie_custom_lib_rel}" "${ie_custom_lib_dbg}" "INF_ENGINE_{INCLUDE,LIB}_DIRS")
|
||||
endif()
|
||||
|
||||
set(_loc "$ENV{INTEL_OPENVINO_DIR}")
|
||||
if(NOT _loc AND DEFINED ENV{INTEL_CVSDK_DIR})
|
||||
set(_loc "$ENV{INTEL_CVSDK_DIR}") # OpenVINO 2018.x
|
||||
endif()
|
||||
if(NOT INF_ENGINE_TARGET AND _loc)
|
||||
if(NOT INF_ENGINE_RELEASE VERSION_GREATER "2018050000")
|
||||
set(INF_ENGINE_PLATFORM_DEFAULT "ubuntu_16.04")
|
||||
else()
|
||||
set(INF_ENGINE_PLATFORM_DEFAULT "")
|
||||
if(DEFINED InferenceEngine_VERSION)
|
||||
message(STATUS "InferenceEngine: ${InferenceEngine_VERSION}")
|
||||
if(NOT INF_ENGINE_RELEASE AND NOT (InferenceEngine_VERSION VERSION_LESS "2021.4"))
|
||||
math(EXPR INF_ENGINE_RELEASE_INIT "${InferenceEngine_VERSION_MAJOR} * 1000000 + ${InferenceEngine_VERSION_MINOR} * 10000 + ${InferenceEngine_VERSION_PATCH} * 100")
|
||||
endif()
|
||||
set(INF_ENGINE_PLATFORM "${INF_ENGINE_PLATFORM_DEFAULT}" CACHE STRING "InferenceEngine platform (library dir)")
|
||||
find_path(ie_custom_env_inc "inference_engine.hpp" PATHS "${_loc}/deployment_tools/inference_engine/include" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_env_lib "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/${INF_ENGINE_PLATFORM}/intel64" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_env_lib_rel "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/intel64/Release" NO_DEFAULT_PATH)
|
||||
find_library(ie_custom_env_lib_dbg "inference_engine" PATHS "${_loc}/deployment_tools/inference_engine/lib/intel64/Debug" NO_DEFAULT_PATH)
|
||||
add_custom_ie_build("${ie_custom_env_inc}" "${ie_custom_env_lib}" "${ie_custom_env_lib_rel}" "${ie_custom_env_lib_dbg}" "OpenVINO (${_loc})")
|
||||
endif()
|
||||
if(NOT INF_ENGINE_RELEASE AND NOT INF_ENGINE_RELEASE_INIT)
|
||||
message(STATUS "WARNING: InferenceEngine version has not been set, 2021.4.2 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
|
||||
set(INF_ENGINE_RELEASE_INIT "2021040200")
|
||||
elseif(DEFINED INF_ENGINE_RELEASE)
|
||||
set(INF_ENGINE_RELEASE_INIT "${INF_ENGINE_RELEASE}")
|
||||
endif()
|
||||
set(INF_ENGINE_RELEASE "${INF_ENGINE_RELEASE_INIT}" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2020.1.0.2 -> 2020010002)")
|
||||
|
||||
set(tgts)
|
||||
set(defs)
|
||||
|
||||
# Add more features to the target
|
||||
|
||||
if(INF_ENGINE_TARGET)
|
||||
if(NOT INF_ENGINE_RELEASE)
|
||||
message(WARNING "InferenceEngine version have not been set, 2019R3 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
|
||||
endif()
|
||||
set(INF_ENGINE_RELEASE "2019030000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)")
|
||||
set_target_properties(${INF_ENGINE_TARGET} PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
|
||||
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
|
||||
)
|
||||
list(APPEND tgts ${INF_ENGINE_TARGET})
|
||||
list(APPEND defs "INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}" "HAVE_INF_ENGINE")
|
||||
endif()
|
||||
|
||||
if(WITH_NGRAPH)
|
||||
if(WITH_NGRAPH OR NOT DEFINED WITH_NGRAPH)
|
||||
find_package(ngraph QUIET)
|
||||
if(ngraph_FOUND)
|
||||
ocv_assert(TARGET ngraph::ngraph)
|
||||
|
@ -111,5 +71,9 @@ if(WITH_NGRAPH)
|
|||
endif()
|
||||
message(STATUS "Detected ngraph: cmake package (${ngraph_VERSION})")
|
||||
set(HAVE_NGRAPH ON)
|
||||
list(APPEND tgts ngraph::ngraph)
|
||||
list(APPEND defs "HAVE_NGRAPH" "HAVE_DNN_NGRAPH")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ocv_add_external_target(openvino "" "${tgts}" "${defs}")
|
||||
|
|
|
@ -80,4 +80,13 @@ if(OPENCL_FOUND)
|
|||
|
||||
# check WITH_OPENCL_D3D11_NV is located in OpenCVDetectDirectX.cmake file
|
||||
|
||||
if(WITH_VA_INTEL AND HAVE_VA)
|
||||
if(HAVE_OPENCL AND EXISTS "${OPENCL_INCLUDE_DIR}/CL/cl_va_api_media_sharing_intel.h")
|
||||
set(HAVE_VA_INTEL ON)
|
||||
elseif(HAVE_OPENCL AND EXISTS "${OPENCL_INCLUDE_DIR}/CL/va_ext.h")
|
||||
set(HAVE_VA_INTEL ON)
|
||||
set(HAVE_VA_INTEL_OLD_HEADER ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
@ -78,10 +78,10 @@ if(NOT ${found})
|
|||
AND NOT DEFINED ${executable}
|
||||
)
|
||||
if(NOT OPENCV_SKIP_PYTHON_WARNING)
|
||||
message(WARNING "CMake's 'find_host_package(PythonInterp ${__python_package_version})' founds wrong Python version:\n"
|
||||
message(WARNING "CMake's 'find_host_package(PythonInterp ${__python_package_version})' found wrong Python version:\n"
|
||||
"PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}\n"
|
||||
"PYTHON_VERSION_STRING=${PYTHON_VERSION_STRING}\n"
|
||||
"Consider specify '${executable}' variable via CMake command line or environment variables\n")
|
||||
"Consider providing the '${executable}' variable via CMake command line or environment variables\n")
|
||||
endif()
|
||||
ocv_clear_vars(PYTHONINTERP_FOUND PYTHON_EXECUTABLE PYTHON_VERSION_STRING PYTHON_VERSION_MAJOR PYTHON_VERSION_MINOR PYTHON_VERSION_PATCH)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.12")
|
||||
|
@ -177,7 +177,7 @@ if(NOT ${found})
|
|||
|
||||
if(NOT ANDROID AND NOT IOS)
|
||||
if(CMAKE_HOST_UNIX)
|
||||
execute_process(COMMAND ${_executable} -c "from distutils.sysconfig import *; print(get_python_lib())"
|
||||
execute_process(COMMAND ${_executable} -c "from sysconfig import *; print(get_path('purelib'))"
|
||||
RESULT_VARIABLE _cvpy_process
|
||||
OUTPUT_VARIABLE _std_packages_path
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Search TBB library (4.1 - 4.4, 2017)
|
||||
# Search TBB library: 4.1 - 4.4, 2017-2020, 2021+ (oneTBB)
|
||||
#
|
||||
# Own TBB (3rdparty/tbb):
|
||||
# - set cmake option BUILD_TBB to ON
|
||||
|
@ -19,7 +19,7 @@
|
|||
# - "tbb" target exists and added to OPENCV_LINKER_LIBS
|
||||
|
||||
function(ocv_tbb_cmake_guess _found)
|
||||
find_package(TBB QUIET COMPONENTS tbb PATHS "$ENV{TBBROOT}/cmake")
|
||||
find_package(TBB QUIET COMPONENTS tbb PATHS "$ENV{TBBROOT}/cmake" "$ENV{TBBROOT}/lib/cmake/tbb")
|
||||
if(TBB_FOUND)
|
||||
if(NOT TARGET TBB::tbb)
|
||||
message(WARNING "No TBB::tbb target found!")
|
||||
|
@ -28,11 +28,11 @@ function(ocv_tbb_cmake_guess _found)
|
|||
get_target_property(_lib TBB::tbb IMPORTED_LOCATION_RELEASE)
|
||||
message(STATUS "Found TBB (cmake): ${_lib}")
|
||||
get_target_property(_inc TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
ocv_tbb_read_version("${_inc}")
|
||||
add_library(tbb INTERFACE IMPORTED)
|
||||
set_target_properties(tbb PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES TBB::tbb
|
||||
)
|
||||
ocv_tbb_read_version("${_inc}" tbb)
|
||||
set(${_found} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -66,7 +66,6 @@ function(ocv_tbb_env_guess _found)
|
|||
find_library(TBB_ENV_LIB_DEBUG NAMES "tbb_debug")
|
||||
if (TBB_ENV_INCLUDE AND (TBB_ENV_LIB OR TBB_ENV_LIB_DEBUG))
|
||||
ocv_tbb_env_verify()
|
||||
ocv_tbb_read_version("${TBB_ENV_INCLUDE}")
|
||||
add_library(tbb UNKNOWN IMPORTED)
|
||||
set_target_properties(tbb PROPERTIES
|
||||
IMPORTED_LOCATION "${TBB_ENV_LIB}"
|
||||
|
@ -82,12 +81,23 @@ function(ocv_tbb_env_guess _found)
|
|||
get_filename_component(_dir "${TBB_ENV_LIB}" DIRECTORY)
|
||||
set_target_properties(tbb PROPERTIES INTERFACE_LINK_LIBRARIES "-L${_dir}")
|
||||
endif()
|
||||
ocv_tbb_read_version("${TBB_ENV_INCLUDE}" tbb)
|
||||
if(NOT (TBB_INTERFACE_VERSION LESS 12000)) # >= 12000, oneTBB 2021+
|
||||
# avoid "defaultlib" requirement of tbb12.lib (we are using absolute path to 'tbb.lib' only)
|
||||
# https://github.com/oneapi-src/oneTBB/blame/2dba2072869a189b9fdab3ffa431d3ea49059a19/include/oneapi/tbb/detail/_config.h#L334
|
||||
if(NOT (CMAKE_VERSION VERSION_LESS "3.16.0")) # https://gitlab.kitware.com/cmake/cmake/-/issues/19434
|
||||
target_compile_definitions(tbb INTERFACE "__TBB_NO_IMPLICIT_LINKAGE=1")
|
||||
else()
|
||||
set_target_properties(tbb PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__TBB_NO_IMPLICIT_LINKAGE=1")
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "Found TBB (env): ${TBB_ENV_LIB}")
|
||||
set(${_found} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_tbb_read_version _path)
|
||||
function(ocv_tbb_read_version _path _tgt)
|
||||
find_file(TBB_VER_FILE oneapi/tbb/version.h "${_path}" NO_DEFAULT_PATH CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
find_file(TBB_VER_FILE tbb/tbb_stddef.h "${_path}" NO_DEFAULT_PATH CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
ocv_parse_header("${TBB_VER_FILE}" TBB_VERSION_LINES TBB_VERSION_MAJOR TBB_VERSION_MINOR TBB_INTERFACE_VERSION CACHE)
|
||||
endfunction()
|
||||
|
|
|
@ -1,16 +1,34 @@
|
|||
# VTK 6.x components
|
||||
find_package(VTK QUIET COMPONENTS vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
IF(VTK_FOUND)
|
||||
IF(VTK_RENDERING_BACKEND) #in vtk 7, the rendering backend is exported as a var.
|
||||
find_package(VTK QUIET COMPONENTS vtkRendering${VTK_RENDERING_BACKEND} vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport vtkIOGeometry NO_MODULE)
|
||||
ELSE(VTK_RENDERING_BACKEND)
|
||||
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
ENDIF(VTK_RENDERING_BACKEND)
|
||||
ENDIF(VTK_FOUND)
|
||||
|
||||
# VTK 5.x components
|
||||
if(NOT VTK_FOUND)
|
||||
find_package(VTK QUIET COMPONENTS vtkCommon NO_MODULE)
|
||||
find_package(VTK QUIET NAMES vtk VTK)
|
||||
if(VTK_FOUND)
|
||||
if(NOT (VTK_VERSION VERSION_LESS "9.0.0") AND (VTK_VERSION VERSION_LESS "10.0.0")) # VTK 9.x
|
||||
find_package(VTK 9 QUIET NAMES vtk COMPONENTS
|
||||
FiltersExtraction
|
||||
FiltersSources
|
||||
FiltersTexture
|
||||
IOExport
|
||||
IOGeometry
|
||||
IOPLY
|
||||
InteractionStyle
|
||||
RenderingCore
|
||||
RenderingLOD
|
||||
RenderingOpenGL2
|
||||
NO_MODULE)
|
||||
elseif(VTK_VERSION VERSION_GREATER "5") # VTK 6.x components
|
||||
find_package(VTK QUIET COMPONENTS vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
IF(VTK_FOUND)
|
||||
IF(VTK_RENDERING_BACKEND) #in vtk 7, the rendering backend is exported as a var.
|
||||
find_package(VTK QUIET COMPONENTS vtkRendering${VTK_RENDERING_BACKEND} vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport vtkIOGeometry NO_MODULE)
|
||||
ELSE(VTK_RENDERING_BACKEND)
|
||||
find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
|
||||
ENDIF(VTK_RENDERING_BACKEND)
|
||||
ENDIF(VTK_FOUND)
|
||||
elseif(VTK_VERSION VERSION_EQUAL "5") # VTK 5.x components
|
||||
find_package(VTK QUIET COMPONENTS vtkCommon NO_MODULE)
|
||||
else()
|
||||
set(VTK_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT VTK_FOUND)
|
||||
|
@ -26,32 +44,15 @@ if(VTK_VERSION VERSION_LESS "5.8.0")
|
|||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together
|
||||
if(HAVE_QT5 AND VTK_VERSION VERSION_LESS "6.0.0")
|
||||
if(VTK_USE_QT)
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together. VTK 6.0.0 doesn't provide a way to get Qt version it was linked with
|
||||
if(HAVE_QT5 AND VTK_VERSION VERSION_EQUAL "6.0.0" AND NOT DEFINED FORCE_VTK)
|
||||
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt5, and VTK ver.${VTK_VERSION} with Qt4")
|
||||
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DFORCE_VTK=TRUE' flag in CMake")
|
||||
if((HAVE_QT AND VTK_USE_QT)
|
||||
AND NOT DEFINED FORCE_VTK # deprecated
|
||||
AND NOT DEFINED OPENCV_FORCE_VTK
|
||||
)
|
||||
message(STATUS "VTK support is disabled. Possible incompatible combination: OpenCV+Qt, and VTK ver.${VTK_VERSION} with Qt")
|
||||
message(STATUS "If it is known that VTK was compiled without Qt4, please define '-DOPENCV_FORCE_VTK=TRUE' flag in CMake")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Different Qt versions can't be linked together
|
||||
if(HAVE_QT AND VTK_VERSION VERSION_GREATER "6.0.0" AND NOT ${VTK_QT_VERSION} STREQUAL "")
|
||||
if(HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "4")
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt5 and VTK ver.${VTK_VERSION} + Qt4")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_QT5 AND ${VTK_QT_VERSION} EQUAL "5")
|
||||
message(STATUS "VTK support is disabled. Incompatible combination: OpenCV + Qt4 and VTK ver.${VTK_VERSION} + Qt5")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
try_compile(VTK_COMPILE_STATUS
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/vtk_test.cpp"
|
||||
|
@ -66,4 +67,8 @@ if(NOT ${VTK_COMPILE_STATUS})
|
|||
endif()
|
||||
|
||||
set(HAVE_VTK ON)
|
||||
message(STATUS "Found VTK ${VTK_VERSION} (${VTK_USE_FILE})")
|
||||
if (VTK_VERSION VERSION_LESS "8.90.0")
|
||||
message(STATUS "Found VTK ${VTK_VERSION} (${VTK_USE_FILE})")
|
||||
else()
|
||||
message(STATUS "Found VTK ${VTK_VERSION}")
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
if(NOT EMSCRIPTEN)
|
||||
if(WITH_WEBNN)
|
||||
ocv_check_environment_variables(WEBNN_HEADER_DIRS)
|
||||
ocv_check_environment_variables(WEBNN_INCLUDE_DIRS)
|
||||
ocv_check_environment_variables(WEBNN_LIBRARIES)
|
||||
if(NOT DEFINED WEBNN_HEADER_DIRS)
|
||||
set(WEBNN_HEADER_DIRS "$ENV{WEBNN_NATIVE_DIR}/gen/src/include")
|
||||
endif()
|
||||
if(NOT DEFINED WEBNN_INCLUDE_DIRS)
|
||||
set(WEBNN_INCLUDE_DIRS "$ENV{WEBNN_NATIVE_DIR}/../../src/include")
|
||||
endif()
|
||||
if(NOT DEFINED WEBNN_LIBRARIES)
|
||||
set(WEBNN_LIBRARIES "$ENV{WEBNN_NATIVE_DIR}/libwebnn_native.so;$ENV{WEBNN_NATIVE_DIR}/libwebnn_proc.so")
|
||||
endif()
|
||||
endif()
|
||||
try_compile(VALID_WEBNN
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
SOURCES "${OpenCV_SOURCE_DIR}/cmake/checks/webnn.cpp"
|
||||
"$ENV{WEBNN_NATIVE_DIR}/gen/src/webnn/webnn_cpp.cpp"
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${WEBNN_INCLUDE_DIRS}\;${WEBNN_HEADER_DIRS}"
|
||||
"-DLINK_LIBRARIES:STRING=${WEBNN_LIBRARIES}"
|
||||
OUTPUT_VARIABLE TRY_OUT
|
||||
)
|
||||
else()
|
||||
try_compile(VALID_WEBNN
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
SOURCES "${OpenCV_SOURCE_DIR}/cmake/checks/webnn.cpp"
|
||||
OUTPUT_VARIABLE TRY_OUT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT VALID_WEBNN)
|
||||
if(NOT EMSCRIPTEN)
|
||||
message(WARNING "Can't use WebNN-native")
|
||||
return()
|
||||
else()
|
||||
message(WARNING "Can't use WebNN")
|
||||
return()
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_WEBNN ON)
|
||||
message(STATUS "Set HAVE_WEBNN = ${HAVE_WEBNN}")
|
||||
endif()
|
||||
|
||||
if(NOT EMSCRIPTEN)
|
||||
message(AUTHOR_WARNING "Use WebNN-native")
|
||||
else()
|
||||
message(AUTHOR_WARNING "Use WebNN")
|
||||
endif()
|
|
@ -23,7 +23,7 @@ set(OPENCV_DOWNLOAD_LOG "${OpenCV_BINARY_DIR}/CMakeDownloadLog.txt")
|
|||
set(OPENCV_DOWNLOAD_WITH_CURL "${OpenCV_BINARY_DIR}/download_with_curl.sh")
|
||||
set(OPENCV_DOWNLOAD_WITH_WGET "${OpenCV_BINARY_DIR}/download_with_wget.sh")
|
||||
set(OPENCV_DOWNLOAD_TRIES_LIST 1 CACHE STRING "List of download tries") # a list
|
||||
set(OPENCV_DOWNLOAD_PARAMS INACTIVITY_TIMEOUT 60 TIMEOUT 600 CACHE STRING "Download parameters to be passed to file(DOWNLAOD ...)")
|
||||
set(OPENCV_DOWNLOAD_PARAMS INACTIVITY_TIMEOUT 60 TIMEOUT 600 CACHE STRING "Download parameters to be passed to file(DOWNLOAD ...)")
|
||||
mark_as_advanced(OPENCV_DOWNLOAD_TRIES_LIST OPENCV_DOWNLOAD_PARAMS)
|
||||
|
||||
# Init download cache directory and log file and helper scripts
|
||||
|
@ -37,6 +37,50 @@ file(WRITE "${OPENCV_DOWNLOAD_LOG}" "#use_cache \"${OPENCV_DOWNLOAD_PATH}\"\n")
|
|||
file(REMOVE "${OPENCV_DOWNLOAD_WITH_CURL}")
|
||||
file(REMOVE "${OPENCV_DOWNLOAD_WITH_WGET}")
|
||||
|
||||
ocv_check_environment_variables(OPENCV_DOWNLOAD_MIRROR_ID)
|
||||
|
||||
function(ocv_init_download_mirror)
|
||||
if(NOT DEFINED OPENCV_DOWNLOAD_MIRROR_ID)
|
||||
# Run `git remote get-url origin` to get remote source
|
||||
execute_process(
|
||||
COMMAND
|
||||
git remote get-url origin
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE
|
||||
RESULT_STATUS
|
||||
OUTPUT_VARIABLE
|
||||
OCV_GIT_ORIGIN_URL_OUTPUT
|
||||
ERROR_QUIET
|
||||
)
|
||||
# if non-git, OCV_GIT_ORIGIN_URL_OUTPUT is empty
|
||||
if(NOT OCV_GIT_ORIGIN_URL_OUTPUT)
|
||||
message(STATUS "ocv_init_download: OpenCV source tree is not fetched as git repository. 3rdparty resources will be downloaded from github.com by default.")
|
||||
return()
|
||||
else()
|
||||
# Check if git origin is github.com
|
||||
string(FIND "${OCV_GIT_ORIGIN_URL_OUTPUT}" "github.com" _found_github)
|
||||
if(NOT ${_found_github} EQUAL -1)
|
||||
set(OPENCV_DOWNLOAD_MIRROR_ID "github" CACHE STRING "")
|
||||
endif()
|
||||
# Check if git origin is gitcode.net
|
||||
string(FIND "${OCV_GIT_ORIGIN_URL_OUTPUT}" "gitcode.net" _found_gitcode)
|
||||
if(NOT ${_found_gitcode} EQUAL -1)
|
||||
set(OPENCV_DOWNLOAD_MIRROR_ID "gitcode" CACHE STRING "")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPENCV_DOWNLOAD_MIRROR_ID STREQUAL "gitcode" OR OPENCV_DOWNLOAD_MIRROR_ID STREQUAL "custom")
|
||||
message(STATUS "ocv_init_download: Using ${OPENCV_DOWNLOAD_MIRROR_ID}-hosted mirror to download 3rdparty components.")
|
||||
ocv_cmake_hook_append(OPENCV_DOWNLOAD_PRE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/mirrors/${OPENCV_DOWNLOAD_MIRROR_ID}.cmake")
|
||||
elseif(OPENCV_DOWNLOAD_MIRROR_ID STREQUAL "github")
|
||||
return()
|
||||
else()
|
||||
message(STATUS "ocv_init_download: Unable to recognize git server of OpenCV source code. Using github.com to download 3rdparty components.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_download)
|
||||
cmake_parse_arguments(DL "UNPACK;RELATIVE_URL" "FILENAME;HASH;DESTINATION_DIR;ID;STATUS" "URL" ${ARGN})
|
||||
|
||||
|
@ -67,6 +111,8 @@ function(ocv_download)
|
|||
set(${DL_STATUS} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
ocv_cmake_hook(OPENCV_DOWNLOAD_PRE)
|
||||
|
||||
# Check CMake cache for already processed tasks
|
||||
string(FIND "${DL_DESTINATION_DIR}" "${CMAKE_BINARY_DIR}" DL_BINARY_PATH_POS)
|
||||
if(DL_BINARY_PATH_POS EQUAL 0)
|
||||
|
@ -115,7 +161,7 @@ function(ocv_download)
|
|||
if(DL_ID)
|
||||
set(__msg_prefix "${DL_ID}: ")
|
||||
endif()
|
||||
message(STATUS "${__msg_prefix}Download: ${DL_FILENAME}")
|
||||
message(STATUS "${__msg_prefix}Downloading ${DL_FILENAME} from ${DL_URL}")
|
||||
|
||||
# Copy mode: check if copy destination exists and is correct
|
||||
if(NOT DL_UNPACK)
|
||||
|
@ -252,3 +298,8 @@ ${OPENCV_DOWNLOAD_LOG}
|
|||
set(${OCV_DOWNLOAD_HASH_NAME} "${DL_HASH}" CACHE INTERNAL "")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Initialize download in case mirror is used
|
||||
# ----------------------------------------------------------------------------
|
||||
ocv_init_download_mirror()
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# Uninstall target, for "make uninstall"
|
||||
# ----------------------------------------------------------------------------
|
||||
CONFIGURE_FILE(
|
||||
"${OpenCV_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
@ONLY)
|
||||
if(NOT TARGET uninstall) # avoid conflicts with parent projects
|
||||
configure_file(
|
||||
"${OpenCV_SOURCE_DIR}/cmake/templates/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(uninstall PROPERTIES FOLDER "CMakeTargets")
|
||||
add_custom_target(uninstall
|
||||
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
)
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(uninstall PROPERTIES FOLDER "CMakeTargets")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# target building all OpenCV modules
|
||||
# ----------------------------------------------------------------------------
|
||||
|
|
|
@ -17,7 +17,7 @@ else()
|
|||
endif()
|
||||
|
||||
# --- Concurrency ---
|
||||
if(MSVC AND NOT HAVE_TBB)
|
||||
if(MSVC AND NOT HAVE_TBB AND NOT OPENCV_DISABLE_THREAD_SUPPORT)
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp")
|
||||
file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
|
||||
try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}")
|
||||
|
|
|
@ -143,12 +143,27 @@ macro(ipp_detect_version)
|
|||
list(APPEND IPP_LIBRARIES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX})
|
||||
else ()
|
||||
add_library(ipp${name} STATIC IMPORTED)
|
||||
set(_filename "${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}")
|
||||
set_target_properties(ipp${name} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES ""
|
||||
IMPORTED_LOCATION ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
IMPORTED_LOCATION ${IPP_LIBRARY_DIR}/${_filename}
|
||||
)
|
||||
if("${name}" STREQUAL "core") # https://github.com/opencv/opencv/pull/19681
|
||||
if(OPENCV_FORCE_IPP_EXCLUDE_LIBS OR OPENCV_FORCE_IPP_EXCLUDE_LIBS_CORE
|
||||
OR (UNIX AND NOT ANDROID AND NOT APPLE
|
||||
AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Intel"
|
||||
)
|
||||
AND NOT OPENCV_SKIP_IPP_EXCLUDE_LIBS_CORE
|
||||
)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.13.0")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--exclude-libs,${_filename} ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
else()
|
||||
target_link_options(ipp${name} INTERFACE "LINKER:--exclude-libs,${_filename}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND IPP_LIBRARIES ipp${name})
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
if (NOT BUILD_SHARED_LIBS AND (HAVE_IPP_ICV OR ";${OPENCV_INSTALL_EXTERNAL_DEPENDENCIES};" MATCHES ";ipp;"))
|
||||
# CMake doesn't support "install(TARGETS ${IPP_PREFIX}${name} " command with imported targets
|
||||
install(FILES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
|
||||
DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
|
@ -236,6 +251,10 @@ if(DEFINED ENV{OPENCV_IPP_PATH} AND NOT DEFINED IPPROOT)
|
|||
endif()
|
||||
|
||||
if(NOT DEFINED IPPROOT)
|
||||
if(APPLE AND NOT IPP_X64)
|
||||
message(STATUS "IPPICV: 32-bit binaries are not supported on Apple platform (MacOSX)")
|
||||
return()
|
||||
endif()
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ippicv/ippicv.cmake")
|
||||
download_ippicv(ICV_PACKAGE_ROOT)
|
||||
if(NOT ICV_PACKAGE_ROOT)
|
||||
|
@ -248,6 +267,7 @@ if(NOT DEFINED IPPROOT)
|
|||
else()
|
||||
ocv_install_3rdparty_licenses(ippicv "${ICV_PACKAGE_ROOT}/EULA.txt")
|
||||
endif()
|
||||
ocv_install_3rdparty_licenses(ippicv "${ICV_PACKAGE_ROOT}/third-party-programs.txt")
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH "${IPPROOT}" __IPPROOT)
|
||||
|
|
|
@ -108,12 +108,13 @@ macro(ippiw_setup PATH BUILD)
|
|||
message(STATUS "found Intel IPP Integration Wrappers binaries: ${IW_VERSION_MAJOR}.${IW_VERSION_MINOR}.${IW_VERSION_UPDATE}")
|
||||
message(STATUS "at: ${IPP_IW_PATH}")
|
||||
|
||||
add_library(ippiw STATIC IMPORTED)
|
||||
set_target_properties(ippiw PROPERTIES
|
||||
add_library(ipp_iw STATIC IMPORTED)
|
||||
set_target_properties(ipp_iw PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES ""
|
||||
IMPORTED_LOCATION "${FILE}"
|
||||
)
|
||||
if (NOT BUILD_SHARED_LIBS)
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS AND ";${OPENCV_INSTALL_EXTERNAL_DEPENDENCIES};" MATCHES ";ipp;")
|
||||
# CMake doesn't support "install(TARGETS ${name} ...)" command with imported targets
|
||||
install(FILES "${FILE}"
|
||||
DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
|
@ -122,7 +123,7 @@ macro(ippiw_setup PATH BUILD)
|
|||
endif()
|
||||
|
||||
set(IPP_IW_INCLUDES "${IPP_IW_PATH}/include")
|
||||
set(IPP_IW_LIBRARIES ippiw)
|
||||
set(IPP_IW_LIBRARIES ipp_iw)
|
||||
|
||||
set(HAVE_IPP_IW 1)
|
||||
set(BUILD_IPP_IW 0)
|
||||
|
|
|
@ -1,22 +1,11 @@
|
|||
macro(_find_header_file_in_dirs VAR NAME)
|
||||
unset(${VAR})
|
||||
unset(${VAR} CACHE)
|
||||
if(" ${ARGN}" STREQUAL " ")
|
||||
check_include_file("${NAME}" HAVE_${VAR})
|
||||
if(HAVE_${VAR})
|
||||
set(${VAR} "${NAME}") # fallback
|
||||
else()
|
||||
set(${VAR} "")
|
||||
endif()
|
||||
check_include_file("${NAME}" HAVE_${VAR})
|
||||
if(HAVE_${VAR})
|
||||
set(${VAR} "${NAME}") # fallback
|
||||
else()
|
||||
find_path(${VAR} "${NAME}" ${ARGN} NO_DEFAULT_PATH)
|
||||
if(${VAR})
|
||||
set(${VAR} "${${VAR}}/${NAME}")
|
||||
unset(${VAR} CACHE)
|
||||
else()
|
||||
unset(${VAR} CACHE)
|
||||
set(${VAR} "")
|
||||
endif()
|
||||
set(${VAR} "")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -51,6 +40,23 @@ macro(ocv_lapack_check)
|
|||
if(NOT "${OPENCV_CBLAS_H_PATH_${_lapack_impl}}" STREQUAL "${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}")
|
||||
list(APPEND _lapack_content "#include \"${OPENCV_LAPACKE_H_PATH_${_lapack_impl}}\"")
|
||||
endif()
|
||||
list(APPEND _lapack_content "
|
||||
#if defined(LAPACK_GLOBAL) || defined(LAPACK_NAME)
|
||||
/*
|
||||
* Using netlib's reference LAPACK implementation version >= 3.4.0 (first with C interface).
|
||||
* Use LAPACK_xxxx to transparently (via predefined lapack macros) deal with pre and post 3.9.1 versions.
|
||||
* LAPACK 3.9.1 introduces LAPACK_FORTRAN_STRLEN_END and modifies (through preprocessing) the declarations of the following functions used in opencv
|
||||
* sposv_, dposv_, spotrf_, dpotrf_, sgesdd_, dgesdd_, sgels_, dgels_
|
||||
* which end up with an extra parameter.
|
||||
* So we also need to preprocess the function calls in opencv coding by prefixing them with LAPACK_.
|
||||
* The good news is the preprocessing works fine whatever netlib's LAPACK version.
|
||||
*/
|
||||
#define OCV_LAPACK_FUNC(f) LAPACK_##f
|
||||
#else
|
||||
/* Using other LAPACK implementations so fall back to opencv's assumption until now */
|
||||
#define OCV_LAPACK_FUNC(f) f##_
|
||||
#endif
|
||||
")
|
||||
if(${_lapack_add_extern_c})
|
||||
list(APPEND _lapack_content "}")
|
||||
endif()
|
||||
|
@ -58,16 +64,52 @@ macro(ocv_lapack_check)
|
|||
string(REPLACE ";" "\n" _lapack_content "${_lapack_content}")
|
||||
ocv_update_file("${CBLAS_H_PROXY_PATH}" "${_lapack_content}")
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio" # MSBuild
|
||||
AND LAPACK_IMPL STREQUAL "MKL"
|
||||
AND ";${LAPACK_LIBRARIES};" MATCHES ";tbb;" AND TARGET tbb
|
||||
AND DEFINED TBB_INTERFACE_VERSION AND NOT (TBB_INTERFACE_VERSION LESS 12000) # oneTBB/oneAPI workaround
|
||||
)
|
||||
# workaround DEFAULTLIB:tbb12.lib issue
|
||||
get_target_property(_tbb_lib tbb IMPORTED_LOCATION)
|
||||
if(NOT _tbb_lib)
|
||||
get_target_property(_tbb_lib tbb IMPORTED_LOCATION_RELEASE)
|
||||
endif()
|
||||
if(_tbb_lib AND NOT OPENCV_SKIP_WORKAROUND_MKL_LINK_DIRECTORIES_TBB)
|
||||
# MSBuild drops content of 'LIB' environment variable,
|
||||
# so pass TBB library directory through `link_directories()`
|
||||
get_filename_component(_tbb_lib_dir "${_tbb_lib}" DIRECTORY)
|
||||
message(STATUS "MKL: adding '${_tbb_lib_dir}' to link directories (workaround DEFAULTLIB issue)")
|
||||
link_directories("${_tbb_lib_dir}")
|
||||
elseif(NOT OPENCV_SKIP_WORKAROUND_MKL_DEFAULTLIB)
|
||||
# We may have tbb.lib for 'tbb' target, but not 'tbb12.lib'
|
||||
ocv_update(OPENCV_MKL_IGNORE_DEFAULTLIB_TBB "tbb12.lib")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NODEFAULTLIB:${OPENCV_MKL_IGNORE_DEFAULTLIB_TBB}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:${OPENCV_MKL_IGNORE_DEFAULTLIB_TBB}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# TODO add cache for try_compile() inputs/results
|
||||
|
||||
get_property(__link_directories DIRECTORY PROPERTY LINK_DIRECTORIES)
|
||||
if(LAPACK_LINK_LIBRARIES)
|
||||
list(APPEND __link_directories ${LAPACK_LINK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
try_compile(__VALID_LAPACK
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/lapack_check.cpp"
|
||||
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${LAPACK_INCLUDE_DIR}\;${CMAKE_BINARY_DIR}"
|
||||
"-DLINK_DIRECTORIES:STRING=${LAPACK_LINK_LIBRARIES}"
|
||||
"-DLINK_LIBRARIES:STRING=${LAPACK_LIBRARIES}"
|
||||
"-DLINK_DIRECTORIES:STRING=${__link_directories}"
|
||||
LINK_LIBRARIES ${LAPACK_LIBRARIES}
|
||||
OUTPUT_VARIABLE TRY_OUT
|
||||
)
|
||||
if(NOT __VALID_LAPACK)
|
||||
#message(FATAL_ERROR "LAPACK: check build log:\n${TRY_OUT}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"\nLAPACK(${LAPACK_IMPL}) check FAILED:\n"
|
||||
" LAPACK_INCLUDE_DIR: '${LAPACK_INCLUDE_DIR}'\n"
|
||||
" LAPACK_LIBRARIES: '${LAPACK_LIBRARIES}'\n"
|
||||
" LAPACK_LINK_LIBRARIES: '${__link_directories}'\n"
|
||||
" Output:\n${TRY_OUT}\n\n")
|
||||
message(STATUS "LAPACK(${LAPACK_IMPL}): Can't build LAPACK check code. This LAPACK version is not supported.")
|
||||
unset(LAPACK_LIBRARIES)
|
||||
else()
|
||||
|
|
|
@ -2,71 +2,61 @@
|
|||
# Detect 3rd-party GUI libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
#--- Win32 UI ---
|
||||
ocv_clear_vars(HAVE_WIN32UI)
|
||||
if(WITH_WIN32UI)
|
||||
try_compile(HAVE_WIN32UI
|
||||
"${OpenCV_BINARY_DIR}"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/win32uitest.cpp"
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=user32;gdi32")
|
||||
endif()
|
||||
|
||||
# --- QT4 ---
|
||||
# --- QT4/5 ---
|
||||
ocv_clear_vars(HAVE_QT HAVE_QT5)
|
||||
|
||||
macro(ocv_find_package_Qt4)
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtTest ${ARGN})
|
||||
if(QT4_FOUND)
|
||||
set(QT_FOUND 1)
|
||||
ocv_assert(QT_VERSION_MAJOR EQUAL 4)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_find_package_Qt OCV_QT_VER)
|
||||
find_package(Qt${OCV_QT_VER} COMPONENTS Core Gui Widgets Test Concurrent ${ARGN} NO_MODULE)
|
||||
if(Qt${OCV_QT_VER}_FOUND)
|
||||
set(QT_FOUND 1)
|
||||
set(QT_VERSION "${Qt${OCV_QT_VER}_VERSION}")
|
||||
set(QT_VERSION_MAJOR "${Qt${OCV_QT_VER}_VERSION_MAJOR}")
|
||||
set(QT_VERSION_MINOR "${Qt${OCV_QT_VER}_VERSION_MINOR}")
|
||||
set(QT_VERSION_PATCH "${Qt${OCV_QT_VER}_VERSION_PATCH}")
|
||||
set(QT_VERSION_TWEAK "${Qt${OCV_QT_VER}_VERSION_TWEAK}")
|
||||
set(QT_VERSION_COUNT "${Qt${OCV_QT_VER}_VERSION_COUNT}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(WITH_QT)
|
||||
if(NOT WITH_QT EQUAL 4)
|
||||
find_package(Qt5 COMPONENTS Core Gui Widgets Test Concurrent REQUIRED NO_MODULE)
|
||||
if(Qt5_FOUND)
|
||||
set(HAVE_QT5 ON)
|
||||
set(HAVE_QT ON)
|
||||
find_package(Qt5 COMPONENTS OpenGL QUIET)
|
||||
if(Qt5OpenGL_FOUND)
|
||||
set(QT_QTOPENGL_FOUND ON)
|
||||
if(NOT WITH_QT GREATER 0)
|
||||
# BUG: Qt5Config.cmake script can't handle components properly: find_package(QT NAMES Qt6 Qt5 REQUIRED NO_MODULE COMPONENTS Core Gui Widgets Test Concurrent)
|
||||
ocv_find_package_Qt(6 QUIET)
|
||||
if(NOT QT_FOUND)
|
||||
ocv_find_package_Qt(5 QUIET)
|
||||
endif()
|
||||
if(NOT QT_FOUND)
|
||||
ocv_find_package_Qt4(QUIET)
|
||||
endif()
|
||||
elseif(WITH_QT EQUAL 4)
|
||||
ocv_find_package_Qt4(REQUIRED)
|
||||
else() # WITH_QT=<major version>
|
||||
ocv_find_package_Qt("${WITH_QT}" REQUIRED)
|
||||
endif()
|
||||
if(QT_FOUND)
|
||||
set(HAVE_QT ON)
|
||||
if(QT_VERSION_MAJOR GREATER 4)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL QUIET)
|
||||
if(Qt${QT_VERSION_MAJOR}OpenGL_FOUND)
|
||||
set(QT_QTOPENGL_FOUND ON) # HAVE_QT_OPENGL is defined below
|
||||
if(QT_VERSION_MAJOR GREATER 5) # QGL -> QOpenGL
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGLWidgets QUIET)
|
||||
if(NOT Qt${QT_VERSION_MAJOR}OpenGLWidgets_FOUND)
|
||||
message(STATUS "Qt OpenGLWidgets component not found: turning off Qt OpenGL functionality")
|
||||
set(QT_QTOPENGL_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_QT)
|
||||
find_package(Qt4 REQUIRED QtCore QtGui QtTest)
|
||||
if(QT4_FOUND)
|
||||
set(HAVE_QT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- GTK ---
|
||||
ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT)
|
||||
if(WITH_GTK AND NOT HAVE_QT)
|
||||
if(NOT WITH_GTK_2_X)
|
||||
ocv_check_modules(GTK3 gtk+-3.0)
|
||||
if(HAVE_GTK3)
|
||||
ocv_append_build_options(HIGHGUI GTK3)
|
||||
set(HAVE_GTK TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_GTK)
|
||||
ocv_check_modules(GTK2 gtk+-2.0)
|
||||
if(HAVE_GTK2)
|
||||
if (GTK2_VERSION VERSION_LESS MIN_VER_GTK)
|
||||
message (FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${GTK2_VERSION} found)")
|
||||
else()
|
||||
ocv_append_build_options(HIGHGUI GTK2)
|
||||
set(HAVE_GTK TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
ocv_check_modules(GTHREAD gthread-2.0)
|
||||
if(HAVE_GTK AND NOT HAVE_GTHREAD)
|
||||
message(FATAL_ERROR "gthread not found. This library is required when building with GTK support")
|
||||
else()
|
||||
ocv_append_build_options(HIGHGUI GTHREAD)
|
||||
endif()
|
||||
if(WITH_OPENGL AND NOT HAVE_GTK3)
|
||||
ocv_check_modules(GTKGLEXT gtkglext-1.0)
|
||||
if(HAVE_GTKGLEXT)
|
||||
ocv_append_build_options(HIGHGUI GTKGLEXT)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- OpenGl ---
|
||||
|
@ -76,7 +66,6 @@ if(WITH_OPENGL)
|
|||
find_package (OpenGL QUIET)
|
||||
if(OPENGL_FOUND)
|
||||
set(HAVE_OPENGL TRUE)
|
||||
list(APPEND OPENCV_LINKER_LIBS ${OPENGL_LIBRARIES})
|
||||
if(QT_QTOPENGL_FOUND)
|
||||
set(HAVE_QT_OPENGL TRUE)
|
||||
else()
|
||||
|
|
|
@ -6,20 +6,32 @@
|
|||
if(BUILD_ZLIB)
|
||||
ocv_clear_vars(ZLIB_FOUND)
|
||||
else()
|
||||
ocv_clear_internal_cache_vars(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
|
||||
if(ANDROID)
|
||||
set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .so)
|
||||
endif()
|
||||
find_package(ZLIB "${MIN_VER_ZLIB}")
|
||||
if(ANDROID)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
endif()
|
||||
if(ZLIB_FOUND AND ANDROID)
|
||||
if(ZLIB_LIBRARIES MATCHES "/usr/(lib|lib32|lib64)/libz.so$")
|
||||
if(ZLIB_LIBRARY MATCHES "/usr/lib.*/libz.so$")
|
||||
set(ZLIB_LIBRARY z)
|
||||
set(ZLIB_LIBRARIES z)
|
||||
set(ZLIB_LIBRARY_RELEASE z)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT ZLIB_FOUND)
|
||||
ocv_clear_vars(ZLIB_LIBRARY ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)
|
||||
ocv_clear_vars(ZLIB_LIBRARY ZLIB_LIBRARIES ZLIB_INCLUDE_DIR)
|
||||
|
||||
set(ZLIB_LIBRARY zlib)
|
||||
set(ZLIB_LIBRARY zlib CACHE INTERNAL "")
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/zlib")
|
||||
set(ZLIB_INCLUDE_DIRS "${${ZLIB_LIBRARY}_SOURCE_DIR}" "${${ZLIB_LIBRARY}_BINARY_DIR}")
|
||||
set(ZLIB_INCLUDE_DIR "${${ZLIB_LIBRARY}_SOURCE_DIR}" "${${ZLIB_LIBRARY}_BINARY_DIR}" CACHE INTERNAL "")
|
||||
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
|
||||
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
|
||||
|
||||
ocv_parse_header2(ZLIB "${${ZLIB_LIBRARY}_SOURCE_DIR}/zlib.h" ZLIB_VERSION)
|
||||
|
@ -30,23 +42,25 @@ if(WITH_JPEG)
|
|||
if(BUILD_JPEG)
|
||||
ocv_clear_vars(JPEG_FOUND)
|
||||
else()
|
||||
ocv_clear_internal_cache_vars(JPEG_LIBRARY JPEG_INCLUDE_DIR)
|
||||
include(FindJPEG)
|
||||
endif()
|
||||
|
||||
if(NOT JPEG_FOUND)
|
||||
ocv_clear_vars(JPEG_LIBRARY JPEG_LIBRARIES JPEG_INCLUDE_DIR)
|
||||
ocv_clear_vars(JPEG_LIBRARY JPEG_INCLUDE_DIR)
|
||||
|
||||
if(NOT BUILD_JPEG_TURBO_DISABLE)
|
||||
set(JPEG_LIBRARY libjpeg-turbo)
|
||||
set(JPEG_LIBRARY libjpeg-turbo CACHE INTERNAL "")
|
||||
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg-turbo")
|
||||
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}/src")
|
||||
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}/src" CACHE INTERNAL "")
|
||||
else()
|
||||
set(JPEG_LIBRARY libjpeg)
|
||||
set(JPEG_LIBRARY libjpeg CACHE INTERNAL "")
|
||||
set(JPEG_LIBRARIES ${JPEG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg")
|
||||
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
|
||||
set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}" CACHE INTERNAL "")
|
||||
endif()
|
||||
set(JPEG_INCLUDE_DIRS "${JPEG_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
macro(ocv_detect_jpeg_version header_file)
|
||||
|
@ -74,6 +88,7 @@ if(WITH_TIFF)
|
|||
if(BUILD_TIFF)
|
||||
ocv_clear_vars(TIFF_FOUND)
|
||||
else()
|
||||
ocv_clear_internal_cache_vars(TIFF_LIBRARY TIFF_INCLUDE_DIR)
|
||||
include(FindTIFF)
|
||||
if(TIFF_FOUND)
|
||||
ocv_parse_header("${TIFF_INCLUDE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
|
||||
|
@ -83,10 +98,10 @@ if(WITH_TIFF)
|
|||
if(NOT TIFF_FOUND)
|
||||
ocv_clear_vars(TIFF_LIBRARY TIFF_LIBRARIES TIFF_INCLUDE_DIR)
|
||||
|
||||
set(TIFF_LIBRARY libtiff)
|
||||
set(TIFF_LIBRARY libtiff CACHE INTERNAL "")
|
||||
set(TIFF_LIBRARIES ${TIFF_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libtiff")
|
||||
set(TIFF_INCLUDE_DIR "${${TIFF_LIBRARY}_SOURCE_DIR}" "${${TIFF_LIBRARY}_BINARY_DIR}")
|
||||
set(TIFF_INCLUDE_DIR "${${TIFF_LIBRARY}_SOURCE_DIR}" "${${TIFF_LIBRARY}_BINARY_DIR}" CACHE INTERNAL "")
|
||||
ocv_parse_header("${${TIFF_LIBRARY}_SOURCE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
|
||||
endif()
|
||||
|
||||
|
@ -117,6 +132,7 @@ if(WITH_WEBP)
|
|||
if(BUILD_WEBP)
|
||||
ocv_clear_vars(WEBP_FOUND WEBP_LIBRARY WEBP_LIBRARIES WEBP_INCLUDE_DIR)
|
||||
else()
|
||||
ocv_clear_internal_cache_vars(WEBP_LIBRARY WEBP_INCLUDE_DIR)
|
||||
include(cmake/OpenCVFindWebP.cmake)
|
||||
if(WEBP_FOUND)
|
||||
set(HAVE_WEBP 1)
|
||||
|
@ -128,12 +144,12 @@ endif()
|
|||
if(WITH_WEBP AND NOT WEBP_FOUND
|
||||
AND (NOT ANDROID OR HAVE_CPUFEATURES)
|
||||
)
|
||||
|
||||
set(WEBP_LIBRARY libwebp)
|
||||
ocv_clear_vars(WEBP_LIBRARY WEBP_INCLUDE_DIR)
|
||||
set(WEBP_LIBRARY libwebp CACHE INTERNAL "")
|
||||
set(WEBP_LIBRARIES ${WEBP_LIBRARY})
|
||||
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libwebp")
|
||||
set(WEBP_INCLUDE_DIR "${${WEBP_LIBRARY}_SOURCE_DIR}/src")
|
||||
set(WEBP_INCLUDE_DIR "${${WEBP_LIBRARY}_SOURCE_DIR}/src" CACHE INTERNAL "")
|
||||
set(HAVE_WEBP 1)
|
||||
endif()
|
||||
|
||||
|
@ -153,8 +169,36 @@ if(NOT WEBP_VERSION AND WEBP_INCLUDE_DIR)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
# --- libopenjp2 (optional, check before libjasper) ---
|
||||
if(WITH_OPENJPEG)
|
||||
if(BUILD_OPENJPEG)
|
||||
ocv_clear_vars(OpenJPEG_FOUND)
|
||||
else()
|
||||
find_package(OpenJPEG QUIET)
|
||||
endif()
|
||||
|
||||
if(NOT OpenJPEG_FOUND OR OPENJPEG_MAJOR_VERSION LESS 2)
|
||||
ocv_clear_vars(OPENJPEG_MAJOR_VERSION OPENJPEG_MINOR_VERSION OPENJPEG_BUILD_VERSION OPENJPEG_LIBRARIES OPENJPEG_INCLUDE_DIRS)
|
||||
message(STATUS "Could NOT find OpenJPEG (minimal suitable version: 2.0, "
|
||||
"recommended version >= 2.3.1). OpenJPEG will be built from sources")
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/openjpeg")
|
||||
if(OCV_CAN_BUILD_OPENJPEG)
|
||||
set(HAVE_OPENJPEG YES)
|
||||
message(STATUS "OpenJPEG libraries will be built from sources: ${OPENJPEG_LIBRARIES} "
|
||||
"(version \"${OPENJPEG_VERSION}\")")
|
||||
else()
|
||||
set(HAVE_OPENJPEG NO)
|
||||
message(STATUS "OpenJPEG libraries can't be built from sources. System requirements are not fulfilled.")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_OPENJPEG YES)
|
||||
message(STATUS "Found system OpenJPEG: ${OPENJPEG_LIBRARIES} "
|
||||
"(found version \"${OPENJPEG_VERSION}\")")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# --- libjasper (optional, should be searched after libjpeg) ---
|
||||
if(WITH_JASPER)
|
||||
if(WITH_JASPER AND NOT HAVE_OPENJPEG)
|
||||
if(BUILD_JASPER)
|
||||
ocv_clear_vars(JASPER_FOUND)
|
||||
else()
|
||||
|
@ -164,10 +208,10 @@ if(WITH_JASPER)
|
|||
if(NOT JASPER_FOUND)
|
||||
ocv_clear_vars(JASPER_LIBRARY JASPER_LIBRARIES JASPER_INCLUDE_DIR)
|
||||
|
||||
set(JASPER_LIBRARY libjasper)
|
||||
set(JASPER_LIBRARY libjasper CACHE INTERNAL "")
|
||||
set(JASPER_LIBRARIES ${JASPER_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjasper")
|
||||
set(JASPER_INCLUDE_DIR "${${JASPER_LIBRARY}_SOURCE_DIR}")
|
||||
set(JASPER_INCLUDE_DIR "${${JASPER_LIBRARY}_SOURCE_DIR}" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
set(HAVE_JASPER YES)
|
||||
|
@ -182,6 +226,7 @@ if(WITH_PNG)
|
|||
if(BUILD_PNG)
|
||||
ocv_clear_vars(PNG_FOUND)
|
||||
else()
|
||||
ocv_clear_internal_cache_vars(PNG_LIBRARY PNG_INCLUDE_DIR)
|
||||
include(FindPNG)
|
||||
if(PNG_FOUND)
|
||||
include(CheckIncludeFile)
|
||||
|
@ -197,10 +242,10 @@ if(WITH_PNG)
|
|||
if(NOT PNG_FOUND)
|
||||
ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_LIBPNG_PNG_H PNG_DEFINITIONS)
|
||||
|
||||
set(PNG_LIBRARY libpng)
|
||||
set(PNG_LIBRARY libpng CACHE INTERNAL "")
|
||||
set(PNG_LIBRARIES ${PNG_LIBRARY})
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libpng")
|
||||
set(PNG_INCLUDE_DIR "${${PNG_LIBRARY}_SOURCE_DIR}")
|
||||
set(PNG_INCLUDE_DIR "${${PNG_LIBRARY}_SOURCE_DIR}" CACHE INTERNAL "")
|
||||
set(PNG_DEFINITIONS "")
|
||||
ocv_parse_header("${PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
|
||||
endif()
|
||||
|
@ -213,6 +258,7 @@ endif()
|
|||
if(WITH_OPENEXR)
|
||||
ocv_clear_vars(HAVE_OPENEXR)
|
||||
if(NOT BUILD_OPENEXR)
|
||||
ocv_clear_internal_cache_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
|
||||
endif()
|
||||
|
||||
|
@ -224,7 +270,9 @@ if(WITH_OPENEXR)
|
|||
set(OPENEXR_LIBRARIES IlmImf)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/openexr")
|
||||
if(OPENEXR_VERSION) # check via TARGET doesn't work
|
||||
set(BUILD_OPENEXR ON)
|
||||
set(HAVE_OPENEXR YES)
|
||||
set(BUILD_OPENEXR ON)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -242,7 +290,7 @@ if(WITH_GDAL)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if (WITH_GDCM)
|
||||
if(WITH_GDCM)
|
||||
find_package(GDCM QUIET)
|
||||
if(NOT GDCM_FOUND)
|
||||
set(HAVE_GDCM NO)
|
||||
|
@ -273,4 +321,4 @@ if(WITH_IMGCODEC_PFM)
|
|||
set(HAVE_IMGCODEC_PFM ON)
|
||||
elseif(DEFINED WITH_IMGCODEC_PFM)
|
||||
set(HAVE_IMGCODEC_PFM OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -25,6 +25,16 @@ if(WITH_IPP)
|
|||
elseif(ANDROID AND NOT OPENCV_SKIP_ANDROID_IPP_FIX_2)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(OPENCV_FORCE_IPP_EXCLUDE_LIBS
|
||||
OR (HAVE_IPP_ICV
|
||||
AND UNIX AND NOT ANDROID AND NOT APPLE
|
||||
AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Intel"
|
||||
)
|
||||
AND NOT OPENCV_SKIP_IPP_EXCLUDE_LIBS
|
||||
)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -41,7 +51,15 @@ endif(WITH_CUDA)
|
|||
|
||||
# --- Eigen ---
|
||||
if(WITH_EIGEN AND NOT HAVE_EIGEN)
|
||||
find_package(Eigen3 QUIET)
|
||||
if((OPENCV_FORCE_EIGEN_FIND_PACKAGE_CONFIG
|
||||
OR NOT (CMAKE_VERSION VERSION_LESS "3.0.0") # Eigen3Targets.cmake required CMake 3.0.0+
|
||||
) AND NOT OPENCV_SKIP_EIGEN_FIND_PACKAGE_CONFIG
|
||||
)
|
||||
find_package(Eigen3 CONFIG QUIET) # Ceres 2.0.0 CMake scripts doesn't work with CMake's FindEigen3.cmake module (due to missing EIGEN3_VERSION_STRING)
|
||||
endif()
|
||||
if(NOT Eigen3_FOUND)
|
||||
find_package(Eigen3 QUIET)
|
||||
endif()
|
||||
|
||||
if(Eigen3_FOUND)
|
||||
if(TARGET Eigen3::Eigen)
|
||||
|
|
|
@ -3,15 +3,6 @@ if(WIN32)
|
|||
list(APPEND HIGHGUI_LIBRARIES comctl32 gdi32 ole32 setupapi ws2_32)
|
||||
endif(WIN32)
|
||||
|
||||
# --- VA & VA_INTEL ---
|
||||
if(WITH_VA_INTEL)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindVA_INTEL.cmake")
|
||||
if(VA_INTEL_IOCL_INCLUDE_DIR)
|
||||
ocv_include_directories(${VA_INTEL_IOCL_INCLUDE_DIR})
|
||||
endif()
|
||||
set(WITH_VA YES)
|
||||
endif(WITH_VA_INTEL)
|
||||
|
||||
if(WITH_VA)
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindVA.cmake")
|
||||
if(VA_INCLUDE_DIR)
|
||||
|
|
|
@ -3,7 +3,14 @@
|
|||
# installation/package
|
||||
#
|
||||
# Parameters:
|
||||
# MKL_WITH_TBB
|
||||
# MKL_ROOT_DIR / ENV{MKLROOT}
|
||||
# MKL_INCLUDE_DIR
|
||||
# MKL_LIBRARIES
|
||||
# MKL_USE_SINGLE_DYNAMIC_LIBRARY - use single dynamic library mkl_rt.lib / libmkl_rt.so
|
||||
# MKL_WITH_TBB / MKL_WITH_OPENMP
|
||||
#
|
||||
# Extra:
|
||||
# MKL_LIB_FIND_PATHS
|
||||
#
|
||||
# On return this will define:
|
||||
#
|
||||
|
@ -13,12 +20,6 @@
|
|||
# MKL_LIBRARIES - MKL libraries that are used by OpenCV
|
||||
#
|
||||
|
||||
macro (mkl_find_lib VAR NAME DIRS)
|
||||
find_path(${VAR} ${NAME} ${DIRS} NO_DEFAULT_PATH)
|
||||
set(${VAR} ${${VAR}}/${NAME})
|
||||
unset(${VAR} CACHE)
|
||||
endmacro()
|
||||
|
||||
macro(mkl_fail)
|
||||
set(HAVE_MKL OFF)
|
||||
set(MKL_ROOT_DIR "${MKL_ROOT_DIR}" CACHE PATH "Path to MKL directory")
|
||||
|
@ -39,49 +40,57 @@ macro(get_mkl_version VERSION_FILE)
|
|||
set(MKL_VERSION_STR "${MKL_VERSION_MAJOR}.${MKL_VERSION_MINOR}.${MKL_VERSION_UPDATE}" CACHE STRING "MKL version" FORCE)
|
||||
endmacro()
|
||||
|
||||
OCV_OPTION(MKL_USE_SINGLE_DYNAMIC_LIBRARY "Use MKL Single Dynamic Library thorugh mkl_rt.lib / libmkl_rt.so" OFF)
|
||||
OCV_OPTION(MKL_WITH_TBB "Use MKL with TBB multithreading" OFF)#ON IF WITH_TBB)
|
||||
OCV_OPTION(MKL_WITH_OPENMP "Use MKL with OpenMP multithreading" OFF)#ON IF WITH_OPENMP)
|
||||
|
||||
if(NOT DEFINED MKL_USE_MULTITHREAD)
|
||||
OCV_OPTION(MKL_WITH_TBB "Use MKL with TBB multithreading" OFF)#ON IF WITH_TBB)
|
||||
OCV_OPTION(MKL_WITH_OPENMP "Use MKL with OpenMP multithreading" OFF)#ON IF WITH_OPENMP)
|
||||
if(NOT MKL_ROOT_DIR AND DEFINED MKL_INCLUDE_DIR AND EXISTS "${MKL_INCLUDE_DIR}/mkl.h")
|
||||
file(TO_CMAKE_PATH "${MKL_INCLUDE_DIR}" MKL_INCLUDE_DIR)
|
||||
get_filename_component(MKL_ROOT_DIR "${MKL_INCLUDE_DIR}/.." ABSOLUTE)
|
||||
endif()
|
||||
if(NOT MKL_ROOT_DIR)
|
||||
file(TO_CMAKE_PATH "${MKL_ROOT_DIR}" mkl_root_paths)
|
||||
if(DEFINED ENV{MKLROOT})
|
||||
file(TO_CMAKE_PATH "$ENV{MKLROOT}" path)
|
||||
list(APPEND mkl_root_paths "${path}")
|
||||
endif()
|
||||
|
||||
if(WITH_MKL AND NOT mkl_root_paths)
|
||||
if(WIN32)
|
||||
set(ProgramFilesx86 "ProgramFiles(x86)")
|
||||
file(TO_CMAKE_PATH "$ENV{${ProgramFilesx86}}" path)
|
||||
list(APPEND mkl_root_paths ${path}/IntelSWTools/compilers_and_libraries/windows/mkl)
|
||||
endif()
|
||||
if(UNIX)
|
||||
list(APPEND mkl_root_paths "/opt/intel/mkl")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_path(MKL_ROOT_DIR include/mkl.h PATHS ${mkl_root_paths})
|
||||
endif()
|
||||
|
||||
#check current MKL_ROOT_DIR
|
||||
if(NOT MKL_ROOT_DIR OR NOT EXISTS "${MKL_ROOT_DIR}/include/mkl.h")
|
||||
set(mkl_root_paths "${MKL_ROOT_DIR}")
|
||||
if(DEFINED ENV{MKLROOT})
|
||||
list(APPEND mkl_root_paths "$ENV{MKLROOT}")
|
||||
endif()
|
||||
|
||||
if(WITH_MKL AND NOT mkl_root_paths)
|
||||
if(WIN32)
|
||||
set(ProgramFilesx86 "ProgramFiles(x86)")
|
||||
list(APPEND mkl_root_paths $ENV{${ProgramFilesx86}}/IntelSWTools/compilers_and_libraries/windows/mkl)
|
||||
endif()
|
||||
if(UNIX)
|
||||
list(APPEND mkl_root_paths "/opt/intel/mkl")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_path(MKL_ROOT_DIR include/mkl.h PATHS ${mkl_root_paths})
|
||||
mkl_fail()
|
||||
endif()
|
||||
|
||||
set(MKL_INCLUDE_DIRS "${MKL_ROOT_DIR}/include" CACHE PATH "Path to MKL include directory")
|
||||
set(MKL_INCLUDE_DIR "${MKL_ROOT_DIR}/include" CACHE PATH "Path to MKL include directory")
|
||||
|
||||
if(NOT MKL_ROOT_DIR
|
||||
OR NOT EXISTS "${MKL_ROOT_DIR}"
|
||||
OR NOT EXISTS "${MKL_INCLUDE_DIRS}"
|
||||
OR NOT EXISTS "${MKL_INCLUDE_DIRS}/mkl_version.h"
|
||||
OR NOT EXISTS "${MKL_INCLUDE_DIR}"
|
||||
OR NOT EXISTS "${MKL_INCLUDE_DIR}/mkl_version.h"
|
||||
)
|
||||
mkl_fail()
|
||||
mkl_fail()
|
||||
endif()
|
||||
|
||||
get_mkl_version(${MKL_INCLUDE_DIRS}/mkl_version.h)
|
||||
get_mkl_version(${MKL_INCLUDE_DIR}/mkl_version.h)
|
||||
|
||||
#determine arch
|
||||
if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
|
||||
set(MKL_X64 1)
|
||||
set(MKL_ARCH "intel64")
|
||||
|
||||
set(MKL_ARCH_LIST "intel64")
|
||||
if(MSVC)
|
||||
list(APPEND MKL_ARCH_LIST "win-x64")
|
||||
endif()
|
||||
include(CheckTypeSize)
|
||||
CHECK_TYPE_SIZE(int _sizeof_int)
|
||||
if (_sizeof_int EQUAL 4)
|
||||
|
@ -90,51 +99,77 @@ if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
|
|||
set(MKL_ARCH_SUFFIX "ilp64")
|
||||
endif()
|
||||
else()
|
||||
set(MKL_ARCH "ia32")
|
||||
set(MKL_ARCH_LIST "ia32")
|
||||
set(MKL_ARCH_SUFFIX "c")
|
||||
endif()
|
||||
|
||||
if(MKL_VERSION_STR VERSION_GREATER "11.3.0" OR MKL_VERSION_STR VERSION_EQUAL "11.3.0")
|
||||
set(mkl_lib_find_paths
|
||||
${MKL_ROOT_DIR}/lib
|
||||
${MKL_ROOT_DIR}/lib/${MKL_ARCH} ${MKL_ROOT_DIR}/../tbb/lib/${MKL_ARCH})
|
||||
set(mkl_lib_find_paths ${MKL_LIB_FIND_PATHS} ${MKL_ROOT_DIR}/lib)
|
||||
foreach(MKL_ARCH ${MKL_ARCH_LIST})
|
||||
list(APPEND mkl_lib_find_paths
|
||||
${MKL_ROOT_DIR}/lib/${MKL_ARCH}
|
||||
${MKL_ROOT_DIR}/${MKL_ARCH}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
set(mkl_lib_list "mkl_intel_${MKL_ARCH_SUFFIX}")
|
||||
if(DEFINED OPENCV_MKL_LIBRARIES)
|
||||
# custom list, user specified
|
||||
set(mkl_lib_list ${OPENCV_MKL_LIBRARIES})
|
||||
|
||||
if(MKL_WITH_TBB)
|
||||
list(APPEND mkl_lib_list mkl_tbb_thread tbb)
|
||||
elseif(MKL_WITH_OPENMP)
|
||||
if(MSVC)
|
||||
list(APPEND mkl_lib_list mkl_intel_thread libiomp5md)
|
||||
else()
|
||||
list(APPEND mkl_lib_list mkl_gnu_thread)
|
||||
endif()
|
||||
elseif(MKL_USE_SINGLE_DYNAMIC_LIBRARY AND NOT (MKL_VERSION_STR VERSION_LESS "10.3.0"))
|
||||
|
||||
# https://software.intel.com/content/www/us/en/develop/articles/a-new-linking-model-single-dynamic-library-mkl_rt-since-intel-mkl-103.html
|
||||
set(mkl_lib_list "mkl_rt")
|
||||
|
||||
elseif(NOT (MKL_VERSION_STR VERSION_LESS "11.3.0"))
|
||||
|
||||
set(mkl_lib_list "mkl_intel_${MKL_ARCH_SUFFIX}")
|
||||
|
||||
if(MKL_WITH_TBB)
|
||||
list(APPEND mkl_lib_list mkl_tbb_thread)
|
||||
elseif(MKL_WITH_OPENMP)
|
||||
if(MSVC)
|
||||
list(APPEND mkl_lib_list mkl_intel_thread libiomp5md)
|
||||
else()
|
||||
list(APPEND mkl_lib_list mkl_sequential)
|
||||
list(APPEND mkl_lib_list mkl_gnu_thread)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND mkl_lib_list mkl_sequential)
|
||||
endif()
|
||||
|
||||
list(APPEND mkl_lib_list mkl_core)
|
||||
list(APPEND mkl_lib_list mkl_core)
|
||||
else()
|
||||
message(STATUS "MKL version ${MKL_VERSION_STR} is not supported")
|
||||
mkl_fail()
|
||||
message(STATUS "MKL version ${MKL_VERSION_STR} is not supported")
|
||||
mkl_fail()
|
||||
endif()
|
||||
|
||||
set(MKL_LIBRARIES "")
|
||||
foreach(lib ${mkl_lib_list})
|
||||
find_library(${lib} ${lib} ${mkl_lib_find_paths})
|
||||
mark_as_advanced(${lib})
|
||||
if(NOT ${lib})
|
||||
mkl_fail()
|
||||
if(NOT MKL_LIBRARIES)
|
||||
set(MKL_LIBRARIES "")
|
||||
foreach(lib ${mkl_lib_list})
|
||||
set(lib_var_name MKL_LIBRARY_${lib})
|
||||
find_library(${lib_var_name} NAMES ${lib} ${lib}_dll HINTS ${mkl_lib_find_paths})
|
||||
mark_as_advanced(${lib_var_name})
|
||||
if(NOT ${lib_var_name})
|
||||
mkl_fail()
|
||||
endif()
|
||||
list(APPEND MKL_LIBRARIES ${${lib}})
|
||||
endforeach()
|
||||
list(APPEND MKL_LIBRARIES ${${lib_var_name}})
|
||||
endforeach()
|
||||
list(APPEND MKL_LIBRARIES ${OPENCV_EXTRA_MKL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(MKL_WITH_TBB)
|
||||
if(BUILD_TBB)
|
||||
message(STATUS "MKL: reusing builtin TBB binaries is not supported. Consider disabling MKL_WITH_TBB flag to prevent build/runtime errors")
|
||||
else()
|
||||
list(APPEND MKL_LIBRARIES tbb) # tbb target is expected
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Found MKL ${MKL_VERSION_STR} at: ${MKL_ROOT_DIR}")
|
||||
set(HAVE_MKL ON)
|
||||
set(MKL_ROOT_DIR "${MKL_ROOT_DIR}" CACHE PATH "Path to MKL directory")
|
||||
set(MKL_INCLUDE_DIRS "${MKL_INCLUDE_DIRS}" CACHE PATH "Path to MKL include directory")
|
||||
set(MKL_LIBRARIES "${MKL_LIBRARIES}" CACHE STRING "MKL libraries")
|
||||
if(UNIX AND NOT MKL_LIBRARIES_DONT_HACK)
|
||||
set(MKL_INCLUDE_DIRS "${MKL_INCLUDE_DIR}")
|
||||
set(MKL_LIBRARIES "${MKL_LIBRARIES}")
|
||||
if(UNIX AND NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY AND NOT MKL_LIBRARIES_DONT_HACK)
|
||||
#it's ugly but helps to avoid cyclic lib problem
|
||||
set(MKL_LIBRARIES ${MKL_LIBRARIES} ${MKL_LIBRARIES} ${MKL_LIBRARIES} "-lpthread" "-lm" "-ldl")
|
||||
endif()
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
SET(Open_BLAS_INCLUDE_SEARCH_PATHS
|
||||
$ENV{OpenBLAS_HOME}
|
||||
$ENV{OpenBLAS_HOME}/include
|
||||
$ENV{OpenBLAS_HOME}/include/openblas
|
||||
/opt/OpenBLAS/include
|
||||
/usr/local/include/openblas
|
||||
/usr/include/openblas
|
||||
|
@ -56,7 +57,7 @@ SET(Open_BLAS_INCLUDE_SEARCH_PATHS
|
|||
)
|
||||
|
||||
SET(Open_BLAS_LIB_SEARCH_PATHS
|
||||
$ENV{OpenBLAS}cd
|
||||
$ENV{OpenBLAS}
|
||||
$ENV{OpenBLAS}/lib
|
||||
$ENV{OpenBLAS_HOME}
|
||||
$ENV{OpenBLAS_HOME}/lib
|
||||
|
@ -103,4 +104,4 @@ MARK_AS_ADVANCED(
|
|||
OpenBLAS_INCLUDE_DIR
|
||||
OpenBLAS_LIB
|
||||
OpenBLAS
|
||||
)
|
||||
)
|
||||
|
|
|
@ -9,66 +9,119 @@
|
|||
# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR.
|
||||
#
|
||||
|
||||
if(NOT OPENCV_SKIP_OPENEXR_FIND_PACKAGE)
|
||||
find_package(OpenEXR 3 QUIET)
|
||||
#ocv_cmake_dump_vars(EXR)
|
||||
if(OpenEXR_FOUND)
|
||||
if(TARGET OpenEXR::OpenEXR) # OpenEXR 3+
|
||||
set(OPENEXR_LIBRARIES OpenEXR::OpenEXR)
|
||||
set(OPENEXR_INCLUDE_PATHS "")
|
||||
set(OPENEXR_VERSION "${OpenEXR_VERSION}")
|
||||
set(OPENEXR_FOUND 1)
|
||||
return()
|
||||
else()
|
||||
message(STATUS "Unsupported find_package(OpenEXR) - missing OpenEXR::OpenEXR target (version ${OpenEXR_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
SET(OPENEXR_LIBRARIES "")
|
||||
SET(OPENEXR_LIBSEARCH_SUFFIXES "")
|
||||
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
|
||||
|
||||
if(WIN32)
|
||||
SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")
|
||||
if(CMAKE_CL_64)
|
||||
if(X86_64)
|
||||
SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)
|
||||
elseif(MSVC)
|
||||
SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)
|
||||
endif()
|
||||
else()
|
||||
set(OPENEXR_ROOT "")
|
||||
elseif(UNIX)
|
||||
SET(OPENEXR_LIBSEARCH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE})
|
||||
endif()
|
||||
|
||||
SET(LIBRARY_PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/sw/lib
|
||||
/opt/local/lib
|
||||
"${ProgramFiles_ENV_PATH}/OpenEXR/lib/static"
|
||||
"${OPENEXR_ROOT}/lib")
|
||||
SET(SEARCH_PATHS
|
||||
"${OPENEXR_ROOT}"
|
||||
/usr
|
||||
/usr/local
|
||||
/sw
|
||||
/opt
|
||||
"${ProgramFiles_ENV_PATH}/OpenEXR")
|
||||
|
||||
FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
|
||||
PATH_SUFFIXES OpenEXR
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/sw/include
|
||||
/opt/local/include
|
||||
"${ProgramFiles_ENV_PATH}/OpenEXR/include"
|
||||
"${OPENEXR_ROOT}/include")
|
||||
MACRO(FIND_OPENEXR_LIBRARY LIBRARY_NAME LIBRARY_SUFFIX)
|
||||
string(TOUPPER "${LIBRARY_NAME}" LIBRARY_NAME_UPPER)
|
||||
FIND_LIBRARY(OPENEXR_${LIBRARY_NAME_UPPER}_LIBRARY
|
||||
NAMES ${LIBRARY_NAME}${LIBRARY_SUFFIX}
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
NO_DEFAULT_PATH
|
||||
PATHS "${SEARCH_PATH}/lib" "${SEARCH_PATH}/lib/static")
|
||||
ENDMACRO()
|
||||
|
||||
FIND_LIBRARY(OPENEXR_HALF_LIBRARY
|
||||
NAMES Half
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
MACRO(ocv_find_openexr LIBRARY_SUFFIX)
|
||||
IF(NOT OPENEXR_FOUND)
|
||||
FIND_OPENEXR_LIBRARY("Half" "${LIBRARY_SUFFIX}")
|
||||
FIND_OPENEXR_LIBRARY("Iex" "${LIBRARY_SUFFIX}")
|
||||
FIND_OPENEXR_LIBRARY("Imath" "${LIBRARY_SUFFIX}")
|
||||
FIND_OPENEXR_LIBRARY("IlmImf" "${LIBRARY_SUFFIX}")
|
||||
FIND_OPENEXR_LIBRARY("IlmThread" "${LIBRARY_SUFFIX}")
|
||||
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY AND OPENEXR_ILMTHREAD_LIBRARY)
|
||||
SET(OPENEXR_FOUND TRUE)
|
||||
ELSE()
|
||||
UNSET(OPENEXR_IMATH_LIBRARY)
|
||||
UNSET(OPENEXR_ILMIMF_LIBRARY)
|
||||
UNSET(OPENEXR_IEX_LIBRARY)
|
||||
UNSET(OPENEXR_ILMTHREAD_LIBRARY)
|
||||
UNSET(OPENEXR_HALF_LIBRARY)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
FIND_LIBRARY(OPENEXR_IEX_LIBRARY
|
||||
NAMES Iex
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
FOREACH(SEARCH_PATH ${SEARCH_PATHS})
|
||||
FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h
|
||||
PATH_SUFFIXES OpenEXR
|
||||
NO_DEFAULT_PATH
|
||||
PATHS
|
||||
"${SEARCH_PATH}/include")
|
||||
|
||||
FIND_LIBRARY(OPENEXR_IMATH_LIBRARY
|
||||
NAMES Imath
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
IF (OPENEXR_INCLUDE_PATH)
|
||||
SET(OPENEXR_VERSION_FILE "${OPENEXR_INCLUDE_PATH}/OpenEXRConfig.h")
|
||||
IF (EXISTS ${OPENEXR_VERSION_FILE})
|
||||
FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_MAJOR ")
|
||||
IF (${contents} MATCHES "#define OPENEXR_VERSION_MAJOR ([0-9]+)")
|
||||
SET(OPENEXR_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
ENDIF ()
|
||||
FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_MINOR ")
|
||||
IF (${contents} MATCHES "#define OPENEXR_VERSION_MINOR ([0-9]+)")
|
||||
SET(OPENEXR_VERSION_MINOR "${CMAKE_MATCH_1}")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY
|
||||
NAMES IlmImf
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
IF (OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR)
|
||||
set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}")
|
||||
ENDIF ()
|
||||
|
||||
FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY
|
||||
NAMES IlmThread
|
||||
PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES}
|
||||
PATHS ${LIBRARY_PATHS})
|
||||
ocv_find_openexr("-${OPENEXR_VERSION}")
|
||||
ocv_find_openexr("-${OPENEXR_VERSION}_s")
|
||||
ocv_find_openexr("-${OPENEXR_VERSION}_d")
|
||||
ocv_find_openexr("-${OPENEXR_VERSION}_s_d")
|
||||
ocv_find_openexr("")
|
||||
ocv_find_openexr("_s")
|
||||
ocv_find_openexr("_d")
|
||||
ocv_find_openexr("_s_d")
|
||||
|
||||
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
|
||||
SET(OPENEXR_FOUND TRUE)
|
||||
IF (OPENEXR_FOUND)
|
||||
BREAK()
|
||||
ENDIF()
|
||||
|
||||
UNSET(OPENEXR_INCLUDE_PATH)
|
||||
UNSET(OPENEXR_VERSION_FILE)
|
||||
UNSET(OPENEXR_VERSION_MAJOR)
|
||||
UNSET(OPENEXR_VERSION_MINOR)
|
||||
UNSET(OPENEXR_VERSION)
|
||||
ENDFOREACH()
|
||||
|
||||
IF (OPENEXR_FOUND)
|
||||
SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE PATH "The include paths needed to use OpenEXR")
|
||||
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR" FORCE)
|
||||
ENDIF ()
|
||||
|
|
|
@ -6,9 +6,15 @@ if(NOT WITH_PROTOBUF)
|
|||
return()
|
||||
endif()
|
||||
|
||||
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf from sources" ON)
|
||||
ocv_option(BUILD_PROTOBUF "Force to build libprotobuf runtime from sources" ON)
|
||||
ocv_option(PROTOBUF_UPDATE_FILES "Force rebuilding .proto files (protoc should be available)" OFF)
|
||||
|
||||
# BUILD_PROTOBUF=OFF: Custom manual protobuf configuration (see find_package(Protobuf) for details):
|
||||
# - Protobuf_INCLUDE_DIR
|
||||
# - Protobuf_LIBRARY
|
||||
# - Protobuf_PROTOC_EXECUTABLE
|
||||
|
||||
|
||||
function(get_protobuf_version version include)
|
||||
file(STRINGS "${include}/google/protobuf/stubs/common.h" ver REGEX "#define GOOGLE_PROTOBUF_VERSION [0-9]+")
|
||||
string(REGEX MATCHALL "[0-9]+" ver ${ver})
|
||||
|
@ -19,7 +25,9 @@ function(get_protobuf_version version include)
|
|||
endfunction()
|
||||
|
||||
if(BUILD_PROTOBUF)
|
||||
ocv_assert(NOT PROTOBUF_UPDATE_FILES)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/protobuf")
|
||||
set(Protobuf_LIBRARIES "libprotobuf")
|
||||
set(HAVE_PROTOBUF TRUE)
|
||||
else()
|
||||
unset(Protobuf_VERSION CACHE)
|
||||
|
@ -44,10 +52,7 @@ else()
|
|||
|
||||
if(Protobuf_FOUND)
|
||||
if(TARGET protobuf::libprotobuf)
|
||||
add_library(libprotobuf INTERFACE IMPORTED)
|
||||
set_target_properties(libprotobuf PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES protobuf::libprotobuf
|
||||
)
|
||||
set(Protobuf_LIBRARIES "protobuf::libprotobuf")
|
||||
else()
|
||||
add_library(libprotobuf UNKNOWN IMPORTED)
|
||||
set_target_properties(libprotobuf PROPERTIES
|
||||
|
@ -56,21 +61,31 @@ else()
|
|||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
|
||||
)
|
||||
get_protobuf_version(Protobuf_VERSION "${Protobuf_INCLUDE_DIR}")
|
||||
set(Protobuf_LIBRARIES "libprotobuf")
|
||||
endif()
|
||||
set(HAVE_PROTOBUF TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP)
|
||||
find_package(Protobuf QUIET)
|
||||
if(NOT COMMAND PROTOBUF_GENERATE_CPP)
|
||||
message(FATAL_ERROR "PROTOBUF_GENERATE_CPP command is not available")
|
||||
endif()
|
||||
message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})")
|
||||
endif()
|
||||
|
||||
if(HAVE_PROTOBUF)
|
||||
list(APPEND CUSTOM_STATUS protobuf)
|
||||
if(NOT BUILD_PROTOBUF)
|
||||
if(TARGET "${Protobuf_LIBRARIES}")
|
||||
get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION_RELEASE)
|
||||
if(NOT __location)
|
||||
get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION)
|
||||
endif()
|
||||
elseif(Protobuf_LIBRARY)
|
||||
set(__location "${Protobuf_LIBRARY}")
|
||||
else()
|
||||
set(__location "${Protobuf_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND CUSTOM_STATUS_protobuf " Protobuf:"
|
||||
BUILD_PROTOBUF THEN "build (${Protobuf_VERSION})"
|
||||
ELSE "${Protobuf_LIBRARY} (${Protobuf_VERSION})")
|
||||
ELSE "${__location} (${Protobuf_VERSION})")
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
set(TIMVX_INSTALL_DIR "" CACHE PATH "Path to libtim-vx installation")
|
||||
set(VIVANTE_SDK_DIR "" CACHE PATH "Path to VIVANTE SDK needed by TIM-VX.")
|
||||
set(VIVANTE_SDK_LIB_CANDIDATES "OpenVX;VSC;GAL;ArchModelSw;NNArchPerf" CACHE STRING "VIVANTE SDK library candidates")
|
||||
|
||||
# Ensure VIVANTE SDK library candidates are present in given search path
|
||||
function(find_vivante_sdk_libs _viv_notfound _viv_search_path)
|
||||
foreach(one ${VIVANTE_SDK_LIB_CANDIDATES})
|
||||
#NO_DEFAULT_PATH is used to ensure VIVANTE SDK libs are from one only source
|
||||
find_library(VIV_${one}_LIB ${one} PATHS "${_viv_search_path}/lib" NO_DEFAULT_PATH)
|
||||
if(NOT VIV_${one}_LIB)
|
||||
list(APPEND _viv_notfound_list ${one})
|
||||
endif()
|
||||
endforeach()
|
||||
set(${_viv_notfound} ${_viv_notfound_list} PARENT_SCOPE)
|
||||
endfunction()
|
||||
# Default value for VIVANTE_SDK_DIR: /usr
|
||||
if(NOT VIVANTE_SDK_DIR)
|
||||
set(VIVANTE_SDK_DIR "/usr")
|
||||
endif()
|
||||
# Environment variable VIVANTE_SDK_DIR overrides the one in this script
|
||||
if(DEFINED ENV{VIVANTE_SDK_DIR})
|
||||
set(VIVANTE_SDK_DIR $ENV{VIVANTE_SDK_DIR})
|
||||
message(STATUS "TIM-VX: Load VIVANTE_SDK_DIR from system environment: ${VIVANTE_SDK_DIR}")
|
||||
endif()
|
||||
|
||||
|
||||
# Compile with pre-installed TIM-VX; Or compile together with TIM-VX from source
|
||||
if(TIMVX_INSTALL_DIR AND NOT BUILD_TIMVX)
|
||||
message(STATUS "TIM-VX: Use binaries at ${TIMVX_INSTALL_DIR}")
|
||||
set(BUILD_TIMVX OFF)
|
||||
|
||||
set(TIMVX_INC_DIR "${TIMVX_INSTALL_DIR}/include" CACHE INTERNAL "TIM-VX include directory")
|
||||
find_library(TIMVX_LIB "tim-vx" PATHS "${TIMVX_INSTALL_DIR}/lib")
|
||||
if(TIMVX_LIB)
|
||||
set(TIMVX_FOUND ON)
|
||||
else()
|
||||
set(TIMVX_FOUND OFF)
|
||||
endif()
|
||||
|
||||
# Verify if requested VIVANTE SDK libraries are all found
|
||||
find_vivante_sdk_libs(missing ${VIVANTE_SDK_DIR})
|
||||
if(missing)
|
||||
message(STATUS "TIM-VX: Failed to find ${missing} in ${VIVANTE_SDK_DIR}/lib. Turning off TIMVX_VIV_FOUND")
|
||||
set(TIMVX_VIV_FOUND OFF)
|
||||
else()
|
||||
message(STATUS "TIM-VX: dependent VIVANTE SDK libraries are found at ${VIVANTE_SDK_DIR}/lib.")
|
||||
set(TIMVX_VIV_FOUND ON)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "TIM-VX: Build from source")
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/libtim-vx/tim-vx.cmake")
|
||||
endif()
|
||||
|
||||
if(TIMVX_FOUND AND TIMVX_VIV_FOUND)
|
||||
set(HAVE_TIMVX 1)
|
||||
|
||||
message(STATUS "TIM-VX: Found TIM-VX includes: ${TIMVX_INC_DIR}")
|
||||
message(STATUS "TIM-VX: Found TIM-VX library: ${TIMVX_LIB}")
|
||||
set(TIMVX_LIBRARY ${TIMVX_LIB})
|
||||
set(TIMVX_INCLUDE_DIR ${TIMVX_INC_DIR})
|
||||
|
||||
message(STATUS "TIM-VX: Found VIVANTE SDK libraries: ${VIVANTE_SDK_DIR}/lib")
|
||||
link_directories(${VIVANTE_SDK_DIR}/lib)
|
||||
endif()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
TIMVX_INC_DIR
|
||||
TIMVX_LIB
|
||||
)
|
|
@ -0,0 +1,78 @@
|
|||
# COPYRIGHT
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# License); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Copyright (c) 2020, OPEN AI LAB
|
||||
# Author: qtang@openailab.com or https://github.com/BUG1989
|
||||
#
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Path for Tengine binaries
|
||||
# ----------------------------------------------------------------------------
|
||||
set(OPENCV_LIBTENGINE_ROOT_DIR "" CACHE PATH "Path to TENGINE binaries installation")
|
||||
|
||||
IF(OPENCV_LIBTENGINE_ROOT_DIR AND NOT BUILD_TENGINE)
|
||||
|
||||
MESSAGE(STATUS "TENGINE:-- Use binaries at ${OPENCV_LIBTENGINE_ROOT_DIR}")
|
||||
|
||||
SET(Tengine_FOUND ON)
|
||||
set(BUILD_TENGINE OFF)
|
||||
|
||||
SET(Tengine_INCLUDE_DIR "${OPENCV_LIBTENGINE_ROOT_DIR}/include" CACHE PATH "TENGINE include dir")
|
||||
SET(Tengine_LIB "${OPENCV_LIBTENGINE_ROOT_DIR}/lib/libtengine.a" CACHE PATH "TENGINE library dir")
|
||||
|
||||
ELSE()
|
||||
IF(ANDROID)
|
||||
IF(OPENCV_TENGINE_FORCE_ANDROID)
|
||||
# nothing, use Android
|
||||
ELSEIF(OPENCV_TENGINE_SKIP_ANDROID)
|
||||
set(Tengine_FOUND OFF)
|
||||
set(HAVE_TENGINE FALSE)
|
||||
return()
|
||||
ELSEIF(NOT DEFINED ANDROID_NDK_REVISION)
|
||||
MESSAGE(STATUS "Android NDK version Tengine not support: ANDROID_NDK_REVISION is not defined")
|
||||
set(Tengine_FOUND OFF)
|
||||
set(HAVE_TENGINE FALSE)
|
||||
return()
|
||||
ELSEIF(ANDROID_NDK_REVISION VERSION_LESS 14)
|
||||
MESSAGE(STATUS "Android NDK version Tengine not support: ANDROID_NDK_REVISION=${ANDROID_NDK_REVISION}")
|
||||
set(Tengine_FOUND OFF)
|
||||
set(HAVE_TENGINE FALSE)
|
||||
return()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "TENGINE:-- Build Tengine from source code. ")
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/libtengine/tengine.cmake")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT Tengine_LIB)
|
||||
SET(Tengine_FOUND OFF)
|
||||
MESSAGE(STATUS "#### Could not find Tengine lib. Turning Tengine_FOUND off")
|
||||
ENDIF()
|
||||
|
||||
IF (Tengine_FOUND)
|
||||
MESSAGE(STATUS "Found Tengine include: ${Tengine_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "Found Tengine libraries: ${Tengine_LIB}")
|
||||
set(HAVE_TENGINE 1)
|
||||
set(TENGINE_LIBRARIES ${Tengine_LIB})
|
||||
set(TENGINE_INCLUDE_DIRS ${Tengine_INCLUDE_DIR})
|
||||
ENDIF (Tengine_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
Tengine_INCLUDE_DIR
|
||||
Tengine_LIB
|
||||
)
|
|
@ -1,21 +1,21 @@
|
|||
# Main variables:
|
||||
# HAVE_VA for conditional compilation OpenCV with/without libva
|
||||
# Output:
|
||||
# HAVE_VA - libva is available
|
||||
# HAVE_VA_INTEL - OpenCL/libva Intel interoperability extension is available
|
||||
|
||||
if(UNIX AND NOT ANDROID)
|
||||
find_path(
|
||||
find_path(
|
||||
VA_INCLUDE_DIR
|
||||
NAMES va/va.h
|
||||
PATHS "/usr/include"
|
||||
PATHS ${VA_ROOT_DIR}
|
||||
PATH_SUFFIXES include
|
||||
DOC "Path to libva headers")
|
||||
endif()
|
||||
DOC "Path to libva headers"
|
||||
)
|
||||
|
||||
if(VA_INCLUDE_DIR)
|
||||
set(HAVE_VA TRUE)
|
||||
if(NOT DEFINED VA_LIBRARIES)
|
||||
if(NOT DEFINED VA_LIBRARIES AND NOT OPENCV_LIBVA_LINK)
|
||||
set(VA_LIBRARIES "va" "va-drm")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_VA FALSE)
|
||||
message(WARNING "libva installation is not found.")
|
||||
message(STATUS "libva: missing va.h header (VA_INCLUDE_DIR)")
|
||||
endif()
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
# Main variables:
|
||||
# VA_INTEL_IOCL_INCLUDE_DIR to use VA_INTEL
|
||||
# HAVE_VA_INTEL for conditional compilation OpenCV with/without VA_INTEL
|
||||
|
||||
# VA_INTEL_IOCL_ROOT - root of Intel OCL installation
|
||||
|
||||
if(UNIX AND NOT ANDROID)
|
||||
if($ENV{VA_INTEL_IOCL_ROOT})
|
||||
set(VA_INTEL_IOCL_ROOT $ENV{VA_INTEL_IOCL_ROOT})
|
||||
else()
|
||||
set(VA_INTEL_IOCL_ROOT "/opt/intel/opencl")
|
||||
endif()
|
||||
|
||||
find_path(
|
||||
VA_INTEL_IOCL_INCLUDE_DIR
|
||||
NAMES CL/va_ext.h
|
||||
PATHS ${VA_INTEL_IOCL_ROOT}
|
||||
PATH_SUFFIXES include
|
||||
DOC "Path to Intel OpenCL headers")
|
||||
endif()
|
||||
|
||||
if(VA_INTEL_IOCL_INCLUDE_DIR)
|
||||
set(HAVE_VA_INTEL TRUE)
|
||||
if(NOT DEFINED VA_INTEL_LIBRARIES)
|
||||
set(VA_INTEL_LIBRARIES "va" "va-drm")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_VA_INTEL FALSE)
|
||||
message(WARNING "Intel OpenCL installation is not found.")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(FORCE VA_INTEL_IOCL_INCLUDE_DIR)
|
|
@ -2,6 +2,8 @@ if (NOT GENERATE_ABI_DESCRIPTOR)
|
|||
return()
|
||||
endif()
|
||||
|
||||
set(OPENCV_ABI_SKIP_MODULES_LIST "" CACHE STRING "List of modules to exclude from ABI checker")
|
||||
|
||||
set(filename "opencv_abi.xml")
|
||||
set(path1 "${CMAKE_BINARY_DIR}/${filename}")
|
||||
|
||||
|
@ -26,6 +28,7 @@ foreach(mod ${OPENCV_MODULES_BUILD})
|
|||
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
|
||||
if(NOT OPENCV_MODULE_opencv_${mod}_CLASS STREQUAL "PUBLIC"
|
||||
OR NOT "${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}" # opencv_contrib
|
||||
OR ";${mod};" MATCHES ";${OPENCV_ABI_SKIP_MODULES_LIST};"
|
||||
)
|
||||
# headers
|
||||
foreach(h ${OPENCV_MODULE_opencv_${mod}_HEADERS})
|
||||
|
|
|
@ -30,6 +30,11 @@ if(BUILD_FAT_JAVA_LIB AND HAVE_opencv_java)
|
|||
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_java)
|
||||
endif()
|
||||
|
||||
if(BUILD_OBJC AND HAVE_opencv_objc)
|
||||
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_objc)
|
||||
endif()
|
||||
|
||||
|
||||
# -------------------------------------------------------------------------------------------
|
||||
# Part 1/3: ${BIN_DIR}/OpenCVConfig.cmake -> For use *without* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -2,7 +2,11 @@ set(OPENCV_APPLE_BUNDLE_NAME "OpenCV")
|
|||
set(OPENCV_APPLE_BUNDLE_ID "org.opencv")
|
||||
|
||||
if(IOS)
|
||||
if (APPLE_FRAMEWORK AND BUILD_SHARED_LIBS)
|
||||
if(MAC_CATALYST)
|
||||
# Copy the iOS plist over to the OSX directory if building iOS library for Catalyst
|
||||
configure_file("${OpenCV_SOURCE_DIR}/platforms/ios/Info.plist.in"
|
||||
"${CMAKE_BINARY_DIR}/osx/Info.plist")
|
||||
elseif(APPLE_FRAMEWORK AND DYNAMIC_PLIST)
|
||||
configure_file("${OpenCV_SOURCE_DIR}/platforms/ios/Info.Dynamic.plist.in"
|
||||
"${CMAKE_BINARY_DIR}/ios/Info.plist")
|
||||
else()
|
||||
|
|
|
@ -6,4 +6,3 @@ set(MIN_VER_CUDNN 7.5)
|
|||
set(MIN_VER_PYTHON2 2.7)
|
||||
set(MIN_VER_PYTHON3 3.2)
|
||||
set(MIN_VER_ZLIB 1.2.3)
|
||||
set(MIN_VER_GTK 2.18.0)
|
||||
|
|
|
@ -98,15 +98,6 @@ macro(ocv_add_dependencies full_modname)
|
|||
endforeach()
|
||||
unset(__depsvar)
|
||||
|
||||
# hack for python
|
||||
set(__python_idx)
|
||||
list(FIND OPENCV_MODULE_${full_modname}_WRAPPERS "python" __python_idx)
|
||||
if (NOT __python_idx EQUAL -1)
|
||||
list(REMOVE_ITEM OPENCV_MODULE_${full_modname}_WRAPPERS "python")
|
||||
list(APPEND OPENCV_MODULE_${full_modname}_WRAPPERS "python_bindings_generator" "python2" "python3")
|
||||
endif()
|
||||
unset(__python_idx)
|
||||
|
||||
ocv_list_unique(OPENCV_MODULE_${full_modname}_REQ_DEPS)
|
||||
ocv_list_unique(OPENCV_MODULE_${full_modname}_OPT_DEPS)
|
||||
ocv_list_unique(OPENCV_MODULE_${full_modname}_PRIVATE_REQ_DEPS)
|
||||
|
@ -210,11 +201,6 @@ macro(ocv_add_module _name)
|
|||
set(OPENCV_MODULES_DISABLED_USER ${OPENCV_MODULES_DISABLED_USER} "${the_module}" CACHE INTERNAL "List of OpenCV modules explicitly disabled by user")
|
||||
endif()
|
||||
|
||||
# add reverse wrapper dependencies
|
||||
foreach (wrapper ${OPENCV_MODULE_${the_module}_WRAPPERS})
|
||||
ocv_add_dependencies(opencv_${wrapper} OPTIONAL ${the_module})
|
||||
endforeach()
|
||||
|
||||
# stop processing of current file
|
||||
ocv_cmake_hook(POST_ADD_MODULE)
|
||||
ocv_cmake_hook(POST_ADD_MODULE_${the_module})
|
||||
|
@ -268,7 +254,7 @@ function(_glob_locations out_paths out_names)
|
|||
list(LENGTH paths before)
|
||||
get_filename_component(path "${path}" ABSOLUTE)
|
||||
# Either module itself
|
||||
if(NOT path STREQUAL CMAKE_CURRENT_SOURCE_DIR AND EXISTS "${path}/CMakeLists.txt")
|
||||
if(NOT path STREQUAL "${OpenCV_SOURCE_DIR}/modules" AND EXISTS "${path}/CMakeLists.txt")
|
||||
get_filename_component(name "${path}" NAME)
|
||||
list(APPEND paths "${path}")
|
||||
list(APPEND names "${name}")
|
||||
|
@ -310,7 +296,7 @@ macro(_add_modules_1 paths names)
|
|||
list(GET ${names} ${i} __name)
|
||||
#message(STATUS "First pass: ${__name} => ${__path}")
|
||||
include("${__path}/cmake/init.cmake" OPTIONAL)
|
||||
add_subdirectory("${__path}" "${CMAKE_CURRENT_BINARY_DIR}/.firstpass/${__name}")
|
||||
add_subdirectory("${__path}" "${OpenCV_BINARY_DIR}/modules/.firstpass/${__name}")
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
|
@ -330,7 +316,7 @@ macro(_add_modules_2)
|
|||
endif()
|
||||
string(REGEX REPLACE "^opencv_" "" name "${m}")
|
||||
#message(STATUS "Second pass: ${name} => ${OPENCV_MODULE_${m}_LOCATION}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${name}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${OpenCV_BINARY_DIR}/modules/${name}")
|
||||
endif()
|
||||
ocv_cmake_hook(POST_MODULES_CREATE_${the_module})
|
||||
endforeach()
|
||||
|
@ -383,7 +369,6 @@ macro(ocv_glob_modules main_root)
|
|||
__ocv_resolve_dependencies()
|
||||
|
||||
# create modules
|
||||
set(OPENCV_INITIAL_PASS OFF PARENT_SCOPE)
|
||||
set(OPENCV_INITIAL_PASS OFF)
|
||||
ocv_cmake_hook(PRE_MODULES_CREATE)
|
||||
_add_modules_2(${OPENCV_MODULES_BUILD})
|
||||
|
@ -391,6 +376,37 @@ macro(ocv_glob_modules main_root)
|
|||
endmacro()
|
||||
|
||||
|
||||
# called by root CMakeLists.txt
|
||||
macro(ocv_register_modules)
|
||||
if(NOT OPENCV_MODULES_PATH)
|
||||
set(OPENCV_MODULES_PATH "${OpenCV_SOURCE_DIR}/modules")
|
||||
endif()
|
||||
|
||||
ocv_glob_modules(${OPENCV_MODULES_PATH} ${OPENCV_EXTRA_MODULES_PATH})
|
||||
|
||||
# build lists of modules to be documented
|
||||
set(OPENCV_MODULES_MAIN "")
|
||||
set(OPENCV_MODULES_EXTRA "")
|
||||
|
||||
foreach(mod ${OPENCV_MODULES_BUILD} ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
|
||||
string(REGEX REPLACE "^opencv_" "" mod "${mod}")
|
||||
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
|
||||
list(APPEND OPENCV_MODULES_MAIN ${mod})
|
||||
else()
|
||||
list(APPEND OPENCV_MODULES_EXTRA ${mod})
|
||||
endif()
|
||||
endforeach()
|
||||
ocv_list_sort(OPENCV_MODULES_MAIN)
|
||||
ocv_list_sort(OPENCV_MODULES_EXTRA)
|
||||
set(FIXED_ORDER_MODULES core imgproc imgcodecs videoio highgui video calib3d features2d objdetect dnn ml flann photo stitching)
|
||||
list(REMOVE_ITEM OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES})
|
||||
set(OPENCV_MODULES_MAIN ${FIXED_ORDER_MODULES} ${OPENCV_MODULES_MAIN})
|
||||
|
||||
set(OPENCV_MODULES_MAIN ${OPENCV_MODULES_MAIN} CACHE INTERNAL "List of main modules" FORCE)
|
||||
set(OPENCV_MODULES_EXTRA ${OPENCV_MODULES_EXTRA} CACHE INTERNAL "List of extra modules" FORCE)
|
||||
endmacro()
|
||||
|
||||
|
||||
# disables OpenCV module with missing dependencies
|
||||
function(__ocv_module_turn_off the_module)
|
||||
list(REMOVE_ITEM OPENCV_MODULES_DISABLED_AUTO "${the_module}")
|
||||
|
@ -501,6 +517,21 @@ function(__ocv_resolve_dependencies)
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
# add reverse wrapper dependencies (BINDINDS)
|
||||
foreach(the_module ${OPENCV_MODULES_BUILD})
|
||||
foreach (wrapper ${OPENCV_MODULE_${the_module}_WRAPPERS})
|
||||
if(wrapper STREQUAL "python") # hack for python (BINDINDS)
|
||||
ocv_add_dependencies(opencv_python2 OPTIONAL ${the_module})
|
||||
ocv_add_dependencies(opencv_python3 OPTIONAL ${the_module})
|
||||
else()
|
||||
ocv_add_dependencies(opencv_${wrapper} OPTIONAL ${the_module})
|
||||
endif()
|
||||
if(DEFINED OPENCV_MODULE_opencv_${wrapper}_bindings_generator_CLASS)
|
||||
ocv_add_dependencies(opencv_${wrapper}_bindings_generator OPTIONAL ${the_module})
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
# disable MODULES with unresolved dependencies
|
||||
set(has_changes ON)
|
||||
while(has_changes)
|
||||
|
@ -788,6 +819,7 @@ macro(ocv_glob_module_sources)
|
|||
if (APPLE)
|
||||
file(GLOB_RECURSE lib_srcs_apple
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/*.mm"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/src/*.swift"
|
||||
)
|
||||
list(APPEND lib_srcs ${lib_srcs_apple})
|
||||
endif()
|
||||
|
@ -875,9 +907,14 @@ macro(ocv_create_module)
|
|||
endmacro()
|
||||
|
||||
macro(_ocv_create_module)
|
||||
add_definitions(-D__OPENCV_BUILD=1)
|
||||
|
||||
ocv_compiler_optimization_process_sources(OPENCV_MODULE_${the_module}_SOURCES OPENCV_MODULE_${the_module}_DEPS_EXT ${the_module})
|
||||
set(OPENCV_MODULE_${the_module}_HEADERS ${OPENCV_MODULE_${the_module}_HEADERS} CACHE INTERNAL "List of header files for ${the_module}")
|
||||
set(__module_headers ${OPENCV_MODULE_${the_module}_HEADERS})
|
||||
if(__module_headers)
|
||||
list(SORT __module_headers) # fix headers order, useful for bindings
|
||||
endif()
|
||||
set(OPENCV_MODULE_${the_module}_HEADERS ${__module_headers} CACHE INTERNAL "List of header files for ${the_module}")
|
||||
set(OPENCV_MODULE_${the_module}_SOURCES ${OPENCV_MODULE_${the_module}_SOURCES} CACHE INTERNAL "List of source files for ${the_module}")
|
||||
|
||||
# The condition we ought to be testing here is whether ocv_add_precompiled_headers will
|
||||
|
@ -1087,6 +1124,17 @@ macro(ocv_check_dependencies)
|
|||
endforeach()
|
||||
endmacro()
|
||||
|
||||
################################################################################
|
||||
# OpenCV tests
|
||||
################################################################################
|
||||
|
||||
if(DEFINED OPENCV_BUILD_TEST_MODULES_LIST)
|
||||
string(REPLACE "," ";" OPENCV_BUILD_TEST_MODULES_LIST "${OPENCV_BUILD_TEST_MODULES_LIST}") # support comma-separated list (,) too
|
||||
endif()
|
||||
if(DEFINED OPENCV_BUILD_PERF_TEST_MODULES_LIST)
|
||||
string(REPLACE "," ";" OPENCV_BUILD_PERF_TEST_MODULES_LIST "${OPENCV_BUILD_PERF_TEST_MODULES_LIST}") # support comma-separated list (,) too
|
||||
endif()
|
||||
|
||||
# auxiliary macro to parse arguments of ocv_add_accuracy_tests and ocv_add_perf_tests commands
|
||||
macro(__ocv_parse_test_sources tests_type)
|
||||
set(OPENCV_${tests_type}_${the_module}_SOURCES "")
|
||||
|
@ -1115,6 +1163,8 @@ macro(__ocv_parse_test_sources tests_type)
|
|||
unset(__currentvar)
|
||||
endmacro()
|
||||
|
||||
ocv_check_environment_variables(OPENCV_TEST_EXTRA_CXX_FLAGS_Release)
|
||||
|
||||
# this is a command for adding OpenCV performance tests to the module
|
||||
# ocv_add_perf_tests(<extra_dependencies>)
|
||||
function(ocv_add_perf_tests)
|
||||
|
@ -1125,7 +1175,12 @@ function(ocv_add_perf_tests)
|
|||
endif()
|
||||
|
||||
set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf")
|
||||
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}")
|
||||
if(BUILD_PERF_TESTS AND EXISTS "${perf_path}"
|
||||
AND (NOT DEFINED OPENCV_BUILD_PERF_TEST_MODULES_LIST
|
||||
OR OPENCV_BUILD_PERF_TEST_MODULES_LIST STREQUAL "all"
|
||||
OR ";${OPENCV_BUILD_PERF_TEST_MODULES_LIST};" MATCHES ";${name};"
|
||||
)
|
||||
)
|
||||
__ocv_parse_test_sources(PERF ${ARGN})
|
||||
|
||||
# opencv_imgcodecs is required for imread/imwrite
|
||||
|
@ -1159,6 +1214,9 @@ function(ocv_add_perf_tests)
|
|||
if(TARGET opencv_videoio_plugins)
|
||||
add_dependencies(${the_target} opencv_videoio_plugins)
|
||||
endif()
|
||||
if(TARGET opencv_highgui_plugins)
|
||||
add_dependencies(${the_target} opencv_highgui_plugins)
|
||||
endif()
|
||||
|
||||
if(HAVE_HPX)
|
||||
message("Linking HPX to Perf test of module ${name}")
|
||||
|
@ -1210,7 +1268,12 @@ function(ocv_add_accuracy_tests)
|
|||
ocv_debug_message("ocv_add_accuracy_tests(" ${ARGN} ")")
|
||||
|
||||
set(test_path "${CMAKE_CURRENT_LIST_DIR}/test")
|
||||
if(BUILD_TESTS AND EXISTS "${test_path}")
|
||||
if(BUILD_TESTS AND EXISTS "${test_path}"
|
||||
AND (NOT DEFINED OPENCV_BUILD_TEST_MODULES_LIST
|
||||
OR OPENCV_BUILD_TEST_MODULES_LIST STREQUAL "all"
|
||||
OR ";${OPENCV_BUILD_TEST_MODULES_LIST};" MATCHES ";${name};"
|
||||
)
|
||||
)
|
||||
__ocv_parse_test_sources(TEST ${ARGN})
|
||||
|
||||
# opencv_imgcodecs is required for imread/imwrite
|
||||
|
@ -1249,6 +1312,9 @@ function(ocv_add_accuracy_tests)
|
|||
if(TARGET opencv_videoio_plugins)
|
||||
add_dependencies(${the_target} opencv_videoio_plugins)
|
||||
endif()
|
||||
if(TARGET opencv_highgui_plugins)
|
||||
add_dependencies(${the_target} opencv_highgui_plugins)
|
||||
endif()
|
||||
|
||||
if(HAVE_HPX)
|
||||
message("Linking HPX to Perf test of module ${name}")
|
||||
|
@ -1279,6 +1345,10 @@ function(ocv_add_accuracy_tests)
|
|||
_ocv_add_precompiled_headers(${the_target})
|
||||
endif()
|
||||
|
||||
if(OPENCV_TEST_EXTRA_CXX_FLAGS_Release)
|
||||
target_compile_options(${the_target} PRIVATE "$<$<CONFIG:Release>:${OPENCV_TEST_EXTRA_CXX_FLAGS_Release}>")
|
||||
endif()
|
||||
|
||||
ocv_add_test_from_target("${the_target}" "Accuracy" "${the_target}")
|
||||
else(OCV_DEPENDENCIES_FOUND)
|
||||
# TODO: warn about unsatisfied dependencies
|
||||
|
@ -1335,9 +1405,12 @@ function(ocv_add_samples)
|
|||
if(TARGET opencv_videoio_plugins)
|
||||
add_dependencies(${the_target} opencv_videoio_plugins)
|
||||
endif()
|
||||
if(TARGET opencv_highgui_plugins)
|
||||
add_dependencies(${the_target} opencv_highgui_plugins)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION "samples/${module_id}" COMPONENT samples)
|
||||
if(INSTALL_BIN_EXAMPLES)
|
||||
install(TARGETS ${the_target} RUNTIME DESTINATION "${OPENCV_SAMPLES_BIN_INSTALL_PATH}/${module_id}" COMPONENT samples)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
|
|
@ -60,7 +60,7 @@ set(CPACK_RPM_COMPONENT_INSTALL TRUE)
|
|||
set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
|
||||
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
|
||||
set(CPACK_RPM_PACKAGE_URL "http://opencv.org")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "BSD")
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0")
|
||||
|
||||
#deb options
|
||||
set(CPACK_DEB_COMPONENT_INSTALL TRUE)
|
||||
|
@ -123,10 +123,9 @@ endif()
|
|||
set(STD_OPENCV_LIBS opencv-data)
|
||||
set(STD_OPENCV_DEV libopencv-dev)
|
||||
|
||||
foreach(module calib3d core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters
|
||||
cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping
|
||||
cudev features2d flann hal highgui imgcodecs imgproc ml objdetect ocl
|
||||
photo shape stitching superres ts video videoio videostab viz)
|
||||
foreach(module calib3d core dnn features2d flann gapi highgui
|
||||
imgcodecs imgproc ml objdetect
|
||||
photo stitching ts video videoio)
|
||||
if(HAVE_opencv_${module})
|
||||
list(APPEND STD_OPENCV_LIBS "libopencv-${module}4.0")
|
||||
list(APPEND STD_OPENCV_DEV "libopencv-${module}-dev")
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
# Standalone OpenCV plugins build scripts
|
||||
#
|
||||
# Useful OpenCV common build variables:
|
||||
# - CMAKE_BUILD_TYPE=Release/Debug
|
||||
# - BUILD_WITH_DEBUG_INFO=ON
|
||||
# - ENABLE_BUILD_HARDENING=ON
|
||||
#
|
||||
# Plugin configuration variables:
|
||||
# - OPENCV_PLUGIN_DEPS - set of extra dependencies (modules), used for include dirs, target_link_libraries
|
||||
# - OPENCV_PLUGIN_SUFFIX
|
||||
# - OPENCV_PLUGIN_NAME
|
||||
# - OPENCV_PLUGIN_OUTPUT_NAME_FULL (overrides both OPENCV_PLUGIN_NAME / OPENCV_PLUGIN_SUFFIX)
|
||||
#
|
||||
#=============================================
|
||||
|
||||
if(NOT OpenCV_SOURCE_DIR)
|
||||
message(FATAL_ERROR "OpenCV_SOURCE_DIR must be set to build the plugin!")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
message(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
||||
|
||||
set(BUILD_SHARED_LIBS ON CACHE BOOL "")
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
message(FATAL_ERROR "Static plugin build does not make sense")
|
||||
endif()
|
||||
|
||||
# re-use OpenCV build scripts
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVUtils.cmake")
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCXXCompiler.cmake")
|
||||
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVCompilerOptions.cmake")
|
||||
|
||||
function(ocv_create_plugin module default_name dependency_target dependency_target_desc)
|
||||
|
||||
set(OPENCV_PLUGIN_NAME ${default_name} CACHE STRING "")
|
||||
set(OPENCV_PLUGIN_DESTINATION "" CACHE PATH "")
|
||||
project(${OPENCV_PLUGIN_NAME} LANGUAGES CXX)
|
||||
|
||||
if(NOT TARGET ${dependency_target})
|
||||
message(FATAL_ERROR "${dependency_target_desc} was not found! (missing target ${dependency_target})")
|
||||
endif()
|
||||
|
||||
set(modules_ROOT "${OpenCV_SOURCE_DIR}/modules")
|
||||
set(module_ROOT "${modules_ROOT}/${module}")
|
||||
|
||||
foreach(src ${ARGN})
|
||||
list(APPEND sources "${module_ROOT}/${src}")
|
||||
endforeach()
|
||||
|
||||
add_library(${OPENCV_PLUGIN_NAME} MODULE
|
||||
"${sources}"
|
||||
${OPENCV_PLUGIN_EXTRA_SRC_FILES}
|
||||
)
|
||||
|
||||
if(OPENCV_PLUGIN_DEPS)
|
||||
foreach(d ${OPENCV_PLUGIN_DEPS})
|
||||
list(APPEND OPENCV_PLUGIN_EXTRA_INCLUDES "${modules_ROOT}/${d}/include")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
target_include_directories(${OPENCV_PLUGIN_NAME} PRIVATE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${module_ROOT}/src"
|
||||
"${module_ROOT}/include"
|
||||
${OPENCV_PLUGIN_EXTRA_INCLUDES}
|
||||
)
|
||||
target_compile_definitions(${OPENCV_PLUGIN_NAME} PRIVATE "BUILD_PLUGIN=1")
|
||||
|
||||
target_link_libraries(${OPENCV_PLUGIN_NAME} PRIVATE ${dependency_target})
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES
|
||||
CXX_STANDARD 11
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
)
|
||||
|
||||
if(DEFINED OPENCV_PLUGIN_MODULE_PREFIX)
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES PREFIX "${OPENCV_PLUGIN_MODULE_PREFIX}")
|
||||
endif()
|
||||
|
||||
if(WIN32 OR NOT APPLE)
|
||||
set(OPENCV_PLUGIN_NO_LINK FALSE CACHE BOOL "")
|
||||
else()
|
||||
set(OPENCV_PLUGIN_NO_LINK TRUE CACHE BOOL "")
|
||||
endif()
|
||||
|
||||
if(OPENCV_PLUGIN_NO_LINK)
|
||||
if(APPLE)
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
else()
|
||||
find_package(OpenCV REQUIRED ${module} ${OPENCV_PLUGIN_DEPS})
|
||||
target_link_libraries(${OPENCV_PLUGIN_NAME} PRIVATE ${OpenCV_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(NOT OpenCV_FOUND) # build against sources (Linux)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/opencv2/opencv_modules.hpp" "#pragma once")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
ocv_update(OPENCV_DEBUG_POSTFIX d)
|
||||
endif()
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}")
|
||||
|
||||
if(DEFINED OPENCV_PLUGIN_SUFFIX)
|
||||
# custom value
|
||||
else()
|
||||
if(WIN32)
|
||||
ocv_update(OPENCV_PLUGIN_VERSION "${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}")
|
||||
if(CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
|
||||
ocv_update(OPENCV_PLUGIN_ARCH "_64")
|
||||
else()
|
||||
ocv_update(OPENCV_PLUGIN_ARCH "")
|
||||
endif()
|
||||
else()
|
||||
# empty
|
||||
endif()
|
||||
ocv_update(OPENCV_PLUGIN_SUFFIX "${OPENCV_PLUGIN_VERSION}${OPENCV_PLUGIN_ARCH}")
|
||||
endif()
|
||||
|
||||
if(OPENCV_PLUGIN_DESTINATION)
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OPENCV_PLUGIN_DESTINATION}")
|
||||
message(STATUS "Output destination: ${OPENCV_PLUGIN_DESTINATION}")
|
||||
endif()
|
||||
|
||||
if(OPENCV_PLUGIN_OUTPUT_NAME_FULL)
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES OUTPUT_NAME "${OPENCV_PLUGIN_OUTPUT_NAME_FULL}")
|
||||
elseif(OPENCV_PLUGIN_OUTPUT_NAME)
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES OUTPUT_NAME "${OPENCV_PLUGIN_OUTPUT_NAME}${OPENCV_PLUGIN_SUFFIX}")
|
||||
else()
|
||||
set_target_properties(${OPENCV_PLUGIN_NAME} PROPERTIES OUTPUT_NAME "${OPENCV_PLUGIN_NAME}${OPENCV_PLUGIN_SUFFIX}")
|
||||
endif()
|
||||
|
||||
install(TARGETS ${OPENCV_PLUGIN_NAME} LIBRARY DESTINATION . COMPONENT plugins)
|
||||
|
||||
message(STATUS "Library name: ${OPENCV_PLUGIN_NAME}")
|
||||
|
||||
endfunction()
|
|
@ -122,7 +122,6 @@ function(ocv_pylint_finalize)
|
|||
|
||||
list(LENGTH PYLINT_TARGET_ID __total)
|
||||
set(PYLINT_TOTAL_TARGETS "${__total}" CACHE INTERNAL "")
|
||||
message(STATUS "Pylint: registered ${__total} targets. Build 'check_pylint' target to run checks (\"cmake --build . --target check_pylint\" or \"make check_pylint\")")
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/pylint.cmake.in" "${CMAKE_BINARY_DIR}/pylint.cmake" @ONLY)
|
||||
|
||||
add_custom_target(check_pylint
|
||||
|
|
|
@ -8,7 +8,20 @@ include(CMakeParseArguments)
|
|||
function(ocv_cmake_dump_vars)
|
||||
set(OPENCV_SUPPRESS_DEPRECATIONS 1) # suppress deprecation warnings from variable_watch() guards
|
||||
get_cmake_property(__variableNames VARIABLES)
|
||||
cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN})
|
||||
cmake_parse_arguments(DUMP "FORCE" "TOFILE" "" ${ARGN})
|
||||
|
||||
# avoid generation of excessive logs with "--trace" or "--trace-expand" parameters
|
||||
# Note: `-DCMAKE_TRACE_MODE=1` should be passed to CMake through command line. It is not a CMake buildin variable for now (2020-12)
|
||||
# Use `cmake . -UCMAKE_TRACE_MODE` to remove this variable from cache
|
||||
if(CMAKE_TRACE_MODE AND NOT DUMP_FORCE)
|
||||
if(DUMP_TOFILE)
|
||||
file(WRITE ${CMAKE_BINARY_DIR}/${DUMP_TOFILE} "Skipped due to enabled CMAKE_TRACE_MODE")
|
||||
else()
|
||||
message(AUTHOR_WARNING "ocv_cmake_dump_vars() is skipped due to enabled CMAKE_TRACE_MODE")
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(regex "${DUMP_UNPARSED_ARGUMENTS}")
|
||||
string(TOLOWER "${regex}" regex_lower)
|
||||
set(__VARS "")
|
||||
|
@ -400,10 +413,28 @@ macro(ocv_clear_vars)
|
|||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
# Clears passed variables with INTERNAL type from CMake cache
|
||||
macro(ocv_clear_internal_cache_vars)
|
||||
foreach(_var ${ARGN})
|
||||
get_property(_propertySet CACHE ${_var} PROPERTY TYPE SET)
|
||||
if(_propertySet)
|
||||
get_property(_type CACHE ${_var} PROPERTY TYPE)
|
||||
if(_type STREQUAL "INTERNAL")
|
||||
message("Cleaning INTERNAL cached variable: ${_var}")
|
||||
unset(${_var} CACHE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_propertySet)
|
||||
unset(_type)
|
||||
endmacro()
|
||||
|
||||
|
||||
set(OCV_COMPILER_FAIL_REGEX
|
||||
"argument '.*' is not valid" # GCC 9+
|
||||
"command line option .* is valid for .* but not for C\\+\\+" # GNU
|
||||
"command line option .* is valid for .* but not for C" # GNU
|
||||
"argument .* is not valid" # GCC 9+ (including support of unicode quotes)
|
||||
"command[- ]line option .* is valid for .* but not for C\\+\\+" # GNU
|
||||
"command[- ]line option .* is valid for .* but not for C" # GNU
|
||||
"unrecognized .*option" # GNU
|
||||
"unknown .*option" # Clang
|
||||
"ignoring unknown option" # MSVC
|
||||
|
@ -533,16 +564,22 @@ macro(ocv_check_flag_support lang flag varname base_options)
|
|||
elseif("_${lang}_" MATCHES "_C_")
|
||||
set(_lang C)
|
||||
elseif("_${lang}_" MATCHES "_OBJCXX_")
|
||||
set(_lang OBJCXX)
|
||||
if(DEFINED CMAKE_OBJCXX_COMPILER) # CMake 3.16+ and enable_language(OBJCXX) call are required
|
||||
set(_lang OBJCXX)
|
||||
else()
|
||||
set(_lang CXX)
|
||||
endif()
|
||||
else()
|
||||
set(_lang ${lang})
|
||||
endif()
|
||||
|
||||
string(TOUPPER "${flag}" ${varname})
|
||||
string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}")
|
||||
string(REGEX REPLACE " -|-|=| |\\." "_" ${varname} "${${varname}}")
|
||||
string(REGEX REPLACE " -|-|=| |\\.|," "_" ${varname} "${${varname}}")
|
||||
|
||||
ocv_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN})
|
||||
if(DEFINED CMAKE_${_lang}_COMPILER)
|
||||
ocv_check_compiler_flag("${_lang}" "${base_options} ${flag}" ${${varname}} ${ARGN})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(ocv_check_runtime_flag flag result)
|
||||
|
@ -829,7 +866,9 @@ macro(ocv_check_modules define)
|
|||
foreach(flag ${${define}_LDFLAGS})
|
||||
if(flag MATCHES "^-L(.*)")
|
||||
list(APPEND _libs_paths ${CMAKE_MATCH_1})
|
||||
elseif(IS_ABSOLUTE "${flag}")
|
||||
elseif(IS_ABSOLUTE "${flag}"
|
||||
OR flag STREQUAL "-lstdc++"
|
||||
)
|
||||
list(APPEND _libs "${flag}")
|
||||
elseif(flag MATCHES "^-l(.*)")
|
||||
set(_lib "${CMAKE_MATCH_1}")
|
||||
|
@ -1442,8 +1481,8 @@ function(ocv_target_link_libraries target)
|
|||
if(NOT LINK_PENDING STREQUAL "")
|
||||
__ocv_push_target_link_libraries(${LINK_MODE} ${LINK_PENDING})
|
||||
set(LINK_PENDING "")
|
||||
set(LINK_MODE "${dep}")
|
||||
endif()
|
||||
set(LINK_MODE "${dep}")
|
||||
else()
|
||||
if(BUILD_opencv_world)
|
||||
if(OPENCV_MODULE_${dep}_IS_PART_OF_WORLD)
|
||||
|
@ -1512,10 +1551,16 @@ function(ocv_add_library target)
|
|||
|
||||
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG 1)
|
||||
|
||||
if(IOS AND NOT MAC_CATALYST)
|
||||
set(OPENCV_APPLE_INFO_PLIST "${CMAKE_BINARY_DIR}/ios/Info.plist")
|
||||
else()
|
||||
set(OPENCV_APPLE_INFO_PLIST "${CMAKE_BINARY_DIR}/osx/Info.plist")
|
||||
endif()
|
||||
|
||||
set_target_properties(${target} PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
MACOSX_FRAMEWORK_IDENTIFIER org.opencv
|
||||
MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_BINARY_DIR}/ios/Info.plist
|
||||
MACOSX_FRAMEWORK_INFO_PLIST ${OPENCV_APPLE_INFO_PLIST}
|
||||
# "current version" in semantic format in Mach-O binary file
|
||||
VERSION ${OPENCV_LIBVERSION}
|
||||
# "compatibility version" in semantic format in Mach-O binary file
|
||||
|
@ -1534,6 +1579,60 @@ function(ocv_add_library target)
|
|||
endfunction()
|
||||
|
||||
|
||||
function(ocv_add_external_target name inc link def)
|
||||
if(BUILD_SHARED_LIBS AND link)
|
||||
set(imp IMPORTED)
|
||||
endif()
|
||||
add_library(ocv.3rdparty.${name} INTERFACE ${imp})
|
||||
if(def)
|
||||
if(NOT (CMAKE_VERSION VERSION_LESS "3.11.0")) # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1264 : eliminates "Cannot specify compile definitions for imported target" error message
|
||||
target_compile_definitions(ocv.3rdparty.${name} INTERFACE "${def}")
|
||||
else()
|
||||
set_target_properties(ocv.3rdparty.${name} PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${def}")
|
||||
endif()
|
||||
endif()
|
||||
if(inc)
|
||||
if(NOT (CMAKE_VERSION VERSION_LESS "3.11.0")) # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1264 : eliminates "Cannot specify compile definitions for imported target" error message
|
||||
target_include_directories(ocv.3rdparty.${name} SYSTEM INTERFACE "$<BUILD_INTERFACE:${inc}>")
|
||||
else()
|
||||
set_target_properties(ocv.3rdparty.${name} PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${inc}>"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${inc}>"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(link)
|
||||
# When cmake version is greater than or equal to 3.11, INTERFACE_LINK_LIBRARIES no longer applies to interface library
|
||||
# See https://github.com/opencv/opencv/pull/18658
|
||||
if(CMAKE_VERSION VERSION_LESS 3.11)
|
||||
set_target_properties(ocv.3rdparty.${name} PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES "${link}")
|
||||
else()
|
||||
target_link_libraries(ocv.3rdparty.${name} INTERFACE ${link})
|
||||
endif()
|
||||
endif()
|
||||
# to install used target only upgrade CMake
|
||||
if(NOT BUILD_SHARED_LIBS
|
||||
AND CMAKE_VERSION VERSION_LESS "3.13.0" # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/2152
|
||||
)
|
||||
install(TARGETS ocv.3rdparty.${name} EXPORT OpenCVModules)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Returns the first non-interface target
|
||||
function(ocv_get_imported_target imported interface)
|
||||
set(__result "${interface}")
|
||||
get_target_property(__type "${__result}" TYPE)
|
||||
if(__type STREQUAL "INTERFACE_LIBRARY")
|
||||
get_target_property(__libs "${__result}" INTERFACE_LINK_LIBRARIES)
|
||||
list(GET __libs 0 __interface)
|
||||
ocv_get_imported_target(__result "${__interface}")
|
||||
endif()
|
||||
set(${imported} "${__result}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
macro(ocv_get_libname var_name)
|
||||
get_filename_component(__libname "${ARGN}" NAME)
|
||||
# libopencv_core.so.3.3 -> opencv_core
|
||||
|
@ -1881,3 +1980,15 @@ function(ocv_update_file filepath content)
|
|||
file(WRITE "${filepath}" "${content}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS AND (CMAKE_VERSION VERSION_LESS "3.14.0"))
|
||||
ocv_update(OPENCV_3RDPARTY_EXCLUDE_FROM_ALL "") # avoid CMake warnings: https://gitlab.kitware.com/cmake/cmake/-/issues/18938
|
||||
else()
|
||||
ocv_update(OPENCV_3RDPARTY_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# Include configuration override settings
|
||||
#
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/vars/EnableModeVars.cmake")
|
||||
|
|
|
@ -10,8 +10,10 @@ set(OPENCV_VERSION_PLAIN "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPEN
|
|||
|
||||
set(OPENCV_VERSION "${OPENCV_VERSION_PLAIN}${OPENCV_VERSION_STATUS}")
|
||||
|
||||
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
|
||||
set(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
||||
string(REGEX MATCH "[0-9][0-9]$" OPENCV_VERSION_MINOR_2DIGITS "00${OPENCV_VERSION_MINOR}")
|
||||
string(REGEX MATCH "[0-9][0-9]$" OPENCV_VERSION_PATCH_2DIGITS "00${OPENCV_VERSION_PATCH}")
|
||||
ocv_update(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR_2DIGITS}")
|
||||
ocv_update(OPENCV_LIBVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
||||
|
||||
# create a dependency on the version file
|
||||
# we never use the output of the following command but cmake will rerun automatically if the version file changes
|
||||
|
|
|
@ -1,9 +1,27 @@
|
|||
# https://developer.android.com/studio/releases/gradle-plugin
|
||||
set(ANDROID_GRADLE_PLUGIN_VERSION "3.2.1" CACHE STRING "Android Gradle Plugin version (3.0+)")
|
||||
set(ANDROID_GRADLE_PLUGIN_VERSION "3.2.1" CACHE STRING "Android Gradle Plugin version")
|
||||
message(STATUS "Android Gradle Plugin version: ${ANDROID_GRADLE_PLUGIN_VERSION}")
|
||||
|
||||
set(KOTLIN_PLUGIN_VERSION "1.4.10" CACHE STRING "Kotlin Plugin version")
|
||||
message(STATUS "kotlin Plugin version: ${KOTLIN_GRADLE_PLUGIN_VERSION}")
|
||||
|
||||
if(BUILD_KOTLIN_EXTENSIONS)
|
||||
set(KOTLIN_PLUGIN_DECLARATION "apply plugin: 'kotlin-android'" CACHE STRING "Kotlin Plugin version")
|
||||
set(KOTLIN_STD_LIB "implementation 'org.jetbrains.kotlin:kotlin-stdlib:${KOTLIN_PLUGIN_VERSION}'" CACHE STRING "Kotlin Standard Library dependency")
|
||||
else()
|
||||
set(KOTLIN_PLUGIN_DECLARATION "" CACHE STRING "Kotlin Plugin version")
|
||||
set(KOTLIN_STD_LIB "" CACHE STRING "Kotlin Standard Library dependency")
|
||||
endif()
|
||||
|
||||
set(GRADLE_VERSION "5.6.4" CACHE STRING "Gradle version")
|
||||
message(STATUS "Gradle version: ${GRADLE_VERSION}")
|
||||
|
||||
set(ANDROID_COMPILE_SDK_VERSION "26" CACHE STRING "Android compileSdkVersion")
|
||||
set(ANDROID_MIN_SDK_VERSION "21" CACHE STRING "Android minSdkVersion")
|
||||
if(ANDROID_NATIVE_API_LEVEL GREATER 21)
|
||||
set(ANDROID_MIN_SDK_VERSION "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android minSdkVersion")
|
||||
else()
|
||||
set(ANDROID_MIN_SDK_VERSION "21" CACHE STRING "Android minSdkVersion")
|
||||
endif()
|
||||
set(ANDROID_TARGET_SDK_VERSION "26" CACHE STRING "Android minSdkVersion")
|
||||
|
||||
set(ANDROID_BUILD_BASE_DIR "${OpenCV_BINARY_DIR}/opencv_android" CACHE INTERNAL "")
|
||||
|
@ -38,9 +56,11 @@ set(ANDROID_ABI_FILTER "${ANDROID_INSTALL_ABI_FILTER}")
|
|||
configure_file("${OpenCV_SOURCE_DIR}/samples/android/build.gradle.in" "${ANDROID_TMP_INSTALL_BASE_DIR}/${ANDROID_INSTALL_SAMPLES_DIR}/build.gradle" @ONLY)
|
||||
install(FILES "${ANDROID_TMP_INSTALL_BASE_DIR}/${ANDROID_INSTALL_SAMPLES_DIR}/build.gradle" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}" COMPONENT samples)
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/platforms/android/gradle-wrapper/gradle/wrapper/gradle-wrapper.properties.in" "${ANDROID_BUILD_BASE_DIR}/gradle/wrapper/gradle-wrapper.properties" @ONLY)
|
||||
install(FILES "${ANDROID_BUILD_BASE_DIR}/gradle/wrapper/gradle-wrapper.properties" DESTINATION "${ANDROID_INSTALL_SAMPLES_DIR}/gradle/wrapper" COMPONENT samples)
|
||||
|
||||
set(GRADLE_WRAPPER_FILES
|
||||
"gradle/wrapper/gradle-wrapper.jar"
|
||||
"gradle/wrapper/gradle-wrapper.properties"
|
||||
"gradlew.bat"
|
||||
"gradlew"
|
||||
"gradle.properties"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#if defined _WIN32 && (defined(_M_ARM) || defined(_M_ARM64))
|
||||
# define _ARM64_DISTINCT_NEON_TYPES
|
||||
# include <Intrin.h>
|
||||
# include <arm_neon.h>
|
||||
# define CV_NEON 1
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#if defined(__riscv)
|
||||
# include <riscv_vector.h>
|
||||
# define CV_RVV 1
|
||||
#endif
|
||||
|
||||
#if defined CV_RVV
|
||||
int test()
|
||||
{
|
||||
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
vfloat32m1_t val = vle32_v_f32m1((const float*)(src), 4);
|
||||
return (int)vfmv_f_s_f32m1_f32(val);
|
||||
}
|
||||
#else
|
||||
#error "RISC-V vector extension(RVV) is not supported"
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%d\n", test());
|
||||
return 0;
|
||||
}
|
|
@ -16,6 +16,6 @@ int main()
|
|||
{
|
||||
__vector float vf;
|
||||
__vector signed int vi;
|
||||
__asm__ __volatile__ ("xvcvsxwsp %x0,%x1" : "=wf" (vf) : "wa" (vi));
|
||||
__asm__ __volatile__ ("xvcvsxwsp %x0,%x1" : "=wa" (vf) : "wa" (vi));
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#include <webnn/webnn_cpp.h>
|
||||
#include <webnn/webnn.h>
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/html5.h>
|
||||
#include <emscripten/html5_webnn.h>
|
||||
#else
|
||||
#include <webnn/webnn_proc.h>
|
||||
#include <webnn_native/WebnnNative.h>
|
||||
#endif
|
||||
|
||||
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
#ifdef __EMSCRIPTEN__
|
||||
ml::Context ml_context = ml::Context(emscripten_webnn_create_context());
|
||||
#else
|
||||
WebnnProcTable backendProcs = webnn_native::GetProcs();
|
||||
webnnProcSetProcs(&backendProcs);
|
||||
ml::Context ml_context = ml::Context(webnn_native::CreateContext());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
# Gitlab-style mirror
|
||||
# CMake scripts look for opencv/opencv_3rdparty,
|
||||
# OAID/Tengine, 01org/tbb(oneAPI/oneTBB), opencv/ade
|
||||
# from OPENCV_DOWNLOAD_MIRROR
|
||||
ocv_update(OPENCV_DOWNLOAD_MIRROR_URL "")
|
||||
|
||||
######
|
||||
# Download via commit id
|
||||
######
|
||||
# Tengine
|
||||
ocv_update(TENGINE_PKG_MD5_CUSTOM "")
|
||||
ocv_update(TENGINE_PKG_MD5_ORIGINAL 23f61ebb1dd419f1207d8876496289c5) # same as tengine_md5sum for TENGINE commit of e89cf8870de2ff0a80cfe626c0b52b2a16fb302e
|
||||
# NVIDIA_OPTICAL_FLOW
|
||||
ocv_update(NVIDIA_OPTICAL_FLOW_PKG_MD5_GITCODE "")
|
||||
ocv_update(NVIDIA_OPTICAL_FLOW_PKG_MD5_ORIGINAL a73cd48b18dcc0cc8933b30796074191)
|
||||
# TIM-VX
|
||||
ocv_update(TIM-VX_PKG_MD5_GITCODE "")
|
||||
ocv_update(TIM-VX_PKG_MD5_ORIGINAL 92619cc4498014ac7a09834d5e33ebd5)
|
||||
|
||||
######
|
||||
# Download from release page
|
||||
#####
|
||||
# TBB
|
||||
ocv_update(TBB_RELEASE_CUSTOM "")
|
||||
ocv_update(TBB_PKG_NAME_CUSTOM "")
|
||||
ocv_update(TBB_PKG_MD5_CUSTOM "")
|
||||
ocv_update(TBB_PKG_MD5_ORIGINAL 5af6f6c2a24c2043e62e47205e273b1f) # same as OPENCV_TBB_RELEASE_MD5 for TBB release of v2020.2
|
||||
# ADE
|
||||
ocv_update(ADE_RELEASE_CUSTOM "")
|
||||
ocv_update(ADE_PKG_NAME_CUSTOM "")
|
||||
ocv_update(ADE_PKG_MD5_CUSTOM "")
|
||||
ocv_update(ADE_PKG_MD5_ORIGINAL b624b995ec9c439cbc2e9e6ee940d3a2) # same as ade_md5 for ADE release of v0.1.1f
|
||||
|
||||
macro(ocv_download_url_custom_usercontent OWNER)
|
||||
string(REPLACE "/" ";" DL_URL_split ${DL_URL})
|
||||
list(GET DL_URL_split 5 __COMMIT_ID)
|
||||
list(GET DL_URL_split 6 __PKG_NAME)
|
||||
set(DL_URL "https://${OPENCV_DOWNLOAD_MIRROR_URL}/${OWNER}/opencv_3rdparty/-/raw/${__COMMIT_ID}/${__PKG_NAME}/")
|
||||
endmacro()
|
||||
macro(ocv_download_url_custom_archive_commit_id)
|
||||
if("m${${DL_ID}_PKG_MD5_CUSTOM}" STREQUAL "m")
|
||||
message(WARNING "ocv_download: specify ${DL_ID}_PKG_MD5_CUSTOM to download ${DL_ID} from custom source.")
|
||||
elseif(${DL_ID}_PKG_MD5_ORIGINAL STREQUAL "${DL_HASH}")
|
||||
string(REPLACE "/" ";" DL_URL_split ${DL_URL})
|
||||
list(GET DL_URL_split 3 __OWNER)
|
||||
list(GET DL_URL_split 4 __REPO_NAME)
|
||||
set(DL_URL "https://${OPENCV_DOWNLOAD_MIRROR_URL}/${__OWNER}/${__REPO_NAME}/-/archive/")
|
||||
set(DL_HASH "${${DL_ID}_PKG_MD5_CUSTOM}")
|
||||
else()
|
||||
message(WARNING "No information about mirrors for downloading ${DL_FILENAME} from URL='${DL_URL}' and MD5=${DL_HASH}.")
|
||||
endif()
|
||||
endmacro()
|
||||
macro(ocv_download_url_custom_archive_release)
|
||||
if("m${${DL_ID}_RELEASE_CUSTOM}" STREQUAL "m")
|
||||
message(WARNING "ocv_download: specify ${DL_ID}_RELEASE_CUSTOM to download ${DL_ID} from custom source.")
|
||||
return()
|
||||
endif()
|
||||
if("m${${DL_ID}_PKG_NAME_CUSTOM}" STREQUAL "m")
|
||||
message(WARNING "ocv_download: specify ${DL_ID}_PKG_NAME_CUSTOM to download ${DL_ID} from custom source.")
|
||||
return()
|
||||
endif()
|
||||
if("m${${DL_ID}_PKG_MD5_CUSTOM}" STREQUAL "m")
|
||||
message(WARNING "ocv_download: specify ${DL_ID}_PKG_MD5_CUSTOM to download ${DL_ID} from custom source.")
|
||||
return()
|
||||
endif()
|
||||
string(REPLACE "/" ";" DL_URL_split ${DL_URL})
|
||||
list(GET DL_URL_split 3 __OWNER)
|
||||
list(GET DL_URL_split 4 __REPO_NAME)
|
||||
set(DL_URL "https://${OPENCV_DOWNLOAD_MIRROR_URL}/${__OWNER}/${__REPO_NAME}/-/archive/${${DL_ID}_RELEASE_CUSTOM}/${__REPO_NAME}-")
|
||||
set(DL_HASH "${${DL_ID}_PKG_MD5_CUSTOM}")
|
||||
endmacro()
|
||||
|
||||
if("m${OPENCV_DOWNLOAD_MIRROR_URL}" STREQUAL "m")
|
||||
message(WARNING "ocv_download: specify OPENCV_DOWNLOAD_MIRROR_URL to use custom mirror.")
|
||||
else()
|
||||
if((DL_ID STREQUAL "FFMPEG") OR (DL_ID STREQUAL "IPPICV") OR (DL_ID STREQUAL "data") OR (DL_ID STREQUAL "xfeatures2d/boostdesc") OR (DL_ID STREQUAL "xfeatures2d/vgg"))
|
||||
ocv_download_url_custom_usercontent(opencv)
|
||||
elseif(DL_ID STREQUAL "wechat_qrcode")
|
||||
ocv_download_url_gitcode_usercontent(WeChatCV)
|
||||
elseif((DL_ID STREQUAL "TENGINE") OR (DL_ID STREQUAL "NVIDIA_OPTICAL_FLOW") OR (DL_ID STREQUAL "TIM-VX"))
|
||||
ocv_download_url_custom_archive_commit_id()
|
||||
elseif(DL_ID STREQUAL "TBB")
|
||||
ocv_download_url_custom_archive_release()
|
||||
set(OPENCV_TBB_SUBDIR "${TBB_PKG_NAME_CUSTOM}" PARENT_SCOPE)
|
||||
elseif(DL_ID STREQUAL "ADE")
|
||||
ocv_download_url_custom_archive_release()
|
||||
set(ade_subdir "${ADE_PKG_NAME_CUSTOM}" PARENT_SCOPE)
|
||||
else()
|
||||
message(STATUS "ocv_download: Unknown download ID ${DL_ID} for using mirror ${OPENCV_DOWNLOAD_MIRROR_URL}. Use original source instead.")
|
||||
endif()
|
||||
endif()
|
|
@ -0,0 +1,86 @@
|
|||
######
|
||||
# Download via commit id
|
||||
######
|
||||
# Tengine
|
||||
ocv_update(TENGINE_PKG_MD5_GITCODE 1b5908632b557275cd6e85b0c03f9690)
|
||||
ocv_update(TENGINE_PKG_MD5_ORIGINAL 23f61ebb1dd419f1207d8876496289c5) # same as tengine_md5sum for TENGINE commit of e89cf8870de2ff0a80cfe626c0b52b2a16fb302e
|
||||
# NVIDIA_OPTICAL_FLOW
|
||||
ocv_update(NVIDIA_OPTICAL_FLOW_PKG_MD5_GITCODE 8d5b7eeb24d6ca9c6bcfdff4196d5b47)
|
||||
ocv_update(NVIDIA_OPTICAL_FLOW_PKG_MD5_ORIGINAL a73cd48b18dcc0cc8933b30796074191)
|
||||
# TIM-VX
|
||||
ocv_update(TIM-VX_PKG_MD5_GITCODE 3f2a548b40b170668aaa60d4f60ba40b)
|
||||
ocv_update(TIM-VX_PKG_MD5_ORIGINAL 92619cc4498014ac7a09834d5e33ebd5)
|
||||
|
||||
######
|
||||
# Download from release page
|
||||
#####
|
||||
# TBB
|
||||
ocv_update(TBB_RELEASE_GITCODE "v2020.2")
|
||||
ocv_update(TBB_PKG_NAME_GITCODE "tbb-${TBB_RELEASE_GITCODE}")
|
||||
ocv_update(TBB_PKG_MD5_GITCODE 4eeafdf16a90cb66e39a31c8d6c6804e)
|
||||
ocv_update(TBB_PKG_MD5_ORIGINAL 5af6f6c2a24c2043e62e47205e273b1f) # same as OPENCV_TBB_RELEASE_MD5 for TBB release of v2020.2
|
||||
# ADE
|
||||
ocv_update(ADE_RELEASE_GITCODE "v0.1.1f")
|
||||
ocv_update(ADE_PKG_NAME_GITCODE "ade-${ADE_RELEASE_GITCODE}")
|
||||
ocv_update(ADE_PKG_MD5_GITCODE c12909e0ccfa93138c820ba91ff37b3c)
|
||||
ocv_update(ADE_PKG_MD5_ORIGINAL b624b995ec9c439cbc2e9e6ee940d3a2) # same as ade_md5 for ADE release of v0.1.1f
|
||||
|
||||
#
|
||||
# Replace download links for packages in opencv/opencv_3rdparty:
|
||||
# 1. Extract repo owner and repo name from DL_URL.
|
||||
# 2. Put repo owner and repo name into the placeholders of new DL_URL.
|
||||
#
|
||||
macro(ocv_download_url_gitcode_usercontent OWNER)
|
||||
string(REPLACE "/" ";" DL_URL_split ${DL_URL})
|
||||
list(GET DL_URL_split 5 __COMMIT_ID)
|
||||
list(GET DL_URL_split 6 __PKG_NAME)
|
||||
set(DL_URL "https://gitcode.net/${OWNER}/opencv_3rdparty/-/raw/${__COMMIT_ID}/")
|
||||
if(__PKG_NAME)
|
||||
set(DL_URL "${DL_URL}${__PKG_NAME}/")
|
||||
endif()
|
||||
endmacro()
|
||||
#
|
||||
# Replace download links and checksums for archives/releases in other repositories:
|
||||
# 1. Check if versions matched. If not matched, download from github instead.
|
||||
# 2. Extract repo owner and repo name from DL_URL.
|
||||
# 3. Put repo owner and repo name into the placeholders of new DL_URL.
|
||||
# 4. Replace DL_HASH with the one downloaded from gitcode.net.
|
||||
#
|
||||
macro(ocv_download_url_gitcode_archive_commit_id)
|
||||
if(DL_HASH STREQUAL "${${DL_ID}_PKG_MD5_ORIGINAL}")
|
||||
string(REPLACE "/" ";" DL_URL_split ${DL_URL})
|
||||
list(GET DL_URL_split 3 __OWNER)
|
||||
list(GET DL_URL_split 4 __REPO_NAME)
|
||||
set(DL_URL "https://gitcode.net/mirrors/${__OWNER}/${__REPO_NAME}/-/archive/")
|
||||
set(DL_HASH "${${DL_ID}_PKG_MD5_GITCODE}")
|
||||
else()
|
||||
message(WARNING "Package ${DL_ID} from mirror gitcode.net is outdated and will be downloaded from github.com instead.")
|
||||
endif()
|
||||
endmacro()
|
||||
macro(ocv_download_url_gitcode_archive_release)
|
||||
if(DL_HASH STREQUAL "${${DL_ID}_PKG_MD5_ORIGINAL}")
|
||||
string(REPLACE "/" ";" DL_URL_split ${DL_URL})
|
||||
list(GET DL_URL_split 3 __OWNER)
|
||||
list(GET DL_URL_split 4 __REPO_NAME)
|
||||
set(DL_URL "https://gitcode.net/${__OWNER}/${__REPO_NAME}/-/archive/${${DL_ID}_RELEASE_GITCODE}/${__REPO_NAME}-")
|
||||
set(DL_HASH "${${DL_ID}_PKG_MD5_GITCODE}")
|
||||
else()
|
||||
message(WARNING "Package ${DL_ID} from mirror gitcode.net is outdated and will be downloaded from github.com instead.")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if((DL_ID STREQUAL "FFMPEG") OR (DL_ID STREQUAL "IPPICV") OR (DL_ID STREQUAL "data") OR (DL_ID STREQUAL "xfeatures2d/boostdesc") OR (DL_ID STREQUAL "xfeatures2d/vgg"))
|
||||
ocv_download_url_gitcode_usercontent(opencv)
|
||||
elseif(DL_ID STREQUAL "wechat_qrcode")
|
||||
ocv_download_url_gitcode_usercontent(mirrors/WeChatCV)
|
||||
elseif((DL_ID STREQUAL "TENGINE") OR (DL_ID STREQUAL "NVIDIA_OPTICAL_FLOW") OR (DL_ID STREQUAL "TIM-VX"))
|
||||
ocv_download_url_gitcode_archive_commit_id()
|
||||
elseif(DL_ID STREQUAL "TBB")
|
||||
ocv_download_url_gitcode_archive_release()
|
||||
set(OPENCV_TBB_SUBDIR "${TBB_PKG_NAME_GITCODE}" PARENT_SCOPE)
|
||||
elseif(DL_ID STREQUAL "ADE")
|
||||
ocv_download_url_gitcode_archive_release()
|
||||
set(ade_subdir "${ADE_PKG_NAME_GITCODE}" PARENT_SCOPE)
|
||||
else()
|
||||
message(STATUS "ocv_download: Unknown download ID ${DL_ID} for using mirror gitcode.net. Use original source instead.")
|
||||
endif()
|
|
@ -0,0 +1 @@
|
|||
set(OPENCV_SKIP_LINK_AS_NEEDED 1)
|
|
@ -273,6 +273,32 @@ endif()
|
|||
# ==============================================================
|
||||
set(OpenCV_LIBRARIES ${OpenCV_LIBS})
|
||||
|
||||
# Require C++11 features for OpenCV modules
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if(NOT OpenCV_FIND_QUIETLY AND NOT OPENCV_HIDE_WARNING_COMPILE_FEATURES)
|
||||
message(STATUS "OpenCV: CMake version is low (${CMAKE_VERSION}, required 3.1+). Can't enable C++11 features: https://github.com/opencv/opencv/issues/13000")
|
||||
endif()
|
||||
else()
|
||||
set(__target opencv_core)
|
||||
if(TARGET opencv_world)
|
||||
set(__target opencv_world)
|
||||
endif()
|
||||
set(__compile_features cxx_std_11) # CMake 3.8+
|
||||
if(DEFINED OPENCV_COMPILE_FEATURES)
|
||||
set(__compile_features ${OPENCV_COMPILE_FEATURES}) # custom override
|
||||
elseif(CMAKE_VERSION VERSION_LESS "3.8")
|
||||
set(__compile_features cxx_auto_type cxx_rvalue_references cxx_lambdas)
|
||||
endif()
|
||||
if(__compile_features)
|
||||
# Simulate exported result of target_compile_features(opencv_core PUBLIC ...)
|
||||
set_target_properties(${__target} PROPERTIES
|
||||
INTERFACE_COMPILE_FEATURES "${__compile_features}"
|
||||
)
|
||||
endif()
|
||||
unset(__target)
|
||||
unset(__compile_features)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Some macros for samples
|
||||
#
|
||||
|
|
|
@ -137,6 +137,20 @@ elseif(MSVC)
|
|||
set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version
|
||||
endif()
|
||||
endif()
|
||||
elseif(MSVC_VERSION MATCHES "^193[0-9]$")
|
||||
set(OpenCV_RUNTIME vc17)
|
||||
check_one_config(has_VS2022)
|
||||
if(NOT has_VS2022)
|
||||
set(OpenCV_RUNTIME vc16)
|
||||
check_one_config(has_VS2019)
|
||||
if(NOT has_VS2019)
|
||||
set(OpenCV_RUNTIME vc15) # selecting previous compatible runtime version
|
||||
check_one_config(has_VS2017)
|
||||
if(NOT has_VS2017)
|
||||
set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
# -----------------------------------------------
|
||||
# File that provides "make uninstall" target
|
||||
# We use the file 'install_manifest.txt'
|
||||
#
|
||||
# Details: https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
|
||||
# -----------------------------------------------
|
||||
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
STRING(REGEX REPLACE "\n" ";" files "${files}")
|
||||
FOREACH(file ${files})
|
||||
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
IF(EXISTS "$ENV{DESTDIR}${file}")
|
||||
EXEC_PROGRAM(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
IF(NOT "${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
ENDIF(NOT "${rm_retval}" STREQUAL 0)
|
||||
ELSE(EXISTS "$ENV{DESTDIR}${file}")
|
||||
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
|
||||
ENDFOREACH(file)
|
||||
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
|
||||
endif()
|
||||
|
||||
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
foreach(file ${files})
|
||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
exec_program(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
if(NOT "${rm_retval}" STREQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
||||
endif()
|
||||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
||||
endif()
|
||||
endforeach()
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
/* Compile for 'real' NVIDIA GPU architectures */
|
||||
#define CUDA_ARCH_BIN "${OPENCV_CUDA_ARCH_BIN}"
|
||||
|
||||
/* Create PTX or BIN for 1.0 compute capability */
|
||||
#cmakedefine CUDA_ARCH_BIN_OR_PTX_10
|
||||
|
||||
/* NVIDIA GPU features are used */
|
||||
#define CUDA_ARCH_FEATURES "${OPENCV_CUDA_ARCH_FEATURES}"
|
||||
|
||||
|
@ -31,9 +28,6 @@
|
|||
/* Clp support */
|
||||
#cmakedefine HAVE_CLP
|
||||
|
||||
/* Cocoa API */
|
||||
#cmakedefine HAVE_COCOA
|
||||
|
||||
/* NVIDIA CUDA Runtime API*/
|
||||
#cmakedefine HAVE_CUDA
|
||||
|
||||
|
@ -59,12 +53,6 @@
|
|||
/* Geospatial Data Abstraction Library */
|
||||
#cmakedefine HAVE_GDAL
|
||||
|
||||
/* GTK+ 2.0 Thread support */
|
||||
#cmakedefine HAVE_GTHREAD
|
||||
|
||||
/* GTK+ 2.x toolkit */
|
||||
#cmakedefine HAVE_GTK
|
||||
|
||||
/* Halide support */
|
||||
#cmakedefine HAVE_HALIDE
|
||||
|
||||
|
@ -81,6 +69,7 @@
|
|||
#cmakedefine HAVE_IPP_IW_LL
|
||||
|
||||
/* JPEG-2000 codec */
|
||||
#cmakedefine HAVE_OPENJPEG
|
||||
#cmakedefine HAVE_JASPER
|
||||
|
||||
/* IJG JPEG codec */
|
||||
|
@ -94,6 +83,8 @@
|
|||
|
||||
/* NVIDIA Video Decoding API*/
|
||||
#cmakedefine HAVE_NVCUVID
|
||||
#cmakedefine HAVE_NVCUVID_HEADER
|
||||
#cmakedefine HAVE_DYNLINK_NVCUVID_HEADER
|
||||
|
||||
/* NVIDIA Video Encoding API*/
|
||||
#cmakedefine HAVE_NVCUVENC
|
||||
|
@ -121,12 +112,6 @@
|
|||
/* parallel_for with pthreads */
|
||||
#cmakedefine HAVE_PTHREADS_PF
|
||||
|
||||
/* Qt support */
|
||||
#cmakedefine HAVE_QT
|
||||
|
||||
/* Qt OpenGL support */
|
||||
#cmakedefine HAVE_QT_OPENGL
|
||||
|
||||
/* Intel Threading Building Blocks */
|
||||
#cmakedefine HAVE_TBB
|
||||
|
||||
|
@ -136,9 +121,6 @@
|
|||
/* TIFF codec */
|
||||
#cmakedefine HAVE_TIFF
|
||||
|
||||
/* Win32 UI */
|
||||
#cmakedefine HAVE_WIN32UI
|
||||
|
||||
/* Define if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine WORDS_BIGENDIAN
|
||||
|
|
|
@ -3,12 +3,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir_old=@includedir@/opencv
|
||||
includedir_new=@includedir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: OpenCV
|
||||
Description: Open Source Computer Vision Library
|
||||
Version: @OPENCV_VERSION_PLAIN@
|
||||
Libs: @OPENCV_PC_LIBS@
|
||||
Libs.private: @OPENCV_PC_LIBS_PRIVATE@
|
||||
Cflags: -I${includedir_old} -I${includedir_new}
|
||||
Cflags: -I${includedir}
|
||||
|
|
|
@ -26,12 +26,15 @@
|
|||
opencv2/core/hal/*.impl.*
|
||||
opencv2/core/cuda*
|
||||
opencv2/core/opencl*
|
||||
opencv2/core/parallel/backend/*
|
||||
opencv2/core/private*
|
||||
opencv2/core/*quaternion*
|
||||
opencv/cxeigen.hpp
|
||||
opencv2/core/eigen.hpp
|
||||
opencv2/flann/hdf5.h
|
||||
opencv2/imgcodecs/imgcodecs_c.h
|
||||
opencv2/imgcodecs/ios.h
|
||||
opencv2/imgcodecs/macosx.h
|
||||
opencv2/videoio/videoio_c.h
|
||||
opencv2/videoio/cap_ios.h
|
||||
opencv2/xobjdetect/private.hpp
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
# https://crascit.com/2016/04/09/using-ccache-with-cmake/
|
||||
|
||||
# Xcode generator doesn't include the compiler as the
|
||||
# first argument, Ninja and Makefiles do. Handle both cases.
|
||||
if [[ "$1" = "${CMAKE_C_COMPILER}" ]] ; then
|
||||
shift
|
||||
fi
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
exec "${CCACHE_PROGRAM}" "${CMAKE_C_COMPILER}" "$@"
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
# https://crascit.com/2016/04/09/using-ccache-with-cmake/
|
||||
|
||||
# Xcode generator doesn't include the compiler as the
|
||||
# first argument, Ninja and Makefiles do. Handle both cases.
|
||||
if [[ "$1" = "${CMAKE_CXX_COMPILER}" ]] ; then
|
||||
shift
|
||||
fi
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
exec "${CCACHE_PROGRAM}" "${CMAKE_CXX_COMPILER}" "$@"
|
|
@ -0,0 +1,21 @@
|
|||
set(__OCV_MODE_VARS_DIR "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
macro(ocv_change_mode_var)
|
||||
set(__var "${ARGV0}")
|
||||
set(__mode "${ARGV1}")
|
||||
set(__value "${ARGV2}")
|
||||
if(__mode STREQUAL "MODIFIED_ACCESS" AND __value)
|
||||
if(NOT __applied_mode_${__var})
|
||||
include("${__OCV_MODE_VARS_DIR}/${__var}.cmake")
|
||||
set(__applied_mode_${__var} 1)
|
||||
else()
|
||||
#message("Mode is already applied: ${__var}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
variable_watch(OPENCV_DISABLE_THREAD_SUPPORT ocv_change_mode_var)
|
||||
set(OPENCV_DISABLE_THREAD_SUPPORT "${OPENCV_DISABLE_THREAD_SUPPORT}")
|
||||
|
||||
variable_watch(OPENCV_SEMIHOSTING ocv_change_mode_var)
|
||||
set(OPENCV_SEMIHOSTING "${OPENCV_SEMIHOSTING}")
|
|
@ -0,0 +1,28 @@
|
|||
# Force removal of code conditionally compiled with `#if
|
||||
# HAVE_PTHREAD`.
|
||||
ocv_update(HAVE_PTHREAD 0)
|
||||
|
||||
# There components are disabled because they require
|
||||
# multi-threaded execution.
|
||||
ocv_update(WITH_PROTOBUF OFF)
|
||||
ocv_update(WITH_GSTREAMER OFF)
|
||||
ocv_update(WITH_IPP OFF)
|
||||
ocv_update(WITH_ITT OFF)
|
||||
ocv_update(WITH_OPENCL OFF)
|
||||
ocv_update(WITH_VA OFF)
|
||||
ocv_update(WITH_VA_INTEL OFF)
|
||||
|
||||
# Disable bindings
|
||||
ocv_update(BUILD_opencv_python2 OFF)
|
||||
ocv_update(BUILD_opencv_python3 OFF)
|
||||
ocv_update(BUILD_JAVA OFF)
|
||||
ocv_update(BUILD_opencv_java OFF)
|
||||
|
||||
# These modules require `#include
|
||||
# <[thread|mutex|condition_variable|future]>` and linkage into
|
||||
# `libpthread` to work.
|
||||
ocv_update(BUILD_opencv_objdetect OFF)
|
||||
ocv_update(BUILD_opencv_gapi OFF)
|
||||
ocv_update(BUILD_opencv_dnn OFF)
|
||||
|
||||
set(OPJ_USE_THREAD "OFF" CACHE INTERNAL "")
|
|
@ -0,0 +1,10 @@
|
|||
set(CV_TRACE OFF)
|
||||
|
||||
# These third parties libraries are incompatible with the semihosting
|
||||
# toolchain.
|
||||
set(WITH_JPEG OFF)
|
||||
set(WITH_OPENEXR OFF)
|
||||
set(WITH_TIFF OFF)
|
||||
|
||||
# Turn off `libpng` for some linking issues.
|
||||
set(WITH_PNG OFF)
|
|
@ -1,7 +0,0 @@
|
|||
*.c text
|
||||
*.cpp text
|
||||
*.h text
|
||||
*.hpp text
|
||||
*.txt text
|
||||
*.mk text
|
||||
*.java text
|
|
@ -1,5 +1,5 @@
|
|||
<!--
|
||||
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
|
||||
If you have a question rather than reporting a bug please go to https://forum.opencv.org where you get much faster responses.
|
||||
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).
|
||||
|
||||
This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
|
||||
|
@ -7,9 +7,9 @@ This is a template helping you to create an issue which can be processed as quic
|
|||
|
||||
##### System information (version)
|
||||
<!-- Example
|
||||
- OpenCV => 3.1
|
||||
- OpenCV => 4.2
|
||||
- Operating System / Platform => Windows 64 Bit
|
||||
- Compiler => Visual Studio 2015
|
||||
- Compiler => Visual Studio 2017
|
||||
-->
|
||||
|
||||
- OpenCV => :grey_question:
|
||||
|
@ -27,4 +27,43 @@ This is a template helping you to create an issue which can be processed as quic
|
|||
// C++ code example
|
||||
```
|
||||
or attach as .txt or .zip file
|
||||
-->
|
||||
-->
|
||||
|
||||
##### Issue submission checklist
|
||||
|
||||
- [ ] I report the issue, it's not a question
|
||||
<!--
|
||||
OpenCV team works with forum.opencv.org, Stack Overflow and other communities
|
||||
to discuss problems. Tickets with questions without a real issue statement will be
|
||||
closed.
|
||||
-->
|
||||
- [ ] I checked the problem with documentation, FAQ, open issues,
|
||||
forum.opencv.org, Stack Overflow, etc and have not found any solution
|
||||
<!--
|
||||
Places to check:
|
||||
* OpenCV documentation: https://docs.opencv.org
|
||||
* FAQ page: https://github.com/opencv/opencv/wiki/FAQ
|
||||
* OpenCV forum: https://forum.opencv.org
|
||||
* OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
|
||||
* Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
|
||||
-->
|
||||
- [ ] I updated to the latest OpenCV version and the issue is still there
|
||||
<!--
|
||||
master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
|
||||
OpenCV team supports only the latest release for each branch.
|
||||
The ticket is closed if the problem is not reproduced with the modern version.
|
||||
-->
|
||||
- [ ] There is reproducer code and related data files: videos, images, onnx, etc
|
||||
<!--
|
||||
The best reproducer -- test case for OpenCV that we can add to the library.
|
||||
Recommendations for media files and binary files:
|
||||
* Try to reproduce the issue with images and videos in opencv_extra repository
|
||||
to reduce attachment size
|
||||
* Use PNG for images, if you report some CV related bug, but not image reader
|
||||
issue
|
||||
* Attach the image as an archive to the ticket, if you report some reader issue.
|
||||
Image hosting services compress images and it breaks the repro code.
|
||||
* Provide ONNX file for some public model or ONNX file with random weights,
|
||||
if you report ONNX parsing or handling issue. Architecture details diagram
|
||||
from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
|
||||
-->
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<!-- Please use this line to close one or multiple issues when this pullrequest gets merged
|
||||
You can add another line right under the first one:
|
||||
resolves #1234
|
||||
resolves #1235
|
||||
-->
|
||||
### Pull Request Readiness Checklist
|
||||
|
||||
### This pullrequest changes
|
||||
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
|
||||
|
||||
<!-- Please describe what your pullrequest is changing -->
|
||||
- [ ] I agree to contribute to the project under Apache 2 License.
|
||||
- [ ] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
|
||||
- [ ] The PR is proposed to the proper branch
|
||||
- [ ] There is a reference to the original bug report and related work
|
||||
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
|
||||
Patch to opencv_extra has the same branch name.
|
||||
- [ ] The feature is well documented and sample code can be built with the project CMake
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
name: PR:4.x
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 4.x
|
||||
|
||||
jobs:
|
||||
ARM64:
|
||||
uses: opencv/ci-gha-workflow/.github/workflows/OCV-Contrib-PR-4.x-ARM64.yaml@main
|
||||
|
||||
U20:
|
||||
uses: opencv/ci-gha-workflow/.github/workflows/OCV-Contrib-PR-4.x-U20.yaml@main
|
||||
|
||||
W10:
|
||||
uses: opencv/ci-gha-workflow/.github/workflows/OCV-Contrib-PR-4.x-W10.yaml@main
|
|
@ -1,12 +0,0 @@
|
|||
*.autosave
|
||||
*.pyc
|
||||
*.user
|
||||
*~
|
||||
.*.swp
|
||||
.DS_Store
|
||||
.sw[a-z]
|
||||
Thumbs.db
|
||||
tags
|
||||
tegra/
|
||||
*.i
|
||||
.download*
|
227
contrib/LICENSE
227
contrib/LICENSE
|
@ -1,41 +1,202 @@
|
|||
By downloading, copying, installing or using the software you agree to this license.
|
||||
If you do not agree to this license, do not download, install,
|
||||
copy or use the software.
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
License Agreement
|
||||
For Open Source Computer Vision Library
|
||||
(3-clause BSD License)
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
Copyright (C) 2000-2018, Intel Corporation, all rights reserved.
|
||||
Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved.
|
||||
Copyright (C) 2009-2015, NVIDIA Corporation, all rights reserved.
|
||||
Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved.
|
||||
Copyright (C) 2015-2018, OpenCV Foundation, all rights reserved.
|
||||
Copyright (C) 2015-2016, Itseez Inc., all rights reserved.
|
||||
Third party copyrights are property of their respective owners.
|
||||
1. Definitions.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of the contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
This software is provided by the copyright holders and contributors "as is" and
|
||||
any express or implied warranties, including, but not limited to, the implied
|
||||
warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
In no event shall copyright holders or contributors be liable for any direct,
|
||||
indirect, incidental, special, exemplary, or consequential damages
|
||||
(including, but not limited to, procurement of substitute goods or services;
|
||||
loss of use, data, or profits; or business interruption) however caused
|
||||
and on any theory of liability, whether in contract, strict liability,
|
||||
or tort (including negligence or otherwise) arising in any way out of
|
||||
the use of this software, even if advised of the possibility of such damage.
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
## Repository for OpenCV's extra modules
|
||||
|
||||
This repository is intended for development of so-called "extra" modules,
|
||||
This repository is intended for the development of so-called "extra" modules,
|
||||
contributed functionality. New modules quite often do not have stable API,
|
||||
and they are not well-tested. Thus, they shouldn't be released as a part of
|
||||
and they are not well-tested. Thus, they shouldn't be released as a part of the
|
||||
official OpenCV distribution, since the library maintains binary compatibility,
|
||||
and tries to provide decent performance and stability.
|
||||
|
||||
So, all the new modules should be developed separately, and published in the
|
||||
`opencv_contrib` repository at first. Later, when the module matures and gains
|
||||
popularity, it is moved to the central OpenCV repository, and the development team
|
||||
provides production quality support for this module.
|
||||
provides production-quality support for this module.
|
||||
|
||||
### How to build OpenCV with extra modules
|
||||
|
||||
|
@ -33,28 +33,28 @@ $ cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -DBUILD_opencv_lega
|
|||
|
||||
If you also want to build the samples from the "samples" folder of each module, also include the "-DBUILD_EXAMPLES=ON" option.
|
||||
|
||||
If you prefer using the gui version of cmake (cmake-gui), then, you can add `opencv_contrib` modules within `opencv` core by doing the following:
|
||||
If you prefer using the GUI version of CMake (cmake-gui), then, you can add `opencv_contrib` modules within `opencv` core by doing the following:
|
||||
|
||||
1. start cmake-gui
|
||||
1. Start cmake-gui.
|
||||
|
||||
2. select the opencv source code folder and the folder where binaries will be built (the 2 upper forms of the interface)
|
||||
2. Select the opencv source code folder and the folder where binaries will be built (the 2 upper forms of the interface).
|
||||
|
||||
3. press the `configure` button. you will see all the opencv build parameters in the central interface
|
||||
3. Press the `configure` button. You will see all the opencv build parameters in the central interface.
|
||||
|
||||
4. browse the parameters and look for the form called `OPENCV_EXTRA_MODULES_PATH` (use the search form to focus rapidly on it)
|
||||
4. Browse the parameters and look for the form called `OPENCV_EXTRA_MODULES_PATH` (use the search form to focus rapidly on it).
|
||||
|
||||
5. complete this `OPENCV_EXTRA_MODULES_PATH` by the proper pathname to the `<opencv_contrib>/modules` value using its browse button.
|
||||
5. Complete this `OPENCV_EXTRA_MODULES_PATH` by the proper pathname to the `<opencv_contrib>/modules` value using its browse button.
|
||||
|
||||
6. press the `configure` button followed by the `generate` button (the first time, you will be asked which makefile style to use)
|
||||
6. Press the `configure` button followed by the `generate` button (the first time, you will be asked which makefile style to use).
|
||||
|
||||
7. build the `opencv` core with the method you chose (make and make install if you chose Unix makefile at step 6)
|
||||
7. Build the `opencv` core with the method you chose (make and make install if you chose Unix makefile at step 6).
|
||||
|
||||
8. to run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.
|
||||
8. To run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.
|
||||
|
||||
### Update the repository documentation
|
||||
|
||||
In order to keep a clean overview containing all contributed modules the following files need to be created/adapted.
|
||||
In order to keep a clean overview containing all contributed modules, the following files need to be created/adapted:
|
||||
|
||||
1. Update the README.md file under the modules folder. Here you add your model with a single line description.
|
||||
1. Update the README.md file under the modules folder. Here, you add your model with a single-line description.
|
||||
|
||||
2. Add a README.md inside your own module folder. This README explains which functionality (separate functions) is available, links to the corresponding samples and explains in somewhat more detail what the module is expected to do. If any extra requirements are needed to build the module without problems, add them here also.
|
||||
2. Add a README.md inside your own module folder. This README explains which functionality (separate functions) is available, links to the corresponding samples, and explains in somewhat more detail what the module is expected to do. If any extra requirements are needed to build the module without problems, add them here also.
|
||||
|
|
|
@ -8,8 +8,12 @@ To turn off building one of these module repositories, set the names in bold bel
|
|||
$ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D BUILD_opencv_<reponame>=OFF <opencv_source_directory>
|
||||
```
|
||||
|
||||
- **alphamat**: Computer Vision based Alpha Matting -- Given an input image and a trimap, generate an alpha matte.
|
||||
|
||||
- **aruco**: ArUco and ChArUco Markers -- Augmented reality ArUco marker and "ChARUco" markers where ArUco markers embedded inside the white areas of the checker board.
|
||||
|
||||
- **barcode**: Barcode detecting and decoding methods.
|
||||
|
||||
- **bgsegm**: Background segmentation algorithm combining statistical background image estimation and per-pixel Bayesian segmentation.
|
||||
|
||||
- **bioinspired**: Biological Vision -- Biologically inspired vision model: minimize noise and luminance variance, transient event segmentation, high dynamic range tone mapping methods.
|
||||
|
@ -32,22 +36,38 @@ $ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D BUILD_opencv_<r
|
|||
|
||||
- **face**: Face Recognition -- Face recognition techniques: Eigen, Fisher and Local Binary Pattern Histograms LBPH methods.
|
||||
|
||||
- **fuzzy**: Fuzzy Logic in Vision -- Fuzzy logic image transform and inverse; Fuzzy image processing.
|
||||
|
||||
- **freetype**: Drawing text using freetype and harfbuzz.
|
||||
|
||||
- **fuzzy**: Fuzzy Logic in Vision -- Fuzzy logic image transform and inverse; Fuzzy image processing.
|
||||
|
||||
- **hdf**: Hierarchical Data Storage -- This module contains I/O routines for Hierarchical Data Format: https://en.m.wikipedia.org/wiki/Hierarchical_Data_Format meant to store large amounts of data.
|
||||
|
||||
- **line_descriptor**: Line Segment Extract and Match -- Methods of extracting, describing and latching line segments using binary descriptors.
|
||||
- **hfs**: Hierarchical Feature Selection for Efficient Image Segmentation -- This module contains an efficient algorithm to segment an image.
|
||||
|
||||
- **img_hash**: This module contains algorithms to extract hash of an image allowing to efficiently estimate similarity between images.
|
||||
|
||||
- **intensity_transform**: The module brings implementations of intensity transformation algorithms to adjust image contrast.
|
||||
|
||||
- **julia**: Julia language wrappers with samples and tests.
|
||||
|
||||
- **line_descriptor**: Line Segment Extract and Match -- Methods of extracting, describing and matching line segments using binary descriptors.
|
||||
|
||||
- **matlab**: Matlab Interface -- OpenCV Matlab Mex wrapper code generator for certain opencv core modules.
|
||||
|
||||
- **mcc**: Macbeth Color Chart detector -- Find and return color patch location in MacBeth color calibration charts.
|
||||
|
||||
- **optflow**: Optical Flow -- Algorithms for running and evaluating deepflow, simpleflow, sparsetodenseflow and motion templates (silhouette flow).
|
||||
|
||||
- **ovis**: OGRE 3D Visualiser -- allows you to render 3D data using the OGRE 3D engine.
|
||||
|
||||
- **phase_unwrapping**: Quality-guided phase unwrapping.
|
||||
|
||||
- **plot**: Plotting -- The plot module allows you to easily plot data in 1D or 2D.
|
||||
|
||||
- **quality**: Image Quality Analysis (IQA) API.
|
||||
|
||||
- **rapid**: Silhouette based 3D object tracking.
|
||||
|
||||
- **reg**: Image Registration -- Pixels based image registration for precise alignment. Follows the paper "Image Alignment and Stitching: A Tutorial", by Richard Szeliski.
|
||||
|
||||
- **rgbd**: RGB-Depth Processing module -- Linemod 3D object recognition; Fast surface normals and 3D plane finding. 3D visual odometry. 3d reconstruction using KinectFusion.
|
||||
|
@ -56,17 +76,27 @@ $ cmake -D OPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules -D BUILD_opencv_<r
|
|||
|
||||
- **sfm**: Structure from Motion -- This module contains algorithms to perform 3d reconstruction from 2d images. The core of the module is a light version of Libmv.
|
||||
|
||||
- **shape**: Shape Distance and Matching
|
||||
|
||||
- **stereo**: Stereo Correspondence -- Stereo matching done with different descriptors: Census / CS-Census / MCT / BRIEF / MV and dense stereo correspondence using Quasi Dense Stereo method.
|
||||
|
||||
- **structured_light**: Structured Light Use -- How to generate and project gray code patterns and use them to find dense depth in a scene.
|
||||
|
||||
- **superres**: Super Resolution
|
||||
|
||||
- **surface_matching**: Point Pair Features -- Implements 3d object detection and localization using multimodal point pair features.
|
||||
|
||||
- **text**: Visual Text Matching -- In a visual scene, detect text, segment words and recognise the text.
|
||||
- **text**: Scene Text Detection and Recognition -- This module contains algorithms to perform text detection, words segmentation and text recognition in a visual scene.
|
||||
|
||||
- **tracking**: Vision Based Object Tracking -- Use and/or evaluate one of 5 different visual object tracking techniques.
|
||||
- **tracking**: Vision Based Object Tracking -- Use and/or evaluate different visual object tracking techniques.
|
||||
|
||||
- **xfeatures2d**: Features2D extra -- Extra 2D Features Framework containing experimental and non-free 2D feature detector/descriptor algorithms. SURF, SIFT, BRIEF, Censure, Freak, LUCID, Daisy, Self-similar.
|
||||
- **videostab**: Video Stabilization
|
||||
|
||||
- **viz**: 3D Visualizer
|
||||
|
||||
- **wechat_qrcode**: WeChat QR code detector for detecting and parsing QR code.
|
||||
|
||||
- **xfeatures2d**: Features2D extra -- Extra 2D Features Framework containing experimental and non-free 2D feature detector/descriptor algorithms. SURF, BRIEF, Censure, Freak, LUCID, Daisy, Self-similar.
|
||||
|
||||
- **ximgproc**: Extended Image Processing -- Structured Forests / Domain Transform Filter / Guided Filter / Adaptive Manifold Filter / Joint Bilateral Filter / Superpixels / Ridge Detection Filter.
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
if(NOT HAVE_EIGEN)
|
||||
message(STATUS "Module opencv_alphamat disabled because the following dependencies are not found: Eigen")
|
||||
ocv_module_disable(alphamat)
|
||||
endif()
|
||||
|
||||
ocv_define_module(alphamat
|
||||
opencv_core
|
||||
opencv_imgproc
|
||||
WRAP python
|
||||
)
|
|
@ -0,0 +1,23 @@
|
|||
# Computer Vision based Alpha Matting
|
||||
|
||||
This project was part of the Google Summer of Code 2019.
|
||||
|
||||
####Student: Muskaan Kularia
|
||||
####Mentor: Sunita Nayak
|
||||
***
|
||||
Alphamatting is the problem of extracting the foreground from an image. Given the input of an image and its corresponding trimap, we try to extract the foreground from the background.
|
||||
|
||||
This project is implementation of "[Designing Effective Inter-Pixel Information Flow for Natural Image Matting](https://www.researchgate.net/publication/318489370_Designing_Effective_Inter-Pixel_Information_Flow_for_Natural_Image_Matting)" by Yağız Aksoy, Tunç Ozan Aydın and Marc Pollefeys[1]. It required implementation of parts of other papers [2,3,4].
|
||||
|
||||
|
||||
## References
|
||||
|
||||
[1] Yagiz Aksoy, Tunc Ozan Aydin, Marc Pollefeys, "[Designing Effective Inter-Pixel Information Flow for Natural Image Matting](https://www.researchgate.net/publication/318489370_Designing_Effective_Inter-Pixel_Information_Flow_for_Natural_Image_Matting)", CVPR, 2017.
|
||||
|
||||
[2] Roweis, Sam T., and Lawrence K. Saul. "[Nonlinear dimensionality reduction by locally linear embedding](https://science.sciencemag.org/content/290/5500/2323)" Science 290.5500 (2000): 2323-2326.
|
||||
|
||||
[3] Anat Levin, Dani Lischinski, Yair Weiss, "[A Closed Form Solution to Natural Image Matting](https://www.researchgate.net/publication/5764820_A_Closed-Form_Solution_to_Natural_Image_Matting)", IEEE TPAMI, 2008.
|
||||
|
||||
[4] Qifeng Chen, Dingzeyu Li, Chi-Keung Tang, "[KNN Matting](http://dingzeyu.li/files/knn-matting-tpami.pdf)", IEEE TPAMI, 2013.
|
||||
|
||||
[5] Yagiz Aksoy, "[Affinity Based Matting Toolbox](https://github.com/yaksoy/AffinityBasedMattingToolbox)".
|
|
@ -0,0 +1,26 @@
|
|||
@inproceedings{aksoy2017designing,
|
||||
title={Designing effective inter-pixel information flow for natural image matting},
|
||||
author={Aksoy, Yagiz and Ozan Aydin, Tunc and Pollefeys, Marc},
|
||||
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
|
||||
pages={29--37},
|
||||
year={2017}
|
||||
}
|
||||
|
||||
@article{roweis2000nonlinear,
|
||||
title={Nonlinear dimensionality reduction by locally linear embedding},
|
||||
author={Roweis, Sam T and Saul, Lawrence K},
|
||||
journal={science},
|
||||
volume={290},
|
||||
number={5500},
|
||||
pages={2323--2326},
|
||||
year={2000},
|
||||
publisher={American Association for the Advancement of Science}
|
||||
}
|
||||
|
||||
@inproceedings{shahrian2013improving,
|
||||
title={Improving image matting using comprehensive sampling sets},
|
||||
author={Shahrian, Ehsan and Rajan, Deepu and Price, Brian and Cohen, Scott},
|
||||
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
|
||||
pages={636--643},
|
||||
year={2013}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
/** Information Flow algorithm implementaton for alphamatting */
|
||||
|
||||
#ifndef _OPENCV_ALPHAMAT_HPP_
|
||||
#define _OPENCV_ALPHAMAT_HPP_
|
||||
|
||||
/**
|
||||
* @defgroup alphamat Alpha Matting
|
||||
* Alpha matting is used to extract a foreground object with soft boundaries from a background image.
|
||||
*
|
||||
* This module is dedicated to computing alpha matte of objects in images from a given input image and a greyscale trimap image that contains information about the foreground, background and unknown pixels. The unknown pixels are assumed to be a combination of foreground and background pixels. The algorithm uses a combination of multiple carefully defined pixels affinities to estimate the opacity of the foreground pixels in the unkown region.
|
||||
*
|
||||
* The implementation is based on @cite aksoy2017designing.
|
||||
*
|
||||
* This module was developed by Muskaan Kularia and Sunita Nayak as a project
|
||||
* for Google Summer of Code 2019 (GSoC 19).
|
||||
*
|
||||
*/
|
||||
|
||||
namespace cv { namespace alphamat {
|
||||
//! @addtogroup alphamat
|
||||
//! @{
|
||||
|
||||
/**
|
||||
* @brief Compute alpha matte of an object in an image
|
||||
* @param image Input RGB image
|
||||
* @param tmap Input greyscale trimap image
|
||||
* @param result Output alpha matte image
|
||||
*
|
||||
* The function infoFlow performs alpha matting on a RGB image using a greyscale trimap image, and outputs a greyscale alpha matte image. The output alpha matte can be used to softly extract the foreground object from a background image. Examples can be found in the samples directory.
|
||||
*
|
||||
*/
|
||||
CV_EXPORTS_W void infoFlow(InputArray image, InputArray tmap, OutputArray result);
|
||||
|
||||
//! @}
|
||||
}} // namespace
|
||||
|
||||
#endif
|
|
@ -0,0 +1,87 @@
|
|||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
// Include relevant headers
|
||||
#include <iostream>
|
||||
#include "opencv2/highgui.hpp"
|
||||
#include <opencv2/core.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/alphamat.hpp>
|
||||
|
||||
// Set namespaces
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::alphamat;
|
||||
|
||||
// Set the usage parameter names
|
||||
const char* keys =
|
||||
"{img || input image name}"
|
||||
"{tri || input trimap image name}"
|
||||
"{out || output image name}"
|
||||
"{help h || print help message}"
|
||||
;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
parser.about("This sample demonstrates Information Flow Alpha Matting");
|
||||
|
||||
if (parser.has("help"))
|
||||
{
|
||||
parser.printMessage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Read the paths to the input image, input trimap and the location of the output image.
|
||||
string img_path = parser.get<std::string>("img");
|
||||
string trimap_path = parser.get<std::string>("tri");
|
||||
string result_path = parser.get<std::string>("out");
|
||||
|
||||
// Make sure the user inputs paths to the input image and trimap
|
||||
if (!parser.check()
|
||||
|| img_path.empty() || trimap_path.empty())
|
||||
{
|
||||
parser.printMessage();
|
||||
parser.printErrors();
|
||||
return 1;
|
||||
}
|
||||
|
||||
Mat image, tmap;
|
||||
|
||||
// Read the input image
|
||||
image = imread(img_path, IMREAD_COLOR);
|
||||
if (image.empty())
|
||||
{
|
||||
printf("Cannot read image file: '%s'\n", img_path.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Read the trimap
|
||||
tmap = imread(trimap_path, IMREAD_GRAYSCALE);
|
||||
if (tmap.empty())
|
||||
{
|
||||
printf("Cannot read trimap file: '%s'\n", trimap_path.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
Mat result;
|
||||
// Perform information flow alpha matting
|
||||
infoFlow(image, tmap, result);
|
||||
|
||||
if (result_path.empty())
|
||||
{
|
||||
// Show the alpha matte if a result filepath is not provided.
|
||||
namedWindow("result alpha matte", WINDOW_NORMAL);
|
||||
imshow("result alpha matte", result);
|
||||
waitKey(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save the alphamatte
|
||||
imwrite(result_path, result);
|
||||
printf("Result saved: '%s'\n", result_path.c_str());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 268 KiB |
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
|
@ -0,0 +1,117 @@
|
|||
/***********************************************************************
|
||||
* Software License Agreement (BSD License)
|
||||
*
|
||||
* Copyright 2011-16 Jose Luis Blanco (joseluisblancoc@gmail.com).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "nanoflann.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
// ===== This example shows how to use nanoflann with these types of containers: =======
|
||||
//typedef std::vector<std::vector<double> > my_vector_of_vectors_t;
|
||||
//typedef std::vector<Eigen::VectorXd> my_vector_of_vectors_t; // This requires #include <Eigen/Dense>
|
||||
// =====================================================================================
|
||||
|
||||
|
||||
/** A simple vector-of-vectors adaptor for nanoflann, without duplicating the storage.
|
||||
* The i'th vector represents a point in the state space.
|
||||
*
|
||||
* \tparam DIM If set to >0, it specifies a compile-time fixed dimensionality for the points in the data set, allowing more compiler optimizations.
|
||||
* \tparam num_t The type of the point coordinates (typically, double or float).
|
||||
* \tparam Distance The distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc.
|
||||
* \tparam IndexType The type for indices in the KD-tree index (typically, size_t of int)
|
||||
*/
|
||||
template <class VectorOfVectorsType, typename num_t = double, int DIM = -1, class Distance = nanoflann::metric_L2, typename IndexType = size_t>
|
||||
struct KDTreeVectorOfVectorsAdaptor
|
||||
{
|
||||
typedef KDTreeVectorOfVectorsAdaptor<VectorOfVectorsType, num_t, DIM,Distance> self_t;
|
||||
typedef typename Distance::template traits<num_t, self_t>::distance_t metric_t;
|
||||
typedef nanoflann::KDTreeSingleIndexAdaptor< metric_t, self_t, DIM, IndexType> index_t;
|
||||
|
||||
index_t* index; //! The kd-tree index for the user to call its methods as usual with any other FLANN index.
|
||||
|
||||
/// Constructor: takes a const ref to the vector of vectors object with the data points
|
||||
KDTreeVectorOfVectorsAdaptor(const size_t /* dimensionality */, const VectorOfVectorsType &mat, const int leaf_max_size = 10) : m_data(mat)
|
||||
{
|
||||
assert(mat.size() != 0 && mat[0].size() != 0);
|
||||
const size_t dims = mat[0].size();
|
||||
if (DIM>0 && static_cast<int>(dims) != DIM)
|
||||
throw std::runtime_error("Data set dimensionality does not match the 'DIM' template argument");
|
||||
index = new index_t( static_cast<int>(dims), *this /* adaptor */, nanoflann::KDTreeSingleIndexAdaptorParams(leaf_max_size ) );
|
||||
index->buildIndex();
|
||||
}
|
||||
|
||||
~KDTreeVectorOfVectorsAdaptor() {
|
||||
delete index;
|
||||
}
|
||||
|
||||
const VectorOfVectorsType &m_data;
|
||||
|
||||
/** Query for the \a num_closest closest points to a given point (entered as query_point[0:dim-1]).
|
||||
* Note that this is a short-cut method for index->findNeighbors().
|
||||
* The user can also call index->... methods as desired.
|
||||
* \note nChecks_IGNORED is ignored but kept for compatibility with the original FLANN interface.
|
||||
*/
|
||||
//inline void query(const num_t *query_point, const size_t num_closest, IndexType *out_indices, num_t *out_distances_sq, const int nChecks_IGNORED = 10) const
|
||||
inline void query(const num_t *query_point, const size_t num_closest, IndexType *out_indices, num_t *out_distances_sq) const
|
||||
{
|
||||
nanoflann::KNNResultSet<num_t, IndexType> resultSet(num_closest);
|
||||
resultSet.init(out_indices, out_distances_sq);
|
||||
index->findNeighbors(resultSet, query_point, nanoflann::SearchParams());
|
||||
}
|
||||
|
||||
/** @name Interface expected by KDTreeSingleIndexAdaptor
|
||||
* @{ */
|
||||
|
||||
const self_t & derived() const {
|
||||
return *this;
|
||||
}
|
||||
self_t & derived() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Must return the number of data points
|
||||
inline size_t kdtree_get_point_count() const {
|
||||
return m_data.size();
|
||||
}
|
||||
|
||||
// Returns the dim'th component of the idx'th point in the class:
|
||||
inline num_t kdtree_get_pt(const size_t idx, const size_t dim) const {
|
||||
return m_data[idx][dim];
|
||||
}
|
||||
|
||||
// Optional bounding-box computation: return false to default to a standard bbox computation loop.
|
||||
// Return true if the BBOX was already computed by the class and returned in "bb" so it can be avoided to redo it again.
|
||||
// Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3 for point clouds)
|
||||
template <class BBOX>
|
||||
bool kdtree_get_bbox(BBOX & /*bb*/) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
}; // end of KDTreeVectorOfVectorsAdaptor
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue