Open neko-para opened 9 months ago
According to the portfile.cmake
if(BUILD_opencv_quality AND "contrib" IN_LIST FEATURES)
string(APPEND DEPS_STRING "
# C language is required for try_compile tests in FindHDF5
enable_language(C)
find_dependency(HDF5)
find_dependency(Tesseract)")
endif()
I'm not sure if I should use BUILD_opencv_quality instead of BUILD_opencv_hdf.
Yes, you can use this BUILD_opencv_quality=OFF
to disable to find HDF5
.
Yes, you can use this
BUILD_opencv_quality=OFF
to disable to findHDF5
.
After some of tries, setting BUILD_opencv_quality seems don't stop generating that find_dependency(HDF5)
. Thus, I dup it into overlay and comment that set which finally work.
# 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()
#]]
set(BUILD_opencv_quality OFF)
Actually, I don't really understand that set(BUILD_opencv_quality CMAKE_DEPENDS_IN_PROJECT_ONLY)
. Is it the reason why those find_dependency
s still been generated?
Given that you had a successful opencv4 build before, this buildsystem already handles the absence of hdf5, so it doesn't really need a different configuration.
And you already pointed out that it is the portfile which adds the unconditional find_dependency(HDF5)
.
So as a simple mitigation, change that line in the portfile to find_package(HDF5)
. This will find HDF5 when it is available, and won't complain if it isn't.
(The proper solution is a patch.)
As shown in cmake file above and also in pkg json, hdf5 is disabled when targetting uwp, ios or win-arm64. However, hdf5 can hardly cross compiling(after all, targetting linux-arm64 or mac-arm64 on x86 machine caused failure). I wonder if there would be a flag or option to mark it, as linux-arm64 should be built on arm machine, thus cannot simply disable it because of arch.
Also, I'm quite unfamilar with the vcpkg patch logic. I know that it's possible to patch the source, but is it possible to patch the portfile.cmake or the installed files?
This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.
This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.
Operating system
Windows
Compiler
MSVC
Steps to reproduce the behavior
Failure logs
Additional context
I want to disable HDF5 for opencv, as it cannot be cross compiling.
With script above in triplet file, opencv DO stop depending on it. But when another library depending on opencv, the
OpenCVModules.cmake
always want to find hdf5.