Merge pull request #3700 from MSOpenTech:winrt-cmake-contrib

This commit is contained in:
Vadim Pisarevsky
2015-03-03 12:52:02 +00:00
184 changed files with 8228 additions and 580 deletions

View File

@@ -3,11 +3,10 @@ ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}"
OPTIONAL opencv_cudev
WRAP java python)
if(HAVE_WINRT_CX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif()
if(HAVE_WINRT)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"")
set(extra_libs "")
if(WINRT AND CMAKE_SYSTEM_NAME MATCHES WindowsStore AND CMAKE_SYSTEM_VERSION MATCHES "8.0")
list(APPEND extra_libs ole32.lib)
endif()
if(HAVE_CUDA)
@@ -24,7 +23,7 @@ ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version
HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail})
ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS})
ocv_create_module()
ocv_create_module(${extra_libs})
ocv_add_accuracy_tests()
ocv_add_perf_tests()

View File

@@ -56,14 +56,14 @@ namespace
struct DIR
{
#ifdef HAVE_WINRT
#ifdef WINRT
WIN32_FIND_DATAW data;
#else
WIN32_FIND_DATA data;
#endif
HANDLE handle;
dirent ent;
#ifdef HAVE_WINRT
#ifdef WINRT
DIR() { }
~DIR()
{
@@ -77,7 +77,7 @@ namespace
{
DIR* dir = new DIR;
dir->ent.d_name = 0;
#ifdef HAVE_WINRT
#ifdef WINRT
cv::String full_path = cv::String(path) + "\\*";
wchar_t wfull_path[MAX_PATH];
size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH);
@@ -99,7 +99,7 @@ namespace
dirent* readdir(DIR* dir)
{
#ifdef HAVE_WINRT
#ifdef WINRT
if (dir->ent.d_name != 0)
{
if (::FindNextFileW(dir->handle, &dir->data) != TRUE)
@@ -147,7 +147,7 @@ static bool isDir(const cv::String& path, DIR* dir)
else
{
WIN32_FILE_ATTRIBUTE_DATA all_attrs;
#ifdef HAVE_WINRT
#ifdef WINRT
wchar_t wpath[MAX_PATH];
size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));

View File

@@ -64,7 +64,15 @@
// TODO Move to some common place
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);
#endif
if (envValue == NULL)
{
return defaultValue;
@@ -85,7 +93,7 @@ static bool getBoolParameter(const char* name, bool defaultValue)
// TODO Move to some common place
static size_t getConfigurationParameterForSize(const char* name, size_t defaultValue)
{
#ifdef HAVE_WINRT
#ifdef NO_GETENV
const char* envValue = NULL;
#else
const char* envValue = getenv(name);
@@ -728,7 +736,7 @@ static void* initOpenCLAndLoad(const char* funcname)
static HMODULE handle = 0;
if (!handle)
{
#ifndef HAVE_WINRT
#ifndef WINRT
if(!initialized)
{
handle = LoadLibraryA("OpenCL.dll");
@@ -2231,7 +2239,7 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr,
return true;
}
#ifdef HAVE_WINRT
#ifdef WINRT
static cl_device_id selectOpenCLDevice()
{
return NULL;

View File

@@ -69,7 +69,7 @@
#define HAVE_GCD
#endif
#if defined _MSC_VER && _MSC_VER >= 1600
#if defined _MSC_VER && _MSC_VER >= 1600 && !defined(WINRT)
#define HAVE_CONCURRENCY
#endif
@@ -458,7 +458,7 @@ int cv::getNumberOfCPUs(void)
{
#if defined WIN32 || defined _WIN32
SYSTEM_INFO sysinfo;
#if defined(_M_ARM) || defined(_M_X64) || defined(HAVE_WINRT)
#if defined(_M_ARM) || defined(_M_X64) || defined(WINRT)
GetNativeSystemInfo( &sysinfo );
#else
GetSystemInfo( &sysinfo );

View File

@@ -109,7 +109,7 @@
#endif
#endif
#ifdef HAVE_WINRT
#ifdef WINRT
#include <wrl/client.h>
#ifndef __cplusplus_winrt
#include <windows.storage.h>
@@ -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[5]), UINT(g.Data4[6]), UINT(g.Data4[7]));
return prefix + std::wstring(guidStr);
return prefix.append(std::wstring(guidStr));
}
#endif
@@ -542,12 +542,12 @@ String format( const char* fmt, ... )
String tempfile( const char* suffix )
{
String fname;
#ifndef HAVE_WINRT
#ifndef WINRT
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
#endif
#if defined WIN32 || defined _WIN32
#ifdef HAVE_WINRT
#ifdef WINRT
RoInitialize(RO_INIT_MULTITHREADED);
std::wstring temp_dir = L"";
const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str();
@@ -559,7 +559,7 @@ String tempfile( const char* suffix )
if (temp_file.empty())
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());
char aname[MAX_PATH];
@@ -955,7 +955,7 @@ public:
#pragma warning(disable:4505) // unreferenced local function has been removed
#endif
#ifdef HAVE_WINRT
#ifdef WINRT
// using C++11 thread attribute for local thread data
static __declspec( thread ) TLSStorage* g_tlsdata = NULL;
@@ -1006,10 +1006,10 @@ public:
}
return d;
}
#endif //HAVE_WINRT
#endif //WINRT
#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
#endif