mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-25 19:27:50 +08:00
471f7dc970
Split off contrib, ipp, webp, openexr, tiff, png, tiff, jpeg, jasper, eigen into features. Prevent downloads during the build
141 lines
6.3 KiB
Diff
141 lines
6.3 KiB
Diff
From 005963d571f95fc536f60aa77098b9ecbb17128c Mon Sep 17 00:00:00 2001
|
|
From: Robert Schumacher <roschuma@microsoft.com>
|
|
Date: Wed, 21 Feb 2018 17:03:30 -0800
|
|
Subject: [PATCH 1/5] winrt-fixes
|
|
|
|
---
|
|
CMakeLists.txt | 2 +-
|
|
cmake/OpenCVCompilerOptions.cmake | 3 +++
|
|
cmake/OpenCVModule.cmake | 2 +-
|
|
modules/core/src/utils/filesystem.cpp | 14 ++++++++++++--
|
|
modules/highgui/include/opencv2/highgui/highgui_winrt.hpp | 1 +
|
|
modules/highgui/src/window_winrt_bridge.hpp | 1 +
|
|
modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp | 4 ++--
|
|
7 files changed, 21 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 4464441..6bfbecd 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -296,7 +296,7 @@ OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binar
|
|
# OpenCV build options
|
|
# ===================================================
|
|
OCV_OPTION(ENABLE_CCACHE "Use ccache" (UNIX AND NOT IOS AND (CMAKE_GENERATOR MATCHES "Makefile" OR CMAKE_GENERATOR MATCHES "Ninja")) )
|
|
-OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS AND NOT CMAKE_CROSSCOMPILING) )
|
|
+OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS AND (MSVC OR NOT CMAKE_CROSSCOMPILING)) )
|
|
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" (MSVC_IDE OR CMAKE_GENERATOR MATCHES Xcode) )
|
|
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX )
|
|
OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov" OFF IF CMAKE_COMPILER_IS_GNUCXX )
|
|
diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake
|
|
index 353ee12..8f4aa3b 100644
|
|
--- a/cmake/OpenCVCompilerOptions.cmake
|
|
+++ b/cmake/OpenCVCompilerOptions.cmake
|
|
@@ -37,6 +37,9 @@ if(MSVC)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "Flags used by the compiler during all build types." FORCE)
|
|
endif()
|
|
+ if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
|
|
+ endif()
|
|
endif()
|
|
|
|
set(OPENCV_EXTRA_FLAGS "")
|
|
diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake
|
|
index a84bbff..8feb6df 100644
|
|
--- a/cmake/OpenCVModule.cmake
|
|
+++ b/cmake/OpenCVModule.cmake
|
|
@@ -785,7 +785,7 @@ macro(ocv_create_module)
|
|
set(the_module_target ${the_module})
|
|
endif()
|
|
|
|
- if(WINRT)
|
|
+ if(WINRT AND BUILD_TESTS)
|
|
# removing APPCONTAINER from modules to run from console
|
|
# in case of usual starting of WinRT test apps output is missing
|
|
# so starting of console version w/o APPCONTAINER is required to get test results
|
|
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)
|
|
diff --git a/modules/highgui/include/opencv2/highgui/highgui_winrt.hpp b/modules/highgui/include/opencv2/highgui/highgui_winrt.hpp
|
|
index f4147f3..b92efdd 100644
|
|
--- a/modules/highgui/include/opencv2/highgui/highgui_winrt.hpp
|
|
+++ b/modules/highgui/include/opencv2/highgui/highgui_winrt.hpp
|
|
@@ -24,6 +24,7 @@
|
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
+#include "opencv2/core/cvdef.h"
|
|
using namespace Windows::UI::Xaml::Controls;
|
|
|
|
namespace cv
|
|
diff --git a/modules/highgui/src/window_winrt_bridge.hpp b/modules/highgui/src/window_winrt_bridge.hpp
|
|
index 25f4aef..5429f0b 100644
|
|
--- a/modules/highgui/src/window_winrt_bridge.hpp
|
|
+++ b/modules/highgui/src/window_winrt_bridge.hpp
|
|
@@ -28,6 +28,7 @@
|
|
|
|
#include <map>
|
|
#include <opencv2\core.hpp>
|
|
+#include "opencv2/highgui/highgui_c.h"
|
|
|
|
using namespace Windows::UI::Xaml::Controls;
|
|
|
|
diff --git a/modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp b/modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp
|
|
index 236e227..e2417dc 100644
|
|
--- a/modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp
|
|
+++ b/modules/videoio/src/cap_winrt/CaptureFrameGrabber.cpp
|
|
@@ -94,10 +94,10 @@ Media::CaptureFrameGrabber::~CaptureFrameGrabber()
|
|
|
|
void Media::CaptureFrameGrabber::ShowCameraSettings()
|
|
{
|
|
-#if WINAPI_FAMILY!=WINAPI_FAMILY_PHONE_APP
|
|
+#if (WINAPI_FAMILY!=WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY!=WINAPI_FAMILY_APP)
|
|
if (_state == State::Started)
|
|
{
|
|
- CameraOptionsUI::Show(_capture.Get());
|
|
+ CameraOptionsUI::Show(_capture.Get()); // TODO: Turn it on again in UWP mode by adding reference to UWP Desktop Extensions
|
|
}
|
|
#endif
|
|
}
|
|
--
|
|
2.15.1.windows.2
|
|
|