Skip to content

Commit

Permalink
[OpenCV] update to v4.5 and to v3.4.12 (#15162)
Browse files Browse the repository at this point in the history
* [tesseract] add missing reference for downstream projects

* [tesseract] restore ci, fix many regressions that are uncovered by that

* Update ports/opencv2/CONTROL

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* [opencv] fix regressions on uwp, accept failure on arm64 for now

* Apply suggestions from code review

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* [opencv4] allow failures on all arm windows targets, both win32 and uwp

* [OpenCV] update to v4.5, draft

* Restore CI tests on arm architectures, they will have to work!

* adopts hints from #15180

* [libarchive] bump control version

* [libarchive] use vcpkg-cmake-wrapper instead of a custom libarchiveConfig, since it is vcpkg-provided and not port-provided

* enable features to be visible in parent scope

* apply documentation fix from CI

* [libarchive] remove unnecessary lines in portfile

* update patches

* restore ci tests for all opencv4 configs

* add port versions to baseline

* [OpenCV contrib] fix glog integration

* [OpenCV4] fix target processor detection

* update version refs

* [OpenCV3] fix target processor detection

* fix also ocv3

* remove vtk feature from opencv-ci testing

* remove qt5-tools from baseline, it works locally

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
  • Loading branch information
cenit and NancyLi1013 authored Jan 22, 2021
1 parent 42bb41f commit 450de5f
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 686 deletions.
130 changes: 65 additions & 65 deletions ports/opencv3/0002-install-options.patch
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 614baa2..1e930a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -601,7 +601,7 @@ endif()
ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)

# --- Python Support ---
-if(NOT IOS)
+if(0)
include(cmake/OpenCVDetectPython.cmake)
endif()

diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake
index 476156f..4b27b6a 100644
--- a/cmake/OpenCVCompilerOptions.cmake
+++ b/cmake/OpenCVCompilerOptions.cmake
@@ -261,7 +261,6 @@ if(MSVC)
#endif()

if(BUILD_WITH_DEBUG_INFO)
- set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} /Zi")
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
set(OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE} /debug")
endif()
diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake
index c7f9fc2..84bd302 100644
--- a/cmake/OpenCVGenConfig.cmake
+++ b/cmake/OpenCVGenConfig.cmake
@@ -109,11 +109,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME)
endif()
endfunction()

-if((CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" OR UNIX) AND NOT ANDROID)
+if(TRUE)
ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "" "")
endif()

-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()
@@ -121,7 +121,7 @@ endif()
# --------------------------------------------------------------------------------------------
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
# --------------------------------------------------------------------------------------------
-if(WIN32)
+if(0)
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/data/CMakeLists.txt b/data/CMakeLists.txt
index 1f0d720..0bb1ff7 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -1,8 +1,6 @@
file(GLOB HAAR_CASCADES haarcascades/*.xml)
file(GLOB LBP_CASCADES lbpcascades/*.xml)

-install(FILES ${HAAR_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/haarcascades COMPONENT libs)
-install(FILES ${LBP_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/lbpcascades COMPONENT libs)

if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d143a7a..15eb053 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -602,7 +602,7 @@ endif()
ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)

# --- Python Support ---
-if(NOT IOS)
+if(FALSE)
include(cmake/OpenCVDetectPython.cmake)
endif()

diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake
index 9ac671d..b14ce09 100644
--- a/cmake/OpenCVCompilerOptions.cmake
+++ b/cmake/OpenCVCompilerOptions.cmake
@@ -263,7 +263,6 @@ if(MSVC)
#endif()

if(BUILD_WITH_DEBUG_INFO)
- set(OPENCV_EXTRA_FLAGS_RELEASE "${OPENCV_EXTRA_FLAGS_RELEASE} /Zi")
set(OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_EXE_LINKER_FLAGS_RELEASE} /debug")
set(OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE} /debug")
endif()
diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake
index c7f9fc2..a1f657b 100644
--- a/cmake/OpenCVGenConfig.cmake
+++ b/cmake/OpenCVGenConfig.cmake
@@ -109,11 +109,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME)
endif()
endfunction()

-if((CMAKE_HOST_SYSTEM_NAME MATCHES "Linux" OR UNIX) AND NOT ANDROID)
+if(TRUE)
ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "" "")
endif()

-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()
@@ -121,7 +121,7 @@ endif()
# --------------------------------------------------------------------------------------------
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
# --------------------------------------------------------------------------------------------
-if(WIN32)
+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/data/CMakeLists.txt b/data/CMakeLists.txt
index 1f0d720..0bb1ff7 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -1,8 +1,6 @@
file(GLOB HAAR_CASCADES haarcascades/*.xml)
file(GLOB LBP_CASCADES lbpcascades/*.xml)

-install(FILES ${HAAR_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/haarcascades COMPONENT libs)
-install(FILES ${LBP_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/lbpcascades COMPONENT libs)

if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH)
install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests")
24 changes: 12 additions & 12 deletions ports/opencv3/0004-add-missing-stdexcept-include.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/modules/cvv/src/util/observer_ptr.hpp b/modules/cvv/src/util/observer_ptr.hpp
index fef3fea..68d1a80 100644
--- a/modules/cvv/src/util/observer_ptr.hpp
+++ b/modules/cvv/src/util/observer_ptr.hpp
@@ -11,6 +11,7 @@
#include <cstddef> //size_t
#include <cstdint> // [u]intXX_t
#include <algorithm> // since some people like to forget that one
+#include <stdexcept>

namespace cvv
{
diff --git a/modules/cvv/src/util/observer_ptr.hpp b/modules/cvv/src/util/observer_ptr.hpp
index fef3fea..68d1a80 100644
--- a/modules/cvv/src/util/observer_ptr.hpp
+++ b/modules/cvv/src/util/observer_ptr.hpp
@@ -11,6 +11,7 @@
#include <cstddef> //size_t
#include <cstdint> // [u]intXX_t
#include <algorithm> // since some people like to forget that one
+#include <stdexcept>

namespace cvv
{
2 changes: 1 addition & 1 deletion ports/opencv3/0005-fix-vtk9.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/cmake/OpenCVDetectVTK.cmake b/cmake/OpenCVDetectVTK.cmake
index 1495688..4c83504 100644
index 1495688..e5c6049 100644
--- a/cmake/OpenCVDetectVTK.cmake
+++ b/cmake/OpenCVDetectVTK.cmake
@@ -1,12 +1,30 @@
Expand Down
2 changes: 1 addition & 1 deletion ports/opencv3/0009-fix-uwp.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake
index 634b5b2..07a96fb 100644
index 10ee406..73f4af2 100644
--- a/cmake/OpenCVModule.cmake
+++ b/cmake/OpenCVModule.cmake
@@ -1183,7 +1183,7 @@ function(ocv_add_perf_tests)
Expand Down
3 changes: 1 addition & 2 deletions ports/opencv3/CONTROL
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Source: opencv3
Version: 3.4.10
Port-Version: 5
Version: 3.4.12
Build-Depends: zlib
Homepage: https://github.com/opencv/opencv
Description: computer vision library
Expand Down
22 changes: 19 additions & 3 deletions ports/opencv3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ if (EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv4")
message(FATAL_ERROR "OpenCV 4 is installed, please uninstall and try again:\n vcpkg remove opencv4")
endif()

set(OPENCV_VERSION "3.4.10")
set(OPENCV_VERSION "3.4.12")

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO opencv/opencv
REF ${OPENCV_VERSION}
SHA512 7ccdc7fef26436b2f643cce2a13c9f9f77e56d3fd0340117419df3c1665ca12416277b626cce3c056fdc14899805bbe9ece391f11d28c6adea716d47ce8894bc
SHA512 e69ff4869a8128b7d2a0537d198ec7f287fb821a8965df26339bec662da1888860941f50a269db7693309b9861f986c219288bb5856de76a6c7bc4c0a7026bee
HEAD_REF master
PATCHES
0001-disable-downloading.patch
Expand All @@ -22,6 +22,16 @@ vcpkg_from_github(
0009-fix-uwp.patch
)

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(TARGET_IS_AARCH64 1)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(TARGET_IS_ARM 1)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(TARGET_IS_X86_64 1)
else()
set(TARGET_IS_X86 1)
endif()

file(REMOVE "${SOURCE_PATH}/cmake/FindCUDNN.cmake")

string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT)
Expand Down Expand Up @@ -101,7 +111,7 @@ if("contrib" IN_LIST FEATURES)
OUT_SOURCE_PATH CONTRIB_SOURCE_PATH
REPO opencv/opencv_contrib
REF ${OPENCV_VERSION}
SHA512 70b4ecfaf9881390ad826a2aba24cced8514a680965ec7151df9926082fff53364bbe6be36458bb9ff466fda6f6f6ca2174eeac94c10a6bada989f07ed1c4da1
SHA512 0191b1d49d5a50195ed94951c570da03dc33677b682e61a65b34d40f355c36a58441034730ea7eca78dcb4af4c821983754250f93fdf3adb2b4a20e71806eb03
HEAD_REF master
PATCHES
0004-add-missing-stdexcept-include.patch
Expand Down Expand Up @@ -242,6 +252,12 @@ vcpkg_configure_cmake(
PREFER_NINJA
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
###### 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}
###### ocv_options
-DOpenCV_INSTALL_BINARIES_PREFIX=
-DOPENCV_BIN_INSTALL_PATH=bin
Expand Down
14 changes: 7 additions & 7 deletions ports/opencv4/0002-install-options.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c0b388..16c0ede 100644
index 4350b2f..89521b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -594,7 +594,7 @@ endif()
@@ -603,7 +603,7 @@ endif()
ocv_cmake_hook(POST_CMAKE_BUILD_OPTIONS)

# --- Python Support ---
Expand All @@ -12,10 +12,10 @@ index 4c0b388..16c0ede 100644
endif()

diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake
index 87b2161..5192875 100644
index 080c78c..616ce64 100644
--- a/cmake/OpenCVCompilerOptions.cmake
+++ b/cmake/OpenCVCompilerOptions.cmake
@@ -263,7 +263,6 @@ if(MSVC)
@@ -265,7 +265,6 @@ if(MSVC)
#endif()

if(BUILD_WITH_DEBUG_INFO)
Expand All @@ -24,10 +24,10 @@ index 87b2161..5192875 100644
set(OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE "${OPENCV_EXTRA_SHARED_LINKER_FLAGS_RELEASE} /debug")
endif()
diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake
index 6991289..3a691c5 100644
index 838852c..04906b3 100644
--- a/cmake/OpenCVGenConfig.cmake
+++ b/cmake/OpenCVGenConfig.cmake
@@ -109,11 +109,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME)
@@ -114,11 +114,11 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME)
endif()
endfunction()

Expand All @@ -41,7 +41,7 @@ index 6991289..3a691c5 100644
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()
@@ -121,7 +121,7 @@ endif()
@@ -126,7 +126,7 @@ endif()
# --------------------------------------------------------------------------------------------
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
# --------------------------------------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions ports/opencv4/0003-force-package-requirements.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake
index 0beaf19..3ba1ebd 100644
index 22e20b6..5d1431c 100644
--- a/cmake/OpenCVFindLibsGrfmt.cmake
+++ b/cmake/OpenCVFindLibsGrfmt.cmake
@@ -6,7 +6,7 @@
Expand Down Expand Up @@ -38,7 +38,7 @@ index 0beaf19..3ba1ebd 100644
if(WEBP_FOUND)
set(HAVE_WEBP 1)
endif()
@@ -173,7 +173,7 @@ if(WITH_JASPER AND NOT HAVE_OPENJPEG)
@@ -186,7 +186,7 @@ if(WITH_JASPER AND NOT HAVE_OPENJPEG)
if(BUILD_JASPER)
ocv_clear_vars(JASPER_FOUND)
else()
Expand All @@ -47,7 +47,7 @@ index 0beaf19..3ba1ebd 100644
endif()

if(NOT JASPER_FOUND)
@@ -197,7 +197,7 @@ if(WITH_PNG)
@@ -210,7 +210,7 @@ if(WITH_PNG)
if(BUILD_PNG)
ocv_clear_vars(PNG_FOUND)
else()
Expand All @@ -56,7 +56,7 @@ index 0beaf19..3ba1ebd 100644
if(PNG_FOUND)
include(CheckIncludeFile)
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
@@ -228,7 +228,7 @@ endif()
@@ -241,7 +241,7 @@ endif()
if(WITH_OPENEXR)
ocv_clear_vars(HAVE_OPENEXR)
if(NOT BUILD_OPENEXR)
Expand All @@ -65,7 +65,7 @@ index 0beaf19..3ba1ebd 100644
endif()

if(OPENEXR_FOUND)
@@ -246,7 +246,7 @@ endif()
@@ -259,7 +259,7 @@ endif()

# --- GDAL (optional) ---
if(WITH_GDAL)
Expand All @@ -74,7 +74,7 @@ index 0beaf19..3ba1ebd 100644

if(NOT GDAL_FOUND)
set(HAVE_GDAL NO)
@@ -258,7 +258,7 @@ if(WITH_GDAL)
@@ -271,7 +271,7 @@ if(WITH_GDAL)
endif()

if (WITH_GDCM)
Expand Down
4 changes: 2 additions & 2 deletions ports/opencv4/0004-fix-policy-CMP0057.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
diff --git a/modules/videoio/CMakeLists.txt b/modules/videoio/CMakeLists.txt
index c1c6754..360aa6b 100644
index 12ff992..afd56eb 100644
--- a/modules/videoio/CMakeLists.txt
+++ b/modules/videoio/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.3)
set(VIDEOIO_PLUGIN_LIST "" CACHE STRING "List of videoio backends to be compiled as plugins (ffmpeg, gstreamer)")
set(VIDEOIO_PLUGIN_LIST "" CACHE STRING "List of videoio backends to be compiled as plugins (ffmpeg, gstreamer, mfx, msmf or special value 'all')")
set(VIDEOIO_ENABLE_PLUGINS "ON" CACHE BOOL "Allow building videoio plugin support")
set(VIDEOIO_ENABLE_STRICT_PLUGIN_CHECK "ON" CACHE BOOL "Make sure OpenCV version is the same in plugin and host code")
24 changes: 12 additions & 12 deletions ports/opencv4/0005-add-missing-stdexcept-include.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/modules/cvv/src/util/observer_ptr.hpp b/modules/cvv/src/util/observer_ptr.hpp
index fef3fea..68d1a80 100644
--- a/modules/cvv/src/util/observer_ptr.hpp
+++ b/modules/cvv/src/util/observer_ptr.hpp
@@ -11,6 +11,7 @@
#include <cstddef> //size_t
#include <cstdint> // [u]intXX_t
#include <algorithm> // since some people like to forget that one
+#include <stdexcept>

namespace cvv
{
diff --git a/modules/cvv/src/util/observer_ptr.hpp b/modules/cvv/src/util/observer_ptr.hpp
index fef3fea..68d1a80 100644
--- a/modules/cvv/src/util/observer_ptr.hpp
+++ b/modules/cvv/src/util/observer_ptr.hpp
@@ -11,6 +11,7 @@
#include <cstddef> //size_t
#include <cstdint> // [u]intXX_t
#include <algorithm> // since some people like to forget that one
+#include <stdexcept>

namespace cvv
{
12 changes: 12 additions & 0 deletions ports/opencv4/0006-fix-glog-abbreviated-severity.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/modules/sfm/CMakeLists.txt b/modules/sfm/CMakeLists.txt
index 53a8d43..8809c88 100644
--- a/modules/sfm/CMakeLists.txt
+++ b/modules/sfm/CMakeLists.txt
@@ -20,6 +20,7 @@ if((gflags_FOUND OR GFLAGS_FOUND OR GFLAGS_INCLUDE_DIRS) AND (glog_FOUND OR GLOG
)
file(REMOVE "${_fname}")
message(STATUS "Checking SFM deps... ${SFM_DEPS_OK}")
+ add_definitions(-DGLOG_NO_ABBREVIATED_SEVERITIES)
else()
set(SFM_DEPS_OK FALSE)
endif()
Loading

0 comments on commit 450de5f

Please sign in to comment.