xmake-repo
xmake-repo copied to clipboard
opencv: win下使用vcpkg::opencv,vcpkg已经成功安装了,但xmake check不到
Xmake 版本
2.9.5
操作系统版本和架构
Windows11
描述问题
如题
Building opencv[contrib,core,default-features,freetype]:[email protected]#1...
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVConfig.cmake
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVConfig-version.cmake
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVModules.cmake
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVModules-release.cmake
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVModules-debug.cmake
-- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
Stored binaries in 1 destinations in 98.2 ms.
Elapsed time to handle opencv:x64-windows-static: 190 ms
opencv:x64-windows-static package ABI: 73d127ca672c832f82cfdcc0b2435ea64df748687fd39a50f9267c3756bd42dc
Total install time: 23 min
opencv provides CMake targets:
# this is heuristically generated, and may not be correct
find_package(OpenCV CONFIG REQUIRED)
# note: 53 additional targets are not displayed.
target_link_libraries(main PRIVATE opencv_ml opencv_dnn opencv_dpm opencv_hdf)
checking for vcpkg::opencv[contrib,freetype] ... no
error: fetch vcpkg::opencv[contrib,freetype]-latest failed!
=> install vcpkg::opencv[contrib,freetype] latest .. failed
error: install failed!
期待的结果
解决
工程配置
add_rules("mode.debug", "mode.release")
set_policy("package.precompiled", false)
set_languages("c++20")
set_encodings("utf-8")
add_requires("vcpkg::opencv[contrib,freetype]")
target("osd")
set_kind("binary")
add_files("src/*.cpp")
add_packages("opencv")
附加信息和错误日志
-- Using msys root at C:/vcpkg/downloads/tools/msys2/1e74ca60daa10104
-- Installing: C:/vcpkg/packages/opencv4_x64-windows-static/share/opencv4/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 36 s.
Elapsed time to handle opencv4:x64-windows-static: 5.1 min
opencv4:x64-windows-static package ABI: afcef3206334a7fcacb344492f6122ba7d57940c2058ba7eaaa89716565f2e1b
Installing 15/15 opencv[contrib,core,default-features,freetype]:[email protected]#1...
Building opencv[contrib,core,default-features,freetype]:[email protected]#1...
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVConfig.cmake
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVConfig-version.cmake
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVModules.cmake
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVModules-release.cmake
-- Installing: C:/vcpkg/packages/opencv_x64-windows-static/share/opencv/OpenCVModules-debug.cmake
-- Skipping post-build validation due to VCPKG_POLICY_EMPTY_PACKAGE
Stored binaries in 1 destinations in 98.2 ms.
Elapsed time to handle opencv:x64-windows-static: 190 ms
opencv:x64-windows-static package ABI: 73d127ca672c832f82cfdcc0b2435ea64df748687fd39a50f9267c3756bd42dc
Total install time: 23 min
opencv provides CMake targets:
# this is heuristically generated, and may not be correct
find_package(OpenCV CONFIG REQUIRED)
# note: 53 additional targets are not displayed.
target_link_libraries(main PRIVATE opencv_ml opencv_dnn opencv_dpm opencv_hdf)
checking for vcpkg::opencv[contrib,freetype] ... no
error: fetch vcpkg::opencv[contrib,freetype]-latest failed!
=> install vcpkg::opencv[contrib,freetype] latest .. failed
error: install failed!