Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opencv4] Fix freetype, harfbuzz, gtk dependencies #27343

Merged
merged 6 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions ports/opencv4/0015-fix-freetype.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
--- a/modules/gapi/cmake/init.cmake
+++ b/modules/gapi/cmake/init.cmake
@@ -20,10 +20,8 @@ if(NOT TARGET ade)
@@ -20,7 +20,7 @@ if(NOT TARGET ade)
endif()

if(WITH_FREETYPE)
- ocv_check_modules(FREETYPE freetype2)
- if (FREETYPE_FOUND)
+ find_package(freetype CONFIG REQUIRED)
+ find_package(Freetype REQUIRED)
if (FREETYPE_FOUND)
dg0yt marked this conversation as resolved.
Show resolved Hide resolved
set(HAVE_FREETYPE TRUE)
- endif()
endif()

if(WITH_PLAIDML)
endif()
7 changes: 4 additions & 3 deletions ports/opencv4/0016-fix-freetype-contrib.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
--- a/modules/freetype/CMakeLists.txt
+++ b/modules/freetype/CMakeLists.txt
@@ -3,8 +5,10 @@ if(APPLE_FRAMEWORK)
@@ -3,8 +5,11 @@ if(APPLE_FRAMEWORK)
ocv_module_disable(freetype)
endif()

-ocv_check_modules(FREETYPE freetype2)
-ocv_check_modules(HARFBUZZ harfbuzz)
+if(WITH_FREETYPE)
+find_package(freetype CONFIG REQUIRED)
+find_package(harfbuzz CONFIG REQUIRED)
+ find_package(Freetype REQUIRED)
+ find_package(HARFBUZZ NAMES harfbuzz REQUIRED)
+ set(HARFBUZZ_LIBRARIES harfbuzz::harfbuzz)
+endif()

if(OPENCV_INITIAL_PASS)
Expand Down
19 changes: 8 additions & 11 deletions ports/opencv4/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
"freetype" WITH_FREETYPE
"gdcm" WITH_GDCM
"gstreamer" WITH_GSTREAMER
"gtk" WITH_GTK
"halide" WITH_HALIDE
"jasper" WITH_JASPER
"jpeg" WITH_JPEG
Expand Down Expand Up @@ -83,15 +84,6 @@ if("dnn" IN_LIST FEATURES)
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()

set(WITH_QT OFF)
if("qt" IN_LIST FEATURES)
set(WITH_QT ${USE_QT_VERSION})
Expand Down Expand Up @@ -502,6 +494,9 @@ 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()
Expand All @@ -524,7 +519,7 @@ find_dependency(Tesseract)")
string(APPEND DEPS_STRING "\nfind_dependency(OpenMP)")
endif()
if(BUILD_opencv_ovis)
string(APPEND DEPS_STRING "\nfind_dependency(Ogre)\nfind_dependency(freetype)")
string(APPEND DEPS_STRING "\nfind_dependency(Ogre)")
endif()
if("quirc" IN_LIST FEATURES)
string(APPEND DEPS_STRING "\nfind_dependency(quirc)")
Expand Down Expand Up @@ -584,4 +579,6 @@ vcpkg_fixup_pkgconfig()

configure_file("${CURRENT_PORT_DIR}/usage.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage")

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(GLOB extra_license_files "${CURRENT_PACKAGES_DIR}/share/licenses/opencv4/*")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE" ${extra_license_files})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/licenses")
17 changes: 13 additions & 4 deletions ports/opencv4/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencv4",
"version": "4.6.0",
"port-version": 6,
"port-version": 7,
"description": "computer vision library",
"homepage": "https://github.com/opencv/opencv",
"license": "Apache-2.0",
Expand Down Expand Up @@ -130,8 +130,14 @@
"freetype": {
"description": "Freetype support for opencv",
"dependencies": [
"freetype",
"harfbuzz"
{
"name": "freetype",
"default-features": false
},
{
"name": "harfbuzz",
"default-features": false
}
]
},
"gdcm": {
Expand All @@ -149,7 +155,10 @@
"gtk": {
"description": "GTK support for opencv",
"dependencies": [
"gtk"
{
"name": "gtk3",
"default-features": false
}
]
},
"halide": {
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5426,7 +5426,7 @@
},
"opencv4": {
"baseline": "4.6.0",
"port-version": 6
"port-version": 7
},
"opendnp3": {
"baseline": "3.1.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/opencv4.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5a2d5ed9c3c3ba9bb38ba5d3dd4f62252cf80202",
"version": "4.6.0",
"port-version": 7
},
{
"git-tree": "9961bbcc88c934054f6137f3417bbd9cccf478d4",
"version": "4.6.0",
Expand Down