Skip to content

Commit

Permalink
[OpenCV] update to v4.5.4 and v3.4.16 (microsoft#20658)
Browse files Browse the repository at this point in the history
* Make gtk4.4 build.

* Update baseline for gtk

* Fix vcpkg version.

* Fix vcpkg version.

* [gtk] Fix macos build.

* [gtk] Fix linux build.

* [gtk] Add patches.

* [gtk] Bump versions - again

* Fix macos patch.

* Bump versions.

* [OpenCV] update to v4.5.4 and v3.4.16

* fix patches

* [OpenCV] fix references

* fix patches

* update references

* add gstreamer support

* fix references

* fixes

* update references

* Install xdamage.

* Bump versions.

* [fontconfig] disable doc building which is failing on bare linux

* fix references

* [opencv] use qt6

* [opencv2] use newer approach to downstream dependency handling

* fix references

* Add merged patch from upstream.

* [gtk] Bump version.

* [OpenCV] restore using qt5

* [opencv] force qt5

* update references

* use a different strategy to find qt5 dependency for downstream projects

* fix references

* use a different strategy to find qt5 dependency for downstream projects also for opencv2

* fix references

* [opencv2] fix patches

* fix references

* Update ports/fontconfig/vcpkg.json

Co-authored-by: JonLiu1993 <[email protected]>

* fix references

* fix references, again

* add gtk to linux default features

* fix references

* [OpenCV2] fix cuda patch for newer cuda versions

* fix references

* [OpenCV2] add GTK feature

* fix references

* [opencv2] bump port version

* [opencv2] fix references

* Delete duplicate install of libxdamage-dev

* [fontconfig] bump version

* fix references

* [fontconfig] bump version

* fix references

* move vcpkg-ci-opencv to manifest

Co-authored-by: Berrysoft <[email protected]>
Co-authored-by: JonLiu1993 <[email protected]>
Co-authored-by: Billy Robert O'Neal III <[email protected]>
  • Loading branch information
4 people authored Dec 2, 2021
1 parent 1b66470 commit f6601ee
Show file tree
Hide file tree
Showing 24 changed files with 470 additions and 230 deletions.
8 changes: 6 additions & 2 deletions ports/fontconfig/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ vcpkg_find_acquire_program(GPERF)
get_filename_component(GPERF_PATH ${GPERF} DIRECTORY)
vcpkg_add_to_path(${GPERF_PATH})

vcpkg_configure_meson(SOURCE_PATH ${SOURCE_PATH})
vcpkg_configure_meson(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-Ddoc=disabled
)
vcpkg_install_meson(ADD_BIN_TO_PATH)

vcpkg_copy_pdbs()
Expand Down Expand Up @@ -72,7 +76,7 @@ if(NOT VCPKG_TARGET_IS_WINDOWS)
endif()

if(VCPKG_TARGET_IS_WINDOWS)
# Unnecessary make rule creating the fontconfig cache dir on windows.
# Unnecessary make rule creating the fontconfig cache dir on windows.
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}LOCAL_APPDATA_FONTCONFIG_CACHE")
endif()

Expand Down
2 changes: 1 addition & 1 deletion ports/fontconfig/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fontconfig",
"version": "2.13.94",
"port-version": 2,
"port-version": 3,
"description": "Library for configuring and customizing font access.",
"homepage": "https://www.freedesktop.org/wiki/Software/fontconfig",
"dependencies": [
Expand Down
58 changes: 51 additions & 7 deletions ports/opencv/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opencv",
"version": "4.5.3",
"version": "4.5.4",
"description": "Computer vision library",
"homepage": "https://github.com/opencv/opencv",
"dependencies": [
Expand All @@ -10,12 +10,7 @@
}
],
"default-features": [
"dnn",
"jpeg",
"png",
"quirc",
"tiff",
"webp"
"default-features"
],
"features": {
"ade": {
Expand Down Expand Up @@ -66,6 +61,31 @@
}
]
},
"default-features": {
"description": "Platform-dependent default features",
"dependencies": [
{
"name": "opencv4",
"default-features": false,
"features": [
"dnn",
"jpeg",
"png",
"quirc",
"tiff",
"webp"
]
},
{
"name": "opencv4",
"default-features": false,
"features": [
"gtk"
],
"platform": "linux"
}
]
},
"dnn": {
"description": "Enable dnn module",
"dependencies": [
Expand Down Expand Up @@ -114,6 +134,30 @@
}
]
},
"gstreamer": {
"description": "gstreamer support for opencv",
"dependencies": [
{
"name": "opencv4",
"default-features": false,
"features": [
"gstreamer"
]
}
]
},
"gtk": {
"description": "GTK support for opencv",
"dependencies": [
{
"name": "opencv4",
"default-features": false,
"features": [
"gtk"
]
}
]
},
"halide": {
"description": "Halide support for opencv",
"dependencies": [
Expand Down
18 changes: 0 additions & 18 deletions ports/opencv2/0002-install-options.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt
index b0e076f..3f7ade1 100644
--- a/3rdparty/libtiff/CMakeLists.txt
+++ b/3rdparty/libtiff/CMakeLists.txt
@@ -102,7 +102,7 @@ if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
Expand All @@ -11,8 +9,6 @@ index b0e076f..3f7ade1 100644

set_target_properties(${TIFF_LIBRARY}
PROPERTIES
diff --git a/3rdparty/openexr/CMakeLists.txt b/3rdparty/openexr/CMakeLists.txt
index 9387616..54ecc1a 100644
--- a/3rdparty/openexr/CMakeLists.txt
+++ b/3rdparty/openexr/CMakeLists.txt
@@ -55,7 +55,7 @@ if(MSVC AND CV_ICC)
Expand All @@ -24,8 +20,6 @@ index 9387616..54ecc1a 100644

set_target_properties(IlmImf
PROPERTIES
diff --git a/3rdparty/tbb/CMakeLists.txt b/3rdparty/tbb/CMakeLists.txt
index fd8ef32..fe571a2 100644
--- a/3rdparty/tbb/CMakeLists.txt
+++ b/3rdparty/tbb/CMakeLists.txt
@@ -116,7 +116,7 @@ endif()
Expand All @@ -37,8 +31,6 @@ index fd8ef32..fe571a2 100644
if(NOT __statvar EQUAL 0)
message(FATAL_ERROR "Failed to download TBB sources (${__statvar}): ${tbb_url}")
endif()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90e16c2..6601820 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -275,23 +275,10 @@ if (ANDROID)
Expand Down Expand Up @@ -182,8 +174,6 @@ index 146043f..1202225 100644
endif(WITH_FFMPEG)

# --- VideoInput/DirectShow ---
diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake
index dacfbb1..3760866 100644
--- a/cmake/OpenCVGenConfig.cmake
+++ b/cmake/OpenCVGenConfig.cmake
@@ -101,7 +101,7 @@ endif()
Expand All @@ -204,8 +194,6 @@ index dacfbb1..3760866 100644
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/include\" \"\${OpenCV_CONFIG_PATH}/include/opencv\"")
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"")

diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake
index 6f9fb0b..56f8879 100644
--- a/cmake/OpenCVModule.cmake
+++ b/cmake/OpenCVModule.cmake
@@ -86,10 +86,10 @@ macro(ocv_add_dependencies full_modname)
Expand Down Expand Up @@ -250,8 +238,6 @@ index 6f9fb0b..56f8879 100644

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")
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index e3177bd..f902b2b 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -5,8 +5,6 @@ if(ANDROID)
Expand All @@ -270,8 +256,6 @@ index e3177bd..f902b2b 100644
-endif()
\ No newline at end of file
+endif()
diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt
index d9de52d..be604dc 100644
--- a/modules/core/CMakeLists.txt
+++ b/modules/core/CMakeLists.txt
@@ -1,9 +1,9 @@
Expand All @@ -286,8 +270,6 @@ index d9de52d..be604dc 100644
endif()

ocv_module_include_directories("${OpenCV_SOURCE_DIR}/modules/dynamicuda/include/" ${ZLIB_INCLUDE_DIR})
diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt
index d59e95a..ce7f87b 100644
--- a/modules/highgui/CMakeLists.txt
+++ b/modules/highgui/CMakeLists.txt
@@ -15,23 +15,23 @@ endif()
Expand Down
2 changes: 0 additions & 2 deletions ports/opencv2/0003-force-package-requirements.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake
index 43c3b16..9b43066 100644
--- a/cmake/OpenCVFindLibsGrfmt.cmake
+++ b/cmake/OpenCVFindLibsGrfmt.cmake
@@ -6,7 +6,7 @@
Expand Down
140 changes: 71 additions & 69 deletions ports/opencv2/0005-fix-cuda.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
--- a/cmake/OpenCVDetectCUDA.cmake
+++ b/cmake/OpenCVDetectCUDA.cmake
@@ -51,7 +51,7 @@ if(CUDA_FOUND)
@@ -51,7 +51,6 @@ if(CUDA_FOUND)

message(STATUS "CUDA detected: " ${CUDA_VERSION})

- set(_generations "Fermi" "Kepler")
+ set(_generations "Kepler" "Maxwell")
if(NOT CMAKE_CROSSCOMPILING)
list(APPEND _generations "Auto")
endif()
@@ -70,14 +70,10 @@ if(CUDA_FOUND)
@@ -69,48 +68,8 @@ if(CUDA_FOUND)
unset(CUDA_ARCH_PTX CACHE)
endif()

set(__cuda_arch_ptx "")
- set(__cuda_arch_ptx "")
- if(CUDA_GENERATION STREQUAL "Fermi")
- set(__cuda_arch_bin "2.0 2.1(2.0)")
- elseif(CUDA_GENERATION STREQUAL "Kepler")
Expand All @@ -21,76 +21,45 @@
- else()
- set(__cuda_arch_bin "3.0 3.5")
- endif()
+ if(CUDA_GENERATION STREQUAL "Kepler")
+ set(__cuda_arch_bin "3.0 3.5 3.7")
+ elseif(CUDA_GENERATION STREQUAL "Maxwell")
+ set(__cuda_arch_bin "5.0 5.2")
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/"
@@ -87,7 +83,6 @@ if(CUDA_FOUND)
message(STATUS "Automatic detection of CUDA generation failed. Going to build for all known architectures.")
else()
set(__cuda_arch_bin "${_nvcc_out}")
- 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()

@@ -102,11 +97,11 @@ if(CUDA_FOUND)
endif()
else()
if(${CUDA_VERSION} VERSION_LESS "5.0")
- 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")
+ set(__cuda_arch_bin "3.0")
elseif(${CUDA_VERSION} VERSION_GREATER "6.5")
- elseif(${CUDA_VERSION} VERSION_GREATER "6.5")
- set(__cuda_arch_bin "2.0 2.1(2.0) 3.0 3.5")
+ set(__cuda_arch_bin "3.0 3.5")
else()
- else()
- set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")
+ set(__cuda_arch_bin "3.0 3.5")
endif()
set(__cuda_arch_ptx "3.0")
endif()
diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in
index fe85571..0f9d2f5 100644
--- 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()
- endif()
- set(__cuda_arch_ptx "3.0")
- endif()
- endif()
+ set(__cuda_arch_ptx "5.0")
+ set(__cuda_arch_bin "5.0")

# ==============================================================
diff --git a/cmake/OpenCVDetectCUDA.cmake b/cmake/OpenCVDetectCUDA.cmake
index 30b5093..50dcdc9 100644
--- a/cmake/OpenCVDetectCUDA.cmake
+++ b/cmake/OpenCVDetectCUDA.cmake
@@ -229,18 +229,40 @@ else()
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)
Expand Down Expand Up @@ -136,3 +105,36 @@ index 30b5093..50dcdc9 100644
+ 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()

# ==============================================================
Loading

0 comments on commit f6601ee

Please sign in to comment.