mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 11:21:12 +08:00
[opencv] Fix UWP and ARM
This commit is contained in:
parent
8fde459990
commit
8d4d308714
@ -1,5 +1,5 @@
|
||||
Source: opencv
|
||||
Version: 3.4.0
|
||||
Version: 3.4.0-1
|
||||
Build-Depends: zlib, libpng, libjpeg-turbo, tiff, protobuf (windows)
|
||||
Description: computer vision library
|
||||
|
||||
|
41
ports/opencv/filesystem-uwp.patch
Normal file
41
ports/opencv/filesystem-uwp.patch
Normal file
@ -0,0 +1,41 @@
|
||||
diff --git a/modules/core/src/utils/filesystem.cpp b/modules/core/src/utils/filesystem.cpp
|
||||
index 266a92f..1d5a302 100644
|
||||
--- a/modules/core/src/utils/filesystem.cpp
|
||||
+++ b/modules/core/src/utils/filesystem.cpp
|
||||
@@ -186,7 +186,7 @@ bool createDirectory(const cv::String& path)
|
||||
wchar_t wpath[MAX_PATH];
|
||||
size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH);
|
||||
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
|
||||
- int result = CreateDirectoryA(wpath, NULL) ? 0 : -1;
|
||||
+ int result = CreateDirectoryW(wpath, NULL) ? 0 : -1;
|
||||
#else
|
||||
int result = _mkdir(path.c_str());
|
||||
#endif
|
||||
@@ -248,8 +248,16 @@ struct FileLock::Impl
|
||||
int numRetries = 5;
|
||||
do
|
||||
{
|
||||
+#ifdef WINRT
|
||||
+ wchar_t wpath[MAX_PATH];
|
||||
+ size_t copied = mbstowcs(wpath, fname, MAX_PATH);
|
||||
+ CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
|
||||
+ handle = ::CreateFile2(wpath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
+ OPEN_EXISTING, NULL);
|
||||
+#else
|
||||
handle = ::CreateFileA(fname, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
+#endif
|
||||
if (INVALID_HANDLE_VALUE == handle)
|
||||
{
|
||||
if (ERROR_SHARING_VIOLATION == GetLastError())
|
||||
@@ -399,7 +407,9 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu
|
||||
if (cache_path.empty())
|
||||
{
|
||||
cv::String default_cache_path;
|
||||
-#ifdef _WIN32
|
||||
+#if WINRT
|
||||
+ // no defaults
|
||||
+#elif defined _WIN32
|
||||
char tmp_path_buf[MAX_PATH+1] = {0};
|
||||
DWORD res = GetTempPath(MAX_PATH, tmp_path_buf);
|
||||
if (res > 0 && res <= MAX_PATH)
|
@ -68,6 +68,15 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
||||
set(WITH_MSMF OFF)
|
||||
endif()
|
||||
|
||||
set(BUILD_opencv_line_descriptor ON)
|
||||
set(BUILD_opencv_saliency ON)
|
||||
set(BUILD_opencv_bgsegm ON)
|
||||
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
|
||||
set(BUILD_opencv_line_descriptor OFF)
|
||||
set(BUILD_opencv_saliency OFF)
|
||||
set(BUILD_opencv_bgsegm OFF)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
@ -94,6 +103,9 @@ vcpkg_configure_cmake(
|
||||
-DBUILD_opencv_python2=OFF
|
||||
-DBUILD_opencv_python3=OFF
|
||||
-DBUILD_opencv_sfm=${BUILD_opencv_sfm}
|
||||
-DBUILD_opencv_line_descriptor=${BUILD_opencv_line_descriptor}
|
||||
-DBUILD_opencv_saliency=${BUILD_opencv_saliency}
|
||||
-DBUILD_opencv_bgsegm=${BUILD_opencv_bgsegm}
|
||||
# CMAKE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_JNI=ON
|
||||
# ENABLE
|
||||
@ -137,6 +149,10 @@ else()
|
||||
endif()
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
set(OpenCV_ARCH x64)
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
|
||||
set(OpenCV_ARCH ARM)
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
||||
set(OpenCV_ARCH ARM64)
|
||||
else()
|
||||
set(OpenCV_ARCH x86)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user