Commit cdd23440 authored by Maxim Kostin's avatar Maxim Kostin

Adding support for WinRT(WinPhone 8/8.1 and Win Store) via CMake 3.1

- Substituted HAVE_WINRT with WINRT
- Fixed compilation issues in ocl.cpp and parallel.cpp
- Fixed compiler issue for WP8: "C2678: binary '+' : no operator found which takes a left-hand - Fixed gitignore
- Added #ifdef HAVE_OPENCL to remove compiler warnings in ocl.cpp
- Used NO_GETENV similar to '3rdparty\libjpeg\jmemmgr.c;
- Added ole32.lib for core module (for WindowsStore 8.0 builds)
- Made OpenCV_ARCH aware of ARM
Signed-off-by: 's avatarMaxim Kostin <v-maxkos@microsoft.com>
parent 5850a9b8
...@@ -8,3 +8,12 @@ ...@@ -8,3 +8,12 @@
Thumbs.db Thumbs.db
tags tags
tegra/ tegra/
bin/
CMakeFiles/
*.sdf
*.opensdf
*.obj
*.stamp
*.depend
*.rule
*.tmp
...@@ -29,10 +29,6 @@ if(MSVC) ...@@ -29,10 +29,6 @@ if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC) endif(MSVC)
if (HAVE_WINRT)
add_definitions(-DHAVE_WINRT)
endif()
add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs}) add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES}) target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES})
......
...@@ -7,7 +7,7 @@ index 07b2b0b..e7824b8 100644 ...@@ -7,7 +7,7 @@ index 07b2b0b..e7824b8 100644
/* Memory model/platform independent fns */ /* Memory model/platform independent fns */
#ifndef PNG_ABORT #ifndef PNG_ABORT
-# ifdef _WINDOWS_ -# ifdef _WINDOWS_
+# if defined(_WINDOWS_) && !defined(HAVE_WINRT) +# if defined(_WINDOWS_) && !defined(WINRT)
# define PNG_ABORT() ExitProcess(0) # define PNG_ABORT() ExitProcess(0)
# else # else
# define PNG_ABORT() abort() # define PNG_ABORT() abort()
...@@ -16,7 +16,7 @@ index 07b2b0b..e7824b8 100644 ...@@ -16,7 +16,7 @@ index 07b2b0b..e7824b8 100644
# define png_memset _fmemset # define png_memset _fmemset
#else #else
-# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */ -# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
+# if defined(_WINDOWS_) && !defined(HAVE_WINRT) /* Favor Windows over C runtime fns */ +# if defined(_WINDOWS_) && !defined(WINRT) /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr) # define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strlen lstrlenA # define png_strlen lstrlenA
...@@ -360,7 +360,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; ...@@ -360,7 +360,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
/* Memory model/platform independent fns */ /* Memory model/platform independent fns */
#ifndef PNG_ABORT #ifndef PNG_ABORT
# if defined(_WINDOWS_) && !defined(HAVE_WINRT) # if defined(_WINDOWS_) && !defined(WINRT)
# define PNG_ABORT() ExitProcess(0) # define PNG_ABORT() ExitProcess(0)
# else # else
# define PNG_ABORT() abort() # define PNG_ABORT() abort()
...@@ -378,7 +378,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; ...@@ -378,7 +378,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
# define png_memcpy _fmemcpy # define png_memcpy _fmemcpy
# define png_memset _fmemset # define png_memset _fmemset
#else #else
# if defined(_WINDOWS_) && !defined(HAVE_WINRT) /* Favor Windows over C runtime fns */ # if defined(_WINDOWS_) && !defined(WINRT) /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr) # define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strlen lstrlenA # define png_strlen lstrlenA
......
...@@ -17,7 +17,7 @@ check_include_file(string.h HAVE_STRING_H) ...@@ -17,7 +17,7 @@ check_include_file(string.h HAVE_STRING_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(unistd.h HAVE_UNISTD_H)
if(WIN32 AND NOT HAVE_WINRT) if(WIN32)
set(USE_WIN32_FILEIO 1) set(USE_WIN32_FILEIO 1)
endif() endif()
...@@ -79,7 +79,7 @@ set(lib_srcs ...@@ -79,7 +79,7 @@ set(lib_srcs
"${CMAKE_CURRENT_BINARY_DIR}/tif_config.h" "${CMAKE_CURRENT_BINARY_DIR}/tif_config.h"
) )
if(WIN32 AND NOT HAVE_WINRT) if(WIN32)
list(APPEND lib_srcs tif_win32.c) list(APPEND lib_srcs tif_win32.c)
else() else()
list(APPEND lib_srcs tif_unix.c) list(APPEND lib_srcs tif_unix.c)
......
This diff is collapsed.
...@@ -2,47 +2,37 @@ if(NOT MSVC) ...@@ -2,47 +2,37 @@ if(NOT MSVC)
message(FATAL_ERROR "CRT options are available only for MSVC") message(FATAL_ERROR "CRT options are available only for MSVC")
endif() endif()
#INCLUDE (CheckIncludeFiles) #if (${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore" OR ${CMAKE_SYSTEM_NAME} MATCHES "WindowsPhone")
# set(WINRT TRUE)
set(HAVE_WINRT FALSE) if (WINRT)
add_definitions(/DWINVER=_WIN32_WINNT_WIN8 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=_WIN32_WINNT_WIN8)
# search Windows Platform SDK
message(STATUS "Checking for Windows Platform SDK")
GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
if(WINDOWS_SDK_PATH STREQUAL "")
set(HAVE_MSPDK FALSE)
message(STATUS "Windows Platform SDK 8.0 was not found")
else()
set(HAVE_MSPDK TRUE)
endif() endif()
#search for Visual Studio 11.0 install directory # Removing LNK4075 warnings for debug WinRT builds
message(STATUS "Checking for Visual Studio 2012") # "LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification"
GET_FILENAME_COMPONENT(VISUAL_STUDIO_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] REALPATH CACHE) # "LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification"
if(VISUAL_STUDIO_PATH STREQUAL "") if(MSVC AND WINRT)
set(HAVE_MSVC2012 FALSE) # Optional verification checks since we don't know existing contents of variables below
message(STATUS "Visual Studio 2012 was not found") string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
else() string(REPLACE "/OPT:REF " "/OPT:NOREF " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
set(HAVE_MSVC2012 TRUE) string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
endif() string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
try_compile(HAVE_WINRT_SDK string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
"${OpenCV_BINARY_DIR}" string(REPLACE "/OPT:REF " "/OPT:NORE F" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
"${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp") string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
if(ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK) string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
set(HAVE_WINRT TRUE) string(REPLACE "/OPT:REF " "/OPT:NOREF " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
set(HAVE_WINRT_CX TRUE) string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
elseif(ENABLE_WINRT_MODE_NATIVE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK) string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
set(HAVE_WINRT TRUE)
set(HAVE_WINRT_CX FALSE)
endif()
if(HAVE_WINRT) # Mandatory
add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602) set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /appcontainer") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /appcontainer") set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /appcontainer")
endif() endif()
if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT) if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)
......
...@@ -65,6 +65,9 @@ if(MSVC) ...@@ -65,6 +65,9 @@ if(MSVC)
if(CMAKE_CL_64) if(CMAKE_CL_64)
set(OpenCV_ARCH x64) set(OpenCV_ARCH x64)
set(OpenCV_TBB_ARCH intel64) set(OpenCV_TBB_ARCH intel64)
elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm"))
# see Modules/CmakeGenericSystem.cmake
set(OpenCV_ARCH ARM)
else() else()
set(OpenCV_ARCH x86) set(OpenCV_ARCH x86)
set(OpenCV_TBB_ARCH ia32) set(OpenCV_TBB_ARCH ia32)
......
...@@ -127,6 +127,9 @@ endif() ...@@ -127,6 +127,9 @@ endif()
if(MSVC) if(MSVC)
if(CMAKE_CL_64) if(CMAKE_CL_64)
set(OpenCV_ARCH x64) set(OpenCV_ARCH x64)
elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm"))
# see Modules/CmakeGenericSystem.cmake
set(OpenCV_ARCH ARM)
else() else()
set(OpenCV_ARCH x86) set(OpenCV_ARCH x86)
endif() endif()
......
...@@ -169,9 +169,6 @@ ...@@ -169,9 +169,6 @@
/* Win32 UI */ /* Win32 UI */
#cmakedefine HAVE_WIN32UI #cmakedefine HAVE_WIN32UI
/* Windows Runtime support */
#cmakedefine HAVE_WINRT
/* XIMEA camera support */ /* XIMEA camera support */
#cmakedefine HAVE_XIMEA #cmakedefine HAVE_XIMEA
......
set(the_description "The Core Functionality") set(the_description "The Core Functionality")
ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" OPTIONAL opencv_cudev) ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" OPTIONAL opencv_cudev)
if(HAVE_WINRT_CX) set(extra_libs "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif() if(WINRT AND CMAKE_SYSTEM_NAME MATCHES WindowsStore AND CMAKE_SYSTEM_VERSION MATCHES "8.0")
if(HAVE_WINRT) list(APPEND extra_libs ole32.lib)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"")
endif() endif()
if(HAVE_CUDA) if(HAVE_CUDA)
...@@ -22,7 +21,7 @@ ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version ...@@ -22,7 +21,7 @@ ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail}) HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS}) ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS})
ocv_create_module() ocv_create_module(${extra_libs})
ocv_add_accuracy_tests() ocv_add_accuracy_tests()
ocv_add_perf_tests() ocv_add_perf_tests()
...@@ -56,14 +56,14 @@ namespace ...@@ -56,14 +56,14 @@ namespace
struct DIR struct DIR
{ {
#ifdef HAVE_WINRT #ifdef WINRT
WIN32_FIND_DATAW data; WIN32_FIND_DATAW data;
#else #else
WIN32_FIND_DATA data; WIN32_FIND_DATA data;
#endif #endif
HANDLE handle; HANDLE handle;
dirent ent; dirent ent;
#ifdef HAVE_WINRT #ifdef WINRT
DIR() { } DIR() { }
~DIR() ~DIR()
{ {
...@@ -77,7 +77,7 @@ namespace ...@@ -77,7 +77,7 @@ namespace
{ {
DIR* dir = new DIR; DIR* dir = new DIR;
dir->ent.d_name = 0; dir->ent.d_name = 0;
#ifdef HAVE_WINRT #ifdef WINRT
cv::String full_path = cv::String(path) + "\\*"; cv::String full_path = cv::String(path) + "\\*";
wchar_t wfull_path[MAX_PATH]; wchar_t wfull_path[MAX_PATH];
size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH); size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH);
...@@ -99,7 +99,7 @@ namespace ...@@ -99,7 +99,7 @@ namespace
dirent* readdir(DIR* dir) dirent* readdir(DIR* dir)
{ {
#ifdef HAVE_WINRT #ifdef WINRT
if (dir->ent.d_name != 0) if (dir->ent.d_name != 0)
{ {
if (::FindNextFileW(dir->handle, &dir->data) != TRUE) if (::FindNextFileW(dir->handle, &dir->data) != TRUE)
...@@ -147,7 +147,7 @@ static bool isDir(const cv::String& path, DIR* dir) ...@@ -147,7 +147,7 @@ static bool isDir(const cv::String& path, DIR* dir)
else else
{ {
WIN32_FILE_ATTRIBUTE_DATA all_attrs; WIN32_FILE_ATTRIBUTE_DATA all_attrs;
#ifdef HAVE_WINRT #ifdef WINRT
wchar_t wpath[MAX_PATH]; wchar_t wpath[MAX_PATH];
size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH); size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1)); CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
......
...@@ -64,7 +64,15 @@ ...@@ -64,7 +64,15 @@
// TODO Move to some common place // TODO Move to some common place
static bool getBoolParameter(const char* name, bool defaultValue) static bool getBoolParameter(const char* name, bool defaultValue)
{ {
/*
* If your system doesn't support getenv(), define NO_GETENV to disable
* this feature.
*/
#ifdef NO_GETENV
const char* envValue = NULL;
#else
const char* envValue = getenv(name); const char* envValue = getenv(name);
#endif
if (envValue == NULL) if (envValue == NULL)
{ {
return defaultValue; return defaultValue;
...@@ -85,7 +93,7 @@ static bool getBoolParameter(const char* name, bool defaultValue) ...@@ -85,7 +93,7 @@ static bool getBoolParameter(const char* name, bool defaultValue)
// TODO Move to some common place // TODO Move to some common place
static size_t getConfigurationParameterForSize(const char* name, size_t defaultValue) static size_t getConfigurationParameterForSize(const char* name, size_t defaultValue)
{ {
#ifdef HAVE_WINRT #ifdef NO_GETENV
const char* envValue = NULL; const char* envValue = NULL;
#else #else
const char* envValue = getenv(name); const char* envValue = getenv(name);
...@@ -728,7 +736,7 @@ static void* initOpenCLAndLoad(const char* funcname) ...@@ -728,7 +736,7 @@ static void* initOpenCLAndLoad(const char* funcname)
static HMODULE handle = 0; static HMODULE handle = 0;
if (!handle) if (!handle)
{ {
#ifndef HAVE_WINRT #ifndef WINRT
if(!initialized) if(!initialized)
{ {
handle = LoadLibraryA("OpenCL.dll"); handle = LoadLibraryA("OpenCL.dll");
...@@ -2190,6 +2198,7 @@ inline cl_int getStringInfo(Functor f, ObjectType obj, cl_uint name, std::string ...@@ -2190,6 +2198,7 @@ inline cl_int getStringInfo(Functor f, ObjectType obj, cl_uint name, std::string
return CL_SUCCESS; return CL_SUCCESS;
} }
#ifdef HAVE_OPENCL
static void split(const std::string &s, char delim, std::vector<std::string> &elems) static void split(const std::string &s, char delim, std::vector<std::string> &elems)
{ {
elems.clear(); elems.clear();
...@@ -2230,8 +2239,9 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr, ...@@ -2230,8 +2239,9 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr,
} }
return true; return true;
} }
#endif
#ifdef HAVE_WINRT #ifdef WINRT
static cl_device_id selectOpenCLDevice() static cl_device_id selectOpenCLDevice()
{ {
return NULL; return NULL;
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
#define HAVE_GCD #define HAVE_GCD
#endif #endif
#if defined _MSC_VER && _MSC_VER >= 1600 #if defined _MSC_VER && _MSC_VER >= 1600 && !defined(WINRT)
#define HAVE_CONCURRENCY #define HAVE_CONCURRENCY
#endif #endif
...@@ -458,7 +458,7 @@ int cv::getNumberOfCPUs(void) ...@@ -458,7 +458,7 @@ int cv::getNumberOfCPUs(void)
{ {
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
SYSTEM_INFO sysinfo; SYSTEM_INFO sysinfo;
#if defined(_M_ARM) || defined(_M_X64) || defined(HAVE_WINRT) #if defined(_M_ARM) || defined(_M_X64) || defined(WINRT)
GetNativeSystemInfo( &sysinfo ); GetNativeSystemInfo( &sysinfo );
#else #else
GetSystemInfo( &sysinfo ); GetSystemInfo( &sysinfo );
......
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
#endif #endif
#endif #endif
#ifdef HAVE_WINRT #ifdef WINRT
#include <wrl/client.h> #include <wrl/client.h>
#ifndef __cplusplus_winrt #ifndef __cplusplus_winrt
#include <windows.storage.h> #include <windows.storage.h>
...@@ -159,7 +159,7 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix) ...@@ -159,7 +159,7 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix)
UINT(g.Data4[2]), UINT(g.Data4[3]), UINT(g.Data4[4]), UINT(g.Data4[2]), UINT(g.Data4[3]), UINT(g.Data4[4]),
UINT(g.Data4[5]), UINT(g.Data4[6]), UINT(g.Data4[7])); UINT(g.Data4[5]), UINT(g.Data4[6]), UINT(g.Data4[7]));
return prefix + std::wstring(guidStr); return prefix.append(std::wstring(guidStr));
} }
#endif #endif
...@@ -542,12 +542,12 @@ String format( const char* fmt, ... ) ...@@ -542,12 +542,12 @@ String format( const char* fmt, ... )
String tempfile( const char* suffix ) String tempfile( const char* suffix )
{ {
String fname; String fname;
#ifndef HAVE_WINRT #ifndef WINRT
const char *temp_dir = getenv("OPENCV_TEMP_PATH"); const char *temp_dir = getenv("OPENCV_TEMP_PATH");
#endif #endif
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
#ifdef HAVE_WINRT #ifdef WINRT
RoInitialize(RO_INIT_MULTITHREADED); RoInitialize(RO_INIT_MULTITHREADED);
std::wstring temp_dir = L""; std::wstring temp_dir = L"";
const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str(); const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str();
...@@ -559,7 +559,7 @@ String tempfile( const char* suffix ) ...@@ -559,7 +559,7 @@ String tempfile( const char* suffix )
if (temp_file.empty()) if (temp_file.empty())
return String(); return String();
temp_file = temp_dir + std::wstring(L"\\") + temp_file; temp_file = temp_dir.append(std::wstring(L"\\")).append(temp_file);
DeleteFileW(temp_file.c_str()); DeleteFileW(temp_file.c_str());
char aname[MAX_PATH]; char aname[MAX_PATH];
...@@ -955,7 +955,7 @@ public: ...@@ -955,7 +955,7 @@ public:
#pragma warning(disable:4505) // unreferenced local function has been removed #pragma warning(disable:4505) // unreferenced local function has been removed
#endif #endif
#ifdef HAVE_WINRT #ifdef WINRT
// using C++11 thread attribute for local thread data // using C++11 thread attribute for local thread data
static __declspec( thread ) TLSStorage* g_tlsdata = NULL; static __declspec( thread ) TLSStorage* g_tlsdata = NULL;
...@@ -1006,10 +1006,10 @@ public: ...@@ -1006,10 +1006,10 @@ public:
} }
return d; return d;
} }
#endif //HAVE_WINRT #endif //WINRT
#if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE #if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
#ifdef HAVE_WINRT #ifdef WINRT
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model #pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
#endif #endif
......
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaarithm) ocv_module_disable(cudaarithm)
endif() endif()
......
if(IOS OR APPLE OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR APPLE OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudacodec) ocv_module_disable(cudacodec)
endif() endif()
......
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudafeatures2d) ocv_module_disable(cudafeatures2d)
endif() endif()
......
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudafilters) ocv_module_disable(cudafilters)
endif() endif()
......
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaimgproc) ocv_module_disable(cudaimgproc)
endif() endif()
......
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudaoptflow) ocv_module_disable(cudaoptflow)
endif() endif()
......
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudastereo) ocv_module_disable(cudastereo)
endif() endif()
......
if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS))
ocv_module_disable(cudawarping) ocv_module_disable(cudawarping)
endif() endif()
......
if (WINRT)
ocv_module_disable(highgui)
endif()
set(the_description "High-level GUI and Media I/O") set(the_description "High-level GUI and Media I/O")
ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL opencv_androidcamera) ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL opencv_androidcamera)
...@@ -7,7 +11,8 @@ ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL o ...@@ -7,7 +11,8 @@ ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL o
# Jose Luis Blanco, 2008 # Jose Luis Blanco, 2008
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(HAVE_WINRT_CX) # Compilation with /ZW is not allowed for *.c files
if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif() endif()
......
if(WINRT)
ocv_module_disable(imgcodecs)
endif()
set(the_description "Image codecs") set(the_description "Image codecs")
ocv_add_module(imgcodecs opencv_imgproc) ocv_add_module(imgcodecs opencv_imgproc)
...@@ -9,7 +13,7 @@ ocv_add_module(imgcodecs opencv_imgproc) ...@@ -9,7 +13,7 @@ ocv_add_module(imgcodecs opencv_imgproc)
ocv_clear_vars(GRFMT_LIBS) ocv_clear_vars(GRFMT_LIBS)
if(HAVE_WINRT_CX) if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif() endif()
......
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# CMake file for java support # CMake file for java support
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(IOS OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)) if(IOS OR WINRT OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7))
OR BUILD_opencv_world OR BUILD_opencv_world
) )
ocv_module_disable(java) ocv_module_disable(java)
......
...@@ -9,7 +9,7 @@ if((WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") ...@@ -9,7 +9,7 @@ if((WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
ocv_module_disable(python3) ocv_module_disable(python3)
endif() endif()
if(ANDROID OR IOS) if(ANDROID OR IOS OR WINRT)
ocv_module_disable(python2) ocv_module_disable(python2)
ocv_module_disable(python3) ocv_module_disable(python3)
endif() endif()
......
if(IOS) if(IOS OR WINRT)
ocv_module_disable(superres) ocv_module_disable(superres)
endif() endif()
......
set(the_description "The ts module") set(the_description "The ts module")
if(IOS) if(IOS OR WINRT)
ocv_module_disable(ts) ocv_module_disable(ts)
endif() endif()
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "cvconfig.h" #include "cvconfig.h"
#ifdef HAVE_WINRT #ifdef WINRT
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model #pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
#endif #endif
......
if(WINRT)
ocv_module_disable(videoio)
endif()
set(the_description "Media I/O") set(the_description "Media I/O")
ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera) ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera)
...@@ -7,7 +11,7 @@ ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidca ...@@ -7,7 +11,7 @@ ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidca
# Jose Luis Blanco, 2008 # Jose Luis Blanco, 2008
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if(HAVE_WINRT_CX) if(HAVE_WINRT_CX AND NOT WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif() endif()
......
...@@ -85,7 +85,7 @@ private: ...@@ -85,7 +85,7 @@ private:
icvInitFFMPEG() icvInitFFMPEG()
{ {
#if defined WIN32 || defined _WIN32 #if defined WIN32 || defined _WIN32
# ifdef HAVE_WINRT # ifdef WINRT
const wchar_t* module_name = L"opencv_ffmpeg" const wchar_t* module_name = L"opencv_ffmpeg"
CVAUX_STRW(CV_MAJOR_VERSION) CVAUX_STRW(CV_MINOR_VERSION) CVAUX_STRW(CV_SUBMINOR_VERSION) CVAUX_STRW(CV_MAJOR_VERSION) CVAUX_STRW(CV_MINOR_VERSION) CVAUX_STRW(CV_SUBMINOR_VERSION)
#if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__) #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__)
......
This diff is collapsed.
#ifdef HAVE_WINRT #ifdef WINRT
#define ICustomStreamSink StreamSink #define ICustomStreamSink StreamSink
#ifndef __cplusplus_winrt #ifndef __cplusplus_winrt
...@@ -380,7 +380,7 @@ MAKE_ENUM(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypePairs[] = { ...@@ -380,7 +380,7 @@ MAKE_ENUM(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypePairs[] = {
}; };
MAKE_MAP(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypeMap(StreamSinkMarkerTypePairs, StreamSinkMarkerTypePairs + sizeof(StreamSinkMarkerTypePairs) / sizeof(StreamSinkMarkerTypePairs[0])); MAKE_MAP(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypeMap(StreamSinkMarkerTypePairs, StreamSinkMarkerTypePairs + sizeof(StreamSinkMarkerTypePairs) / sizeof(StreamSinkMarkerTypePairs[0]));
#ifdef HAVE_WINRT #ifdef WINRT
#ifdef __cplusplus_winrt #ifdef __cplusplus_winrt
#define _ContextCallback Concurrency::details::_ContextCallback #define _ContextCallback Concurrency::details::_ContextCallback
...@@ -1070,7 +1070,7 @@ protected: ...@@ -1070,7 +1070,7 @@ protected:
}; };
class StreamSink : class StreamSink :
#ifdef HAVE_WINRT #ifdef WINRT
public Microsoft::WRL::RuntimeClass< public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::ClassicCom>, Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::ClassicCom>,
IMFStreamSink, IMFStreamSink,
...@@ -1100,7 +1100,7 @@ public: ...@@ -1100,7 +1100,7 @@ public:
if (riid == IID_IMarshal) { if (riid == IID_IMarshal) {
return MarshalQI(riid, ppv); return MarshalQI(riid, ppv);
} else { } else {
#ifdef HAVE_WINRT #ifdef WINRT
hr = RuntimeClassT::QueryInterface(riid, ppv); hr = RuntimeClassT::QueryInterface(riid, ppv);
#else #else
if (riid == IID_IUnknown || riid == IID_IMFStreamSink) { if (riid == IID_IUnknown || riid == IID_IMFStreamSink) {
...@@ -1126,7 +1126,7 @@ public: ...@@ -1126,7 +1126,7 @@ public:
return hr; return hr;
} }
#ifdef HAVE_WINRT #ifdef WINRT
STDMETHOD(RuntimeClassInitialize)() { return S_OK; } STDMETHOD(RuntimeClassInitialize)() { return S_OK; }
#else #else
ULONG STDMETHODCALLTYPE AddRef() ULONG STDMETHODCALLTYPE AddRef()
...@@ -1177,7 +1177,7 @@ public: ...@@ -1177,7 +1177,7 @@ public:
m_StartTime(0), m_fGetStartTimeFromSample(false), m_fWaitingForFirstSample(false), m_StartTime(0), m_fGetStartTimeFromSample(false), m_fWaitingForFirstSample(false),
m_state(State_TypeNotSet), m_pParent(nullptr), m_state(State_TypeNotSet), m_pParent(nullptr),
m_imageWidthInPixels(0), m_imageHeightInPixels(0) { m_imageWidthInPixels(0), m_imageHeightInPixels(0) {
#ifdef HAVE_WINRT #ifdef WINRT
m_token.value = 0; m_token.value = 0;
#else #else
m_bConnected = false; m_bConnected = false;
...@@ -1856,7 +1856,7 @@ public: ...@@ -1856,7 +1856,7 @@ public:
return hr; return hr;
} }
private: private:
#ifdef HAVE_WINRT #ifdef WINRT
EventRegistrationToken m_token; EventRegistrationToken m_token;
#else #else
bool m_bConnected; bool m_bConnected;
...@@ -1864,7 +1864,7 @@ private: ...@@ -1864,7 +1864,7 @@ private:
bool m_IsShutdown; // Flag to indicate if Shutdown() method was called. bool m_IsShutdown; // Flag to indicate if Shutdown() method was called.
CRITICAL_SECTION m_critSec; CRITICAL_SECTION m_critSec;
#ifndef HAVE_WINRT #ifndef WINRT
long m_cRef; long m_cRef;
#endif #endif
IMFAttributes* m_pParent; IMFAttributes* m_pParent;
...@@ -2408,7 +2408,7 @@ protected: ...@@ -2408,7 +2408,7 @@ protected:
extern const __declspec(selectany) WCHAR RuntimeClass_CV_MediaSink[] = L"cv.MediaSink"; extern const __declspec(selectany) WCHAR RuntimeClass_CV_MediaSink[] = L"cv.MediaSink";
class MediaSink : class MediaSink :
#ifdef HAVE_WINRT #ifdef WINRT
public Microsoft::WRL::RuntimeClass< public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::WinRtClassicComMix >, Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::WinRtClassicComMix >,
Microsoft::WRL::Implements<ABI::Windows::Media::IMediaExtension>, Microsoft::WRL::Implements<ABI::Windows::Media::IMediaExtension>,
...@@ -2420,7 +2420,7 @@ class MediaSink : ...@@ -2420,7 +2420,7 @@ class MediaSink :
public IMFMediaSink, public IMFClockStateSink, public CBaseAttributes<> public IMFMediaSink, public IMFClockStateSink, public CBaseAttributes<>
#endif #endif
{ {
#ifdef HAVE_WINRT #ifdef WINRT
InspectableClass(RuntimeClass_CV_MediaSink, BaseTrust) InspectableClass(RuntimeClass_CV_MediaSink, BaseTrust)
public: public:
#else #else
...@@ -2488,7 +2488,7 @@ public: ...@@ -2488,7 +2488,7 @@ public:
return S_OK; return S_OK;
} }
} }
#ifdef HAVE_WINRT #ifdef WINRT
STDMETHODIMP SetProperties(ABI::Windows::Foundation::Collections::IPropertySet *pConfiguration) STDMETHODIMP SetProperties(ABI::Windows::Foundation::Collections::IPropertySet *pConfiguration)
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -2828,7 +2828,7 @@ public: ...@@ -2828,7 +2828,7 @@ public:
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
#ifdef HAVE_WINRT #ifdef WINRT
pStream = Microsoft::WRL::Make<StreamSink>(); pStream = Microsoft::WRL::Make<StreamSink>();
if (pStream == nullptr) { if (pStream == nullptr) {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -2940,7 +2940,7 @@ public: ...@@ -2940,7 +2940,7 @@ public:
{ {
hr = m_streams.Remove(pos, nullptr); hr = m_streams.Remove(pos, nullptr);
_ComPtr<ICustomStreamSink> spCustomSink; _ComPtr<ICustomStreamSink> spCustomSink;
#ifdef HAVE_WINRT #ifdef WINRT
spCustomSink = static_cast<StreamSink*>(spStream.Get()); spCustomSink = static_cast<StreamSink*>(spStream.Get());
hr = S_OK; hr = S_OK;
#else #else
...@@ -3164,7 +3164,7 @@ public: ...@@ -3164,7 +3164,7 @@ public:
{ {
_ComPtr<ICustomStreamSink> spCustomSink; _ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr; HRESULT hr;
#ifdef HAVE_WINRT #ifdef WINRT
spCustomSink = static_cast<StreamSink*>(pStream); spCustomSink = static_cast<StreamSink*>(pStream);
#else #else
hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf()));
...@@ -3187,7 +3187,7 @@ public: ...@@ -3187,7 +3187,7 @@ public:
{ {
_ComPtr<ICustomStreamSink> spCustomSink; _ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr; HRESULT hr;
#ifdef HAVE_WINRT #ifdef WINRT
spCustomSink = static_cast<StreamSink*>(pStream); spCustomSink = static_cast<StreamSink*>(pStream);
#else #else
hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf()));
...@@ -3207,7 +3207,7 @@ public: ...@@ -3207,7 +3207,7 @@ public:
{ {
_ComPtr<ICustomStreamSink> spCustomSink; _ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr; HRESULT hr;
#ifdef HAVE_WINRT #ifdef WINRT
spCustomSink = static_cast<StreamSink*>(pStream); spCustomSink = static_cast<StreamSink*>(pStream);
#else #else
hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf()));
...@@ -3317,7 +3317,7 @@ public: ...@@ -3317,7 +3317,7 @@ public:
return hr; return hr;
} }
private: private:
#ifndef HAVE_WINRT #ifndef WINRT
long m_cRef; long m_cRef;
#endif #endif
CRITICAL_SECTION m_critSec; CRITICAL_SECTION m_critSec;
...@@ -3327,6 +3327,6 @@ private: ...@@ -3327,6 +3327,6 @@ private:
LONGLONG m_llStartTime; LONGLONG m_llStartTime;
}; };
#ifdef HAVE_WINRT #ifdef WINRT
ActivatableClass(MediaSink); ActivatableClass(MediaSink);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment