From ca1501f4b2cbc0a502594db6f303622394dbdf9f Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Tue, 5 Nov 2024 20:17:22 +0100 Subject: [PATCH] [opencv] update to 4.9 (#38928) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Howard Su Co-authored-by: Nick Logozzo Co-authored-by: sidy3d Co-authored-by: c8ef Co-authored-by: autoantwort <41973254+autoantwort@users.noreply.github.com> Co-authored-by: jim wang <122244446+jimwang118@users.noreply.github.com> Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com> Co-authored-by: Lily Wang Co-authored-by: Matthias Kuhn Co-authored-by: Mark Harmstone Co-authored-by: Kai Pastor Co-authored-by: Alexandre Bique Co-authored-by: Peter Adam Korodi <52385411+kp-cat@users.noreply.github.com> Co-authored-by: Jakub Melka Co-authored-by: LE GARREC Vincent Co-authored-by: Josh Harris <126129571+harris-josh@users.noreply.github.com> Co-authored-by: Theodore Tsirpanis Co-authored-by: Kaoru Co-authored-by: Javier Matos Denizac Co-authored-by: Javier Matos Co-authored-by: Pravila Co-authored-by: JacobBarthelmeh Co-authored-by: myd7349 Co-authored-by: Billy O'Neal Co-authored-by: Frank <65999885+FrankXie05@users.noreply.github.com> Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com> Co-authored-by: 王太阳 Co-authored-by: 王方凯 Co-authored-by: Chuck Walbourn Co-authored-by: Jaap Aarts --- ports/darknet/fix-dependence-getopt.patch | 61 -- ports/darknet/portfile.cmake | 15 +- ports/darknet/vcpkg.json | 61 +- ports/opencv/portfile.cmake | 9 +- ports/opencv/vcpkg-cmake-wrapper.cmake.in | 3 + ports/opencv/vcpkg.json | 194 ++++- ports/opencv2/0001-install-options.patch | 9 + .../0004-add-ffmpeg-missing-defines.patch | 12 - ports/opencv2/0005-fix-cuda.patch | 140 ---- ports/opencv2/0019-fix-openexr.patch | 4 - ports/opencv2/0020-missing-include.patch | 2 - ports/opencv2/portfile.cmake | 58 +- ports/opencv2/usage.in | 4 +- ports/opencv2/vcpkg.json | 43 +- ports/opencv3/0005-fix-vtk9.patch | 16 +- ...hdf5.patch => 0007-contrib-fix-hdf5.patch} | 0 ...res.patch => 0013-contrib-fix-ceres.patch} | 0 ports/opencv3/0014-fix-pkgconf-name.patch | 11 + ...ortqnx.patch => 0015-fix-supportqnx.patch} | 2 - ....patch => 0016-contrib-fix-freetype.patch} | 0 ...clude.patch => 0017-missing-include.patch} | 2 - ...patch => 0018-contrib-fix-tesseract.patch} | 0 ...fix-tbb-error.patch => 0019-fix-tbb.patch} | 2 - ports/opencv3/portfile.cmake | 578 ++++++++------- ports/opencv3/usage.in | 4 +- ports/opencv3/vcpkg.json | 96 +-- ports/opencv4/0001-disable-downloading.patch | 2 +- ports/opencv4/0002-install-options.patch | 13 +- .../0003-force-package-requirements.patch | 56 +- ports/opencv4/0004-fix-eigen.patch | 2 +- ports/opencv4/0005-fix-policy-CMP0057.patch | 4 +- ports/opencv4/0006-fix-uwp.patch | 2 +- ...hdf5.patch => 0007-contrib-fix-hdf5.patch} | 0 ports/opencv4/0008-devendor-quirc.patch | 4 +- ports/opencv4/0009-fix-protobuf.patch | 20 +- ports/opencv4/0011-remove-python2.patch | 12 +- ...ency.patch => 0013-contrib-fix-ogre.patch} | 0 ...ortqnx.patch => 0014-fix-supportqnx.patch} | 0 ports/opencv4/0015-fix-freetype.patch | 2 +- ....patch => 0016-contrib-fix-freetype.patch} | 4 +- ports/opencv4/0017-fix-flatbuffers.patch | 36 +- ...patch => 0018-contrib-fix-tesseract.patch} | 0 ports/opencv4/0019-fix-cmake-in-list.patch | 13 + ports/opencv4/0019-missing-include.patch | 12 - ports/opencv4/0020-fix-compat-cuda12.2.patch | 32 - ports/opencv4/0021-static-openvino.patch | 25 - ports/opencv4/portfile.cmake | 675 ++++++++++-------- ports/opencv4/usage.in | 5 +- ports/opencv4/vcpkg.json | 112 ++- ports/openimageio/fix-dependencies.patch | 5 +- ports/openimageio/vcpkg.json | 1 + ports/rtabmap/multi-definition.patch | 21 +- ports/rtabmap/vcpkg.json | 2 +- scripts/ci.baseline.txt | 32 +- scripts/test_ports/vcpkg-ci-opencv/vcpkg.json | 125 +++- .../vcpkg-ci-openimageio/vcpkg.json | 3 +- versions/baseline.json | 20 +- versions/d-/darknet.json | 5 + versions/o-/opencv.json | 5 + versions/o-/opencv2.json | 5 + versions/o-/opencv3.json | 5 + versions/o-/opencv4.json | 5 + versions/o-/openimageio.json | 5 + versions/r-/rtabmap.json | 5 + 64 files changed, 1363 insertions(+), 1238 deletions(-) delete mode 100644 ports/darknet/fix-dependence-getopt.patch create mode 100644 ports/opencv/vcpkg-cmake-wrapper.cmake.in delete mode 100644 ports/opencv2/0004-add-ffmpeg-missing-defines.patch delete mode 100644 ports/opencv2/0005-fix-cuda.patch rename ports/opencv3/{0007-fix-hdf5.patch => 0007-contrib-fix-hdf5.patch} (100%) rename ports/opencv3/{0013-fix-ceres.patch => 0013-contrib-fix-ceres.patch} (100%) create mode 100644 ports/opencv3/0014-fix-pkgconf-name.patch rename ports/opencv3/{0020-fix-supportqnx.patch => 0015-fix-supportqnx.patch} (87%) rename ports/opencv3/{0016-fix-freetype-contrib.patch => 0016-contrib-fix-freetype.patch} (100%) rename ports/opencv3/{0019-missing-include.patch => 0017-missing-include.patch} (64%) rename ports/opencv3/{0018-fix-depend-tesseract.patch => 0018-contrib-fix-tesseract.patch} (100%) rename ports/opencv3/{fix-tbb-error.patch => 0019-fix-tbb.patch} (72%) rename ports/opencv4/{0007-fix-hdf5.patch => 0007-contrib-fix-hdf5.patch} (100%) rename ports/opencv4/{0019-fix-ogre-dependency.patch => 0013-contrib-fix-ogre.patch} (100%) rename ports/opencv4/{0022-fix-supportqnx.patch => 0014-fix-supportqnx.patch} (100%) rename ports/opencv4/{0016-fix-freetype-contrib.patch => 0016-contrib-fix-freetype.patch} (91%) rename ports/opencv4/{0018-fix-depend-tesseract.patch => 0018-contrib-fix-tesseract.patch} (100%) create mode 100644 ports/opencv4/0019-fix-cmake-in-list.patch delete mode 100644 ports/opencv4/0019-missing-include.patch delete mode 100644 ports/opencv4/0020-fix-compat-cuda12.2.patch delete mode 100644 ports/opencv4/0021-static-openvino.patch diff --git a/ports/darknet/fix-dependence-getopt.patch b/ports/darknet/fix-dependence-getopt.patch deleted file mode 100644 index e9fa8fc180..0000000000 --- a/ports/darknet/fix-dependence-getopt.patch +++ /dev/null @@ -1,61 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d34b8f8..a8488c6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -203,6 +203,7 @@ if(MSVC AND USE_INTEGRATED_LIBS) - find_package(PThreads4W REQUIRED) - elseif(MSVC) - find_package(pthreads REQUIRED) -+ find_package(unofficial-getopt-win32 REQUIRED) - endif() - if(ENABLE_OPENCV) - find_package(OpenCV REQUIRED) -@@ -371,9 +372,9 @@ list(APPEND headers - if(NOT MSVC) - list(REMOVE_ITEM headers - ${CMAKE_CURRENT_LIST_DIR}/src/gettimeofday.h -- ${CMAKE_CURRENT_LIST_DIR}/src/getopt.h - ) - endif() -+ - #set(exported_headers ${headers}) - - #look for all *.c files in src folder -@@ -391,10 +392,13 @@ list(REMOVE_ITEM sources - if(NOT MSVC) - list(REMOVE_ITEM sources - ${CMAKE_CURRENT_LIST_DIR}/src/gettimeofday.c -- ${CMAKE_CURRENT_LIST_DIR}/src/getopt.c - ) - endif() - -+#remove local getopt files -+list(REMOVE_ITEM headers ${CMAKE_CURRENT_LIST_DIR}/src/getopt.h) -+list(REMOVE_ITEM sources ${CMAKE_CURRENT_LIST_DIR}/src/getopt.c) -+ - if(ENABLE_CUDA) - file(GLOB cuda_sources "${CMAKE_CURRENT_LIST_DIR}/src/*.cu") - endif() -@@ -478,6 +482,7 @@ endif() - if(MSVC) - target_link_libraries(darknet PRIVATE PThreads_windows::PThreads_windows) - target_link_libraries(darknet PRIVATE wsock32) -+ target_link_libraries(dark PRIVATE unofficial::getopt-win32::getopt) - target_link_libraries(dark PUBLIC PThreads_windows::PThreads_windows) - target_link_libraries(dark PUBLIC wsock32) - target_link_libraries(uselib PRIVATE PThreads_windows::PThreads_windows) -diff --git a/DarknetConfig.cmake.in b/DarknetConfig.cmake.in -index 1221206..6bdff49 100644 ---- a/DarknetConfig.cmake.in -+++ b/DarknetConfig.cmake.in -@@ -9,6 +9,10 @@ if(@OpenCV_FOUND@) - find_dependency(OpenCV) - endif() - -+if(@unofficial-getopt-win32_FOUND@) -+ find_dependency(unofficial-getopt-win32) -+endif() -+ - if(@ENABLE_CUDA@) - include(CheckLanguage) - check_language(CUDA) diff --git a/ports/darknet/portfile.cmake b/ports/darknet/portfile.cmake index 4626d33f29..ef514b7e5a 100644 --- a/ports/darknet/portfile.cmake +++ b/ports/darknet/portfile.cmake @@ -1,11 +1,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO AlexeyAB/darknet - REF 8a0bf84c19e38214219dbd3345f04ce778426c57 - SHA512 6253d5b498f4f6eba7fc539d5a4b4e163139f4841623f11d84760bcf1ffabe6519f85e98e3d4aeac6846313fea3b98451407134b6b6f5b91137c62d1647109d9 + REF 19dde2f296941a75b0b9202cccd59528bde7f65a + SHA512 3f24fd5c69a00032e63fc8479d46dedf9008909c5e0f37847f0427c39f35e68f35a5ee89820cd0a179cb282e49730e6b1465a027d89bef585e9a1cfca6e3d3a2 HEAD_REF master - PATCHES - fix-dependence-getopt.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS @@ -16,7 +14,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS #do not move following features to vcpkg_check_features because they break themselves: one off will turn off the others even if true set(ENABLE_OPENCV FALSE) -if ("opencv-base" IN_LIST FEATURES OR "opencv2-base" IN_LIST FEATURES OR "opencv3-base" IN_LIST FEATURES OR "opencv-cuda" IN_LIST FEATURES OR "opencv2-cuda" IN_LIST FEATURES OR "opencv3-cuda" IN_LIST FEATURES) +if ("opencv-base" IN_LIST FEATURES OR "opencv-cuda" IN_LIST FEATURES) set(ENABLE_OPENCV TRUE) endif() @@ -34,16 +32,17 @@ file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/Modules") vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" DISABLE_PARALLEL_CONFIGURE - OPTIONS + OPTIONS ${FEATURE_OPTIONS} -DINSTALL_BIN_DIR:STRING=bin -DINSTALL_LIB_DIR:STRING=lib -DENABLE_OPENCV:BOOL=${ENABLE_OPENCV} + -DSKIP_INSTALL_RUNTIME_LIBS:BOOL=ON ) vcpkg_cmake_install() -vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES darknet uselib) -if ("opencv-cuda" IN_LIST FEATURES OR "opencv3-cuda" IN_LIST FEATURES) +vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES darknet uselib kmeansiou) +if ("opencv-cuda" IN_LIST FEATURES) vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES uselib_track) endif() diff --git a/ports/darknet/vcpkg.json b/ports/darknet/vcpkg.json index db3e543dfc..a5dc0999cb 100644 --- a/ports/darknet/vcpkg.json +++ b/ports/darknet/vcpkg.json @@ -1,7 +1,6 @@ { "name": "darknet", - "version-date": "2022-03-06", - "port-version": 4, + "version-date": "2024-10-10", "description": "Darknet is an open source neural network framework written in C and CUDA. You only look once (YOLO) is a state-of-the-art, real-time object detection system, best example of darknet functionalities.", "homepage": "https://github.com/alexeyab/darknet", "license": null, @@ -54,8 +53,6 @@ { "name": "opencv", "features": [ - "contrib", - "dnn", "ffmpeg" ] } @@ -80,62 +77,6 @@ ] } ] - }, - "opencv2-base": { - "description": "Build darknet with support for OpenCV2", - "dependencies": [ - { - "name": "opencv2", - "features": [ - "ffmpeg" - ] - } - ] - }, - "opencv2-cuda": { - "description": "Build darknet with support for CUDA-enabled OpenCV2", - "dependencies": [ - { - "name": "opencv2", - "features": [ - "cuda", - "ffmpeg" - ] - } - ] - }, - "opencv3-base": { - "description": "Build darknet with support for OpenCV3", - "dependencies": [ - { - "name": "opencv3", - "features": [ - "contrib", - "dnn", - "ffmpeg" - ] - } - ] - }, - "opencv3-cuda": { - "description": "Build darknet with support for CUDA-enabled OpenCV3", - "dependencies": [ - { - "name": "darknet", - "features": [ - "cuda" - ] - }, - { - "name": "opencv3", - "features": [ - "contrib", - "cuda", - "dnn", - "ffmpeg" - ] - } - ] } } } diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 8ff4daa377..3da112227b 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -1,9 +1,4 @@ SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) -file(INSTALL "${CURRENT_INSTALLED_DIR}/share/opencv4/OpenCVConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -file(INSTALL "${CURRENT_INSTALLED_DIR}/share/opencv4/OpenCVConfig-version.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -file(INSTALL "${CURRENT_INSTALLED_DIR}/share/opencv4/OpenCVModules.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -file(INSTALL "${CURRENT_INSTALLED_DIR}/share/opencv4/OpenCVModules-release.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -if (NOT VCPKG_BUILD_TYPE) - file(INSTALL "${CURRENT_INSTALLED_DIR}/share/opencv4/OpenCVModules-debug.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") -endif() +set(USE_OPENCV_VERSION "4") +configure_file("${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/opencv/vcpkg-cmake-wrapper.cmake" @ONLY) diff --git a/ports/opencv/vcpkg-cmake-wrapper.cmake.in b/ports/opencv/vcpkg-cmake-wrapper.cmake.in new file mode 100644 index 0000000000..ba92b8b741 --- /dev/null +++ b/ports/opencv/vcpkg-cmake-wrapper.cmake.in @@ -0,0 +1,3 @@ +set(OpenCV_DIR "${CMAKE_CURRENT_LIST_DIR}/../opencv@USE_OPENCV_VERSION@/" CACHE PATH "Path to OpenCVConfig.cmake" FORCE) +set(OpenCV_ROOT "${CMAKE_CURRENT_LIST_DIR}/../opencv@USE_OPENCV_VERSION@/") +_find_package(${ARGS}) diff --git a/ports/opencv/vcpkg.json b/ports/opencv/vcpkg.json index 6f7f217ae3..4bfdedffbb 100644 --- a/ports/opencv/vcpkg.json +++ b/ports/opencv/vcpkg.json @@ -1,8 +1,7 @@ { "name": "opencv", - "version": "4.8.0", - "port-version": 1, - "description": "Computer vision library", + "version": "4.9.0", + "description": "computer vision library", "homepage": "https://github.com/opencv/opencv", "license": "Apache-2.0", "dependencies": [ @@ -27,6 +26,18 @@ } ] }, + "calib3d": { + "description": "calib3d module", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "calib3d" + ] + } + ] + }, "contrib": { "description": "opencv_contrib module", "dependencies": [ @@ -82,21 +93,8 @@ "name": "opencv4", "default-features": false, "features": [ - "dnn", - "jpeg", - "png", - "quirc", - "tiff", - "webp" + "default-features" ] - }, - { - "name": "opencv4", - "default-features": false, - "features": [ - "gtk" - ], - "platform": "linux" } ] }, @@ -124,6 +122,18 @@ } ] }, + "dshow": { + "description": "enable DirectShow", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "dshow" + ] + } + ] + }, "eigen": { "description": "Eigen support for opencv", "dependencies": [ @@ -149,7 +159,7 @@ ] }, "freetype": { - "description": "freetype support for opencv", + "description": "Freetype support for opencv", "dependencies": [ { "name": "opencv4", @@ -160,6 +170,30 @@ } ] }, + "fs": { + "description": "Enable filesystem support", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "fs" + ] + } + ] + }, + "gapi": { + "description": "Enable gapi module", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "gapi" + ] + } + ] + }, "gdcm": { "description": "GDCM support for opencv", "dependencies": [ @@ -208,6 +242,30 @@ } ] }, + "highgui": { + "description": "highgui module", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "highgui" + ] + } + ] + }, + "intrinsics": { + "description": "enable intrinsics", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "intrinsics" + ] + } + ] + }, "ipp": { "description": "Enable Intel Integrated Performance Primitives", "dependencies": [ @@ -221,7 +279,7 @@ ] }, "jasper": { - "description": "JPEG 2000 support for opencv", + "description": "JPEG 2000 support for opencv (deprecated)", "dependencies": [ { "name": "opencv4", @@ -256,8 +314,20 @@ } ] }, + "msmf": { + "description": "Microsoft Media Foundation support for opencv", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "msmf" + ] + } + ] + }, "nonfree": { - "description": "opencv nonfree module", + "description": "Allow nonfree and unredistributable libraries", "dependencies": [ { "name": "opencv4", @@ -268,6 +338,18 @@ } ] }, + "opencl": { + "description": "Enable OpenCL support", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "opencl" + ] + } + ] + }, "openexr": { "description": "OpenEXR support for opencv", "dependencies": [ @@ -292,6 +374,18 @@ } ] }, + "openjpeg": { + "description": "JPEG 2000 support for opencv", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "openjpeg" + ] + } + ] + }, "openmp": { "description": "Enable openmp support for opencv", "dependencies": [ @@ -304,6 +398,18 @@ } ] }, + "openvino": { + "description": "OpenVINO support for OpenCV DNN", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "openvino" + ] + } + ] + }, "ovis": { "description": "opencv_ovis module", "dependencies": [ @@ -352,6 +458,18 @@ } ] }, + "quality": { + "description": "Build opencv_quality module", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "quality" + ] + } + ] + }, "quirc": { "description": "Enable QR code module", "dependencies": [ @@ -364,6 +482,18 @@ } ] }, + "rgbd": { + "description": "Build opencv_rgbd module", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "rgbd" + ] + } + ] + }, "sfm": { "description": "opencv_sfm module", "dependencies": [ @@ -388,6 +518,18 @@ } ] }, + "thread": { + "description": "Enable thread support", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "thread" + ] + } + ] + }, "tiff": { "description": "TIFF support for opencv", "dependencies": [ @@ -436,6 +578,18 @@ } ] }, + "win32ui": { + "description": "Enable win32ui", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "win32ui" + ] + } + ] + }, "world": { "description": "Compile to a single package support for opencv", "dependencies": [ diff --git a/ports/opencv2/0001-install-options.patch b/ports/opencv2/0001-install-options.patch index 1fde6b4465..fa01b8b6c3 100644 --- a/ports/opencv2/0001-install-options.patch +++ b/ports/opencv2/0001-install-options.patch @@ -256,6 +256,15 @@ set(OPENCV_MODULE_${m}_DEPS ${OPENCV_MODULE_${m}_DEPS} CACHE INTERNAL "Flattened dependencies of ${m} module") set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS_EXT} CACHE INTERNAL "Extra dependencies of ${m} module") +@@ -581,8 +581,6 @@ macro(ocv_create_module) + target_link_libraries(${the_module} LINK_PUBLIC ${OPENCV_MODULE_${the_module}_DEPS}) + target_link_libraries(${the_module} LINK_PUBLIC ${OPENCV_MODULE_${the_module}_DEPS}) + set(extra_deps ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN}) +- ocv_extract_simple_libs(extra_deps _simple_deps _other_deps) +- target_link_libraries(${the_module} LINK_PRIVATE ${_simple_deps}) # this list goes to "export" + target_link_libraries(${the_module} LINK_PRIVATE ${extra_deps}) + endif() + --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -5,8 +5,6 @@ if(ANDROID) diff --git a/ports/opencv2/0004-add-ffmpeg-missing-defines.patch b/ports/opencv2/0004-add-ffmpeg-missing-defines.patch deleted file mode 100644 index 638581d01c..0000000000 --- a/ports/opencv2/0004-add-ffmpeg-missing-defines.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/modules/highgui/src/cap_ffmpeg_impl.hpp -+++ b/modules/highgui/src/cap_ffmpeg_impl.hpp -@@ -42,6 +42,9 @@ - - #define HAVE_FFMPEG_SWSCALE - #define HAVE_GENTOO_FFMPEG -+#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22) -+#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER -+#define AVFMT_RAWPICTURE 0x0020 - - #include "cap_ffmpeg_api.hpp" - #include diff --git a/ports/opencv2/0005-fix-cuda.patch b/ports/opencv2/0005-fix-cuda.patch deleted file mode 100644 index 7ce62966db..0000000000 --- a/ports/opencv2/0005-fix-cuda.patch +++ /dev/null @@ -1,140 +0,0 @@ ---- a/cmake/OpenCVDetectCUDA.cmake -+++ b/cmake/OpenCVDetectCUDA.cmake -@@ -51,7 +51,6 @@ if(CUDA_FOUND) - - message(STATUS "CUDA detected: " ${CUDA_VERSION}) - -- set(_generations "Fermi" "Kepler") - if(NOT CMAKE_CROSSCOMPILING) - list(APPEND _generations "Auto") - endif() -@@ -69,48 +68,8 @@ if(CUDA_FOUND) - unset(CUDA_ARCH_PTX CACHE) - endif() - -- set(__cuda_arch_ptx "") -- if(CUDA_GENERATION STREQUAL "Fermi") -- set(__cuda_arch_bin "2.0 2.1(2.0)") -- elseif(CUDA_GENERATION STREQUAL "Kepler") -- if(${CUDA_VERSION} VERSION_LESS "5.0") -- set(__cuda_arch_bin "3.0") -- else() -- set(__cuda_arch_bin "3.0 3.5") -- endif() -- elseif(CUDA_GENERATION STREQUAL "Auto") -- execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run" -- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/" -- RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out -- ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) -- 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}") -- endif() -- endif() -- -- if(NOT DEFINED __cuda_arch_bin) -- if(ANDROID) -- if (ARM) -- set(__cuda_arch_bin "3.2") -- set(__cuda_arch_ptx "") -- elseif(AARCH64) -- set(__cuda_arch_bin "5.3") -- set(__cuda_arch_ptx "") -- endif() -- else() -- if(${CUDA_VERSION} VERSION_LESS "5.0") -- set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0") -- elseif(${CUDA_VERSION} VERSION_GREATER "6.5") -- set(__cuda_arch_bin "2.0 2.1(2.0) 3.0 3.5") -- else() -- set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5") -- endif() -- set(__cuda_arch_ptx "3.0") -- endif() -- endif() -+ set(__cuda_arch_ptx "5.0") -+ set(__cuda_arch_bin "5.0") - - set(CUDA_ARCH_BIN ${__cuda_arch_bin} CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported") - set(CUDA_ARCH_PTX ${__cuda_arch_ptx} CACHE STRING "Specify 'virtual' PTX architectures to build PTX intermediate code for") -@@ -229,18 +188,40 @@ else() - endif() - - if(HAVE_CUDA) -+ set(CUDA_LIBS_PATH "") -+ foreach(p ${CUDA_LIBRARIES} ${CUDA_npp_LIBRARY}) -+ get_filename_component(_tmp ${p} PATH) -+ list(APPEND CUDA_LIBS_PATH ${_tmp}) -+ endforeach() -+ -+ if(HAVE_CUBLAS) -+ foreach(p ${CUDA_cublas_LIBRARY}) -+ get_filename_component(_tmp ${p} PATH) -+ list(APPEND CUDA_LIBS_PATH ${_tmp}) -+ endforeach() -+ endif() -+ -+ if(HAVE_CUFFT) -+ foreach(p ${CUDA_cufft_LIBRARY}) -+ get_filename_component(_tmp ${p} PATH) -+ list(APPEND CUDA_LIBS_PATH ${_tmp}) -+ endforeach() -+ endif() -+ -+ list(REMOVE_DUPLICATES CUDA_LIBS_PATH) -+ link_directories(${CUDA_LIBS_PATH}) -+ - set(CUDA_LIBRARIES_ABS ${CUDA_LIBRARIES}) -- ocv_create_imported_targets(CUDA_LIBRARIES ${CUDA_LIBRARIES}) -+ ocv_convert_to_lib_name(CUDA_LIBRARIES ${CUDA_LIBRARIES}) - set(CUDA_npp_LIBRARY_ABS ${CUDA_npp_LIBRARY}) -- ocv_create_imported_targets(CUDA_npp_LIBRARY ${CUDA_npp_LIBRARY}) -- -+ ocv_convert_to_lib_name(CUDA_npp_LIBRARY ${CUDA_npp_LIBRARY}) - if(HAVE_CUBLAS) - set(CUDA_cublas_LIBRARY_ABS ${CUDA_cublas_LIBRARY}) -- ocv_create_imported_targets(CUDA_cublas_LIBRARY ${CUDA_cublas_LIBRARY}) -+ ocv_convert_to_lib_name(CUDA_cublas_LIBRARY ${CUDA_cublas_LIBRARY}) - endif() - - if(HAVE_CUFFT) - set(CUDA_cufft_LIBRARY_ABS ${CUDA_cufft_LIBRARY}) -- ocv_create_imported_targets(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY}) -+ ocv_convert_to_lib_name(CUDA_cufft_LIBRARY ${CUDA_cufft_LIBRARY}) - endif() - endif() ---- a/cmake/templates/OpenCVConfig.cmake.in -+++ b/cmake/templates/OpenCVConfig.cmake.in -@@ -256,7 +256,7 @@ if(OpenCV_CUDA_VERSION) - - set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES}) - -- if(${CUDA_VERSION} VERSION_LESS "5.5") -+ if(CUDA_VERSION VERSION_LESS "5.5") - list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY}) - else() - find_cuda_helper_libs(nppc) -@@ -281,14 +281,16 @@ if(OpenCV_CUDA_VERSION) - list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES}) - endif() - -+ set(OpenCV_CUDA_LIBS_RELPATH "") - foreach(l ${OpenCV_CUDA_LIBS_ABSPATH}) -- get_filename_component(_tmp "${l}" NAME_WE) -- string(REGEX REPLACE "^lib" "" _tmp "${_tmp}") -- if(NOT TARGET "opencv_dep_${_tmp}") # protect against repeated inclusions -- add_library("opencv_dep_${_tmp}" UNKNOWN IMPORTED) -- set_target_properties("opencv_dep_${_tmp}" PROPERTIES IMPORTED_LOCATION "${l}") -+ get_filename_component(_tmp ${l} PATH) -+ if(NOT ${_tmp} MATCHES "-Wl.*") -+ list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp}) - endif() - endforeach() -+ -+ list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH) -+ link_directories(${OpenCV_CUDA_LIBS_RELPATH}) - endif() - - # ============================================================== diff --git a/ports/opencv2/0019-fix-openexr.patch b/ports/opencv2/0019-fix-openexr.patch index 5702bb5470..533ce2d849 100644 --- a/ports/opencv2/0019-fix-openexr.patch +++ b/ports/opencv2/0019-fix-openexr.patch @@ -1,5 +1,3 @@ -diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake -index 9b43066..c1cc11f 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -151,7 +151,12 @@ if(WITH_OPENEXR) @@ -16,8 +14,6 @@ index 9b43066..c1cc11f 100644 endif() if(NOT OPENEXR_FOUND) -diff --git a/modules/highgui/src/grfmt_exr.cpp b/modules/highgui/src/grfmt_exr.cpp -index 399e586..b8cd270 100644 --- a/modules/highgui/src/grfmt_exr.cpp +++ b/modules/highgui/src/grfmt_exr.cpp @@ -57,6 +57,7 @@ diff --git a/ports/opencv2/0020-missing-include.patch b/ports/opencv2/0020-missing-include.patch index 2967ebf35a..d5390a1340 100644 --- a/ports/opencv2/0020-missing-include.patch +++ b/ports/opencv2/0020-missing-include.patch @@ -1,5 +1,3 @@ -diff --git a/modules/ts/src/gpu_test.cpp b/modules/ts/src/gpu_test.cpp -index 21d9ad9..a626b0b 100644 --- a/modules/ts/src/gpu_test.cpp +++ b/modules/ts/src/gpu_test.cpp @@ -42,6 +42,7 @@ diff --git a/ports/opencv2/portfile.cmake b/ports/opencv2/portfile.cmake index 28d2213768..6e673cbcf5 100644 --- a/ports/opencv2/portfile.cmake +++ b/ports/opencv2/portfile.cmake @@ -1,18 +1,13 @@ -file(READ "${CMAKE_CURRENT_LIST_DIR}/vcpkg.json" _contents) -string(JSON OPENCV_VERSION GET "${_contents}" version) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO opencv/opencv - REF ${OPENCV_VERSION} + REF "${VERSION}" SHA512 de7d24ac7ed78ac14673011cbecc477cae688b74222a972e553c95a557b5cb8e5913f97db525421d6a72af30998ca300112fa0b285daed65f65832eb2cf7241a HEAD_REF master PATCHES 0001-install-options.patch 0002-fix-paths-containing-symbols.patch 0003-force-package-requirements.patch - 0004-add-ffmpeg-missing-defines.patch - 0005-fix-cuda.patch 0006-fix-jasper.patch 0007-fix-config.patch 0019-fix-openexr.patch @@ -20,17 +15,16 @@ vcpkg_from_github( ) # Disallow accidental build of vendored copies file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr") - file(REMOVE "${SOURCE_PATH}/cmake/FindCUDA.cmake") file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindCUDA") vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES - "cuda" WITH_CUDA "eigen" WITH_EIGEN - "ffmpeg" WITH_FFMPEG + "gtk" WITH_GTK "jasper" WITH_JASPER "jpeg" WITH_JPEG + "msmf" WITH_MSMF "openexr" WITH_OPENEXR "opengl" WITH_OPENGL "png" WITH_PNG @@ -40,37 +34,6 @@ FEATURES "dc1394" WITH_1394 ) -set(WITH_MSMF ON) -if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW) - set(WITH_MSMF OFF) -endif() - -set(WITH_GTK OFF) -if("gtk" IN_LIST FEATURES) - if(VCPKG_TARGET_IS_LINUX) - set(WITH_GTK ON) - else() - message(WARNING "The gtk module cannot be enabled outside Linux") - endif() -endif() - -set(WITH_PYTHON OFF) -if("python" IN_LIST FEATURES) - if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX) - message(STATUS "You need to manually ensure that python2 virtualenv module is installed") - message("This might require running") - message("wget https://bootstrap.pypa.io/pip/2.7/get-pip.py") - message("and then") - message("/usr/bin/python2 get-pip.py") - message("and finally") - message("pip install virtualenv") - message("On some system, these commands must be run as root, otherwise error about virtualenv module missing will persist!") - endif() - x_vcpkg_get_python_packages(PYTHON_VERSION "2" PACKAGES numpy OUT_PYTHON_VAR "PYTHON2") - set(ENV{PYTHON} "${PYTHON2}") - set(WITH_PYTHON ON) -endif() - string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT_LNK) vcpkg_cmake_configure( @@ -105,13 +68,13 @@ vcpkg_cmake_configure( -DWITH_1394=OFF -DWITH_IPP=OFF -DWITH_LAPACK=OFF - -DWITH_MSMF=${WITH_MSMF} -DWITH_OPENCLAMDBLAS=OFF -DWITH_OPENMP=OFF - -DWITH_PYTHON=${WITH_PYTHON} + -DWITH_PYTHON=OFF + -DWITH_FFMPEG=OFF -DWITH_ZLIB=ON - -WITH_GTK=${WITH_GTK} - -DWITH_CUBLAS=OFF # newer libcublas cannot be found by the old cuda cmake script in opencv2, requires a fix + -DWITH_CUBLAS=OFF + -DWITH_CUDA=OFF -DOPENCV_LAPACK_FIND_PACKAGE_ONLY=ON ) @@ -127,9 +90,6 @@ find_dependency(Threads)") if("tiff" IN_LIST FEATURES) string(APPEND DEPS_STRING "\nfind_dependency(TIFF)") endif() - if("cuda" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(CUDA)") - endif() if("openexr" IN_LIST FEATURES) string(APPEND DEPS_STRING "\nfind_dependency(Imath CONFIG)\nfind_dependency(OpenEXR CONFIG)") endif() @@ -165,4 +125,6 @@ vcpkg_fixup_pkgconfig() configure_file("${CURRENT_PORT_DIR}/usage.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY) -file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +file(GLOB extra_license_files "${CURRENT_PACKAGES_DIR}/share/licenses/opencv2/*") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" ${extra_license_files}) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/licenses") diff --git a/ports/opencv2/usage.in b/ports/opencv2/usage.in index 0e9e4b3a1d..217ce72976 100644 --- a/ports/opencv2/usage.in +++ b/ports/opencv2/usage.in @@ -1,4 +1,4 @@ -The package @PORT@ is compatible with CMake if you set the OpenCV_DIR *before* the find_package call +@PORT@ is compatible with built-in CMake variables. In case of multiple OpenCV version installed, set OpenCV_ROOT *before* the find_package call: - set(OpenCV_DIR "${VCPKG_INSTALLED_DIR}/@TARGET_TRIPLET@/share/@PORT@") + set(OpenCV_ROOT "${VCPKG_INSTALLED_DIR}/@TARGET_TRIPLET@/share/@PORT@") find_package(OpenCV REQUIRED) diff --git a/ports/opencv2/vcpkg.json b/ports/opencv2/vcpkg.json index df51bffc79..831ec3aff0 100644 --- a/ports/opencv2/vcpkg.json +++ b/ports/opencv2/vcpkg.json @@ -1,11 +1,11 @@ { "name": "opencv2", "version": "2.4.13.7", - "port-version": 20, + "port-version": 21, "description": "Open Source Computer Vision Library", "homepage": "https://github.com/opencv/opencv", "license": "BSD-3-Clause", - "supports": "!uwp & !(arm & windows)", + "supports": "!uwp & !(arm & windows) & !android", "dependencies": [ { "name": "vcpkg-cmake", @@ -15,22 +15,12 @@ "name": "vcpkg-cmake-config", "host": true }, - { - "name": "vcpkg-get-python-packages", - "host": true - }, "zlib" ], "default-features": [ "default-features" ], "features": { - "cuda": { - "description": "CUDA support for opencv", - "dependencies": [ - "cuda" - ] - }, "dc1394": { "description": "Dc1394 support for opencv", "dependencies": [ @@ -54,9 +44,9 @@ "name": "opencv2", "default-features": false, "features": [ - "gtk" + "msmf" ], - "platform": "linux" + "platform": "windows & !mingw" } ] }, @@ -66,25 +56,11 @@ "eigen3" ] }, - "ffmpeg": { - "description": "ffmpeg support for opencv", - "dependencies": [ - { - "name": "ffmpeg", - "default-features": false, - "features": [ - "avcodec", - "avformat", - "swresample", - "swscale" - ] - } - ] - }, "gtk": { "description": "GTK support for opencv", + "supports": "linux", "dependencies": [ - "gtk" + "gtk3" ] }, "jasper": { @@ -99,6 +75,10 @@ "libjpeg-turbo" ] }, + "msmf": { + "description": "Microsoft Media Foundation support for opencv", + "supports": "windows & !mingw" + }, "openexr": { "description": "OpenEXR support for opencv", "dependencies": [ @@ -118,9 +98,6 @@ "libpng" ] }, - "python": { - "description": "Python wrapper support for opencv" - }, "qt": { "description": "Qt GUI support for opencv", "dependencies": [ diff --git a/ports/opencv3/0005-fix-vtk9.patch b/ports/opencv3/0005-fix-vtk9.patch index 967cc9e94d..5976bfead2 100644 --- a/ports/opencv3/0005-fix-vtk9.patch +++ b/ports/opencv3/0005-fix-vtk9.patch @@ -37,8 +37,6 @@ # VTK 5.x components if(NOT VTK_FOUND) -diff --git a/modules/viz/CMakeLists.txt b/modules/viz/CMakeLists.txt -index 256b464..92698c3 100644 --- a/modules/viz/CMakeLists.txt +++ b/modules/viz/CMakeLists.txt @@ -3,7 +3,6 @@ if(NOT HAVE_VTK) @@ -65,8 +63,6 @@ index 256b464..92698c3 100644 if(APPLE AND BUILD_opencv_viz) ocv_target_link_libraries(${the_module} PRIVATE "-framework Cocoa") -diff --git a/modules/viz/src/precomp.hpp b/modules/viz/src/precomp.hpp -index f92fdb6..4c4bf7c 100644 --- a/modules/viz/src/precomp.hpp +++ b/modules/viz/src/precomp.hpp @@ -133,7 +133,8 @@ @@ -91,8 +87,6 @@ index f92fdb6..4c4bf7c 100644 #include #include -diff --git a/modules/viz/src/types.cpp b/modules/viz/src/types.cpp -index 65571a1..e9a470c 100644 --- a/modules/viz/src/types.cpp +++ b/modules/viz/src/types.cpp @@ -97,10 +97,12 @@ cv::viz::Mesh cv::viz::Mesh::load(const String& file, int type) @@ -131,6 +125,16 @@ index 65571a1..e9a470c 100644 window_->AddRenderer(renderer_); // Create the interactor style +--- a/modules/viz/src/vtk/vtkCocoaInteractorFix.mm ++++ b/modules/viz/src/vtk/vtkCocoaInteractorFix.mm +@@ -49,6 +49,7 @@ + #include + #include + #include ++#include + + namespace cv { namespace viz { + vtkSmartPointer vtkCocoaRenderWindowInteractorNew(); --- a/modules/viz/src/vtk/vtkOBJWriter.cpp +++ b/modules/viz/src/vtk/vtkOBJWriter.cpp @@ -72,7 +72,7 @@ void cv::viz::vtkOBJWriter::WriteData() diff --git a/ports/opencv3/0007-fix-hdf5.patch b/ports/opencv3/0007-contrib-fix-hdf5.patch similarity index 100% rename from ports/opencv3/0007-fix-hdf5.patch rename to ports/opencv3/0007-contrib-fix-hdf5.patch diff --git a/ports/opencv3/0013-fix-ceres.patch b/ports/opencv3/0013-contrib-fix-ceres.patch similarity index 100% rename from ports/opencv3/0013-fix-ceres.patch rename to ports/opencv3/0013-contrib-fix-ceres.patch diff --git a/ports/opencv3/0014-fix-pkgconf-name.patch b/ports/opencv3/0014-fix-pkgconf-name.patch new file mode 100644 index 0000000000..cf88d32f1f --- /dev/null +++ b/ports/opencv3/0014-fix-pkgconf-name.patch @@ -0,0 +1,11 @@ +--- a/cmake/OpenCVGenPkgconfig.cmake ++++ b/cmake/OpenCVGenPkgconfig.cmake +@@ -45,7 +45,7 @@ if(NOT DEFINED CMAKE_HELPER_SCRIPT) + if(INSTALL_TO_MANGLED_PATHS) + set(OPENCV_PC_FILE_NAME "opencv-${OPENCV_VERSION}.pc") + else() +- set(OPENCV_PC_FILE_NAME opencv.pc) ++ set(OPENCV_PC_FILE_NAME opencv3.pc) + endif() + + # build the list of opencv libs and dependencies for all modules diff --git a/ports/opencv3/0020-fix-supportqnx.patch b/ports/opencv3/0015-fix-supportqnx.patch similarity index 87% rename from ports/opencv3/0020-fix-supportqnx.patch rename to ports/opencv3/0015-fix-supportqnx.patch index be592ba4e2..53f614e2fc 100644 --- a/ports/opencv3/0020-fix-supportqnx.patch +++ b/ports/opencv3/0015-fix-supportqnx.patch @@ -1,5 +1,3 @@ -diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp -index 9bade08..28f006e 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -129,11 +129,15 @@ void* allocSingletonNewBuffer(size_t size) { return malloc(size); } diff --git a/ports/opencv3/0016-fix-freetype-contrib.patch b/ports/opencv3/0016-contrib-fix-freetype.patch similarity index 100% rename from ports/opencv3/0016-fix-freetype-contrib.patch rename to ports/opencv3/0016-contrib-fix-freetype.patch diff --git a/ports/opencv3/0019-missing-include.patch b/ports/opencv3/0017-missing-include.patch similarity index 64% rename from ports/opencv3/0019-missing-include.patch rename to ports/opencv3/0017-missing-include.patch index 2da142b0af..52cdea0309 100644 --- a/ports/opencv3/0019-missing-include.patch +++ b/ports/opencv3/0017-missing-include.patch @@ -1,5 +1,3 @@ -diff --git a/modules/dnn/src/op_halide.cpp b/modules/dnn/src/op_halide.cpp -index c96971bc6aac..d107e01887d0 100644 --- a/modules/dnn/src/op_halide.cpp +++ b/modules/dnn/src/op_halide.cpp @@ -11,6 +11,7 @@ diff --git a/ports/opencv3/0018-fix-depend-tesseract.patch b/ports/opencv3/0018-contrib-fix-tesseract.patch similarity index 100% rename from ports/opencv3/0018-fix-depend-tesseract.patch rename to ports/opencv3/0018-contrib-fix-tesseract.patch diff --git a/ports/opencv3/fix-tbb-error.patch b/ports/opencv3/0019-fix-tbb.patch similarity index 72% rename from ports/opencv3/fix-tbb-error.patch rename to ports/opencv3/0019-fix-tbb.patch index e5f4b58c36..60956dcc2a 100644 --- a/ports/opencv3/fix-tbb-error.patch +++ b/ports/opencv3/0019-fix-tbb.patch @@ -1,5 +1,3 @@ -diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp -index a4a7baf..b5981eb 100644 --- a/modules/core/src/parallel.cpp +++ b/modules/core/src/parallel.cpp @@ -101,7 +101,6 @@ diff --git a/ports/opencv3/portfile.cmake b/ports/opencv3/portfile.cmake index a9bd5c140c..b86f7ced44 100644 --- a/ports/opencv3/portfile.cmake +++ b/ports/opencv3/portfile.cmake @@ -1,13 +1,9 @@ -file(READ "${CMAKE_CURRENT_LIST_DIR}/vcpkg.json" _contents) -string(JSON OPENCV_VERSION GET "${_contents}" version) - set(USE_QT_VERSION "5") -set(ENABLE_CXX11 ON) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO opencv/opencv - REF ${OPENCV_VERSION} + REF "${VERSION}" SHA512 96bbeb9525325f17ba635a0b75126aae0a7b0daef211af45057a97abd5d31a57fc50f0e889a6dab614df9b7621a145e06c0d240f0a218f33df1217d9a19c510d HEAD_REF master PATCHES @@ -22,12 +18,14 @@ vcpkg_from_github( 0010-fix-uwp-tiff-imgcodecs.patch 0011-remove-python2.patch 0012-fix-zlib.patch - 0019-missing-include.patch - fix-tbb-error.patch - 0020-fix-supportqnx.patch + 0014-fix-pkgconf-name.patch + 0015-fix-supportqnx.patch + 0017-missing-include.patch + 0019-fix-tbb.patch ) # Disallow accidental build of vendored copies file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr") +file(REMOVE "${SOURCE_PATH}/cmake/FindCUDNN.cmake") if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") set(TARGET_IS_AARCH64 1) @@ -39,97 +37,79 @@ else() set(TARGET_IS_X86 1) endif() -file(REMOVE "${SOURCE_PATH}/cmake/FindCUDNN.cmake") +if (USE_QT_VERSION STREQUAL "6") + set(QT_CORE5COMPAT "Core5Compat") + set(QT_OPENGLWIDGETS "OpenGLWidgets") +endif() string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT) +# Cannot use vcpkg_check_features() for "qt" because it requires the QT version number passed, not just a boolean vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES - "contrib" WITH_CONTRIB - "cuda" WITH_CUBLAS - "cuda" WITH_CUDA - "dnn" BUILD_opencv_dnn - "eigen" WITH_EIGEN - "ffmpeg" WITH_FFMPEG - "flann" BUILD_opencv_flann - "freetype" WITH_FREETYPE - "gdcm" WITH_GDCM - "gstreamer" WITH_GSTREAMER - "halide" WITH_HALIDE - "jasper" WITH_JASPER - "jpeg" WITH_JPEG - "lapack" WITH_LAPACK - "nonfree" OPENCV_ENABLE_NONFREE - "openexr" WITH_OPENEXR - "opengl" WITH_OPENGL - "png" WITH_PNG - "quirc" WITH_QUIRC - "sfm" BUILD_opencv_sfm - "tiff" WITH_TIFF - "vtk" WITH_VTK - "webp" WITH_WEBP - "world" BUILD_opencv_world - "dc1394" WITH_1394 + "bgsegm" BUILD_opencv_bgsegm + "contrib" WITH_CONTRIB + "dc1394" WITH_1394 + "dnn" BUILD_opencv_dnn + "eigen" WITH_EIGEN + "flann" BUILD_opencv_flann + "flann" PROTOBUF_UPDATE_FILES + "flann" UPDATE_PROTO_FILES + "flann" WITH_PROTOBUF + "freetype" WITH_FREETYPE + "gdcm" WITH_GDCM + "gstreamer" WITH_GSTREAMER + "gtk" WITH_GTK + "halide" WITH_HALIDE + "ipp" WITH_IPP + "ipp" BUILD_IPP_IW + "jasper" WITH_JASPER + "jpeg" WITH_JPEG + "lapack" WITH_LAPACK + "line-descriptor" BUILD_opencv_line_descriptor + "msmf" WITH_MSMF + "nonfree" OPENCV_ENABLE_NONFREE + "openexr" WITH_OPENEXR + "opengl" WITH_OPENGL + "openmp" WITH_OPENMP + "ovis" BUILD_opencv_ovis + "png" WITH_PNG + "python" BUILD_opencv_python3 + "python" WITH_PYTHON + "quality" BUILD_opencv_quality + "quirc" WITH_QUIRC + "saliency" BUILD_opencv_saliency + "sfm" BUILD_opencv_sfm + "tbb" WITH_TBB + "tiff" WITH_TIFF + "vtk" WITH_VTK + "webp" WITH_WEBP + "world" BUILD_opencv_world ) -# Cannot use vcpkg_check_features() for "dnn", "gtk", ipp", "openmp", "ovis", "python", "qt", "tbb" -set(BUILD_opencv_dnn OFF) -if("dnn" IN_LIST FEATURES) - if(NOT VCPKG_TARGET_IS_ANDROID) - set(BUILD_opencv_dnn ON) - else() - message(WARNING "The dnn module cannot be enabled on Android") - endif() -endif() - -set(WITH_GTK OFF) -if("gtk" IN_LIST FEATURES) - if(VCPKG_TARGET_IS_LINUX) - set(WITH_GTK ON) - else() - message(WARNING "The gtk module cannot be enabled outside Linux") - endif() -endif() - +# Cannot use vcpkg_check_features() for "python", "qt" set(WITH_QT OFF) if("qt" IN_LIST FEATURES) set(WITH_QT ${USE_QT_VERSION}) endif() -set(WITH_IPP OFF) -if("ipp" IN_LIST FEATURES) - set(WITH_IPP ON) -endif() - -set(WITH_OPENMP OFF) -if("openmp" IN_LIST FEATURES) - if(NOT VCPKG_TARGET_IS_OSX) - set(WITH_OPENMP ON) - else() - message(WARNING "The OpenMP feature is not supported on macOS") - endif() -endif() - -set(BUILD_opencv_ovis OFF) -if("ovis" IN_LIST FEATURES) - set(BUILD_opencv_ovis ON) -endif() - -set(WITH_TBB OFF) -if("tbb" IN_LIST FEATURES) - set(WITH_TBB ON) -endif() - -set(WITH_PYTHON OFF) -set(BUILD_opencv_python3 OFF) if("python" IN_LIST FEATURES) - if (VCPKG_LIBRARY_LINKAGE STREQUAL static AND VCPKG_TARGET_IS_WINDOWS) - message(WARNING "The python module is currently unsupported on Windows when building static OpenCV libraries") - else() - x_vcpkg_get_python_packages(PYTHON_VERSION "3" PACKAGES numpy OUT_PYTHON_VAR "PYTHON3") - set(ENV{PYTHON} "${PYTHON3}") - set(BUILD_opencv_python3 ON) - set(WITH_PYTHON ON) + x_vcpkg_get_python_packages(PYTHON_VERSION "3" PACKAGES numpy OUT_PYTHON_VAR "PYTHON3") + set(ENV{PYTHON} "${PYTHON3}") + file(GLOB _py3_include_path "${CURRENT_INSTALLED_DIR}/include/python3*") + string(REGEX MATCH "python3\\.([0-9]+)" _python_version_tmp ${_py3_include_path}) + set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_1}") + set(python_ver "3.${PYTHON_VERSION_MINOR}") + list(APPEND PYTHON_EXTRA_DEFINES_RELEASE + "-D__INSTALL_PATH_PYTHON3=${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2" + "-DOPENCV_PYTHON_INSTALL_PATH=${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}" + ) + list(APPEND PYTHON_EXTRA_DEFINES_DEBUG + "-D__INSTALL_PATH_PYTHON3=${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/cv2" + "-DOPENCV_PYTHON_INSTALL_PATH=${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}" + ) + if(EXISTS "${CURRENT_INSTALLED_DIR}/${PYTHON3_SITE}/cv2") + message(FATAL_ERROR "You cannot install opencv3[python] if opencv4[python] is already present.") endif() endif() @@ -141,29 +121,18 @@ if("dnn" IN_LIST FEATURES) ) endif() -# Build image quality module when building with 'contrib' feature and not UWP. -set(BUILD_opencv_quality OFF) if("contrib" IN_LIST FEATURES) - if (VCPKG_TARGET_IS_UWP) - set(BUILD_opencv_quality OFF) - message(WARNING "The image quality module (quality) does not build for UWP, the module has been disabled.") - # The hdf module is silently disabled by OpenCVs buildsystem if HDF5 is not detected. - message(WARNING "The hierarchical data format module (hdf) depends on HDF5 which doesn't support UWP, the module has been disabled.") - else() - set(BUILD_opencv_quality CMAKE_DEPENDS_IN_PROJECT_ONLY) - endif() - vcpkg_from_github( OUT_SOURCE_PATH CONTRIB_SOURCE_PATH REPO opencv/opencv_contrib - REF ${OPENCV_VERSION} - SHA512 a051497e61ae55f86c224044487fc2247a3bba1aa27031c4997c981ddf8402edf82f1dd0d307f562c638bc021cfd8bd42a723973f00ab25131495f84d33c5383 + REF "${VERSION}" + SHA512 a051497e61ae55f86c224044487fc2247a3bba1aa27031c4997c981ddf8402edf82f1dd0d307f562c638bc021cfd8bd42a723973f00ab25131495f84d33c5383 HEAD_REF master PATCHES - 0007-fix-hdf5.patch - 0013-fix-ceres.patch - 0016-fix-freetype-contrib.patch - 0018-fix-depend-tesseract.patch + 0007-contrib-fix-hdf5.patch + 0013-contrib-fix-ceres.patch + 0016-contrib-fix-freetype.patch + 0018-contrib-fix-tesseract.patch ) set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") @@ -208,34 +177,26 @@ if("contrib" IN_LIST FEATURES) ) endif() -if(WITH_IPP) +if("ipp" IN_LIST FEATURES) if(VCPKG_TARGET_IS_OSX) - if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") - vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/a56b6ac6f030c312b2dce17430eef13aed9af274/ippicv/ippicv_2020_mac_intel64_20191018_general.tgz" - FILENAME "opencv-cache/ippicv/1c3d675c2a2395d094d523024896e01b-ippicv_2020_mac_intel64_20191018_general.tgz" - SHA512 454dfaaa245e3a3b2f1ffb1aa8e27e280b03685009d66e147482b14e5796fdf2d332cac0f9b0822caedd5760fda4ee0ce2961889597456bbc18202f10bf727cd + vcpkg_download_distfile(OCV_DOWNLOAD + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/a56b6ac6f030c312b2dce17430eef13aed9af274/ippicv/ippicv_2020_mac_intel64_20191018_general.tgz" + FILENAME "opencv-cache/ippicv/1c3d675c2a2395d094d523024896e01b-ippicv_2020_mac_intel64_20191018_general.tgz" + SHA512 454dfaaa245e3a3b2f1ffb1aa8e27e280b03685009d66e147482b14e5796fdf2d332cac0f9b0822caedd5760fda4ee0ce2961889597456bbc18202f10bf727cd ) - else() - message(WARNING "This target architecture is not supported IPPICV") - set(WITH_IPP OFF) - endif() elseif(VCPKG_TARGET_IS_LINUX) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") vcpkg_download_distfile(OCV_DOWNLOAD URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/a56b6ac6f030c312b2dce17430eef13aed9af274/ippicv/ippicv_2020_lnx_intel64_20191018_general.tgz" FILENAME "opencv-cache/ippicv/7421de0095c7a39162ae13a6098782f9-ippicv_2020_lnx_intel64_20191018_general.tgz" SHA512 de6d80695cd6deef359376476edc4ff85fdddcf94972b936e0017f8a48aaa5d18f55c4253ae37deb83bff2f71410f68408063c88b5f3bf4df3c416aa93ceca87 - ) + ) elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") vcpkg_download_distfile(OCV_DOWNLOAD URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/a56b6ac6f030c312b2dce17430eef13aed9af274/ippicv/ippicv_2020_lnx_ia32_20191018_general.tgz" FILENAME "opencv-cache/ippicv/ad189a940fb60eb71f291321322fe3e8-ippicv_2020_lnx_ia32_20191018_general.tgz" SHA512 5ca9dafc3a634e2a5f83f6a498611c990ef16d54358e9b44574b01694e9d64b118d46d6e2011506e40d37e5a9865f576f790e37ff96b7c8b503507633631a296 - ) - else() - message(WARNING "This target architecture is not supported IPPICV") - set(WITH_IPP OFF) + ) endif() elseif(VCPKG_TARGET_IS_WINDOWS) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") @@ -250,45 +211,13 @@ if(WITH_IPP) FILENAME "opencv-cache/ippicv/cd39bdf0c2e1cac9a61101dad7a2413e-ippicv_2020_win_ia32_20191018_general.zip" SHA512 058d00775d9f16955c7a557d554b8c2976ab9dbad4ba3fdb9823c0f768809edbd835e4397f01dc090a9bc80d81de834375e7006614d2a898f42e8004de0e04bf ) - else() - message(WARNING "This target architecture is not supported IPPICV") - set(WITH_IPP OFF) endif() - else() - message(WARNING "This target architecture is not supported IPPICV") - set(WITH_IPP OFF) - endif() -endif() - -set(WITH_MSMF ON) -if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_MINGW) - set(WITH_MSMF OFF) -endif() - -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - if (WITH_TBB) - message(WARNING "TBB is currently unsupported in this build configuration, turning it off") - set(WITH_TBB OFF) - endif() - - if (VCPKG_TARGET_IS_WINDOWS AND BUILD_opencv_ovis) - message(WARNING "OVIS is currently unsupported in this build configuration, turning it off") - set(BUILD_opencv_ovis OFF) - endif() -endif() - -if("ffmpeg" IN_LIST FEATURES) - if(VCPKG_TARGET_IS_UWP) - set(VCPKG_C_FLAGS "/sdl- ${VCPKG_C_FLAGS}") - set(VCPKG_CXX_FLAGS "/sdl- ${VCPKG_CXX_FLAGS}") endif() endif() if("halide" IN_LIST FEATURES) - set(ENABLE_CXX11 OFF) list(APPEND ADDITIONAL_BUILD_FLAGS # Halide 13 requires C++17 - "-DCMAKE_CXX_STANDARD=17" "-DCMAKE_CXX_STANDARD_REQUIRED=ON" "-DCMAKE_DISABLE_FIND_PACKAGE_Halide=ON" "-DHALIDE_ROOT_DIR=${CURRENT_INSTALLED_DIR}" @@ -299,24 +228,19 @@ if("qt" IN_LIST FEATURES) list(APPEND ADDITIONAL_BUILD_FLAGS "-DCMAKE_AUTOMOC=ON") endif() -set(BUILD_opencv_line_descriptor ON) -set(BUILD_opencv_saliency ON) -set(BUILD_opencv_bgsegm ON) -if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm") - set(BUILD_opencv_line_descriptor OFF) - set(BUILD_opencv_saliency OFF) - set(BUILD_opencv_bgsegm OFF) -endif() - vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + ###### Verify that required components and only those are enabled + -DENABLE_CONFIG_VERIFICATION=ON ###### opencv cpu recognition is broken, always using host and not target: here we bypass that -DOPENCV_SKIP_SYSTEM_PROCESSOR_DETECTION=TRUE -DAARCH64=${TARGET_IS_AARCH64} -DX86_64=${TARGET_IS_X86_64} -DX86=${TARGET_IS_X86} -DARM=${TARGET_IS_ARM} + ###### use c++17 to enable features that fail with c++11 (halide, protobuf, etc.) + -DCMAKE_CXX_STANDARD=17 ###### ocv_options -DINSTALL_TO_MANGLED_PATHS=OFF -DOpenCV_INSTALL_BINARIES_PREFIX= @@ -335,37 +259,34 @@ vcpkg_cmake_configure( # Do not build docs/examples -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF + -DBUILD_PERF_TESTS=OFF + -DBUILD_TESTS=OFF ###### Disable build 3rd party libs + -DBUILD_IPP_IW=OFF + -DBUILD_ITT=OFF -DBUILD_JASPER=OFF -DBUILD_JPEG=OFF -DBUILD_OPENEXR=OFF + -DBUILD_OPENJPEG=OFF -DBUILD_PNG=OFF + -DBUILD_PROTOBUF=OFF + -DBUILD_TBB=OFF -DBUILD_TIFF=OFF -DBUILD_WEBP=OFF -DBUILD_ZLIB=OFF - -DBUILD_TBB=OFF - -DBUILD_ITT=OFF - ###### Disable build 3rd party components - -DBUILD_PROTOBUF=OFF + -DOPENCV_LAPACK_FIND_PACKAGE_ONLY=ON ###### OpenCV Build components -DBUILD_opencv_apps=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_js=OFF - -DBUILD_opencv_bgsegm=${BUILD_opencv_bgsegm} - -DBUILD_opencv_line_descriptor=${BUILD_opencv_line_descriptor} - -DBUILD_opencv_saliency=${BUILD_opencv_saliency} + -DBUILD_JAVA=OFF -DBUILD_ANDROID_PROJECT=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DBUILD_PACKAGE=OFF - -DBUILD_PERF_TESTS=OFF - -DBUILD_TESTS=OFF -DBUILD_WITH_DEBUG_INFO=ON -DBUILD_WITH_STATIC_CRT=${BUILD_WITH_STATIC_CRT} - -DBUILD_JAVA=OFF -DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR} ###### PROTOBUF - -DPROTOBUF_UPDATE_FILES=${BUILD_opencv_flann} - -DUPDATE_PROTO_FILES=${BUILD_opencv_flann} ###### PYLINT/FLAKE8 -DENABLE_PYLINT=OFF -DENABLE_FLAKE8=OFF @@ -373,36 +294,39 @@ vcpkg_cmake_configure( -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON -DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON # ENABLE - -DENABLE_CXX11=${ENABLE_CXX11} + -DENABLE_CXX11=ON ###### OPENCV vars "-DOPENCV_DOWNLOAD_PATH=${DOWNLOADS}/opencv-cache" ${BUILD_WITH_CONTRIB_FLAG} - -DOPENCV_OTHER_INSTALL_PATH=share/opencv + -DOPENCV_OTHER_INSTALL_PATH=share/opencv3 ###### customized properties ## Options from vcpkg_check_features() ${FEATURE_OPTIONS} - -DWITH_GTK=${WITH_GTK} -DWITH_QT=${WITH_QT} - -DWITH_IPP=${WITH_IPP} -DWITH_MATLAB=OFF - -DWITH_MSMF=${WITH_MSMF} - -DWITH_OPENMP=${WITH_OPENMP} - -DWITH_PROTOBUF=${BUILD_opencv_flann} - -DWITH_PYTHON=${WITH_PYTHON} - -DWITH_OPENCLAMDBLAS=OFF - -DWITH_TBB=${WITH_TBB} -DWITH_OPENJPEG=OFF -DWITH_CPUFEATURES=OFF - ###### BUILD_options (mainly modules which require additional libraries) - -DBUILD_opencv_ovis=${BUILD_opencv_ovis} - -DBUILD_opencv_dnn=${BUILD_opencv_dnn} - -DBUILD_opencv_python3=${BUILD_opencv_python3} - ###### The following modules are disabled for UWP - -DBUILD_opencv_quality=${BUILD_opencv_quality} + -DWITH_SPNG=OFF + -DWITH_OPENCLAMDFFT=OFF + -DWITH_OPENCLAMDBLAS=OFF + -DWITH_OPENCL_D3D11_NV=OFF + -DWITH_ITT=OFF + -DWITH_NVCUVID=OFF + -DWITH_NVCUVENC=OFF + -DWITH_AVIF=OFF + -DWITH_VA=OFF + -DWITH_VA_INTEL=OFF + -DWITH_FFMPEG=OFF + -DWITH_CUDA=OFF + -DWITH_CUBLAS=OFF ###### Additional build flags ${ADDITIONAL_BUILD_FLAGS} - -DBUILD_IPP_IW=${WITH_IPP} - -DOPENCV_LAPACK_FIND_PACKAGE_ONLY=ON + OPTIONS_RELEASE + ###### Python install path + ${PYTHON_EXTRA_DEFINES_RELEASE} + OPTIONS_DEBUG + ###### Python install path + ${PYTHON_EXTRA_DEFINES_DEBUG} ) vcpkg_cmake_install() @@ -418,9 +342,8 @@ if (NOT VCPKG_BUILD_TYPE) ) endif() -if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - file(READ "${CURRENT_PACKAGES_DIR}/share/opencv3/OpenCVModules.cmake" OPENCV_MODULES) - set(DEPS_STRING "include(CMakeFindDependencyMacro) +file(READ "${CURRENT_PACKAGES_DIR}/share/opencv3/OpenCVModules.cmake" OPENCV_MODULES) +set(DEPS_STRING "include(CMakeFindDependencyMacro) if(${BUILD_opencv_flann} AND NOT TARGET libprotobuf) #Check if the CMake target libprotobuf is already defined find_dependency(Protobuf CONFIG REQUIRED) if(TARGET protobuf::libprotobuf) @@ -438,105 +361,210 @@ if(${BUILD_opencv_flann} AND NOT TARGET libprotobuf) #Check if the CMake target endif() endif() find_dependency(Threads)") - if("tiff" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(TIFF)") - endif() - if("cuda" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(CUDA)") - endif() - if(BUILD_opencv_quality) - string(APPEND DEPS_STRING " +if("tiff" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(TIFF)") +endif() +if("cuda" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(CUDA)") +endif() +if("ffmpeg" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(FFMPEG)") +endif() +if("contrib" IN_LIST FEATURES AND NOT VCPKG_TARGET_IS_UWP AND NOT VCPKG_TARGET_IS_IOS AND NOT (VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")) + string(APPEND DEPS_STRING " # C language is required for try_compile tests in FindHDF5 enable_language(C) find_dependency(HDF5) find_dependency(Tesseract)") - endif() - if(WITH_TBB) - string(APPEND DEPS_STRING "\nfind_dependency(TBB)") - endif() - if("vtk" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(VTK)") - endif() - if("sfm" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(gflags CONFIG)\nfind_dependency(Ceres CONFIG)") - endif() - if("eigen" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(Eigen3 CONFIG)") - endif() - if("lapack" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(LAPACK)") - endif() - if("openexr" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(OpenEXR CONFIG)") - endif() - if(WITH_OPENMP) - string(APPEND DEPS_STRING "\nfind_dependency(OpenMP)") - endif() - if(BUILD_opencv_ovis) - string(APPEND DEPS_STRING "\nfind_dependency(Ogre)\nfind_dependency(freetype)") - endif() - if("quirc" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(quirc)") - endif() - if("qt" IN_LIST FEATURES) - string(APPEND DEPS_STRING " +endif() +if("freetype" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(harfbuzz)") +endif() +if("tbb" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(TBB)") +endif() +if("vtk" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(VTK)") +endif() +if("sfm" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(gflags CONFIG)\nfind_dependency(Ceres CONFIG)") +endif() +if("eigen" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(Eigen3 CONFIG)") +endif() +if("lapack" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(LAPACK)") +endif() +if("openvino" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenVINO CONFIG)") +endif() +if("openexr" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenEXR CONFIG)") +endif() +if("openjpeg" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenJPEG)") +endif() +if("omp" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenMP)") +endif() +if("ovis" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OGRE)") +endif() +if("quirc" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(quirc)") +endif() +if("qt" IN_LIST FEATURES) + string(APPEND DEPS_STRING " set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) -find_dependency(Qt${USE_QT_VERSION} COMPONENTS Core Gui Widgets Test Concurrent)") - if("opengl" IN_LIST FEATURES) - string(APPEND DEPS_STRING " -find_dependency(Qt${USE_QT_VERSION} COMPONENTS OpenGL)") - endif() +set(CMAKE_AUTOUIC ON)") + if("opengl" IN_LIST FEATURES) + string(APPEND DEPS_STRING " +find_dependency(Qt${USE_QT_VERSION} COMPONENTS Core Gui Widgets Test Concurrent ${QT_CORE5COMPAT} OpenGL ${QT_OPENGLWIDGETS})") + else() + string(APPEND DEPS_STRING " +find_dependency(Qt${USE_QT_VERSION} COMPONENTS Core Gui Widgets Test Concurrent ${QT_CORE5COMPAT})") endif() - if("ade" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(ade)") - endif() - if("gdcm" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(GDCM)") - endif() - - string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)" - "set(CMAKE_IMPORT_FILE_VERSION 1)\n${DEPS_STRING}" OPENCV_MODULES "${OPENCV_MODULES}") - - if(WITH_OPENMP) - string(REPLACE "set_target_properties(opencv_core PROPERTIES - INTERFACE_LINK_LIBRARIES \"" - "set_target_properties(opencv_core PROPERTIES - INTERFACE_LINK_LIBRARIES \"\$;" OPENCV_MODULES "${OPENCV_MODULES}") - endif() - - if(BUILD_opencv_ovis) - string(REPLACE "OgreGLSupportStatic" - "OgreGLSupport" OPENCV_MODULES "${OPENCV_MODULES}") - endif() - - file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv3/OpenCVModules.cmake" "${OPENCV_MODULES}") - - - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() +if("ade" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(ade)") +endif() +if("gdcm" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(GDCM)") endif() -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -file(REMOVE "${CURRENT_PACKAGES_DIR}/LICENSE") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/LICENSE") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv/licenses") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv") +string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)" + "set(CMAKE_IMPORT_FILE_VERSION 1)\n${DEPS_STRING}" OPENCV_MODULES "${OPENCV_MODULES}") + +if("openmp" IN_LIST FEATURES) + string(REPLACE "set_target_properties(opencv_core PROPERTIES +INTERFACE_LINK_LIBRARIES \"" + "set_target_properties(opencv_core PROPERTIES +INTERFACE_LINK_LIBRARIES \"\$;" OPENCV_MODULES "${OPENCV_MODULES}") +endif() + +if("ovis" IN_LIST FEATURES) + string(REPLACE "OgreGLSupportStatic" + "OgreGLSupport" OPENCV_MODULES "${OPENCV_MODULES}") +endif() + +file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv3/OpenCVModules.cmake" "${OPENCV_MODULES}") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") +endif() if(VCPKG_TARGET_IS_ANDROID) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/README.android") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/README.android") endif() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2/typing") +file(GLOB PYTHON3_SITE_FILES "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2/*.py") +foreach(PYTHON3_SITE_FILE ${PYTHON3_SITE_FILES}) + vcpkg_replace_string("${PYTHON3_SITE_FILE}" + "os.path.join('${CURRENT_PACKAGES_DIR}'" + "os.path.join('.'" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${PYTHON3_SITE_FILE}" + "os.path.join('${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2'" + "os.path.join('.'" + IGNORE_UNCHANGED + ) +endforeach() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/cv2/typing") +file(GLOB PYTHON3_SITE_FILES_DEBUG "${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/cv2/*.py") +foreach(PYTHON3_SITE_FILE_DEBUG ${PYTHON3_SITE_FILES_DEBUG}) + vcpkg_replace_string("${PYTHON3_SITE_FILE_DEBUG}" + "os.path.join('${CURRENT_PACKAGES_DIR}/debug'" + "os.path.join('.'" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${PYTHON3_SITE_FILE_DEBUG}" + "os.path.join('${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/cv2'" + "os.path.join('.'" + IGNORE_UNCHANGED + ) +endforeach() + +if (EXISTS "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv3.pc") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv3.pc" + "-lQt6::Core5Compat" + "-lQt6Core5Compat" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv3.pc" + "-lhdf5::hdf5-static" + "-lhdf5" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv3.pc" + "-lglog::glog" + "-lglog" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv3.pc" + "-lgflags::gflags_static" + "-lgflags" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv3.pc" + "-lTesseract::libtesseract" + "-ltesseract" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv3.pc" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/" + "\${prefix}" + IGNORE_UNCHANGED + ) +endif() + +if (EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv3.pc") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv3.pc" + "-lQt6::Core5Compat" + "-lQt6Core5Compat" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv3.pc" + "-lhdf5::hdf5-static" + "-lhdf5" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv3.pc" + "-lglog::glog" + "-lglog" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv3.pc" + "-lgflags::gflags_static" + "-lgflags" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv3.pc" + "-lTesseract::libtesseract" + "-ltesseract" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv3.pc" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/" + "\${prefix}" + IGNORE_UNCHANGED + ) +endif() + vcpkg_fixup_pkgconfig() -if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv.pc") - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv.pc" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/" "\${prefix}" IGNORE_UNCHANGED) -endif() -if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv.pc") - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv.pc" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/" "\${prefix}" IGNORE_UNCHANGED) -endif() configure_file("${CURRENT_PORT_DIR}/usage.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY) -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") +file(REMOVE "${CURRENT_PACKAGES_DIR}/LICENSE") +file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/LICENSE") +file(GLOB_RECURSE extra1_license_files "${CURRENT_PACKAGES_DIR}/share/licenses/*") +file(GLOB_RECURSE extra2_license_files "${CURRENT_PACKAGES_DIR}/share/opencv3/licenses/*") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" ${extra1_license_files} ${extra2_license_files}) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv3/licenses") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/licenses") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/ports/opencv3/usage.in b/ports/opencv3/usage.in index 0e9e4b3a1d..217ce72976 100644 --- a/ports/opencv3/usage.in +++ b/ports/opencv3/usage.in @@ -1,4 +1,4 @@ -The package @PORT@ is compatible with CMake if you set the OpenCV_DIR *before* the find_package call +@PORT@ is compatible with built-in CMake variables. In case of multiple OpenCV version installed, set OpenCV_ROOT *before* the find_package call: - set(OpenCV_DIR "${VCPKG_INSTALLED_DIR}/@TARGET_TRIPLET@/share/@PORT@") + set(OpenCV_ROOT "${VCPKG_INSTALLED_DIR}/@TARGET_TRIPLET@/share/@PORT@") find_package(OpenCV REQUIRED) diff --git a/ports/opencv3/vcpkg.json b/ports/opencv3/vcpkg.json index 6e3ecb3ba6..f44abc58ec 100644 --- a/ports/opencv3/vcpkg.json +++ b/ports/opencv3/vcpkg.json @@ -1,7 +1,7 @@ { "name": "opencv3", "version": "3.4.18", - "port-version": 16, + "port-version": 17, "description": "Open Source Computer Vision Library", "homepage": "https://github.com/opencv/opencv", "license": "BSD-3-Clause", @@ -24,6 +24,10 @@ "default-features" ], "features": { + "bgsegm": { + "description": "opencv_bgsegm module", + "supports": "!arm" + }, "contrib": { "description": "opencv_contrib module", "dependencies": [ @@ -35,7 +39,8 @@ "name": "opencv3", "features": [ "dnn" - ] + ], + "platform": "!android" }, { "name": "tesseract", @@ -43,20 +48,6 @@ } ] }, - "cuda": { - "description": "CUDA support for opencv", - "dependencies": [ - "cuda", - "cudnn", - { - "name": "opencv3", - "default-features": false, - "features": [ - "contrib" - ] - } - ] - }, "dc1394": { "description": "Dc1394 support for opencv", "dependencies": [ @@ -70,26 +61,18 @@ "name": "opencv3", "default-features": false, "features": [ - "dnn", "jpeg", "png", "quirc", "tiff", "webp" ] - }, - { - "name": "opencv3", - "default-features": false, - "features": [ - "gtk" - ], - "platform": "linux" } ] }, "dnn": { "description": "Enable dnn module", + "supports": "!android", "dependencies": [ { "name": "opencv3", @@ -105,21 +88,6 @@ "eigen3" ] }, - "ffmpeg": { - "description": "ffmpeg support for opencv", - "dependencies": [ - { - "name": "ffmpeg", - "default-features": false, - "features": [ - "avcodec", - "avformat", - "swresample", - "swscale" - ] - } - ] - }, "flann": { "description": "opencv_flann module", "dependencies": [ @@ -133,6 +101,10 @@ "harfbuzz" ] }, + "gapi": { + "description": "Enable gapi module", + "supports": "!uwp" + }, "gdcm": { "description": "GDCM support for opencv", "dependencies": [ @@ -147,8 +119,9 @@ }, "gtk": { "description": "GTK support for opencv", + "supports": "linux", "dependencies": [ - "gtk" + "gtk3" ] }, "halide": { @@ -168,7 +141,8 @@ ] }, "ipp": { - "description": "Enable Intel Integrated Performance Primitives" + "description": "Enable Intel Integrated Performance Primitives", + "supports": "(osx & x64) | (windows & (x64 | x86)) | (linux & (x64 | x86))" }, "jasper": { "description": "JPEG 2000 support for opencv", @@ -189,6 +163,14 @@ "lapack" ] }, + "line-descriptor": { + "description": "opencv_line_descriptor module", + "supports": "!arm" + }, + "msmf": { + "description": "Microsoft Media Foundation support for opencv", + "supports": "windows & !uwp & !mingw" + }, "nonfree": { "description": "allow nonfree and unredistributable libraries" }, @@ -205,10 +187,12 @@ ] }, "openmp": { - "description": "Enable openmp support for opencv" + "description": "Enable openmp support for opencv", + "supports": "!osx" }, "ovis": { "description": "opencv_ovis module", + "supports": "!(windows & static) & !android", "dependencies": [ "ogre", { @@ -236,7 +220,13 @@ "flann" ] }, - "python3" + { + "name": "python3", + "default-features": false, + "features": [ + "extensions" + ] + } ] }, "qt": { @@ -248,12 +238,29 @@ } ] }, + "quality": { + "description": "Build opencv_quality module", + "supports": "!uwp", + "dependencies": [ + { + "name": "opencv3", + "default-features": false, + "features": [ + "contrib" + ] + } + ] + }, "quirc": { "description": "Enable QR code module", "dependencies": [ "quirc" ] }, + "salicency": { + "description": "opencv_salicency module", + "supports": "!arm" + }, "sfm": { "description": "opencv_sfm module", "dependencies": [ @@ -278,6 +285,7 @@ }, "tbb": { "description": "Enable Intel Threading Building Blocks", + "supports": "!static", "dependencies": [ "tbb" ] diff --git a/ports/opencv4/0001-disable-downloading.patch b/ports/opencv4/0001-disable-downloading.patch index e2c886d455..88ec1eb746 100644 --- a/ports/opencv4/0001-disable-downloading.patch +++ b/ports/opencv4/0001-disable-downloading.patch @@ -1,6 +1,6 @@ --- a/cmake/OpenCVDownload.cmake +++ b/cmake/OpenCVDownload.cmake -@@ -157,6 +157,9 @@ function(ocv_download) +@@ -203,6 +203,9 @@ function(ocv_download) # Download if(NOT EXISTS "${CACHE_CANDIDATE}") ocv_download_log("#cmake_download \"${CACHE_CANDIDATE}\" \"${DL_URL}\"") diff --git a/ports/opencv4/0002-install-options.patch b/ports/opencv4/0002-install-options.patch index 6592723851..40517c7757 100644 --- a/ports/opencv4/0002-install-options.patch +++ b/ports/opencv4/0002-install-options.patch @@ -1,17 +1,17 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -616,7 +616,7 @@ endif() +@@ -656,7 +656,7 @@ endif() ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS) # --- Python Support --- --if(NOT IOS) +-if(NOT IOS AND NOT XROS) +if(WITH_PYTHON) include(cmake/OpenCVDetectPython.cmake) endif() --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake -@@ -286,7 +286,6 @@ if(MSVC) +@@ -307,7 +307,6 @@ if(MSVC) #endif() if(BUILD_WITH_DEBUG_INFO) @@ -21,7 +21,7 @@ set(OPENCV_EXTRA_MODULE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_MODULE_LINKER_FLAGS_RELEASE} /debug") --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake -@@ -114,11 +114,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) +@@ -118,18 +118,18 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) endif() endfunction() @@ -33,14 +33,13 @@ -if(ANDROID) +if(FALSE) ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "abi-${ANDROID_NDK_ABI_NAME}" "OpenCVConfig.root-ANDROID.cmake.in") - install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION "${OPENCV_CONFIG_INSTALL_PATH}" COMPONENT dev) endif() -@@ -126,7 +126,7 @@ endif() + # -------------------------------------------------------------------------------------------- # Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages # -------------------------------------------------------------------------------------------- -if(WIN32) -+if(0) ++if(FALSE) if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows AND NOT OPENCV_SKIP_CMAKE_ROOT_CONFIG) ocv_gen_config("${CMAKE_BINARY_DIR}/win-install" "${OPENCV_INSTALL_BINARIES_PREFIX}${OPENCV_INSTALL_BINARIES_SUFFIX}" diff --git a/ports/opencv4/0003-force-package-requirements.patch b/ports/opencv4/0003-force-package-requirements.patch index 3c2bfe7930..293f75d974 100644 --- a/ports/opencv4/0003-force-package-requirements.patch +++ b/ports/opencv4/0003-force-package-requirements.patch @@ -9,7 +9,16 @@ if(ANDROID) set(CMAKE_FIND_LIBRARY_SUFFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) unset(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) -@@ -41,7 +41,7 @@ if(WITH_JPEG) +@@ -41,7 +41,7 @@ endif() + + if(WITH_AVIF) + ocv_clear_internal_cache_vars(AVIF_LIBRARY AVIF_INCLUDE_DIR) +- include(cmake/OpenCVFindAVIF.cmake) ++ find_package(libavif REQUIRED) + if(AVIF_FOUND) + set(HAVE_AVIF 1) + endif() +@@ -53,7 +53,7 @@ if(WITH_JPEG) ocv_clear_vars(JPEG_FOUND) else() ocv_clear_internal_cache_vars(JPEG_LIBRARY JPEG_INCLUDE_DIR) @@ -18,7 +27,7 @@ endif() if(NOT JPEG_FOUND) -@@ -87,7 +87,7 @@ if(WITH_TIFF) +@@ -99,7 +99,7 @@ if(WITH_TIFF) ocv_clear_vars(TIFF_FOUND) else() ocv_clear_internal_cache_vars(TIFF_LIBRARY TIFF_INCLUDE_DIR) @@ -27,7 +36,7 @@ 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) endif() -@@ -131,7 +131,7 @@ if(WITH_WEBP) +@@ -143,7 +143,7 @@ if(WITH_WEBP) ocv_clear_vars(WEBP_FOUND WEBP_LIBRARY WEBP_LIBRARIES WEBP_INCLUDE_DIR) else() ocv_clear_internal_cache_vars(WEBP_LIBRARY WEBP_INCLUDE_DIR) @@ -36,7 +45,7 @@ if(WEBP_FOUND) set(HAVE_WEBP 1) endif() -@@ -172,7 +172,7 @@ if(WITH_OPENJPEG) +@@ -184,7 +184,7 @@ if(WITH_OPENJPEG) if(BUILD_OPENJPEG) ocv_clear_vars(OpenJPEG_FOUND) else() @@ -45,7 +54,7 @@ endif() if(NOT OpenJPEG_FOUND OR OPENJPEG_MAJOR_VERSION LESS 2) -@@ -200,7 +200,7 @@ if(WITH_JASPER AND NOT HAVE_OPENJPEG) +@@ -213,7 +213,7 @@ if(WITH_JASPER AND NOT HAVE_OPENJPEG) if(BUILD_JASPER) ocv_clear_vars(JASPER_FOUND) else() @@ -54,16 +63,35 @@ endif() if(NOT JASPER_FOUND) -@@ -225,7 +225,7 @@ if(WITH_PNG) +@@ -239,7 +239,7 @@ if(WITH_SPNG) + # CMakeConfig bug in SPNG, include is missing there in version 0.7.4 and older + # See https://github.com/randy408/libspng/pull/264 + include(CMakeFindDependencyMacro) +- find_package(SPNG QUIET) ++ find_package(SPNG REQUIRED) + if(SPNG_FOUND) + set(SPNG_LIBRARY "spng::spng" CACHE INTERNAL "") + set(SPNG_LIBRARIES ${SPNG_LIBRARY}) +@@ -273,7 +273,7 @@ if(NOT HAVE_SPNG AND WITH_PNG) ocv_clear_vars(PNG_FOUND) else() ocv_clear_internal_cache_vars(PNG_LIBRARY PNG_INCLUDE_DIR) -- include(FindPNG) +- find_package(PNG QUIET) + find_package(PNG REQUIRED) - if(PNG_FOUND) - include(CheckIncludeFile) - check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H) -@@ -275,7 +275,7 @@ endif() + endif() + + if(NOT PNG_FOUND) +@@ -296,7 +296,8 @@ 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") ++ find_package(OpenEXR CONFIG REQUIRED) ++ set(OPENEXR_FOUND TRUE) + endif() + + if(OPENEXR_FOUND) +@@ -316,7 +316,7 @@ endif() # --- GDAL (optional) --- if(WITH_GDAL) @@ -72,7 +100,7 @@ if(NOT GDAL_FOUND) set(HAVE_GDAL NO) -@@ -287,7 +287,7 @@ if(WITH_GDAL) +@@ -328,7 +328,7 @@ if(WITH_GDAL) endif() if(WITH_GDCM) @@ -81,11 +109,9 @@ if(NOT GDCM_FOUND) set(HAVE_GDCM NO) ocv_clear_vars(GDCM_VERSION GDCM_LIBRARIES) -diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt -index 213667a..4052387 100644 --- a/modules/imgcodecs/CMakeLists.txt +++ b/modules/imgcodecs/CMakeLists.txt -@@ -24,7 +24,7 @@ endif() +@@ -25,7 +25,7 @@ endif() if(HAVE_WEBP) add_definitions(-DHAVE_WEBP) diff --git a/ports/opencv4/0004-fix-eigen.patch b/ports/opencv4/0004-fix-eigen.patch index 196542dcdd..4b0229b344 100644 --- a/ports/opencv4/0004-fix-eigen.patch +++ b/ports/opencv4/0004-fix-eigen.patch @@ -1,6 +1,6 @@ --- a/cmake/OpenCVFindLibsPerf.cmake +++ b/cmake/OpenCVFindLibsPerf.cmake -@@ -55,7 +55,7 @@ if(WITH_EIGEN AND NOT HAVE_EIGEN) +@@ -59,7 +59,7 @@ if(WITH_EIGEN AND NOT HAVE_EIGEN) OR NOT (CMAKE_VERSION VERSION_LESS "3.0.0") # Eigen3Targets.cmake required CMake 3.0.0+ ) AND NOT OPENCV_SKIP_EIGEN_FIND_PACKAGE_CONFIG ) diff --git a/ports/opencv4/0005-fix-policy-CMP0057.patch b/ports/opencv4/0005-fix-policy-CMP0057.patch index 96d0cdebe4..937a50be59 100644 --- a/ports/opencv4/0005-fix-policy-CMP0057.patch +++ b/ports/opencv4/0005-fix-policy-CMP0057.patch @@ -1,7 +1,7 @@ --- a/modules/videoio/CMakeLists.txt +++ b/modules/videoio/CMakeLists.txt @@ -1,3 +1,4 @@ -+cmake_minimum_required(VERSION 3.3) ++cmake_minimum_required(VERSION 3.5) set(VIDEOIO_ENABLE_PLUGINS_DEFAULT ON) - if(EMSCRIPTEN OR IOS OR WINRT) + if(EMSCRIPTEN OR IOS OR XROS OR WINRT) set(VIDEOIO_ENABLE_PLUGINS_DEFAULT OFF) diff --git a/ports/opencv4/0006-fix-uwp.patch b/ports/opencv4/0006-fix-uwp.patch index ec315b4980..9da1d57426 100644 --- a/ports/opencv4/0006-fix-uwp.patch +++ b/ports/opencv4/0006-fix-uwp.patch @@ -1,6 +1,6 @@ --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake -@@ -1205,7 +1205,7 @@ function(ocv_add_perf_tests) +@@ -1259,7 +1259,7 @@ function(ocv_add_perf_tests) set_target_properties(${the_target} PROPERTIES FOLDER "tests performance") endif() diff --git a/ports/opencv4/0007-fix-hdf5.patch b/ports/opencv4/0007-contrib-fix-hdf5.patch similarity index 100% rename from ports/opencv4/0007-fix-hdf5.patch rename to ports/opencv4/0007-contrib-fix-hdf5.patch diff --git a/ports/opencv4/0008-devendor-quirc.patch b/ports/opencv4/0008-devendor-quirc.patch index 4333eb0f6b..b82c562365 100644 --- a/ports/opencv4/0008-devendor-quirc.patch +++ b/ports/opencv4/0008-devendor-quirc.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -810,7 +810,7 @@ if(WITH_OPENVX) +@@ -917,7 +917,7 @@ if(WITH_OPENVX) endif() if(WITH_QUIRC) @@ -11,7 +11,7 @@ --- a/modules/objdetect/CMakeLists.txt +++ b/modules/objdetect/CMakeLists.txt -@@ -2,7 +2,5 @@ js +@@ -13,7 +13,5 @@ ocv_define_module(objdetect ) if(HAVE_QUIRC) diff --git a/ports/opencv4/0009-fix-protobuf.patch b/ports/opencv4/0009-fix-protobuf.patch index 38572e309f..bde8b2e9af 100644 --- a/ports/opencv4/0009-fix-protobuf.patch +++ b/ports/opencv4/0009-fix-protobuf.patch @@ -1,23 +1,23 @@ --- a/cmake/OpenCVFindProtobuf.cmake +++ b/cmake/OpenCVFindProtobuf.cmake -@@ -31,7 +31,7 @@ if(BUILD_PROTOBUF) - set(HAVE_PROTOBUF TRUE) - else() +@@ -34,7 +34,7 @@ else() + set(protobuf_MODULE_COMPATIBLE ON) + unset(Protobuf_VERSION CACHE) -- find_package(Protobuf QUIET) +- find_package(Protobuf QUIET CONFIG) + find_package(Protobuf CONFIG REQUIRED) - - # Backwards compatibility - # Define camel case versions of input variables -@@ -76,6 +76,7 @@ if(HAVE_PROTOBUF) - if(NOT BUILD_PROTOBUF) + if(NOT Protobuf_FOUND) + find_package(Protobuf QUIET) + endif() +@@ -97,6 +97,7 @@ if(HAVE_PROTOBUF) + unset( __location) if(TARGET "${Protobuf_LIBRARIES}") get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION_RELEASE) + get_target_property(__location_debug "${Protobuf_LIBRARIES}" IMPORTED_LOCATION_DEBUG) if(NOT __location) get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION) endif() -@@ -87,5 +88,5 @@ if(HAVE_PROTOBUF) +@@ -112,5 +113,5 @@ if(HAVE_PROTOBUF) endif() list(APPEND CUSTOM_STATUS_protobuf " Protobuf:" BUILD_PROTOBUF THEN "build (${Protobuf_VERSION})" diff --git a/ports/opencv4/0011-remove-python2.patch b/ports/opencv4/0011-remove-python2.patch index bee0faa87c..e0237d7092 100644 --- a/ports/opencv4/0011-remove-python2.patch +++ b/ports/opencv4/0011-remove-python2.patch @@ -1,16 +1,22 @@ --- a/cmake/OpenCVDetectPython.cmake +++ b/cmake/OpenCVDetectPython.cmake -@@ -268,15 +268,6 @@ if(OPENCV_PYTHON_SKIP_DETECTION) +@@ -268,21 +268,6 @@ if(OPENCV_PYTHON_SKIP_DETECTION) return() endif() - --find_python("" "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR + +-ocv_check_environment_variables(OPENCV_ENABLE_PYTHON2) +-ocv_check_environment_variables(PYTHON2_EXECUTABLE) +-if((OPENCV_ENABLE_PYTHON2 OR PYTHON2_EXECUTABLE OR BUILD_opencv_python2) +- AND NOT OPENCV_PYTHON2_SKIP_DETECTION +-) +- find_python("" "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR - PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING - PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND - PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY - PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH - PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH - PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION) +-endif() - -option(OPENCV_PYTHON3_VERSION "Python3 version" "") find_python("${OPENCV_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR diff --git a/ports/opencv4/0019-fix-ogre-dependency.patch b/ports/opencv4/0013-contrib-fix-ogre.patch similarity index 100% rename from ports/opencv4/0019-fix-ogre-dependency.patch rename to ports/opencv4/0013-contrib-fix-ogre.patch diff --git a/ports/opencv4/0022-fix-supportqnx.patch b/ports/opencv4/0014-fix-supportqnx.patch similarity index 100% rename from ports/opencv4/0022-fix-supportqnx.patch rename to ports/opencv4/0014-fix-supportqnx.patch diff --git a/ports/opencv4/0015-fix-freetype.patch b/ports/opencv4/0015-fix-freetype.patch index 875b0e1bbe..6eeafe7f9e 100644 --- a/ports/opencv4/0015-fix-freetype.patch +++ b/ports/opencv4/0015-fix-freetype.patch @@ -1,6 +1,6 @@ --- a/modules/gapi/cmake/init.cmake +++ b/modules/gapi/cmake/init.cmake -@@ -20,7 +20,7 @@ if(NOT TARGET ade) +@@ -21,7 +21,7 @@ if(NOT TARGET ade) endif() if(WITH_FREETYPE) diff --git a/ports/opencv4/0016-fix-freetype-contrib.patch b/ports/opencv4/0016-contrib-fix-freetype.patch similarity index 91% rename from ports/opencv4/0016-fix-freetype-contrib.patch rename to ports/opencv4/0016-contrib-fix-freetype.patch index d4fcfe1482..48f4eeb078 100644 --- a/ports/opencv4/0016-fix-freetype-contrib.patch +++ b/ports/opencv4/0016-contrib-fix-freetype.patch @@ -1,6 +1,6 @@ --- a/modules/freetype/CMakeLists.txt +++ b/modules/freetype/CMakeLists.txt -@@ -3,8 +5,11 @@ if(APPLE_FRAMEWORK) +@@ -3,8 +3,11 @@ if(APPLE_FRAMEWORK) ocv_module_disable(freetype) endif() @@ -11,6 +11,6 @@ + find_package(HARFBUZZ NAMES harfbuzz REQUIRED) + set(HARFBUZZ_LIBRARIES harfbuzz::harfbuzz) +endif() - + if(OPENCV_INITIAL_PASS) if(NOT FREETYPE_FOUND) diff --git a/ports/opencv4/0017-fix-flatbuffers.patch b/ports/opencv4/0017-fix-flatbuffers.patch index 517c6ea99a..6516a58cc9 100644 --- a/ports/opencv4/0017-fix-flatbuffers.patch +++ b/ports/opencv4/0017-fix-flatbuffers.patch @@ -1,20 +1,16 @@ -diff --git a/cmake/OpenCVDetectFlatbuffers.cmake b/cmake/OpenCVDetectFlatbuffers.cmake -index 537b738..6dba0fb 100644 ---- a/cmake/OpenCVDetectFlatbuffers.cmake -+++ b/cmake/OpenCVDetectFlatbuffers.cmake -@@ -1,9 +1,11 @@ - if(WITH_FLATBUFFERS) - set(HAVE_FLATBUFFERS 1) -- set(flatbuffers_VERSION "23.5.9") -- ocv_install_3rdparty_licenses(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/LICENSE.txt") -- ocv_add_external_target(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/include" "" "HAVE_FLATBUFFERS=1") -- set(CUSTOM_STATUS_flatbuffers " Flatbuffers:" "builtin/3rdparty (${flatbuffers_VERSION})") -+ set(flatbuffers_VERSION "23.5.26") -+ #ocv_install_3rdparty_licenses(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/LICENSE.txt") -+ find_path(FLATBUFFERS_INCLUDE_DIR flatbuffers.h PATH_SUFFIXES flatbuffers) -+ get_filename_component(FLATBUFFERS_INCLUDE_DIR "${FLATBUFFERS_INCLUDE_DIR}" PATH) -+ ocv_add_external_target(flatbuffers "${FLATBUFFERS_INCLUDE_DIR}" "" "HAVE_FLATBUFFERS=1") -+ #set(CUSTOM_STATUS_flatbuffers " Flatbuffers:" "builtin/3rdparty (${flatbuffers_VERSION})") - endif() - - if(WITH_FLATBUFFERS OR HAVE_FLATBUFFERS) +--- a/cmake/OpenCVDetectFlatbuffers.cmake ++++ b/cmake/OpenCVDetectFlatbuffers.cmake +@@ -1,9 +1,9 @@ + if(WITH_FLATBUFFERS) + set(HAVE_FLATBUFFERS 1) +- set(flatbuffers_VERSION "23.5.9") +- ocv_install_3rdparty_licenses(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/LICENSE.txt") +- ocv_add_external_target(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/include" "" "HAVE_FLATBUFFERS=1") +- set(CUSTOM_STATUS_flatbuffers " Flatbuffers:" "builtin/3rdparty (${flatbuffers_VERSION})") ++ set(flatbuffers_VERSION "23.5.26") ++ find_path(FLATBUFFERS_INCLUDE_DIR flatbuffers.h PATH_SUFFIXES flatbuffers) ++ get_filename_component(FLATBUFFERS_INCLUDE_DIR "${FLATBUFFERS_INCLUDE_DIR}" PATH) ++ ocv_add_external_target(flatbuffers "${FLATBUFFERS_INCLUDE_DIR}" "" "HAVE_FLATBUFFERS=1") + endif() + + if(WITH_FLATBUFFERS OR HAVE_FLATBUFFERS) diff --git a/ports/opencv4/0018-fix-depend-tesseract.patch b/ports/opencv4/0018-contrib-fix-tesseract.patch similarity index 100% rename from ports/opencv4/0018-fix-depend-tesseract.patch rename to ports/opencv4/0018-contrib-fix-tesseract.patch diff --git a/ports/opencv4/0019-fix-cmake-in-list.patch b/ports/opencv4/0019-fix-cmake-in-list.patch new file mode 100644 index 0000000000..25ff0a096c --- /dev/null +++ b/ports/opencv4/0019-fix-cmake-in-list.patch @@ -0,0 +1,13 @@ +--- a/cmake/OpenCVUtils.cmake ++++ b/cmake/OpenCVUtils.cmake +@@ -1663,7 +1663,7 @@ function(ocv_install_used_external_targets) + if(NOT BUILD_SHARED_LIBS + AND NOT (CMAKE_VERSION VERSION_LESS "3.13.0") # upgrade CMake: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/2152 + ) +- foreach(tgt in ${ARGN}) +- if(tgt MATCHES "^ocv\.3rdparty\.") ++ foreach(tgt ${ARGN}) ++ if(tgt MATCHES "^ocv[.]3rdparty[.]") + list(FIND __OPENCV_EXPORTED_EXTERNAL_TARGETS "${tgt}" _found) + if(_found EQUAL -1) # don't export target twice + install(TARGETS ${tgt} EXPORT OpenCVModules) diff --git a/ports/opencv4/0019-missing-include.patch b/ports/opencv4/0019-missing-include.patch deleted file mode 100644 index c1d4d3c157..0000000000 --- a/ports/opencv4/0019-missing-include.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/modules/dnn/src/op_halide.cpp b/modules/dnn/src/op_halide.cpp -index 653de36146cc..db1a72278e70 100644 ---- a/modules/dnn/src/op_halide.cpp -+++ b/modules/dnn/src/op_halide.cpp -@@ -14,6 +14,7 @@ - #include "halide_scheduler.hpp" - - #include -+#include - #endif // HAVE_HALIDE - - namespace cv { diff --git a/ports/opencv4/0020-fix-compat-cuda12.2.patch b/ports/opencv4/0020-fix-compat-cuda12.2.patch deleted file mode 100644 index e027f4e4e4..0000000000 --- a/ports/opencv4/0020-fix-compat-cuda12.2.patch +++ /dev/null @@ -1,32 +0,0 @@ -commit ab8cb6f8a9034da2a289b84685c6d959266029be -Author: cudawarped <12133430+cudawarped@users.noreply.github.com> -Date: Tue Aug 1 13:02:42 2023 +0300 - - cuda: fix for compatibility with CUDA Toolkit >= 12.2.0 - -diff --git a/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp b/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp -index f067dddaa7..91ff33f817 100644 ---- a/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp -+++ b/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp -@@ -111,7 +111,7 @@ namespace cv { namespace dnn { namespace cuda4dnn { - * or there might be several weights - * or we don't have to scale - */ -- if (weight != 1.0) -+ if (weight != static_cast(1.0f)) - { - kernels::scale1_with_bias1(stream, output, input, weight, 1.0); - } -diff --git a/modules/dnn/src/cuda4dnn/primitives/region.hpp b/modules/dnn/src/cuda4dnn/primitives/region.hpp -index d22d44214e..3af05155fe 100644 ---- a/modules/dnn/src/cuda4dnn/primitives/region.hpp -+++ b/modules/dnn/src/cuda4dnn/primitives/region.hpp -@@ -121,7 +121,7 @@ namespace cv { namespace dnn { namespace cuda4dnn { - new_coords - ); - -- if (nms_iou_threshold > 0) { -+ if (nms_iou_threshold > static_cast(0.0f)) { - auto output_mat = output_wrapper->getMutableHostMat(); - CV_Assert(output_mat.type() == CV_32F); - for (int i = 0; i < input.get_axis_size(0); i++) { diff --git a/ports/opencv4/0021-static-openvino.patch b/ports/opencv4/0021-static-openvino.patch deleted file mode 100644 index 156aca2bcc..0000000000 --- a/ports/opencv4/0021-static-openvino.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake -index 437042958e..a90eb5a5ab 100644 ---- a/cmake/OpenCVUtils.cmake -+++ b/cmake/OpenCVUtils.cmake -@@ -1632,13 +1632,19 @@ function(ocv_add_external_target name inc link def) - endif() - endfunction() - -+set(__OPENCV_EXPORTED_EXTERNAL_TARGETS "" CACHE INTERNAL "") - function(ocv_install_used_external_targets) - if(NOT BUILD_SHARED_LIBS - AND NOT (CMAKE_VERSION VERSION_LESS "3.13.0") # upgrade CMake: https://gitlab.kitware.com/cmake/cmake/-/merge_requests/2152 - ) - foreach(tgt in ${ARGN}) - if(tgt MATCHES "^ocv\.3rdparty\.") -- install(TARGETS ${tgt} EXPORT OpenCVModules) -+ list(FIND __OPENCV_EXPORTED_EXTERNAL_TARGETS "${tgt}" _found) -+ if(_found EQUAL -1) # don't export target twice -+ install(TARGETS ${tgt} EXPORT OpenCVModules) -+ list(APPEND __OPENCV_EXPORTED_EXTERNAL_TARGETS "${tgt}") -+ set(__OPENCV_EXPORTED_EXTERNAL_TARGETS "${__OPENCV_EXPORTED_EXTERNAL_TARGETS}" CACHE INTERNAL "") -+ endif() - endif() - endforeach() - endif() diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake index 3f1de208d1..3799483e7e 100644 --- a/ports/opencv4/portfile.cmake +++ b/ports/opencv4/portfile.cmake @@ -1,23 +1,52 @@ set(USE_QT_VERSION "6") -# https://github.com/opencv/opencv/pull/24043 -vcpkg_download_distfile(ARM64_WINDOWS_FIX - URLS https://github.com/opencv/opencv/commit/e5e1a3bfdea96bebda2ad963bc8f6cf17930aef7.patch?full_index=1 - SHA512 8ae2544e4a7ece19efe21261acc183f91202ac5352c1ac42fb86bf33d698352eff1b8962422b092240f4e8c7a691e9aa5ef20d6070adcd37e92bb94c6010ce56 - FILENAME opencv4-e5e1a3bfdea96bebda2ad963bc8f6cf17930aef7.patch +vcpkg_download_distfile(CUDA_124_DNN_PATCH + URLS "https://patch-diff.githubusercontent.com/raw/opencv/opencv/pull/25412.patch" + FILENAME "opencv-opencv4-25412.patch" + SHA512 0b8fcb19d81feeb506cdf596d317b137cc1d71d29c16ff1657c7744b389e9184e20e197a7f7398964c7c71e9950659814d9fbd2387f8d4a5875c2db252dd3f76 ) -vcpkg_download_distfile(CUDA_12_4_FIX - URLS https://github.com/opencv/opencv/commit/3e3ee106fb8ccd003aa2c9a943a2340b066537bc.patch?full_index=1 - SHA512 d50fd2e11563fc80467303a98d480f80f5587b1c1cb5a425c3a360dc14be937173ffb665d34167e27c67202bcce7b95d47ab68e2d5effb1ae8f7130610dac3e0 - FILENAME opencv4-3e3ee106fb8ccd003aa2c9a943a2340b066537bc.patch +vcpkg_download_distfile(CUDA_124_TUPLE_PATCH + URLS "https://patch-diff.githubusercontent.com/raw/opencv/opencv/pull/25658.patch" + FILENAME "opencv-opencv4-25658.patch" + SHA512 ca5661ff2e3761b7f7ba9314539fffb7f1a3e9e6ff07ce0942ef4b88a342110a873d1c14081fbf57f3413af5542643089ee88b92ff3430cdd9e7d82dea2c40fd +) + +vcpkg_download_distfile(CONTRIB_CUDA_124_NPP_PATCH + URLS "https://patch-diff.githubusercontent.com/raw/opencv/opencv_contrib/pull/3726.patch" + FILENAME "opencv-opencv4-contrib-3726.patch" + SHA512 948811a6121e00009812c44c1fbd859cca10f80b447c2d0a69dec2e453eafddd15ece0b96a7f238f6e92f77d249f8f750f020d7913728ed21aba55ecaf07c2d3 +) + +vcpkg_download_distfile(CONTRIB_CUDA_124_PATCH + URLS "https://patch-diff.githubusercontent.com/raw/opencv/opencv_contrib/pull/3742.patch" + FILENAME "opencv-opencv4-contrib-3742.patch" + SHA512 de3b428fe342cd2607bb53cf8c77e066925fd9d59d5b8600a60117f7a0f536424cadcbca7e60c1161a64794e785cceb806dc6d4e244c2c05a59678d2b61d8610 +) + +vcpkg_download_distfile(CONTRIB_CUDA_124_TUPLE_PATCH + URLS "https://patch-diff.githubusercontent.com/raw/opencv/opencv_contrib/pull/3744.patch" + FILENAME "opencv-opencv4-contrib-3744.patch" + SHA512 4b40aa81d708b184afcbd92da29b886139dead5d9b964a3906715864a393ce56737f2bfc3fc67aec18792f2d55932c32d3c18b1b238078949721247bbe985d5f +) + +vcpkg_download_distfile(CONTRIB_CUDA_124_INCLUDE_PATCH + URLS "https://patch-diff.githubusercontent.com/raw/opencv/opencv_contrib/pull/3751.patch" + FILENAME "opencv-opencv4-contrib-3751.patch" + SHA512 3ba5d6e0a1f13c6513f5967d49f5941204eb39a064a402d54fe3a4fa5dbb2cfd8a8bebec99e06da9991098c95acfc816e367d27757f4a4f4d9fed1452debfd8a +) + +vcpkg_download_distfile(ARM64_WINDOWS_PATCH + URLS "https://patch-diff.githubusercontent.com/raw/opencv/opencv/pull/25069.patch" + FILENAME "opencv-opencv4-25069.patch" + SHA512 2842f32ced73beb89850f7dc0c55d501e32b616276557489ccba90959f63d8955dae3395a882e690fdd7db7b38569c06f0141c8a5b9debdeb3670d2d43a4e34b ) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO opencv/opencv REF "${VERSION}" - SHA512 48738c3e7460a361274357aef1dd427082ccd59f749d6317d92a414b3741ce6116ea15ed4fedd2d47a25e456c705f3ba114357558646097bfc0e6dba9b3b865c + SHA512 1598ae59849e7805b3cbec5260bb501006f26edff452343b366b9262a0f48a6e09f4b2e760209cb677f2a64a7b22f4e70bc6195c104bcea74cc9fe04031d0292 HEAD_REF master PATCHES 0001-disable-downloading.patch @@ -31,18 +60,18 @@ vcpkg_from_github( 0010-fix-uwp-tiff-imgcodecs.patch 0011-remove-python2.patch 0012-fix-zlib.patch + 0014-fix-supportqnx.patch 0015-fix-freetype.patch 0017-fix-flatbuffers.patch - 0019-missing-include.patch - 0020-fix-compat-cuda12.2.patch - 0021-static-openvino.patch # https://github.com/opencv/opencv/pull/23963 - "${ARM64_WINDOWS_FIX}" - 0022-fix-supportqnx.patch - "${CUDA_12_4_FIX}" + 0019-fix-cmake-in-list.patch + ${CUDA_124_DNN_PATCH} + ${CUDA_124_TUPLE_PATCH} + ${ARM64_WINDOWS_PATCH} ) # Disallow accidental build of vendored copies file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr") file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/flatbuffers") +file(REMOVE "${SOURCE_PATH}/cmake/FindCUDNN.cmake") if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") set(TARGET_IS_AARCH64 1) @@ -54,55 +83,77 @@ else() set(TARGET_IS_X86 1) endif() -file(REMOVE "${SOURCE_PATH}/cmake/FindCUDNN.cmake") +if (USE_QT_VERSION STREQUAL "6") + set(QT_CORE5COMPAT "Core5Compat") + set(QT_OPENGLWIDGETS "OpenGLWidgets") +endif() string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT) set(ADE_DIR ${CURRENT_INSTALLED_DIR}/share/ade CACHE PATH "Path to existing ADE CMake Config file") +# Cannot use vcpkg_check_features() for "qt" because it requires the QT version number passed, not just a boolean vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES - "ade" WITH_ADE - "contrib" WITH_CONTRIB - "cuda" WITH_CUBLAS - "cuda" WITH_CUDA - "cudnn" WITH_CUDNN - "dnn-cuda" OPENCV_DNN_CUDA - "eigen" WITH_EIGEN - "ffmpeg" WITH_FFMPEG - "freetype" WITH_FREETYPE - "gdcm" WITH_GDCM - "gstreamer" WITH_GSTREAMER - "gtk" WITH_GTK - "halide" WITH_HALIDE - "jasper" WITH_JASPER - "openjpeg" WITH_OPENJPEG - "jpeg" WITH_JPEG - "lapack" WITH_LAPACK - "nonfree" OPENCV_ENABLE_NONFREE - "openvino" WITH_OPENVINO - "openexr" WITH_OPENEXR - "opengl" WITH_OPENGL - "ovis" CMAKE_REQUIRE_FIND_PACKAGE_OGRE - "png" WITH_PNG - "quirc" WITH_QUIRC - "sfm" BUILD_opencv_sfm - "tiff" WITH_TIFF - "vtk" WITH_VTK - "webp" WITH_WEBP - "world" BUILD_opencv_world - "dc1394" WITH_1394 - "vulkan" WITH_VULKAN + "ade" WITH_ADE + "calib3d" BUILD_opencv_calib3d + "contrib" WITH_CONTRIB + "cuda" WITH_CUBLAS + "cuda" WITH_CUDA + "cuda" ENABLE_CUDA_FIRST_CLASS_LANGUAGE + "cudnn" WITH_CUDNN + "dc1394" WITH_1394 + "dnn" BUILD_opencv_dnn + "dnn" PROTOBUF_UPDATE_FILES + "dnn" UPDATE_PROTO_FILES + "dnn" WITH_PROTOBUF + "dnn-cuda" OPENCV_DNN_CUDA + "dshow" WITH_DSHOW + "eigen" WITH_EIGEN + "ffmpeg" WITH_FFMPEG + "freetype" WITH_FREETYPE + "gapi" BUILD_opencv_gapi + "gdcm" WITH_GDCM + "gstreamer" WITH_GSTREAMER + "gtk" WITH_GTK + "halide" WITH_HALIDE + "ipp" WITH_IPP + "ipp" BUILD_IPP_IW + "highgui" BUILD_opencv_highgui + "intrinsics" CV_ENABLE_INTRINSICS + "jasper" WITH_JASPER + "openjpeg" WITH_OPENJPEG + "openmp" WITH_OPENMP + "jpeg" WITH_JPEG + "lapack" WITH_LAPACK + "lapack" DOPENCV_LAPACK_FIND_PACKAGE_ONLY + "msmf" WITH_MSMF + "nonfree" OPENCV_ENABLE_NONFREE + "fs" OPENCV_ENABLE_FILESYSTEM_SUPPORT + "thread" OPENCV_ENABLE_THREAD_SUPPORT + "opencl" WITH_OPENCL + "openvino" WITH_OPENVINO + "openexr" WITH_OPENEXR + "opengl" WITH_OPENGL + "ovis" CMAKE_REQUIRE_FIND_PACKAGE_OGRE + "ovis" BUILD_opencv_ovis + "png" WITH_PNG + "python" BUILD_opencv_python3 + "python" WITH_PYTHON + "quality" BUILD_opencv_quality + "quirc" WITH_QUIRC + "rgbd" BUILD_opencv_rgbd + "sfm" BUILD_opencv_sfm + "tbb" WITH_TBB + "tiff" WITH_TIFF + "vtk" WITH_VTK + "vulkan" WITH_VULKAN + "webp" WITH_WEBP + "win32ui" WITH_WIN32UI + "world" BUILD_opencv_world ) -# Cannot use vcpkg_check_features() for "dnn", "gtk", ipp", "openmp", "ovis", "python", "qt", "tbb" -set(BUILD_opencv_dnn OFF) if("dnn" IN_LIST FEATURES) - if(NOT VCPKG_TARGET_IS_ANDROID) - set(BUILD_opencv_dnn ON) - else() - message(WARNING "The dnn module cannot be enabled on Android") - endif() set(FLATC "${CURRENT_HOST_INSTALLED_DIR}/tools/flatbuffers/flatc${VCPKG_HOST_EXECUTABLE_SUFFIX}") vcpkg_execute_required_process( COMMAND "${FLATC}" --cpp -o "${SOURCE_PATH}/modules/dnn/misc/tflite" "${SOURCE_PATH}/modules/dnn/src/tflite/schema.fbs" @@ -111,56 +162,34 @@ if("dnn" IN_LIST FEATURES) ) endif() +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(OPENCV_LAPACK_SHARED_LIBS OFF) +else() + set(OPENCV_LAPACK_SHARED_LIBS ON) +endif() + set(WITH_QT OFF) if("qt" IN_LIST FEATURES) set(WITH_QT ${USE_QT_VERSION}) endif() -set(BUILD_opencv_gapi ON) -if(VCPKG_TARGET_IS_UWP) - set(BUILD_opencv_gapi OFF) - message(WARNING "The gapi module cannot be enabled on UWP platform") -endif() - -set(WITH_IPP OFF) -if("ipp" IN_LIST FEATURES) - set(WITH_IPP ON) -endif() - -set(WITH_OPENMP OFF) -if("openmp" IN_LIST FEATURES) - if(NOT VCPKG_TARGET_IS_OSX) - set(WITH_OPENMP ON) - else() - message(WARNING "The OpenMP feature is not supported on macOS") - endif() -endif() - -set(BUILD_opencv_ovis OFF) -if("ovis" IN_LIST FEATURES) - set(BUILD_opencv_ovis ON) -endif() - -set(WITH_TBB OFF) -if("tbb" IN_LIST FEATURES) - set(WITH_TBB ON) -endif() - -set(WITH_VULKAN OFF) -if("vulkan" IN_LIST FEATURES) - set(WITH_VULKAN ON) -endif() - -set(WITH_PYTHON OFF) -set(BUILD_opencv_python3 OFF) if("python" IN_LIST FEATURES) - if (VCPKG_LIBRARY_LINKAGE STREQUAL static AND VCPKG_TARGET_IS_WINDOWS) - message(WARNING "The python module is currently unsupported on Windows when building static OpenCV libraries") - else() - x_vcpkg_get_python_packages(PYTHON_VERSION "3" PACKAGES numpy OUT_PYTHON_VAR "PYTHON3") - set(ENV{PYTHON} "${PYTHON3}") - set(BUILD_opencv_python3 ON) - set(WITH_PYTHON ON) + x_vcpkg_get_python_packages(PYTHON_VERSION "3" PACKAGES numpy OUT_PYTHON_VAR "PYTHON3") + set(ENV{PYTHON} "${PYTHON3}") + file(GLOB _py3_include_path "${CURRENT_INSTALLED_DIR}/include/python3*") + string(REGEX MATCH "python3\\.([0-9]+)" _python_version_tmp ${_py3_include_path}) + set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_1}") + set(python_ver "3.${PYTHON_VERSION_MINOR}") + list(APPEND PYTHON_EXTRA_DEFINES_RELEASE + "-D__INSTALL_PATH_PYTHON3=${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2" + "-DOPENCV_PYTHON_INSTALL_PATH=${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}" + ) + list(APPEND PYTHON_EXTRA_DEFINES_DEBUG + "-D__INSTALL_PATH_PYTHON3=${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/cv2" + "-DOPENCV_PYTHON_INSTALL_PATH=${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}" + ) + if(EXISTS "${CURRENT_INSTALLED_DIR}/${PYTHON3_SITE}/cv2") + message(FATAL_ERROR "You cannot install opencv4[python] if opencv3[python] is already present.") endif() endif() @@ -180,50 +209,22 @@ if("cuda" IN_LIST FEATURES) ) endif() -# Build image quality module when building with 'contrib' feature and not UWP. -set(BUILD_opencv_quality OFF) if("contrib" IN_LIST FEATURES) - if (VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_IOS OR (VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_TARGET_IS_WINDOWS)) - set(BUILD_opencv_quality OFF) - message(WARNING "The image quality module (quality) does not build for UWP or iOS, the module has been disabled.") - # The hdf module is silently disabled by OpenCVs buildsystem if HDF5 is not detected. - message(WARNING "The hierarchical data format module (hdf) depends on HDF5 which doesn't support UWP or iOS, the module has been disabled.") - else() - set(BUILD_opencv_quality CMAKE_DEPENDS_IN_PROJECT_ONLY) - endif() - - vcpkg_download_distfile(CUDA_12_4_CONTRIB_FIX - URLS https://github.com/opencv/opencv_contrib/commit/1ed3dd2c53888e3289afdb22ec4e9ebbff3dba87.patch?full_index=1 - SHA512 f4996cf8368b61dce9d434b608bbd5d49d8e0cd51d0f1b2f1536bfa8ce79823715e082ab5db70dcdd50603baf107c129fc4a804f04ee55cd974973e10716dd43 - FILENAME opencv-contrib-1ed3dd2c53888e3289afdb22ec4e9ebbff3dba87.patch - ) - - vcpkg_download_distfile(CUDA_12_4_CONTRIB_FIX_2 - URLS https://github.com/opencv/opencv_contrib/commit/9358ad2e56f6d0b99860856fc1b53b783d186e73.patch?full_index=1 - SHA512 9d2fef86693e723af4c63417178f3082bf1e1cea2fd0164ecf9bd0ec02d348c374d9c3a707c8e0f224560c9671879ef6f8a6c54cdf38820fe5877faba3545732 - FILENAME opencv-contrib-9358ad2e56f6d0b99860856fc1b53b783d186e73.patch - ) - - vcpkg_download_distfile(CUDA_12_4_CONTRIB_FIX_3 - URLS https://github.com/opencv/opencv_contrib/commit/baaeb68b3d6b557536f95b527c0dd87c8f1ce80d.patch?full_index=1 - SHA512 1d5dc4fbcff57044f03b0620385d8b23eb99e3a39f211901b68c7622f2f00e4ccaa3a1e1999a6712285e1812ada72acb70280d62eb089d6bdd015b5545d2d4ae - FILENAME opencv-contrib-baaeb68b3d6b557536f95b527c0dd87c8f1ce80d.patch - ) - vcpkg_from_github( OUT_SOURCE_PATH CONTRIB_SOURCE_PATH REPO opencv/opencv_contrib - REF ${VERSION} - SHA512 81cc41cfe1ea03e60b0657edeaa76a90926e5e79a9f93a482e17bc9edbf1b5ce36b13d108fd8fb097f2fb3d6381fbeb102811f44bfc761c2de7f69bf3c5298a1 + REF "${VERSION}" + SHA512 ebaee3b88bd7ae246727e65a98d9fbc1d9772a4181a1926f3af742410b78dc87d2386bcd96ac67d7fb1a3020c3717a2cdebdcf9304d6dfd9ea494004791cf043 HEAD_REF master PATCHES - 0007-fix-hdf5.patch - 0016-fix-freetype-contrib.patch - 0018-fix-depend-tesseract.patch - 0019-fix-ogre-dependency.patch - "${CUDA_12_4_CONTRIB_FIX}" - "${CUDA_12_4_CONTRIB_FIX_2}" - "${CUDA_12_4_CONTRIB_FIX_3}" + 0007-contrib-fix-hdf5.patch + 0013-contrib-fix-ogre.patch + 0016-contrib-fix-freetype.patch + 0018-contrib-fix-tesseract.patch + ${CONTRIB_CUDA_124_NPP_PATCH} + ${CONTRIB_CUDA_124_PATCH} + ${CONTRIB_CUDA_124_TUPLE_PATCH} + ${CONTRIB_CUDA_124_INCLUDE_PATCH} ) set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules") @@ -310,72 +311,43 @@ if("contrib" IN_LIST FEATURES) ) endif() -if(WITH_IPP) +if("ipp" IN_LIST FEATURES) if(VCPKG_TARGET_IS_OSX) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_mac_intel64_20230330_general.tgz" - FILENAME "opencv-cache/ippicv/d2b234a86af1b616958619a4560356d9-ippicv_2021.8_mac_intel64_20230330_general.tgz" - SHA512 f74a4b7bda9ec20bbf7fbb764171156bfd0ca4915fd4efd77ff53fc7a64ce8219d82d28d4fef5968fde1b85fd669e63f9514f4700d85c25327ce56fa47c0f007 + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a/ippicv/ippicv_2021.9.1_mac_intel64_20230919_general.tgz" + FILENAME "opencv-cache/ippicv/14f01c5a4780bfae9dde9b0aaf5e56fc-ippicv_2021.9.1_mac_intel64_20230919_general.tgz" + SHA512 e53aa1bf4336a94554bf40c29a74c85f595c0aec8d9102a158db7ae075db048c1ff7f50ed81eda3ac8e07b1460862970abc820073a53c0f237e584708c5295da ) - else() - message(WARNING "This target architecture is not supported IPPICV") - set(WITH_IPP OFF) endif() elseif(VCPKG_TARGET_IS_LINUX) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_lnx_intel64_20230330_general.tgz" - FILENAME "opencv-cache/ippicv/43219bdc7e3805adcbe3a1e2f1f3ef3b-ippicv_2021.8_lnx_intel64_20230330_general.tgz" - SHA512 e54085172465a9aa82e454c1055d62be9cb970e99e75343ab7849241f36762021c5b30cf2cff0d92bab2ccec65809c467293bea865e5af3ad82af8f75bf08ea0 + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a/ippicv/ippicv_2021.10.0_lnx_intel64_20230919_general.tgz" + FILENAME "opencv-cache/ippicv/606a19b207ebedfe42d59fd916cc4850-ippicv_2021.10.0_lnx_intel64_20230919_general.tgz" + SHA512 ce4a2fbcf77d435cabecd9b414950db4bd34f88dde385e4a9139586a9c6d31f09e32d13d7ae36ca64418d5511777b5ba212c06422fe5ae1508342846613ca26d ) elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_lnx_ia32_20230330_general.tgz" - FILENAME "opencv-cache/ippicv/165875443d72faa3fd2146869da90d07-ippicv_2021.8_lnx_ia32_20230330_general.tgz" - SHA512 44560b42b1a406723f7d673735c4846dcba859d1f0f29da8885b3d4ab230c6b7bf6fa20837fcfd79ca01519344917be0a33a58f4641ffdaef13d2adbb40a3053 + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a/ippicv/ippicv_2021.10.0_lnx_ia32_20230919_general.tgz" + FILENAME "opencv-cache/ippicv/606a19b207ebedfe42d59fd916cc4850-ippicv_2021.10.0_lnx_ia32_20230919_general.tgz" + SHA512 534fdd08b6f669665cf6a3f719f54505cf53e800f90ba93d96e77b1e149b260738cb59c685c424788c06d924a88756c3038d27bd0e33acdb51e0051f9aac421c ) - else() - message(WARNING "This target architecture is not supported IPPICV") - set(WITH_IPP OFF) endif() elseif(VCPKG_TARGET_IS_WINDOWS) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_win_intel64_20230330_general.zip" - FILENAME "opencv-cache/ippicv/71e4f58de939f0348ec7fb58ffb17dbf-ippicv_2021.8_win_intel64_20230330_general.zip" - SHA512 00233de01a9ad1a8df35fa5b66218ae42b3d0bfca08ed7a14e733d4ea037d01f6932386b6cfc441b159b525c0a31c259414c2f096431ed5cb0fd32dd1d367cde + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a/ippicv/ippicv_2021.10.0_win_intel64_20230919_general.zip" + FILENAME "opencv-cache/ippicv/538a819ec84193a9c9f3c0f8df0be8b7-ippicv_2021.10.0_win_intel64_20230919_general.zip" + SHA512 5aff6d9c8474e9f13e54d849a3e9b03de1e82590437d90cbde8e6c1d3be3a2b0f4263b5171796e8dab41181f8d7f8fd7c6d46e6f4aedacc98213aa5270bd1720 ) elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") vcpkg_download_distfile(OCV_DOWNLOAD - URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/1224f78da6684df04397ac0f40c961ed37f79ccb/ippicv/ippicv_2021.8_win_ia32_20230330_general.zip" - FILENAME "opencv-cache/ippicv/57fd4648cfe64eae9e2ad9d50173a553-ippicv_2021.8_win_ia32_20230330_general.zip" - SHA512 c2942f0bdc51e0d0ee0695c62d4e366c5b87d95acaac38c5df19c2c647849cc544c5689a569134baaf64a260aa4984db51fc094ddd995afef3bd0c1d3f265465 + URLS "https://raw.githubusercontent.com/opencv/opencv_3rdparty/0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a/ippicv/ippicv_2021.10.0_win_ia32_20230919_general.zip" + FILENAME "opencv-cache/ippicv/8ff93c69415ab0835cc1e94dc5660f5d-ippicv_2021.10.0_win_ia32_20230919_general.zip" + SHA512 bd63e8edf52e561154953217d26ca64cc500b529e55b8e3abb927d69766fff979fed2b16d51e453f75e61679d3569abbc5c1bbb2652a93f3f178fbf27354d624 ) - else() - message(WARNING "This target architecture is not supported IPPICV") - set(WITH_IPP OFF) endif() - else() - message(WARNING "This target architecture is not supported IPPICV") - set(WITH_IPP OFF) - endif() -endif() - -set(WITH_MSMF ON) -if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_MINGW) - set(WITH_MSMF OFF) -endif() - -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - if (WITH_TBB) - message(WARNING "TBB is currently unsupported in this build configuration, turning it off") - set(WITH_TBB OFF) - endif() - - if (VCPKG_TARGET_IS_WINDOWS AND BUILD_opencv_ovis) - message(WARNING "OVIS is currently unsupported in this build configuration, turning it off") - set(BUILD_opencv_ovis OFF) endif() endif() @@ -389,7 +361,6 @@ endif() if("halide" IN_LIST FEATURES) list(APPEND ADDITIONAL_BUILD_FLAGS # Halide 13 requires C++17 - "-DCMAKE_CXX_STANDARD=17" "-DCMAKE_CXX_STANDARD_REQUIRED=ON" "-DCMAKE_DISABLE_FIND_PACKAGE_Halide=ON" "-DHALIDE_ROOT_DIR=${CURRENT_INSTALLED_DIR}" @@ -409,17 +380,21 @@ endif() vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + ###### Verify that required components and only those are enabled + -DENABLE_CONFIG_VERIFICATION=ON ###### opencv cpu recognition is broken, always using host and not target: here we bypass that -DOPENCV_SKIP_SYSTEM_PROCESSOR_DETECTION=TRUE -DAARCH64=${TARGET_IS_AARCH64} -DX86_64=${TARGET_IS_X86_64} -DX86=${TARGET_IS_X86} -DARM=${TARGET_IS_ARM} + ###### use c++17 to enable features that fail with c++11 (halide, protobuf, etc.) + -DCMAKE_CXX_STANDARD=17 ###### ocv_options -DINSTALL_TO_MANGLED_PATHS=OFF -DOpenCV_INSTALL_BINARIES_PREFIX= -DOPENCV_BIN_INSTALL_PATH=bin - -DOPENCV_INCLUDE_INSTALL_PATH=include + -DOPENCV_INCLUDE_INSTALL_PATH=include/opencv4 -DOPENCV_LIB_INSTALL_PATH=lib -DOPENCV_3P_LIB_INSTALL_PATH=lib/manual-link/opencv4_thirdparty -DOPENCV_CONFIG_INSTALL_PATH=share/opencv4 @@ -429,39 +404,38 @@ vcpkg_cmake_configure( -DOPENCV_DLLVERSION=4 -DOPENCV_DEBUG_POSTFIX=d -DOPENCV_GENERATE_SETUPVARS=OFF + -DOPENCV_GENERATE_PKGCONFIG=ON # Do not build docs/examples -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF + -DBUILD_PERF_TESTS=OFF + -DBUILD_TESTS=OFF -Dade_DIR=${ADE_DIR} ###### Disable build 3rd party libs + -DBUILD_IPP_IW=OFF + -DBUILD_ITT=OFF -DBUILD_JASPER=OFF - -DBUILD_OPENJPEG=OFF -DBUILD_JPEG=OFF -DBUILD_OPENEXR=OFF + -DBUILD_OPENJPEG=OFF -DBUILD_PNG=OFF + -DBUILD_PROTOBUF=OFF + -DBUILD_TBB=OFF -DBUILD_TIFF=OFF -DBUILD_WEBP=OFF -DBUILD_ZLIB=OFF - -DBUILD_TBB=OFF - -DBUILD_ITT=OFF - ###### Disable build 3rd party components - -DBUILD_PROTOBUF=OFF ###### OpenCV Build components -DBUILD_opencv_apps=OFF -DBUILD_opencv_java=OFF -DBUILD_opencv_js=OFF + -DBUILD_JAVA=OFF -DBUILD_ANDROID_PROJECT=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DBUILD_PACKAGE=OFF - -DBUILD_PERF_TESTS=OFF - -DBUILD_TESTS=OFF -DBUILD_WITH_DEBUG_INFO=ON -DBUILD_WITH_STATIC_CRT=${BUILD_WITH_STATIC_CRT} - -DBUILD_JAVA=OFF -DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR} ###### PROTOBUF - -DPROTOBUF_UPDATE_FILES=${BUILD_opencv_dnn} - -DUPDATE_PROTO_FILES=${BUILD_opencv_dnn} ###### PYLINT/FLAKE8 -DENABLE_PYLINT=OFF -DENABLE_FLAKE8=OFF @@ -473,36 +447,39 @@ vcpkg_cmake_configure( ###### OPENCV vars "-DOPENCV_DOWNLOAD_PATH=${DOWNLOADS}/opencv-cache" ${BUILD_WITH_CONTRIB_FLAG} - -DOPENCV_OTHER_INSTALL_PATH=share/opencv + -DOPENCV_OTHER_INSTALL_PATH=share/opencv4 ###### customized properties ## Options from vcpkg_check_features() ${FEATURE_OPTIONS} - -DWITH_GTK=${WITH_GTK} -DWITH_QT=${WITH_QT} - -DWITH_IPP=${WITH_IPP} - -DWITH_VULKAN=${WITH_VULKAN} -DWITH_MATLAB=OFF - -DWITH_MSMF=${WITH_MSMF} - -DWITH_OPENMP=${WITH_OPENMP} - -DWITH_PROTOBUF=${BUILD_opencv_dnn} - -DWITH_PYTHON=${WITH_PYTHON} - -DWITH_OPENCLAMDBLAS=OFF - -DWITH_OPENVINO=${WITH_OPENVINO} - -DWITH_TBB=${WITH_TBB} + -DWITH_OPENJPEG=OFF -DWITH_CPUFEATURES=OFF - ###### BUILD_options (mainly modules which require additional libraries) - -DBUILD_opencv_ovis=${BUILD_opencv_ovis} - -DBUILD_opencv_dnn=${BUILD_opencv_dnn} - -DBUILD_opencv_python3=${BUILD_opencv_python3} - ###### The following modules are disabled for UWP + -DWITH_SPNG=OFF + -DWITH_OPENCLAMDFFT=OFF + -DWITH_OPENCLAMDBLAS=OFF + -DWITH_OPENCL_D3D11_NV=OFF + -DWITH_ITT=OFF + -DWITH_NVCUVID=OFF + -DWITH_NVCUVENC=OFF + -DWITH_AVIF=OFF + -DWITH_VA=OFF + -DWITH_VA_INTEL=OFF + ###### modules which require special treatment -DBUILD_opencv_quality=${BUILD_opencv_quality} - -DBUILD_opencv_gapi=${BUILD_opencv_gapi} - ###### The following module is disabled because it's broken #https://github.com/opencv/opencv_contrib/issues/2307 - -DBUILD_opencv_rgbd=OFF + -DBUILD_opencv_rgbd=${BUILD_opencv_rgbd} + ###### Additional build flags + -DOPENCV_LAPACK_SHARED_LIBS=${OPENCV_LAPACK_SHARED_LIBS} + -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=${OPENCV_DISABLE_FILESYSTEM_SUPPORT} + -DCV_ENABLE_INTRINSICS=${CV_ENABLE_INTRINSICS} ###### Additional build flags ${ADDITIONAL_BUILD_FLAGS} - -DBUILD_IPP_IW=${WITH_IPP} - -DOPENCV_LAPACK_FIND_PACKAGE_ONLY=ON + OPTIONS_RELEASE + ###### Python install path + ${PYTHON_EXTRA_DEFINES_RELEASE} + OPTIONS_DEBUG + ###### Python install path + ${PYTHON_EXTRA_DEFINES_DEBUG} ) vcpkg_cmake_install() @@ -518,8 +495,8 @@ if (NOT VCPKG_BUILD_TYPE) ) endif() - file(READ "${CURRENT_PACKAGES_DIR}/share/opencv4/OpenCVModules.cmake" OPENCV_MODULES) - set(DEPS_STRING "include(CMakeFindDependencyMacro) +file(READ "${CURRENT_PACKAGES_DIR}/share/opencv4/OpenCVModules.cmake" OPENCV_MODULES) +set(DEPS_STRING "include(CMakeFindDependencyMacro) if(${BUILD_opencv_dnn} AND NOT TARGET libprotobuf) #Check if the CMake target libprotobuf is already defined find_dependency(Protobuf CONFIG REQUIRED) if(TARGET protobuf::libprotobuf) @@ -537,119 +514,207 @@ if(${BUILD_opencv_dnn} AND NOT TARGET libprotobuf) #Check if the CMake target l endif() endif() find_dependency(Threads)") - if("tiff" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(TIFF)") - endif() - if("cuda" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(CUDA)") - endif() - if("ffmpeg" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(FFMPEG)") - endif() - if(BUILD_opencv_quality AND "contrib" IN_LIST FEATURES) - string(APPEND DEPS_STRING " +if("tiff" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(TIFF)") +endif() +if("ffmpeg" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(FFMPEG)") +endif() +if("contrib" IN_LIST FEATURES AND NOT VCPKG_TARGET_IS_UWP AND NOT VCPKG_TARGET_IS_IOS AND NOT (VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^arm")) + string(APPEND DEPS_STRING " # C language is required for try_compile tests in FindHDF5 enable_language(C) find_dependency(HDF5) find_dependency(Tesseract)") - endif() - if(WITH_CONTRIB AND WITH_FREETYPE) - string(APPEND DEPS_STRING "\nfind_dependency(harfbuzz)") - endif() - if(WITH_TBB) - string(APPEND DEPS_STRING "\nfind_dependency(TBB)") - endif() - if("vtk" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(VTK)") - endif() - if("sfm" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(gflags CONFIG)\nfind_dependency(Ceres CONFIG)") - endif() - if("eigen" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(Eigen3 CONFIG)") - endif() - if("lapack" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(LAPACK)") - endif() - if(WITH_OPENVINO) - string(APPEND DEPS_STRING "\nfind_dependency(OpenVINO CONFIG)") - endif() - if("openexr" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(OpenEXR CONFIG)") - endif() - if("openjpeg" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(OpenJPEG)") - endif() - if(WITH_OPENMP) - string(APPEND DEPS_STRING "\nfind_dependency(OpenMP)") - endif() - if(BUILD_opencv_ovis) - string(APPEND DEPS_STRING "\nfind_dependency(OGRE)") - endif() - if("quirc" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(quirc)") - endif() - if("qt" IN_LIST FEATURES) - string(APPEND DEPS_STRING " +endif() +if("freetype" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(harfbuzz)") +endif() +if("tbb" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(TBB)") +endif() +if("vtk" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(VTK)") +endif() +if("sfm" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(gflags CONFIG)\nfind_dependency(Ceres CONFIG)") +endif() +if("eigen" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(Eigen3 CONFIG)") +endif() +if("lapack" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(LAPACK)") +endif() +if("openvino" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenVINO CONFIG)") +endif() +if("openexr" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenEXR CONFIG)") +endif() +if("openjpeg" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenJPEG)") +endif() +if("omp" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OpenMP)") +endif() +if("ovis" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(OGRE)") +endif() +if("quirc" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(quirc)") +endif() +if("qt" IN_LIST FEATURES) + string(APPEND DEPS_STRING " set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) -find_dependency(Qt${USE_QT_VERSION} COMPONENTS Core Gui Widgets Test Concurrent Core5Compat)") - if("opengl" IN_LIST FEATURES) - string(APPEND DEPS_STRING " -find_dependency(Qt${USE_QT_VERSION} COMPONENTS OpenGL)") - endif() - endif() - if("ade" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(ade)") - endif() - if("gdcm" IN_LIST FEATURES) - string(APPEND DEPS_STRING "\nfind_dependency(GDCM)") +set(CMAKE_AUTOUIC ON)") + if("opengl" IN_LIST FEATURES) + string(APPEND DEPS_STRING " +find_dependency(Qt${USE_QT_VERSION} COMPONENTS Core Gui Widgets Test Concurrent ${QT_CORE5COMPAT} OpenGL ${QT_OPENGLWIDGETS})") + else() + string(APPEND DEPS_STRING " +find_dependency(Qt${USE_QT_VERSION} COMPONENTS Core Gui Widgets Test Concurrent ${QT_CORE5COMPAT})") endif() +endif() +if("ade" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(ade)") +endif() +if("gdcm" IN_LIST FEATURES) + string(APPEND DEPS_STRING "\nfind_dependency(GDCM)") +endif() - string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)" - "set(CMAKE_IMPORT_FILE_VERSION 1)\n${DEPS_STRING}" OPENCV_MODULES "${OPENCV_MODULES}") +string(REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)" + "set(CMAKE_IMPORT_FILE_VERSION 1)\n${DEPS_STRING}" OPENCV_MODULES "${OPENCV_MODULES}") - if(WITH_OPENMP) - string(REPLACE "set_target_properties(opencv_core PROPERTIES - INTERFACE_LINK_LIBRARIES \"" - "set_target_properties(opencv_core PROPERTIES - INTERFACE_LINK_LIBRARIES \"\$;" OPENCV_MODULES "${OPENCV_MODULES}") - endif() +if("openmp" IN_LIST FEATURES) + string(REPLACE "set_target_properties(opencv_core PROPERTIES +INTERFACE_LINK_LIBRARIES \"" + "set_target_properties(opencv_core PROPERTIES +INTERFACE_LINK_LIBRARIES \"\$;" OPENCV_MODULES "${OPENCV_MODULES}") +endif() - if(BUILD_opencv_ovis) - string(REPLACE "OgreGLSupportStatic" - "OgreGLSupport" OPENCV_MODULES "${OPENCV_MODULES}") - endif() +if("ovis" IN_LIST FEATURES) + string(REPLACE "OgreGLSupportStatic" + "OgreGLSupport" OPENCV_MODULES "${OPENCV_MODULES}") +endif() - file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv4/OpenCVModules.cmake" "${OPENCV_MODULES}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/opencv4/OpenCVModules.cmake" "${OPENCV_MODULES}") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -file(REMOVE "${CURRENT_PACKAGES_DIR}/LICENSE") -file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/LICENSE") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv4/licenses") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv") - if(VCPKG_TARGET_IS_ANDROID) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/README.android") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/README.android") endif() -if("python" IN_LIST FEATURES) - file(GLOB python_dir LIST_DIRECTORIES true RELATIVE "${CURRENT_PACKAGES_DIR}/lib/" "${CURRENT_PACKAGES_DIR}/lib/python*") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/${python_dir}/site-packages/cv2/typing") - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/${python_dir}/site-packages/cv2/typing") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2/typing") +file(GLOB PYTHON3_SITE_FILES "${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2/*.py") +foreach(PYTHON3_SITE_FILE ${PYTHON3_SITE_FILES}) + vcpkg_replace_string("${PYTHON3_SITE_FILE}" + "os.path.join('${CURRENT_PACKAGES_DIR}'" + "os.path.join('.'" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${PYTHON3_SITE_FILE}" + "os.path.join('${CURRENT_PACKAGES_DIR}/${PYTHON3_SITE}/cv2'" + "os.path.join('.'" + IGNORE_UNCHANGED + ) +endforeach() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/cv2/typing") +file(GLOB PYTHON3_SITE_FILES_DEBUG "${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/cv2/*.py") +foreach(PYTHON3_SITE_FILE_DEBUG ${PYTHON3_SITE_FILES_DEBUG}) + vcpkg_replace_string("${PYTHON3_SITE_FILE_DEBUG}" + "os.path.join('${CURRENT_PACKAGES_DIR}/debug'" + "os.path.join('.'" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${PYTHON3_SITE_FILE_DEBUG}" + "os.path.join('${CURRENT_PACKAGES_DIR}/debug/${PYTHON3_SITE}/cv2'" + "os.path.join('.'" + IGNORE_UNCHANGED + ) +endforeach() + +if (EXISTS "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv4.pc") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv4.pc" + "-lQt6::Core5Compat" + "-lQt6Core5Compat" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv4.pc" + "-lhdf5::hdf5-static" + "-lhdf5" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv4.pc" + "-lglog::glog" + "-lglog" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv4.pc" + "-lgflags::gflags_static" + "-lgflags" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv4.pc" + "-lTesseract::libtesseract" + "-ltesseract" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opencv4.pc" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/" + "\${prefix}" + IGNORE_UNCHANGED + ) +endif() + +if (EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv4.pc") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv4.pc" + "-lQt6::Core5Compat" + "-lQt6Core5Compat" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv4.pc" + "-lhdf5::hdf5-static" + "-lhdf5" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv4.pc" + "-lglog::glog" + "-lglog" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv4.pc" + "-lgflags::gflags_static" + "-lgflags" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv4.pc" + "-lTesseract::libtesseract" + "-ltesseract" + IGNORE_UNCHANGED + ) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/opencv4.pc" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/" + "\${prefix}" + IGNORE_UNCHANGED + ) endif() vcpkg_fixup_pkgconfig() configure_file("${CURRENT_PORT_DIR}/usage.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" @ONLY) -file(GLOB extra_license_files "${CURRENT_PACKAGES_DIR}/share/licenses/opencv4/*") -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" ${extra_license_files}) +file(REMOVE "${CURRENT_PACKAGES_DIR}/LICENSE") +file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/LICENSE") +file(GLOB_RECURSE extra1_license_files "${CURRENT_PACKAGES_DIR}/share/licenses/*") +file(GLOB_RECURSE extra2_license_files "${CURRENT_PACKAGES_DIR}/share/opencv4/licenses/*") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" ${extra1_license_files} ${extra2_license_files}) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv4/licenses") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/licenses") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencv") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/ports/opencv4/usage.in b/ports/opencv4/usage.in index 3c0346ab7a..217ce72976 100644 --- a/ports/opencv4/usage.in +++ b/ports/opencv4/usage.in @@ -1,5 +1,4 @@ -If you do not install the meta-port *opencv*, the package @PORT@ is compatible with CMake -if you set the OpenCV_DIR *before* the find_package call +@PORT@ is compatible with built-in CMake variables. In case of multiple OpenCV version installed, set OpenCV_ROOT *before* the find_package call: - set(OpenCV_DIR "${VCPKG_INSTALLED_DIR}/@TARGET_TRIPLET@/share/@PORT@") + set(OpenCV_ROOT "${VCPKG_INSTALLED_DIR}/@TARGET_TRIPLET@/share/@PORT@") find_package(OpenCV REQUIRED) diff --git a/ports/opencv4/vcpkg.json b/ports/opencv4/vcpkg.json index 6e8623676f..c2d59983cc 100644 --- a/ports/opencv4/vcpkg.json +++ b/ports/opencv4/vcpkg.json @@ -1,7 +1,6 @@ { "name": "opencv4", - "version": "4.8.0", - "port-version": 22, + "version": "4.9.0", "description": "computer vision library", "homepage": "https://github.com/opencv/opencv", "license": "Apache-2.0", @@ -30,6 +29,9 @@ "ade" ] }, + "calib3d": { + "description": "calib3d module" + }, "contrib": { "description": "opencv_contrib module", "dependencies": [ @@ -82,10 +84,14 @@ "name": "opencv4", "default-features": false, "features": [ - "dnn", + "calib3d", + "fs", + "highgui", + "intrinsics", "jpeg", "png", "quirc", + "thread", "tiff", "webp" ] @@ -97,11 +103,37 @@ "gtk" ], "platform": "linux" + }, + { + "name": "opencv4", + "default-features": false, + "features": [ + "gapi" + ], + "platform": "!uwp" + }, + { + "name": "opencv4", + "default-features": false, + "features": [ + "dnn" + ], + "platform": "!android" + }, + { + "name": "opencv4", + "default-features": false, + "features": [ + "dshow", + "win32ui" + ], + "platform": "windows & !uwp" } ] }, "dnn": { "description": "Enable dnn module", + "supports": "!android", "dependencies": [ "flatbuffers", { @@ -125,6 +157,9 @@ } ] }, + "dshow": { + "description": "Enable DirectShow" + }, "eigen": { "description": "Eigen support for opencv", "dependencies": [ @@ -159,6 +194,13 @@ } ] }, + "fs": { + "description": "Enable filesystem support" + }, + "gapi": { + "description": "Enable gapi module", + "supports": "!uwp" + }, "gdcm": { "description": "GDCM support for opencv", "dependencies": [ @@ -203,8 +245,15 @@ } ] }, + "highgui": { + "description": "highgui module" + }, + "intrinsics": { + "description": "Enable intrinsics" + }, "ipp": { - "description": "Enable Intel Integrated Performance Primitives" + "description": "Enable Intel Integrated Performance Primitives", + "supports": "(osx & x64) | (windows & (x64 | x86)) | (linux & (x64 | x86))" }, "jasper": { "description": "JPEG 2000 support for opencv (deprecated)", @@ -225,9 +274,19 @@ "lapack" ] }, + "msmf": { + "description": "Microsoft Media Foundation support for opencv", + "supports": "windows & !uwp & !mingw" + }, "nonfree": { "description": "allow nonfree and unredistributable libraries" }, + "opencl": { + "description": "Enable opencl support", + "dependencies": [ + "opencl" + ] + }, "openexr": { "description": "OpenEXR support for opencv", "dependencies": [ @@ -247,7 +306,8 @@ ] }, "openmp": { - "description": "Enable openmp support for opencv" + "description": "Enable OpenMP support", + "supports": "!osx" }, "openvino": { "description": "OpenVINO support for OpenCV DNN", @@ -281,6 +341,7 @@ }, "ovis": { "description": "opencv_ovis module", + "supports": "!(windows & static)", "dependencies": [ "ogre", { @@ -301,7 +362,13 @@ "python": { "description": "Python wrapper support for opencv", "dependencies": [ - "python3" + { + "name": "python3", + "default-features": false, + "features": [ + "extensions" + ] + } ] }, "qt": { @@ -320,12 +387,37 @@ } ] }, + "quality": { + "description": "Build opencv_quality module", + "supports": "!uwp", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "contrib" + ] + } + ] + }, "quirc": { "description": "Enable QR code module", "dependencies": [ "quirc" ] }, + "rgbd": { + "description": "Build opencv_rgbd module", + "dependencies": [ + { + "name": "opencv4", + "default-features": false, + "features": [ + "contrib" + ] + } + ] + }, "sfm": { "description": "opencv_sfm module", "dependencies": [ @@ -350,10 +442,14 @@ }, "tbb": { "description": "Enable Intel Threading Building Blocks", + "supports": "!static", "dependencies": [ "tbb" ] }, + "thread": { + "description": "Enable thread support" + }, "tiff": { "description": "TIFF support for opencv", "dependencies": [ @@ -396,6 +492,10 @@ "libwebp" ] }, + "win32ui": { + "description": "Enable win32ui", + "supports": "windows & !uwp" + }, "world": { "description": "Compile to a single package support for opencv" } diff --git a/ports/openimageio/fix-dependencies.patch b/ports/openimageio/fix-dependencies.patch index 513c09efd5..9af314c270 100644 --- a/ports/openimageio/fix-dependencies.patch +++ b/ports/openimageio/fix-dependencies.patch @@ -1,7 +1,7 @@ diff -u -r a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in --- a/src/cmake/Config.cmake.in +++ b/src/cmake/Config.cmake.in -@@ -6,6 +6,27 @@ +@@ -6,6 +6,30 @@ include(CMakeFindDependencyMacro) @@ -12,6 +12,9 @@ diff -u -r a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in +if(@USE_LIBHEIF@) + find_dependency(libheif CONFIG) +endif() ++if(@USE_FREETYPE@) ++ find_dependency(freetype CONFIG) ++endif() +find_dependency(PNG) +if(@USE_OPENCV@) + find_dependency(OpenCV CONFIG) diff --git a/ports/openimageio/vcpkg.json b/ports/openimageio/vcpkg.json index dd4243aa0e..cd17dccc7a 100644 --- a/ports/openimageio/vcpkg.json +++ b/ports/openimageio/vcpkg.json @@ -1,6 +1,7 @@ { "name": "openimageio", "version": "2.5.16.0", + "port-version": 1, "description": "A library for reading and writing images, and a bunch of related classes, utilities, and application.", "homepage": "https://github.com/OpenImageIO/oiio", "license": "BSD-3-Clause", diff --git a/ports/rtabmap/multi-definition.patch b/ports/rtabmap/multi-definition.patch index 060396bba5..94c02f47dd 100644 --- a/ports/rtabmap/multi-definition.patch +++ b/ports/rtabmap/multi-definition.patch @@ -1,5 +1,5 @@ diff --git a/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h b/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h -index 2fc12a2..5219a38 100644 +index 2fc12a2..a719512 100644 --- a/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h +++ b/corelib/include/rtabmap/core/stereo/stereoRectifyFisheye.h @@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -13,13 +13,16 @@ index 2fc12a2..5219a38 100644 // Opencv4 doesn't expose those functions below anymore, we should recopy all of them! int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian CV_DEFAULT(0)) { -@@ -919,13 +923,17 @@ void cvConvertPointsHomogeneous( const CvMat* _src, CvMat* _dst ) - - #endif // OpenCV3 +@@ -915,6 +919,8 @@ void cvConvertPointsHomogeneous( const CvMat* _src, CvMat* _dst ) + } + } +} // namespace + - namespace rtabmap + #endif // OpenCV4 + + #endif // OpenCV3 +@@ -923,9 +929,11 @@ namespace rtabmap { void @@ -50,7 +53,7 @@ index 2fc12a2..5219a38 100644 { double _om[3], _t[3] = {0}, _uu[3]={0,0,0}, _r_r[3][3], _pp[3][4]; double _ww[3], _wr[3][3], _z[3] = {0,0,0}, _ri[3][3], _w3[3]; -@@ -1177,14 +1190,20 @@ void cvStereoRectifyFisheye( const CvMat* _cameraMatrix1, const CvMat* _cameraMa +@@ -1177,19 +1190,25 @@ void cvStereoRectifyFisheye( const CvMat* _cameraMatrix1, const CvMat* _cameraMa cvConvert( &Q, matQ ); } } @@ -72,6 +75,12 @@ index 2fc12a2..5219a38 100644 { cv::Mat cameraMatrix1 = _cameraMatrix1.getMat(), cameraMatrix2 = _cameraMatrix2.getMat(); cv::Mat distCoeffs1 = _distCoeffs1.getMat(), distCoeffs2 = _distCoeffs2.getMat(); + cv::Mat Rmat = _Rmat.getMat(), Tmat = _Tmat.getMat(); +- ++ + #if CV_MAJOR_VERSION > 3 || (CV_MAJOR_VERSION >= 3 && (CV_MINOR_VERSION>4 || (CV_MINOR_VERSION>=4 && CV_SUBMINOR_VERSION>=4))) + CvMat c_cameraMatrix1 = cvMat(cameraMatrix1); + CvMat c_cameraMatrix2 = cvMat(cameraMatrix2); @@ -1238,6 +1257,9 @@ void stereoRectifyFisheye( cv::InputArray _cameraMatrix1, cv::InputArray _distCo CvSize(newImageSize)); #endif diff --git a/ports/rtabmap/vcpkg.json b/ports/rtabmap/vcpkg.json index b1ff61f422..051cbaaaba 100644 --- a/ports/rtabmap/vcpkg.json +++ b/ports/rtabmap/vcpkg.json @@ -1,7 +1,7 @@ { "name": "rtabmap", "version": "0.21.4.1", - "port-version": 1, + "port-version": 2, "description": "Real-Time Appearance-Based Mapping", "homepage": "https://introlab.github.io/rtabmap/", "license": null, diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 3c8b8ead09..ccefd7d84e 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -722,9 +722,6 @@ monkeys-audio:x64-android=fail moos-core:arm-neon-android=fail moos-core:arm64-android=fail moos-core:x64-android=fail -mozjpeg:arm-neon-android=fail -mozjpeg:arm64-android=fail -mozjpeg:x64-android=fail mpir:x64-android=fail # ms-gltf require the Microsoft GDK with Xbox Extensions which is not installed on the CI pipeline machines ms-gdkx:x64-windows=fail @@ -741,6 +738,9 @@ moos-essential:x64-windows-static-md=fail moos-essential:x64-windows=fail moos-essential:x86-windows=fail # Conflicts with libjpeg-turbo +mozjpeg:arm-neon-android=fail +mozjpeg:arm64-android=fail +mozjpeg:x64-android=fail mozjpeg:arm64-windows = skip mozjpeg:arm64-uwp = skip mozjpeg:x64-linux = skip @@ -812,27 +812,6 @@ omplapp:x64-linux=skip # opencc/deps/rapidjson-1.1.0/rapidjson.h: Unknown machine endianess detected # opencc/deps/marisa-0.2.5/lib/marisa/grimoire/io/mapper.cc currently doesn't support UWP. opencc:x64-android=fail -opencv2:arm-neon-android=fail -opencv2:arm64-android=fail -opencv2:arm64-windows = skip -opencv2:arm64-uwp = skip -opencv2:x64-android=fail -opencv2:x64-linux = skip -opencv2:x64-osx = skip -opencv2:x64-uwp = skip -opencv2:x64-windows = skip -opencv2:x64-windows-static = skip -opencv2:x64-windows-static-md = skip -opencv2:x86-windows = skip -opencv3:arm64-windows = skip -opencv3:arm64-uwp = skip -opencv3:x64-linux = skip -opencv3:x64-osx = skip -opencv3:x64-uwp = skip -opencv3:x64-windows = skip -opencv3:x64-windows-static = skip -opencv3:x64-windows-static-md = skip -opencv3:x86-windows = skip openfbx:arm-neon-android=fail openimageio:arm-neon-android=fail openimageio:arm64-android=fail @@ -1300,9 +1279,14 @@ vcpkg-ci-mathgl:x64-windows=pass vcpkg-ci-mathgl:x64-windows-static=pass vcpkg-ci-mathgl:x64-windows-static-md=pass vcpkg-ci-mathgl:x86-windows=pass +vcpkg-ci-opencv:arm-neon-android=pass +vcpkg-ci-opencv:arm64-android=pass +vcpkg-ci-opencv:arm64-osx=pass vcpkg-ci-opencv:arm64-uwp=pass vcpkg-ci-opencv:arm64-windows=pass +vcpkg-ci-opencv:x64-android=pass vcpkg-ci-opencv:x64-linux=pass +vcpkg-ci-opencv:x64-osx=pass vcpkg-ci-opencv:x64-uwp=pass vcpkg-ci-opencv:x64-windows-static-md=pass vcpkg-ci-opencv:x64-windows-static=pass diff --git a/scripts/test_ports/vcpkg-ci-opencv/vcpkg.json b/scripts/test_ports/vcpkg-ci-opencv/vcpkg.json index 6cb18e7173..43e744c857 100644 --- a/scripts/test_ports/vcpkg-ci-opencv/vcpkg.json +++ b/scripts/test_ports/vcpkg-ci-opencv/vcpkg.json @@ -1,19 +1,36 @@ { "name": "vcpkg-ci-opencv", "version-string": "1", - "port-version": 5, + "port-version": 6, "description": "Port to force features of certain ports within CI", "homepage": "https://github.com/microsoft/vcpkg", "dependencies": [ { - "name": "opencv", + "name": "opencv2", + "default-features": false, + "features": [ + "eigen", + "jpeg", + "png", + "tiff" + ], + "platform": "!uwp & !(arm & windows) & !android" + }, + { + "name": "opencv2", + "default-features": false, + "features": [ + "jasper", + "opengl", + "qt" + ], + "platform": "!uwp & !android & !(windows & (arm | arm64))" + }, + { + "name": "opencv3", "default-features": false, "features": [ - "ade", - "contrib", - "dnn", "eigen", - "ffmpeg", "jpeg", "nonfree", "png", @@ -23,21 +40,92 @@ ] }, { - "name": "opencv", + "name": "opencv3", "default-features": false, "features": [ - "dc1394", - "gtk" + "openmp" ], - "platform": "linux" + "platform": "!osx" + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "dnn" + ], + "platform": "!android" + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "gstreamer", + "ovis", + "tbb" + ], + "platform": "windows & x64 & !static & !uwp" + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "contrib", + "freetype", + "gdcm", + "ipp", + "jasper", + "opengl", + "qt", + "sfm", + "vtk" + ], + "platform": "!uwp & !android & !(windows & (arm | arm64)) & !(osx & arm64)" }, { "name": "opencv", "default-features": false, "features": [ + "ade", + "calib3d", + "contrib", + "eigen", + "ffmpeg", + "fs", + "highgui", + "intrinsics", + "jpeg", + "nonfree", + "png", + "quirc", + "thread", + "tiff", + "webp" + ] + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "openmp" + ], + "platform": "!osx" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "dnn" + ], + "platform": "!android" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "gapi", "python" ], - "platform": "!uwp & !(windows & static)" + "platform": "!uwp & !(windows & static) & !android" }, { "name": "opencv", @@ -45,9 +133,13 @@ "features": [ "cuda", "cudnn", + "dnn-cuda", + "dshow", "gstreamer", + "opencl", "ovis", - "tbb" + "tbb", + "win32ui" ], "platform": "windows & x64 & !static & !uwp" }, @@ -59,15 +151,14 @@ "gdcm", "ipp", "jasper", - "lapack", - "openexr", "opengl", - "openmp", + "openjpeg", "qt", "sfm", - "vtk" + "vtk", + "vulkan" ], - "platform": "!uwp & !(windows & (arm | arm64))" + "platform": "!uwp & !android & !(windows & (arm | arm64)) & !(osx & arm64)" } ] } diff --git a/scripts/test_ports/vcpkg-ci-openimageio/vcpkg.json b/scripts/test_ports/vcpkg-ci-openimageio/vcpkg.json index 48438a967f..d67f29528f 100644 --- a/scripts/test_ports/vcpkg-ci-openimageio/vcpkg.json +++ b/scripts/test_ports/vcpkg-ci-openimageio/vcpkg.json @@ -1,6 +1,7 @@ { "name": "vcpkg-ci-openimageio", "version-string": "ci", + "port-version": 1, "description": "OpenImageIO testing within CI.", "license": "MIT", "dependencies": [ @@ -33,7 +34,7 @@ "openjpeg", { "name": "pybind11", - "platform": "!(windows & static)" + "platform": "!(windows & static) & !uwp & !mingw" }, "tools", "webp" diff --git a/versions/baseline.json b/versions/baseline.json index 943749e43d..eeea8baed2 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2193,8 +2193,8 @@ "port-version": 1 }, "darknet": { - "baseline": "2022-03-06", - "port-version": 4 + "baseline": "2024-10-10", + "port-version": 0 }, "darts-clone": { "baseline": "1767ab87cffe", @@ -6629,20 +6629,20 @@ "port-version": 0 }, "opencv": { - "baseline": "4.8.0", - "port-version": 1 + "baseline": "4.9.0", + "port-version": 0 }, "opencv2": { "baseline": "2.4.13.7", - "port-version": 20 + "port-version": 21 }, "opencv3": { "baseline": "3.4.18", - "port-version": 16 + "port-version": 17 }, "opencv4": { - "baseline": "4.8.0", - "port-version": 22 + "baseline": "4.9.0", + "port-version": 0 }, "opendnp3": { "baseline": "3.1.1", @@ -6678,7 +6678,7 @@ }, "openimageio": { "baseline": "2.5.16.0", - "port-version": 0 + "port-version": 1 }, "openjpeg": { "baseline": "2.5.2", @@ -8006,7 +8006,7 @@ }, "rtabmap": { "baseline": "0.21.4.1", - "port-version": 1 + "port-version": 2 }, "rtabmap-res-tool": { "baseline": "0.21.4.1", diff --git a/versions/d-/darknet.json b/versions/d-/darknet.json index 3b988ac067..88434fed32 100644 --- a/versions/d-/darknet.json +++ b/versions/d-/darknet.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "41c6aaf3f81927973a736c75c287cd83434517e5", + "version-date": "2024-10-10", + "port-version": 0 + }, { "git-tree": "b61e4babb5696ae0a5b1d85f9d81540c69688675", "version-date": "2022-03-06", diff --git a/versions/o-/opencv.json b/versions/o-/opencv.json index 492a0b94b3..7f111597e9 100644 --- a/versions/o-/opencv.json +++ b/versions/o-/opencv.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "be681746481dc0fb9c03863f988388ba6dc4a642", + "version": "4.9.0", + "port-version": 0 + }, { "git-tree": "bc3a2d25b8cca6c318cdd710381ca152b18ae3cd", "version": "4.8.0", diff --git a/versions/o-/opencv2.json b/versions/o-/opencv2.json index fbf3109e8a..1e63362d97 100644 --- a/versions/o-/opencv2.json +++ b/versions/o-/opencv2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "5e1c99f5f3fe591f1d87befd960c994dab246dcc", + "version": "2.4.13.7", + "port-version": 21 + }, { "git-tree": "eeae7529ebecd4243c28c1d18f4c926f928687c5", "version": "2.4.13.7", diff --git a/versions/o-/opencv3.json b/versions/o-/opencv3.json index df0ed7a783..d69536d196 100644 --- a/versions/o-/opencv3.json +++ b/versions/o-/opencv3.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "765074f2c99fa397d0192c539c0b087b1bef717d", + "version": "3.4.18", + "port-version": 17 + }, { "git-tree": "77a77ff352a1fa7d9271ea206e706929bfd2faff", "version": "3.4.18", diff --git a/versions/o-/opencv4.json b/versions/o-/opencv4.json index 919c43d623..015ad993f2 100644 --- a/versions/o-/opencv4.json +++ b/versions/o-/opencv4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "a0a4d7ac5a52dae02f263a00b3ad2d9da536c2e1", + "version": "4.9.0", + "port-version": 0 + }, { "git-tree": "f1c14acfbb673af2479af39dd8424c8f151752ad", "version": "4.8.0", diff --git a/versions/o-/openimageio.json b/versions/o-/openimageio.json index 6a0b09ed92..7a908fde5e 100644 --- a/versions/o-/openimageio.json +++ b/versions/o-/openimageio.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d9bbe547fec5d39df8a0ac27a2e66b4ba4f2f598", + "version": "2.5.16.0", + "port-version": 1 + }, { "git-tree": "80b1b56e35349c234510ff58abf197eb9cad7a3c", "version": "2.5.16.0", diff --git a/versions/r-/rtabmap.json b/versions/r-/rtabmap.json index e6f095811b..7632301917 100644 --- a/versions/r-/rtabmap.json +++ b/versions/r-/rtabmap.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "1161d6eb7dacc4aa2cff53381126c89c87f30fe0", + "version": "0.21.4.1", + "port-version": 2 + }, { "git-tree": "cfca9d505617acdca97ff519d414ae7e4a05ffa3", "version": "0.21.4.1",